git.annexia.org
/
virt-df.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added private_data_functions.
[virt-df.git]
/
lib
/
diskimage_lvm2.ml
diff --git
a/lib/diskimage_lvm2.ml
b/lib/diskimage_lvm2.ml
index
632e879
..
2c2fa60
100644
(file)
--- a/
lib/diskimage_lvm2.ml
+++ b/
lib/diskimage_lvm2.ml
@@
-23,12
+23,12
@@
open Printf
open ExtList
open Printf
open ExtList
-open Diskimage_
utils
+open Diskimage_
impl
open Diskimage_lvm2_metadata
open Int63.Operators
open Diskimage_lvm2_metadata
open Int63.Operators
-let
plugin_
id = "LVM2"
+let id = "LVM2"
let sector_size_int = 512
let sector_size = ~^sector_size_int
let sector_size_int = 512
let sector_size = ~^sector_size_int
@@
-102,12
+102,12
@@
end
(*----------------------------------------------------------------------*)
(* Probe to see if it's an LVM2 PV. *)
(*----------------------------------------------------------------------*)
(* Probe to see if it's an LVM2 PV. *)
-let rec probe
lvm_plugin_id
dev =
+let rec probe dev =
try
let uuid, _ = read_pv_label dev in
if !debug then
eprintf "LVM2 detected PV UUID %s\n%!" uuid;
try
let uuid, _ = read_pv_label dev in
if !debug then
eprintf "LVM2 detected PV UUID %s\n%!" uuid;
- {
lvm_plugin_id = lvm_plugin_id
; pv_uuid = uuid; pv_dev = dev }
+ {
pv_cb = callbacks
; pv_uuid = uuid; pv_dev = dev }
with exn ->
if !debug then prerr_endline (Printexc.to_string exn);
raise Not_found
with exn ->
if !debug then prerr_endline (Printexc.to_string exn);
raise Not_found
@@
-181,15
+181,17
@@
and read_metadata dev offset len =
* (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.
*)
* (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 rec list_lvs de
vs =
+
and list_lvs p
vs =
(* Read the UUID and metadata (again) from each device to end up with
* an assoc list of PVs, keyed on the UUID.
(* Read the UUID and metadata (again) from each device to end up with
* an assoc list of PVs, keyed on the UUID.
+ *
+ * XXX We've already read this - we should save it in the pv struct.
*)
let pvs = List.map (
*)
let pvs = List.map (
- fun
dev
->
+ fun
{ pv_dev = dev }
->
let uuid, metadata = read_pv_label dev in
(uuid, (metadata, dev))
let uuid, metadata = read_pv_label dev in
(uuid, (metadata, dev))
- )
de
vs in
+ )
p
vs in
(* Parse the metadata using the external lexer/parser. *)
let pvs = List.map (
(* Parse the metadata using the external lexer/parser. *)
let pvs = List.map (
@@
-452,10
+454,13
@@
let rec list_lvs devs =
* structure to determine quickly which blocks are used. Need
* to store the parsed metadata in the structure ...
*)
* structure to determine quickly which blocks are used. Need
* to store the parsed metadata in the structure ...
*)
-
let
offset_is_free _ _ = false
+
and
offset_is_free _ _ = false
-
let
callbacks = {
- lvm_cb_
probe = probe
;
+
and
callbacks = {
+ lvm_cb_
name = id
;
lvm_cb_list_lvs = list_lvs;
lvm_cb_offset_is_free = offset_is_free;
}
lvm_cb_list_lvs = list_lvs;
lvm_cb_offset_is_free = offset_is_free;
}
+
+(* Register the plugin. *)
+let () = register_plugin ~lvm:probe id