summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-03-22 18:36:16 +0000
committerRichard Jones <rjones@redhat.com>2010-03-23 21:56:14 +0000
commitb6483061c25e90ae1b9e016812dea8e3756d6c23 (patch)
tree5c9f8dbde945d1f1aeba90e2ffcaca5012475881 /src
parent5d90acbe4b670e14084bbe9d11b717bfb6d95603 (diff)
downloadlibguestfs-b6483061c25e90ae1b9e016812dea8e3756d6c23.tar.gz
libguestfs-b6483061c25e90ae1b9e016812dea8e3756d6c23.tar.xz
libguestfs-b6483061c25e90ae1b9e016812dea8e3756d6c23.zip
New API: guestfs_copy_size to copy a fixed number of bytes.
This is similar to 'guestfs_dd', but it copies just a fixed number of bytes from the source to the destination. It's an error if the source is too short or if the destination is too small.
Diffstat (limited to 'src')
-rw-r--r--src/MAX_PROC_NR2
-rwxr-xr-xsrc/generator.ml15
2 files changed, 15 insertions, 2 deletions
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index f4146713..2c36bbda 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-226
+227
diff --git a/src/generator.ml b/src/generator.ml
index 551b6bc6..5f5b4370 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -4240,7 +4240,7 @@ example to duplicate a filesystem.
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.");
+This command cannot do partial copies (see C<guestfs_copy_size>).");
("filesize", (RInt64 "size", [Pathname "file"]), 218, [],
[InitBasicFS, Always, TestOutputInt (
@@ -4333,6 +4333,19 @@ calls to associate logical volumes and volume groups.
See also C<guestfs_vgpvuuids>.");
+ ("copy_size", (RErr, [Dev_or_Path "src"; Dev_or_Path "dest"; Int64 "size"]), 227, [],
+ [InitBasicFS, Always, TestOutputBuffer (
+ [["write_file"; "/src"; "hello, world"; "0"];
+ ["copy_size"; "/src"; "/dest"; "5"];
+ ["read_file"; "/dest"]], "hello")],
+ "copy size bytes from source to destination using dd",
+ "\
+This command copies exactly C<size> bytes from one source device
+or file C<src> to another destination device or file C<dest>.
+
+Note this will fail if the source is too short or if the destination
+is not large enough.");
+
]
let all_functions = non_daemon_functions @ daemon_functions