diff --git a/src/generator.ml b/src/generator.ml index e18fa38..03d2d4c 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -5336,6 +5336,98 @@ filesystem can be found. To find the label of a filesystem, use C."); + ("open_file", (RInt "handle", [Pathname "path"]), 267, [], + [], + "open a file", + "\ +This command opens a file in the guest and returns a handle +to it. The returned handle is an opaque int which can be passed +to guestfs_h* calls. + +open_file returns -1 on error."); + + ("open_device", (RInt "handle", [Device "device"]), 268, [], + [], + "open a block device", + "\ +This command opens a block device and returns a handle to it. +It is able to open any block device with a node under /dev, +including LVM logical volumes. The returned handle is an opaque +int which can be passed to guestfs_h* calls. + +open_device returns -1 on error."); + + ("hread", (RBufferOut "content", [Int "handle"; Int64 "size"]), 269, + [ProtocolLimitWarning], [], + "read data from an open handle", + "\ +This command reads up to C bytes from C and returns +the data in C. It will attempt to read exactly C +bytes, but may return less. Returned C with size 0 +indicates EOF. + +hread returns a NULL C on error."); + + ("hpread", (RBufferOut "content", [Int "handle"; Int64 "size"; + Int64 "offset"]), 270, + [ProtocolLimitWarning], [], + "read data from an open handle at a specific offset", + "\ +This command reads up to C bytes from C starting +at C bytes from the beginning of the file. It returns +the data in C. It will attempt to read exactly C +bytes, but may return less. Returned C with size 0 +indicates EOF. + +hpread returns a NULL C on error."); + + ("hwrite", (RErr, [Int "handle"; BufferIn "content"]), 271, + [ProtocolLimitWarning], [], + "write data to an open handle", + "\ +This command writes all the data in C to C. It +returns an error if this fails."); + + ("hpwrite", (RErr, [Int "handle"; BufferIn "content"]), 272, + [ProtocolLimitWarning], [], + "write data to an open handle at a specific offset", + "\ +This command writes all the data in C to C, +starting at C bytes from the beginning of the file. It +returns an error if this fails."); + + ("hseek", (RInt64 "newoffset", [Int "handle"; Int64 "offset"; + Int "whence"]), 273, [], + [], + "seek on an open handle", + "\ +This command updates the 'current position' in C. This +affects the hread and hwrite calls. See L for details +of C and C. + +On success, hseek returns the new offset from the beginning of +the file. It returns an offset of -1 on failure."); + + ("htruncate", (RErr, [Int "handle"; Int64 "size"]), 274, [], + [], + "truncate a file", + "\ +This command sets the size of the file referred to by C +to C. If the file was previously larger than C, the +extra data will be lost. If the file was previously smaller than +C, the file will be zero-filled. The latter case will +typically create a sparse file."); + + ("hallocate", (RErr, [Int "handle"; Int64 "offset"; Int64 "length"]), 275, [], + [], + "reserve space for a file", + "\ +This command ensures that C bytes of disk space have been +allocated, starting at an offset of C bytes from the +beginning of the file, for the file referred to by C. +This will increase the size of the file if necessary. Any newly +allocated space will be zero-filled."); + ] let all_functions = non_daemon_functions @ daemon_functions