diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-11-02 09:32:52 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-11-02 14:35:41 +0000 |
commit | f56bc8edd5f23c23298bf3f609a98dd6fec5d512 (patch) | |
tree | d8810fa734b73881be1312ef7877d3d41c5c4763 | |
parent | 4cfc277674f50ed9eff63e2010d3241172e7a30e (diff) | |
download | libguestfs-f56bc8edd5f23c23298bf3f609a98dd6fec5d512.tar.gz libguestfs-f56bc8edd5f23c23298bf3f609a98dd6fec5d512.tar.xz libguestfs-f56bc8edd5f23c23298bf3f609a98dd6fec5d512.zip |
New API: mklost_and_found
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | daemon/ext2.c | 27 | ||||
-rw-r--r-- | generator/actions.ml | 15 | ||||
-rw-r--r-- | src/MAX_PROC_NR | 2 |
4 files changed, 43 insertions, 2 deletions
@@ -57,7 +57,6 @@ Ideas for extra commands e2image e2undo filefrag - mklost+found SELinux: chcat diff --git a/daemon/ext2.c b/daemon/ext2.c index 7fc1172d..e4afced1 100644 --- a/daemon/ext2.c +++ b/daemon/ext2.c @@ -1178,3 +1178,30 @@ error: if (err) free (err); return -1; } + +int +do_mklost_and_found (const char *mountpoint) +{ + char *cmd; + int r; + + if (asprintf_nowarn (&cmd, "cd %R && mklost+found", mountpoint) == -1) { + reply_with_perror ("asprintf"); + return -1; + } + + r = system (cmd); + if (r == -1) { + reply_with_perror ("system"); + free (cmd); + return -1; + } + if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) { + reply_with_error ("%s: command failed", cmd); + free (cmd); + return -1; + } + free (cmd); + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index 5d713478..5c3de524 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -10345,6 +10345,21 @@ If the optional C<suffix> parameter is given, then the suffix See also: C<guestfs_mkdtemp>." }; + { defaults with + name = "mklost_and_found"; + style = RErr, [Pathname "mountpoint"], []; + proc_nr = Some 374; + tests = [ + InitBasicFS, Always, TestRun ( + [["rm_rf"; "/lost+found"]; + ["mklost_and_found"; "/"]]) + ]; + shortdesc = "make lost+found directory on an ext2/3/4 filesystem"; + longdesc = "\ +Make the C<lost+found> directory, normally in the root directory +of an ext2/3/4 filesystem. C<mountpoint> is the directory under +which we try to create the C<lost+found> directory." }; + ] (* Non-API meta-commands available only in guestfish. diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR index a5c3fde3..38a45c3e 100644 --- a/src/MAX_PROC_NR +++ b/src/MAX_PROC_NR @@ -1 +1 @@ -373 +374 |