[Libguestfs] [PATCH 2/2] NEW API: new api e2fsck-fy for resize2fs

Richard W.M. Jones rjones at redhat.com
Fri Jan 13 13:08:52 UTC 2012


On Fri, Jan 13, 2012 at 07:09:38PM +0800, Wanlong Gao wrote:
> On 01/13/2012 06:12 PM, Richard W.M. Jones wrote:
> 
> > On Fri, Jan 13, 2012 at 02:27:50PM +0800, Wanlong Gao wrote:
> >> Add a new api e2fsck-fy for resize2fs.
> >> Sometimes e2fsck-f is not enough.
> >>
> >> If resiz2fs return the message says: " Please use e2fsck-fy first",
> >> we just haven't such a command, it's so awkward.
> > 
> > Since we are going to rewrite the error message, can we change it to
> > say "use e2fsck-f first"?
> 
> 
> Yes, normally it will say "use e2fsck-f", but after use e2fsck-f, then
> resize2fs still fails, it'll say "use e2fsck-fy".
> 
> > 
> > It's not really clear to me what the difference is between
> > 'e2fsck -p -f' (which is what we use for the 'e2fsck-f' command) and
> > 'e2fsck -y -f'.
> 
> 
> "-p" : correct the errors which is not dangerous, but say "n" to some "may be dangerous"
> 	ones.
> "-y" : always say "y" to try to fix the errors whether it is safe or not.
> 	so, when using "-y", you should know what are you doing now.

I see.

How about designing a new API called "e2fsck" which has optional
arguments:

  OBool "correct" (* same as "-p" *);
  OBool "forceall" (* same as "-y" *)

The advantage of the new API is that we can extend it in future.

That would change the first patch: Instead of rewriting the error
message, just replace it, eg something like this:

  if (strstr (err, "e2fsck -f")) {
    free (err);
    reply_with_error ("you need to run e2fsck with the correct and/or forceall options first");
  } else {
    reply_with_error ("%s", err);
  }

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the Libguestfs mailing list