[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 3/3] e2fsck-f: change the internal to use e2fsck



From: Wanlong Gao <gaowanlong cn fujitsu com>

Since we implement the new api e2fsck, just change the
internal of e2fsck_f to use e2fsck now.

Signed-off-by: Wanlong Gao <gaowanlong cn fujitsu com>
---
 daemon/ext2.c |   27 ++++++---------------------
 1 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/daemon/ext2.c b/daemon/ext2.c
index b0dc6da..da602cc 100644
--- a/daemon/ext2.c
+++ b/daemon/ext2.c
@@ -325,26 +325,6 @@ do_e2fsck (const char *device,
   ADD_ARG (argv, i, NULL);
 
   r = commandv (NULL, &err, argv);
-  if (r == -1 || r >= 2) {
-    reply_with_error ("%s", err);
-    free (err);
-    return -1;
-  }
-
-  free (err);
-  return 0;
-}
-
-int
-do_e2fsck_f (const char *device)
-{
-  char *err;
-  int r;
-
-  char prog[] = "e2fsck";
-  if (e2prog (prog) == -1)
-    return -1;
-
   /* 0 = no errors, 1 = errors corrected.
    *
    * >= 4 means uncorrected or other errors.
@@ -352,7 +332,6 @@ do_e2fsck_f (const char *device)
    * 2, 3 means errors were corrected and we require a reboot.  This is
    * a difficult corner case.
    */
-  r = commandr (NULL, &err, prog, "-p", "-f", device, NULL);
   if (r == -1 || r >= 2) {
     reply_with_error ("%s", err);
     free (err);
@@ -364,6 +343,12 @@ do_e2fsck_f (const char *device)
 }
 
 int
+do_e2fsck_f (const char *device)
+{
+  return do_e2fsck (device, 1, 0);
+}
+
+int
 do_mke2journal (int blocksize, const char *device)
 {
   char *err;
-- 
1.7.8


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]