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

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



On Sat, Jan 14, 2012 at 12:03:45AM +0800, Wanlong Gao wrote:
> 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.
> v1->v2: use optargs_bitmask
> 
> Signed-off-by: Wanlong Gao <gaowanlong cn fujitsu com>
> ---
>  daemon/ext2.c |   28 +++++++---------------------
>  1 files changed, 7 insertions(+), 21 deletions(-)
> 
> diff --git a/daemon/ext2.c b/daemon/ext2.c
> index 5a0ac9f..802d7c3 100644
> --- a/daemon/ext2.c
> +++ b/daemon/ext2.c
> @@ -327,26 +327,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.
> @@ -354,7 +334,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);
> @@ -366,6 +345,13 @@ do_e2fsck_f (const char *device)
>  }
>  
>  int
> +do_e2fsck_f (const char *device)
> +{
> +  optargs_bitmask = GUESTFS_E2FSCK_CORRECT_BITMASK;
> +  return do_e2fsck (device, 1, 0);
> +}
> +
> +int
>  do_mke2journal (int blocksize, const char *device)
>  {
>    char *err;
> -- 
> 1.7.8

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora


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