New APIs: is-chardev, is-blockdev, is-fifo, is-symlink, is-socket
[libguestfs.git] / src / generator.ml
index 363e78f..da01f12 100755 (executable)
@@ -1812,9 +1812,9 @@ See also C<guestfs_is_file>, C<guestfs_is_dir>, C<guestfs_stat>.");
       [["is_file"; "/known-1"]]);
     InitISOFS, Always, TestOutputFalse (
       [["is_file"; "/directory"]])],
-   "test if file exists",
+   "test if a regular file",
    "\
-This returns C<true> if and only if there is a file
+This returns C<true> if and only if there is a regular file
 with the given C<path> name.  Note that it returns false for
 other objects like directories.
 
@@ -1825,7 +1825,7 @@ See also C<guestfs_stat>.");
       [["is_dir"; "/known-3"]]);
     InitISOFS, Always, TestOutputTrue (
       [["is_dir"; "/directory"]])],
-   "test if file exists",
+   "test if a directory",
    "\
 This returns C<true> if and only if there is a directory
 with the given C<path> name.  Note that it returns false for
@@ -5356,6 +5356,68 @@ filesystem can be found.
 
 To find the label of a filesystem, use C<guestfs_vfs_label>.");
 
+  ("is_chardev", (RBool "flag", [Pathname "path"]), 267, [],
+   [InitISOFS, Always, TestOutputFalse (
+      [["is_chardev"; "/directory"]]);
+    InitBasicFS, Always, TestOutputTrue (
+      [["mknod_c"; "0o777"; "99"; "66"; "/test"];
+       ["is_chardev"; "/test"]])],
+   "test if character device",
+   "\
+This returns C<true> if and only if there is a character device
+with the given C<path> name.
+
+See also C<guestfs_stat>.");
+
+  ("is_blockdev", (RBool "flag", [Pathname "path"]), 268, [],
+   [InitISOFS, Always, TestOutputFalse (
+      [["is_blockdev"; "/directory"]]);
+    InitBasicFS, Always, TestOutputTrue (
+      [["mknod_b"; "0o777"; "99"; "66"; "/test"];
+       ["is_blockdev"; "/test"]])],
+   "test if block device",
+   "\
+This returns C<true> if and only if there is a block device
+with the given C<path> name.
+
+See also C<guestfs_stat>.");
+
+  ("is_fifo", (RBool "flag", [Pathname "path"]), 269, [],
+   [InitISOFS, Always, TestOutputFalse (
+      [["is_fifo"; "/directory"]]);
+    InitBasicFS, Always, TestOutputTrue (
+      [["mkfifo"; "0o777"; "/test"];
+       ["is_fifo"; "/test"]])],
+   "test if FIFO (named pipe)",
+   "\
+This returns C<true> if and only if there is a FIFO (named pipe)
+with the given C<path> name.
+
+See also C<guestfs_stat>.");
+
+  ("is_symlink", (RBool "flag", [Pathname "path"]), 270, [],
+   [InitISOFS, Always, TestOutputFalse (
+      [["is_symlink"; "/directory"]]);
+    InitISOFS, Always, TestOutputTrue (
+      [["is_symlink"; "/abssymlink"]])],
+   "test if symbolic link",
+   "\
+This returns C<true> if and only if there is a symbolic link
+with the given C<path> name.
+
+See also C<guestfs_stat>.");
+
+  ("is_socket", (RBool "flag", [Pathname "path"]), 271, [],
+   (* XXX Need a positive test for sockets. *)
+   [InitISOFS, Always, TestOutputFalse (
+      [["is_socket"; "/directory"]])],
+   "test if socket",
+   "\
+This returns C<true> if and only if there is a Unix domain socket
+with the given C<path> name.
+
+See also C<guestfs_stat>.");
+
 ]
 
 let all_functions = non_daemon_functions @ daemon_functions
@@ -5661,7 +5723,44 @@ let prepopts = [
   LVM2 physical volume, and place a volume group and logical volume
   on there.  This defaults to creating a 100MB disk with the VG and
   LV called /dev/VG/LV.  You can change the name of the VG and LV
-  by supplying an alternate name as the first optional parameter.");
+  by supplying an alternate name as the first optional parameter.
+
+  Note this does not create a filesystem.  Use 'lvfs' to do that.");
+
+  ("lvfs",
+   "create a disk with logical volume and filesystem",
+   [ "name", "/dev/VG/LV", "the name of the VG and LV to use";
+     "filesystem", "ext2", "the type of filesystem to use";
+     "size", "100M", "the size of the disk image";
+     "partition", "mbr", "partition table type" ],
+   "  Create a disk with a single partition, set up the partition as an
+  LVM2 physical volume, and place a volume group and logical volume
+  on there.  Then format the LV with a filesystem.  This defaults to
+  creating a 100MB disk with the VG and LV called /dev/VG/LV, with an
+  ext2 filesystem.");
+
+  ("bootroot",
+   "create a boot and root filesystem",
+   [ "bootfs", "ext2", "the type of filesystem to use for boot";
+     "rootfs", "ext2", "the type of filesystem to use for root";
+     "size", "100M", "the size of the disk image";
+     "bootsize", "32M", "the size of the boot filesystem";
+     "partition", "mbr", "partition table type" ],
+   "  Create a disk with two partitions, for boot and root filesystem.
+  Format the two filesystems independently.  There are several optional
+  parameters which control the exact layout and filesystem types.");
+
+  ("bootrootlv",
+   "create a boot and root filesystem using LVM",
+   [ "name", "/dev/VG/LV", "the name of the VG and LV for root";
+     "bootfs", "ext2", "the type of filesystem to use for boot";
+     "rootfs", "ext2", "the type of filesystem to use for root";
+     "size", "100M", "the size of the disk image";
+     "bootsize", "32M", "the size of the boot filesystem";
+     "partition", "mbr", "partition table type" ],
+   "  This is the same as 'bootroot' but the root filesystem (only) is
+  placed on a logical volume, named by default '/dev/VG/LV'.  There are
+  several optional parameters which control the exact layout.");
 
 ]