diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-07-31 08:39:43 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-07-31 10:18:50 +0100 |
commit | afaff775c12f32b7912f194e2fcc8e76b8c82572 (patch) | |
tree | 6c775a65b26a799e49aade3f7b68a7c761120e93 /src | |
parent | 7c3a90f94cd6b8fec9cdd1c052b91a14c0ee0e0e (diff) | |
download | libguestfs-afaff775c12f32b7912f194e2fcc8e76b8c82572.tar.gz libguestfs-afaff775c12f32b7912f194e2fcc8e76b8c82572.tar.xz libguestfs-afaff775c12f32b7912f194e2fcc8e76b8c82572.zip |
New commands: 'ln', 'ln-f', 'ln-s', 'ln-sf' and 'readlink'.
These commands can be used to make hard and symbolic links. The
readlink command is used to read existing symbolic links.
Diffstat (limited to 'src')
-rw-r--r-- | src/MAX_PROC_NR | 2 | ||||
-rwxr-xr-x | src/generator.ml | 46 |
2 files changed, 47 insertions, 1 deletions
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index 9cc2bc3e..de8febe1 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -163 +168 diff --git a/src/generator.ml b/src/generator.ml index 3a35fa2c..34721938 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -3141,6 +3141,52 @@ matching lines."); Return the canonicalized absolute pathname of C<path>. The returned path has no C<.>, C<..> or symbolic link path elements."); + ("ln", (RErr, [String "target"; String "linkname"]), 164, [], + [InitBasicFS, Always, TestOutputStruct ( + [["touch"; "/a"]; + ["ln"; "/a"; "/b"]; + ["stat"; "/b"]], [CompareWithInt ("nlink", 2)])], + "create a hard link", + "\ +This command creates a hard link using the C<ln> command."); + + ("ln_f", (RErr, [String "target"; String "linkname"]), 165, [], + [InitBasicFS, Always, TestOutputStruct ( + [["touch"; "/a"]; + ["touch"; "/b"]; + ["ln_f"; "/a"; "/b"]; + ["stat"; "/b"]], [CompareWithInt ("nlink", 2)])], + "create a hard link", + "\ +This command creates a hard link using the C<ln -f> command. +The C<-f> option removes the link (C<linkname>) if it exists already."); + + ("ln_s", (RErr, [String "target"; String "linkname"]), 166, [], + [InitBasicFS, Always, TestOutputStruct ( + [["touch"; "/a"]; + ["ln_s"; "a"; "/b"]; + ["lstat"; "/b"]], [CompareWithInt ("mode", 0o120777)])], + "create a symbolic link", + "\ +This command creates a symbolic link using the C<ln -s> command."); + + ("ln_sf", (RErr, [String "target"; String "linkname"]), 167, [], + [InitBasicFS, Always, TestOutput ( + [["mkdir_p"; "/a/b"]; + ["touch"; "/a/b/c"]; + ["ln_sf"; "../d"; "/a/b/c"]; + ["readlink"; "/a/b/c"]], "../d")], + "create a symbolic link", + "\ +This command creates a symbolic link using the C<ln -sf> command, +The C<-f> option removes the link (C<linkname>) if it exists already."); + + ("readlink", (RString "link", [String "path"]), 168, [], + [] (* XXX tested above *), + "read the target of a symbolic link", + "\ +This command reads the target of a symbolic link."); + ] let all_functions = non_daemon_functions @ daemon_functions |