[Libguestfs] [PATCH v2 2/3] NEW API: add a new api e2fsck

Richard W.M. Jones rjones at redhat.com
Fri Jan 13 16:11:53 UTC 2012


On Sat, Jan 14, 2012 at 12:03:44AM +0800, Wanlong Gao wrote:
> From: Wanlong Gao <gaowanlong at cn.fujitsu.com>
> +  if (optargs_bitmask & GUESTFS_E2FSCK_CORRECT_BITMASK &&
> +      optargs_bitmask & GUESTFS_E2FSCK_FORCEALL_BITMASK) {

This needs to be:

  if (optargs_bitmask & GUESTFS_E2FSCK_CORRECT_BITMASK && correct
      optargs_bitmask & GUESTFS_E2FSCK_FORCEALL_BITMASK && forceall) {

but maybe it's better to write this, early on in the function:

  /* Default if not selected. */
  if (!(optargs_bitmask & GUESTFS_E2FSCK_CORRECT_BITMASK))
    correct = 0;
  if (!(optargs_bitmask & GUESTFS_E2FSCK_FORCEALL_BITMASK))
    forceall = 0;

then you can forget about optargs_bitmask in the rest of the function
and just use 'correct' and 'forceall' variables!

The rest looks fine to me.

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