diff options
author | Richard Jones <rjones@redhat.com> | 2010-01-25 11:34:56 +0000 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-01-25 11:37:12 +0000 |
commit | 306077ac965cde0a5605782921d33a72bb77c382 (patch) | |
tree | 45a64c587a1cf76b44f686f9aa1b039de939fae2 /src | |
parent | c9324c2025b2636cda243b71debcb6c6457c6001 (diff) | |
download | libguestfs-306077ac965cde0a5605782921d33a72bb77c382.tar.gz libguestfs-306077ac965cde0a5605782921d33a72bb77c382.tar.xz libguestfs-306077ac965cde0a5605782921d33a72bb77c382.zip |
Add 'filesize' call.
Returns the size of a file. You can already do this with 'stat',
but this call is good for scripting.
Diffstat (limited to 'src')
-rw-r--r-- | src/MAX_PROC_NR | 2 | ||||
-rwxr-xr-x | src/generator.ml | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 0ddd619c..dc6f4a87 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -217 +218 diff --git a/src/generator.ml b/src/generator.ml index 4bf4b0f4..e55b2b5a 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -4188,6 +4188,18 @@ If the destination is a device, it must be as large or larger than the source file or device, otherwise the copy will fail. This command cannot do partial copies."); + ("filesize", (RInt64 "size", [Pathname "file"]), 218, [], + [InitBasicFS, Always, TestOutputInt ( + [["write_file"; "/file"; "hello, world"; "0"]; + ["filesize"; "/file"]], 12)], + "return the size of the file in bytes", + "\ +This command returns the size of C<file> in bytes. + +To get other stats about a file, use C<guestfs_stat>, C<guestfs_lstat>, +C<guestfs_is_dir>, C<guestfs_is_file> etc. +To get the size of block devices, use C<guestfs_blockdev_getsize64>."); + ] let all_functions = non_daemon_functions @ daemon_functions |