mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
New API: mklost_and_found
This commit is contained in:
1
TODO
1
TODO
@@ -57,7 +57,6 @@ Ideas for extra commands
|
||||
e2image
|
||||
e2undo
|
||||
filefrag
|
||||
mklost+found
|
||||
|
||||
SELinux:
|
||||
chcat
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1 +1 @@
|
||||
373
|
||||
374
|
||||
|
||||
Reference in New Issue
Block a user