X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=src%2Fgenerator.ml;h=85a867e04989e397b50080050b5fc828ba4054bc;hp=95a263706c1be59f839c94805253ca6f7abb8bd4;hb=27b730a6820b80a49a4da1af9f4c8e8a952f735e;hpb=7cb6fac3074c52ac3c3e9ead5d99e4a2887cf7b1 diff --git a/src/generator.ml b/src/generator.ml index 95a2637..85a867e 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -794,8 +794,9 @@ against a completely different C library. This call was added in version C<1.0.58>. In previous versions of libguestfs there was no way to get the version -number. From C code you can use ELF weak linking tricks to find out if -this symbol exists (if it doesn't, then it's an earlier version). +number. From C code you can use dynamic linker functions +to find out if this symbol exists (if it doesn't, then +it's an earlier version). The call returns a structure with four elements. The first three (C, C and C) are numbers and @@ -806,9 +807,13 @@ used for distro-specific information. To construct the original version string: C<$major.$minor.$release$extra> +See also: L. + I Don't use this call to test for availability -of features. Distro backports makes this unreliable. Use -C instead."); +of features. In enterprise distributions we backport +features from later versions into earlier versions, +making this an unreliable way to test for features. +Use C instead."); ("set_selinux", (RErr, [Bool "selinux"]), -1, [FishAlias "selinux"], [InitNone, Always, TestOutputTrue ( @@ -3151,7 +3156,7 @@ Unknown file type =item '?' -The L returned a C field with an +The L call returned a C field with an unexpected value =back @@ -3474,7 +3479,7 @@ The C<-f> option removes the link (C) if it exists already."); "\ This command reads the target of a symbolic link."); - ("fallocate", (RErr, [Pathname "path"; Int "len"]), 169, [], + ("fallocate", (RErr, [Pathname "path"; Int "len"]), 169, [DeprecatedBy "fallocate64"], [InitBasicFS, Always, TestOutputStruct ( [["fallocate"; "/a"; "1000000"]; ["stat"; "/a"]], [CompareWithInt ("size", 1_000_000)])], @@ -3796,8 +3801,8 @@ was built (see C in the source)."); )], "echo arguments back to the client", "\ -This command concatenate the list of C passed with single spaces between -them and returns the resulting string. +This command concatenates the list of C passed with single spaces +between them and returns the resulting string. You can use this command to test the connection through to the daemon. @@ -3899,12 +3904,13 @@ See also C."); [["vfs_type"; "/dev/sda1"]], "ext2")], "get the Linux VFS type corresponding to a mounted device", "\ -This command gets the block device type corresponding to -a mounted device called C. +This command gets the filesystem type corresponding to +the filesystem on C. -Usually the result is the name of the Linux VFS module that -is used to mount this device (probably determined automatically -if you used the C call)."); +For most filesystems, the result is the name of the Linux +VFS module which would be used to mount this filesystem +if you mounted it without specifying the filesystem type. +For example a string such as C or C."); ("truncate", (RErr, [Pathname "path"]), 199, [], [InitBasicFS, Always, TestOutputStruct ( @@ -3924,8 +3930,13 @@ file must exist already."); "truncate a file to a particular size", "\ This command truncates C to size C bytes. The file -must exist already. If the file is smaller than C then -the file is extended to the required size with null bytes."); +must exist already. + +If the current file size is less than C then +the file is extended to the required size with zero bytes. +This creates a sparse file (ie. disk blocks are not allocated +for the file until you write to it). To create a non-sparse +file of zeroes, use C instead."); ("utimens", (RErr, [Pathname "path"; Int64 "atsecs"; Int64 "atnsecs"; Int64 "mtsecs"; Int64 "mtnsecs"]), 201, [], [InitBasicFS, Always, TestOutputStruct ( @@ -4035,7 +4046,7 @@ C is the list of files from this directory. On return you get a list of strings, with a one-to-one correspondence to the C list. Each string is the -value of the symbol link. +value of the symbolic link. If the C operation fails on any name, then the corresponding result string is the empty string C<\"\">. @@ -4277,6 +4288,8 @@ the libguestfs appliance will be able to provide. The libguestfs groups, and the functions that those groups correspond to, are listed in L. +You can also fetch this list at runtime by calling +C. The argument C is a list of group names, eg: C<[\"inotify\", \"augeas\"]> would check for the availability of @@ -4707,6 +4720,63 @@ allows you to specify the new size (in bytes) explicitly."); This command is the same as C except that it allows you to specify the new size (in bytes) explicitly."); + ("available_all_groups", (RStringList "groups", []), 251, [], + [InitNone, Always, TestRun [["available_all_groups"]]], + "return a list of all optional groups", + "\ +This command returns a list of all optional groups that this +daemon knows about. Note this returns both supported and unsupported +groups. To find out which ones the daemon can actually support +you have to call C on each member of the +returned list. + +See also C and L."); + + ("fallocate64", (RErr, [Pathname "path"; Int64 "len"]), 252, [], + [InitBasicFS, Always, TestOutputStruct ( + [["fallocate64"; "/a"; "1000000"]; + ["stat"; "/a"]], [CompareWithInt ("size", 1_000_000)])], + "preallocate a file in the guest filesystem", + "\ +This command preallocates a file (containing zero bytes) named +C of size C bytes. If the file exists already, it +is overwritten. + +Note that this call allocates disk blocks for the file. +To create a sparse file use C instead. + +The deprecated call C does the same, +but owing to an oversight it only allowed 30 bit lengths +to be specified, effectively limiting the maximum size +of files created through that call to 1GB. + +Do not confuse this with the guestfish-specific +C and C commands which create +a file in the host and attach it as a device."); + + ("vfs_label", (RString "label", [Device "device"]), 253, [], + [InitBasicFS, Always, TestOutput ( + [["set_e2label"; "/dev/sda1"; "LTEST"]; + ["vfs_label"; "/dev/sda1"]], "LTEST")], + "get the filesystem label", + "\ +This returns the filesystem label of the filesystem on +C. + +If the filesystem is unlabeled, this returns the empty string."); + + ("vfs_uuid", (RString "uuid", [Device "device"]), 254, [], + (let uuid = uuidgen () in + [InitBasicFS, Always, TestOutput ( + [["set_e2uuid"; "/dev/sda1"; uuid]; + ["vfs_uuid"; "/dev/sda1"]], uuid)]), + "get the filesystem UUID", + "\ +This returns the filesystem UUID of the filesystem on +C. + +If the filesystem does not have a UUID, this returns the empty string."); + ] let all_functions = non_daemon_functions @ daemon_functions @@ -9113,6 +9183,12 @@ and generate_python_c () = #define PY_SSIZE_T_CLEAN 1 #include +#if PY_VERSION_HEX < 0x02050000 +typedef int Py_ssize_t; +#define PY_SSIZE_T_MAX INT_MAX +#define PY_SSIZE_T_MIN INT_MIN +#endif + #include #include #include @@ -11035,9 +11111,12 @@ print_strings (char *const *argv) | FileIn n | FileOut n -> pr " printf (\"%%s\\n\", %s);\n" n | BufferIn n -> - pr " for (size_t i = 0; i < %s_size; ++i)\n" n; - pr " printf (\"<%%02x>\", %s[i]);\n" n; - pr " printf (\"\\n\");\n" + pr " {\n"; + pr " size_t i;\n"; + pr " for (i = 0; i < %s_size; ++i)\n" n; + pr " printf (\"<%%02x>\", %s[i]);\n" n; + pr " printf (\"\\n\");\n"; + pr " }\n"; | OptString n -> pr " printf (\"%%s\\n\", %s ? %s : \"null\");\n" n n | StringList n | DeviceList n -> pr " print_strings (%s);\n" n | Bool n -> pr " printf (\"%%s\\n\", %s ? \"true\" : \"false\");\n" n