X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=lib%2Fdiskimage_impl.mli;fp=lib%2Fdiskimage_utils.mli;h=26dd5558a02c831c61041c05952d8bde284ed6f2;hb=71536ae75dceb08e0f3c3403033fb2eb25a08883;hp=07179d8a2a7ac0bfcb13922e569882c5115e45e8;hpb=8ecbebaf01f96a781ded3e24235697c62bc515b4;p=virt-df.git diff --git a/lib/diskimage_utils.mli b/lib/diskimage_impl.mli similarity index 77% rename from lib/diskimage_utils.mli rename to lib/diskimage_impl.mli index 07179d8..26dd555 100644 --- a/lib/diskimage_utils.mli +++ b/lib/diskimage_impl.mli @@ -16,6 +16,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *) +(* Don't use the functions and types in here directly. The safe ones + * are reexported through the Diskimage module, see diskimage.mli. + *) + (**/**) val debug : bool ref @@ -90,7 +94,7 @@ and disk_content = ] and partitions = { - parts_plugin_id : parts_plugin_id; + parts_cb : partitioner_callbacks; parts_dev : device; parts : partition list; } @@ -109,7 +113,7 @@ and partition_content = ] and filesystem = { - fs_plugin_id : fs_plugin_id; + fs_cb : filesystem_callbacks; fs_dev : device; fs_blocksize : Int63.t; fs_blocks_total : Int63.t; @@ -124,7 +128,7 @@ and filesystem = { } and pv = { - lvm_plugin_id : lvm_plugin_id; + pv_cb : lvm_callbacks; pv_dev : device; pv_uuid : string; } @@ -132,28 +136,47 @@ and lv = { lv_dev : device; } -and parts_plugin_id = string -and fs_plugin_id = string -and lvm_plugin_id = string - (** {2 Table of callbacks from each type of plug-in} *) -type parts_cb = { - parts_cb_probe : device -> partitions; +and partitioner_probe = device -> partitions + +and partitioner_callbacks = { + parts_cb_name : string; parts_cb_offset_is_free : partitions -> Int63.t -> bool; } -type fs_cb = { - fs_cb_probe : device -> filesystem; +and filesystem_probe = device -> filesystem + +and filesystem_callbacks = { + fs_cb_name : string; + fs_cb_printable_name : string; fs_cb_offset_is_free : filesystem -> Int63.t -> bool; } -type lvm_cb = { - lvm_cb_probe : lvm_plugin_id -> device -> pv; - lvm_cb_list_lvs : device list -> lv list; +and lvm_probe = device -> pv + +and lvm_callbacks = { + lvm_cb_name : string; + lvm_cb_list_lvs : pv list -> lv list; lvm_cb_offset_is_free : pv -> Int63.t -> bool; } +val name_of_filesystem : filesystem -> string + +(** {3 Plug-in registration} *) + +val register_plugin : + ?partitioner:partitioner_probe -> + ?filesystem:filesystem_probe -> + ?lvm:lvm_probe -> + string -> unit + +(** {3 Plug-in-specific data management. *) + + + + + (** {2 Internal functions used by the plug-ins} *) val canonical_uuid : string -> string @@ -174,3 +197,22 @@ val range : int -> int -> int list (** [range a b] returns the list of integers [a <= i < b]. If [a >= b] then the empty list is returned. *) + +(** {2 Functions} *) + +val open_machine : string -> (string * string) list -> machine +val close_machine : machine -> unit +val scan_machine : machine -> machine + +type ownership + +val create_ownership : machine -> ownership + +type owner = + [ `Filesystem of filesystem + | `Partitions of partitions + | `PhysicalVolume of pv ] + +val get_owners_lookup : machine -> ownership -> block_device -> + (Int63.t -> (owner * Int63.t) list) +val offset_is_free : (owner * Int63.t) list -> bool