Re: [Libguestfs] [PATCH 2/3] daemon: use the structs from the Structs module

2018-04-09 Thread Richard W.M. Jones

ACK 1/3 and 2/3.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


[Libguestfs] [PATCH 2/3] daemon: use the structs from the Structs module

2018-04-09 Thread Pino Toscano
No need to redeclare them again in few modules, just use them from the
Structs module.
---
 daemon/btrfs.mli |  8 +---
 daemon/inspect_fs_windows.ml |  4 ++--
 daemon/listfs.ml |  4 ++--
 daemon/parted.mli|  9 +
 daemon/statvfs.mli   | 16 +---
 5 files changed, 7 insertions(+), 34 deletions(-)

diff --git a/daemon/btrfs.mli b/daemon/btrfs.mli
index 8ca91fb47..ce1c2b66f 100644
--- a/daemon/btrfs.mli
+++ b/daemon/btrfs.mli
@@ -16,11 +16,5 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *)
 
-type btrfssubvolume = {
-  btrfssubvolume_id : int64;
-  btrfssubvolume_top_level_id : int64;
-  btrfssubvolume_path : string;
-}
-
-val btrfs_subvolume_list : Mountable.t -> btrfssubvolume list
+val btrfs_subvolume_list : Mountable.t -> Structs.btrfssubvolume list
 val btrfs_subvolume_get_default : Mountable.t -> int64
diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml
index e9d056cd9..8b2aad8d3 100644
--- a/daemon/inspect_fs_windows.ml
+++ b/daemon/inspect_fs_windows.ml
@@ -372,10 +372,10 @@ and map_registry_disk_blob devices blob =
 let offset = int_of_le64 offset in
 let partitions = Parted.part_list device in
 let partition =
-  List.find (fun { Parted.part_start = s } -> s = offset) partitions in
+  List.find (fun { Structs.part_start = s } -> s = offset) partitions in
 
 (* Construct the full device name. *)
-Some (sprintf "%s%ld" device partition.Parted.part_num)
+Some (sprintf "%s%ld" device partition.Structs.part_num)
   with
   | Not_found -> None
 
diff --git a/daemon/listfs.ml b/daemon/listfs.ml
index f6e3dcd6e..56ebadeda 100644
--- a/daemon/listfs.ml
+++ b/daemon/listfs.ml
@@ -125,13 +125,13 @@ and check_with_vfs_type device =
 let default_volume = Btrfs.btrfs_subvolume_get_default mountable in
 let vols =
   List.filter (
-fun { Btrfs.btrfssubvolume_id = id } -> id <> default_volume
+fun { Structs.btrfssubvolume_id = id } -> id <> default_volume
   ) vols in
 
 Some (
   (mountable, vfs_type) (* whole device = default volume *)
   :: List.map (
-   fun { Btrfs.btrfssubvolume_path = path } ->
+   fun { Structs.btrfssubvolume_path = path } ->
  let mountable = Mountable.of_btrfsvol device path in
  (mountable, "btrfs")
  ) vols
diff --git a/daemon/parted.mli b/daemon/parted.mli
index d547f2f2a..0b7eb87f4 100644
--- a/daemon/parted.mli
+++ b/daemon/parted.mli
@@ -16,15 +16,8 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *)
 
-type partition = {
-  part_num : int32;
-  part_start : int64;
-  part_end : int64;
-  part_size : int64;
-}
-
 val part_get_mbr_id : string -> int -> int
-val part_list : string -> partition list
+val part_list : string -> Structs.partition list
 
 val part_get_parttype : string -> string
 
diff --git a/daemon/statvfs.mli b/daemon/statvfs.mli
index d241f995b..13b22f88d 100644
--- a/daemon/statvfs.mli
+++ b/daemon/statvfs.mli
@@ -16,18 +16,4 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *)
 
-type statvfs = {
-  bsize : int64;
-  frsize : int64;
-  blocks : int64;
-  bfree : int64;
-  bavail : int64;
-  files : int64;
-  ffree : int64;
-  favail : int64;
-  fsid : int64;
-  flag : int64;
-  namemax : int64;
-}
-
-val statvfs : string -> statvfs
+val statvfs : string -> Structs.statvfs
-- 
2.14.3

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs