From bb0788a39d9b8675db60a61ecd2baebfdfb5ca10 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] LVM2 PV detection. --- virt-df/virt_df_lvm2.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/virt-df/virt_df_lvm2.ml b/virt-df/virt_df_lvm2.ml index 4247dc3..9355597 100644 --- a/virt-df/virt_df_lvm2.ml +++ b/virt-df/virt_df_lvm2.ml @@ -29,6 +29,7 @@ let sector_size64 = 512L let pv_label_offset = sector_size64 +(* Probe to see if it's an LVM2 PV. Look for the "LABELONE" label. *) let rec probe_pv dev = try ignore (read_pv_label dev); true with _ -> false @@ -37,6 +38,8 @@ and read_pv_label dev = (* Load the second sector. *) let bits = dev#read_bitstring pv_label_offset sector_size in + Bitmatch.hexdump_bitstring stdout bits; + bitmatch bits with | labelone : 8*8 : bitstring; (* "LABELONE" *) padding : 16*8 : bitstring; @@ -49,6 +52,11 @@ and read_pv_label dev = invalid_arg (sprintf "read_pv_label: %s: not an LVM2 physical volume" dev#name) +(* We are passed a list of devices which we previously identified + * as PVs belonging to us. From these produce a list of all LVs + * (as devices) and return them. Note that we don't try to detect + * what is on these LVs - that will be done in the main code. + *) let list_lvs devs = [] (* Register with main code. *) -- 1.8.3.1