get_owners (query) function.
[virt-df.git] / lib / diskimage.mli
index 0689a69..22ba927 100644 (file)
@@ -296,11 +296,38 @@ val scan_machine : machine -> machine
 
 (** {3 Create ownership tables} *)
 
-val create_ownership : machine -> (*ownership*)unit
+type ownership
+
+val create_ownership : machine -> ownership
   (** This creates the ownership tables (mapping disk blocks to the
-      ultimate filesystem, etc., which owns each).
+      ultimate filesystem, etc., which owns each one).
   *)
 
+type owner =
+    [ `Filesystem of filesystem
+    | `Partitions of partitions
+    | `PhysicalVolume of pv ]
+
+val get_owners :
+  machine -> ownership -> device -> Int63.t -> (owner * Int63.t) list
+  (** [get_owners machine ownership disk offset] returns the
+      owners (filesystems, etc.) which reside on block device [disk]
+      at the given byte offset.  [disk] must be a block device
+      of the machine.
+
+      Returns a list of [(owner, owner_offset)] where [owner]
+      is the filesystem, etc., and [owner_offset] is the byte
+      offset relative to the owner.
+
+      It is common for there to be multiple owners: for example
+      in the case where a filesystem is created on a partition,
+      both the filesystem ([`Filesystem fs]) and
+      partition scheme ([`Partitions parts]) will be returned.
+
+      This function is efficient.  {!create_ownership} creates
+      a tree structure which allows ownership to be determined
+      in just a few steps. *)
+
 (** {2 Debugging} *)
 
 val debug : bool ref