fs_block_size -> fs_blocksize, and int to make it consistent
authorRichard W.M. Jones <rjones@redhat.com>
Mon, 28 Apr 2008 15:59:00 +0000 (16:59 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 28 Apr 2008 15:59:00 +0000 (16:59 +0100)
lib/diskimage.mli
lib/diskimage_ext2.ml
lib/diskimage_linux_swap.ml
lib/diskimage_utils.ml
lib/diskimage_utils.mli
virt-df/virt_df_main.ml

index 09d791e..7d51e93 100644 (file)
@@ -194,9 +194,9 @@ and partition_content =
     ]
 
 and filesystem = {
-  fs_dev : device;                     (** Device containing the filesystem. *)
   fs_plugin_id : fs_plugin_id;         (** Filesystem type. *)
-  fs_block_size : int64;               (** Block size (bytes). *)
+  fs_dev : device;                     (** Device containing the filesystem. *)
+  fs_blocksize : int;                  (** Block size (bytes). *)
   fs_blocks_total : int64;             (** Total blocks. *)
   fs_is_swap : bool;                   (** If swap, following not valid. *)
   fs_blocks_reserved : int64;          (** Blocks reserved for super-user. *)
index f9913ca..2226255 100644 (file)
@@ -120,11 +120,14 @@ let probe dev =
    let fs_dev = new blocksize_overlay (Int64.to_int block_size) dev in
 
    {
-     fs_dev = fs_dev;
      fs_plugin_id = plugin_id;
-     fs_block_size = block_size;
+     fs_dev = fs_dev;
+
+     fs_blocksize = Int64.to_int block_size;
      fs_blocks_total = Int64.of_int32 s_blocks_count -^ overhead;
+
      fs_is_swap = false;
+
      fs_blocks_reserved = Int64.of_int32 s_r_blocks_count;
      fs_blocks_avail = Int64.of_int32 s_free_blocks_count;
      fs_blocks_used =
index ae8c405..c5aff63 100644 (file)
@@ -40,9 +40,10 @@ let probe dev =
 
       let fs_dev = new blocksize_overlay blocksize dev in
       {
-       fs_dev = fs_dev;
        fs_plugin_id = plugin_id;
-       fs_block_size = blocksize64;
+       fs_dev = fs_dev;
+
+       fs_blocksize = blocksize;
        fs_blocks_total = fs_dev#size /^ blocksize64;
 
        (* The remaining fields are ignored when fs_is_swap is true. *)
index 84eec94..cbd809f 100644 (file)
@@ -203,9 +203,9 @@ and partition_content =
 
 (* Filesystems (also swap devices). *)
 and filesystem = {
-  fs_dev : device;                     (* Device containing the filesystem. *)
   fs_plugin_id : fs_plugin_id;         (* Filesystem. *)
-  fs_block_size : int64;               (* Block size (bytes). *)
+  fs_dev : device;                     (* Device containing the filesystem. *)
+  fs_blocksize : int;                  (* Block size (bytes). *)
   fs_blocks_total : int64;             (* Total blocks. *)
   fs_is_swap : bool;                   (* If swap, following not valid. *)
   fs_blocks_reserved : int64;          (* Blocks reserved for super-user. *)
index bc67474..d44f038 100644 (file)
@@ -104,9 +104,9 @@ and partition_content =
     ]
 
 and filesystem = {
-  fs_dev : device;
   fs_plugin_id : fs_plugin_id;
-  fs_block_size : int64;
+  fs_dev : device;
+  fs_blocksize : int;
   fs_blocks_total : int64;
   fs_is_swap : bool;
   fs_blocks_reserved : int64;
index 84d7cc2..cfe40e2 100644 (file)
@@ -339,7 +339,7 @@ OPTIONS" in
 
     let {
       Diskimage.fs_plugin_id = fs_plugin_id;
-      fs_block_size = fs_block_size;
+      fs_blocksize = fs_blocksize;
       fs_blocks_total = fs_blocks_total;
       fs_is_swap = fs_is_swap;
       fs_blocks_reserved = fs_blocks_reserved;
@@ -350,6 +350,7 @@ OPTIONS" in
       fs_inodes_avail = fs_inodes_avail;
       fs_inodes_used = fs_inodes_used
     } = fs in
+    let fs_blocksize = Int64.of_int fs_blocksize in
 
     let fs_name = Diskimage.name_of_filesystem fs_plugin_id in
 
@@ -357,10 +358,10 @@ OPTIONS" in
       (* Swap partition. *)
       if not !human then
        printf "%10Ld                       %s\n"
-         (fs_block_size *^ fs_blocks_total /^ 1024L) fs_name
+         (fs_blocksize *^ fs_blocks_total /^ 1024L) fs_name
       else
        printf "%10s                       %s\n"
-         (printable_size (fs_block_size *^ fs_blocks_total)) fs_name
+         (printable_size (fs_blocksize *^ fs_blocks_total)) fs_name
     ) else (
       (* Ordinary filesystem. *)
       if not !inodes then (            (* Block display. *)
@@ -371,15 +372,15 @@ OPTIONS" in
 
        if not !human then (            (* Display 1K blocks. *)
          printf "%10Ld %10Ld %10Ld %s\n"
-           (blocks_total *^ fs_block_size /^ 1024L)
-           (fs_blocks_used *^ fs_block_size /^ 1024L)
-           (blocks_avail *^ fs_block_size /^ 1024L)
+           (blocks_total *^ fs_blocksize /^ 1024L)
+           (fs_blocks_used *^ fs_blocksize /^ 1024L)
+           (blocks_avail *^ fs_blocksize /^ 1024L)
            fs_name
        ) else (                        (* Human-readable blocks. *)
          printf "%10s %10s %10s %s\n"
-           (printable_size (blocks_total *^ fs_block_size))
-           (printable_size (fs_blocks_used *^ fs_block_size))
-           (printable_size (blocks_avail *^ fs_block_size))
+           (printable_size (blocks_total *^ fs_blocksize))
+           (printable_size (fs_blocks_used *^ fs_blocksize))
+           (printable_size (blocks_avail *^ fs_blocksize))
            fs_name
        )
       ) else (                         (* Inodes display. *)
@@ -399,7 +400,7 @@ OPTIONS" in
 
     let {
       Diskimage.fs_plugin_id = fs_plugin_id;
-      fs_block_size = fs_block_size;
+      fs_blocksize = fs_blocksize;
       fs_blocks_total = fs_blocks_total;
       fs_is_swap = fs_is_swap;
       fs_blocks_reserved = fs_blocks_reserved;
@@ -410,25 +411,26 @@ OPTIONS" in
       fs_inodes_avail = fs_inodes_avail;
       fs_inodes_used = fs_inodes_used
     } = fs in
+    let fs_blocksize = Int64.of_int fs_blocksize in
 
     let fs_name = Diskimage.name_of_filesystem fs_plugin_id in
 
     let row =
       if fs_is_swap then
        (* Swap partition. *)
-       [ Int64.to_string (fs_block_size *^ fs_blocks_total /^ 1024L);
+       [ Int64.to_string (fs_blocksize *^ fs_blocks_total /^ 1024L);
          ""; "" ]
       else (
        (* Ordinary filesystem. *)
-       if not !inodes then (           (* Block display. *)
+       if not !inodes then (           (* 1K block display. *)
          (* 'df' doesn't count the restricted blocks. *)
          let blocks_total = fs_blocks_total -^ fs_blocks_reserved in
          let blocks_avail = fs_blocks_avail -^ fs_blocks_reserved in
          let blocks_avail = if blocks_avail < 0L then 0L else blocks_avail in
 
-         [ Int64.to_string (blocks_total *^ fs_block_size /^ 1024L);
-           Int64.to_string (fs_blocks_used *^ fs_block_size /^ 1024L);
-           Int64.to_string (blocks_avail *^ fs_block_size /^ 1024L) ]
+         [ Int64.to_string (blocks_total *^ fs_blocksize /^ 1024L);
+           Int64.to_string (fs_blocks_used *^ fs_blocksize /^ 1024L);
+           Int64.to_string (blocks_avail *^ fs_blocksize /^ 1024L) ]
        ) else (                        (* Inodes display. *)
          [ Int64.to_string fs_inodes_total;
            Int64.to_string fs_inodes_used;