[Libguestfs] [PATCH V3] NEW API:ext:mke2fs

Richard W.M. Jones rjones at redhat.com
Mon Sep 17 07:12:41 UTC 2012


On Mon, Sep 17, 2012 at 02:39:17PM +0800, Wanlong Gao wrote:
> On 09/11/2012 08:53 PM, Wanlong Gao wrote:
> > New api mke2fs for full configuration of filesystem.
> 
> Hi Rich, 
> 
> I fixed as your comments, but see this error,
> "Fatal error: exception Failure("function mke2journal has tests but does not test itself") "
> 
> How should I fix this problem ?

This means that the mke2journal test doesn't test the mke2journal
function.  That's because you shouldn't change the tests of the
deprecated functions (mke2journal etc).  Leave them alone.  But you
should copy those tests into mke2fs, changing them to use mke2fs
(which you did, but only partially).

> And can you review the other parts?

Sure, later (today hopefully).

> Thanks,
> Wanlong Gao
> 
> > 
> > Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com>
> > ---
> >  daemon/ext2.c             | 369 +++++++++++++++++++++++++++++++++++++++++++++-
> >  generator/actions.ml      |  85 ++++++++++-
> >  gobject/Makefile.inc      |   6 +-
> >  guestfs-release-notes.txt |   5 +
> >  po/POTFILES               |   1 +
> >  src/MAX_PROC_NR           |   2 +-
> >  6 files changed, 458 insertions(+), 10 deletions(-)
> > 
> > diff --git a/daemon/ext2.c b/daemon/ext2.c
> > index 40b36d2..7fc1172 100644
> > --- a/daemon/ext2.c
> > +++ b/daemon/ext2.c
> > @@ -29,7 +29,7 @@
> >  #include "c-ctype.h"
> >  #include "actions.h"
> >  
> > -#define MAX_ARGS 64
> > +#define MAX_ARGS 128
> >  
> >  GUESTFSD_EXT_CMD(str_tune2fs, tune2fs);
> >  GUESTFSD_EXT_CMD(str_e2fsck, e2fsck);
> > @@ -811,3 +811,370 @@ do_set_e2generation (const char *filename, int64_t generation)
> >  
> >    return 0;
> >  }
> > +
> > +int
> > +do_mke2fs (const char *device,               /* 0 */
> > +           int64_t blockscount,
> > +           int64_t blocksize,
> > +           int64_t fragsize,
> > +           int64_t blockspergroup,
> > +           int64_t numberofgroups,           /* 5 */
> > +           int64_t bytesperinode,
> > +           int64_t inodesize,
> > +           int64_t journalsize,
> > +           int64_t numberofinodes,
> > +           int64_t stridesize,               /* 10 */
> > +           int64_t stripewidth,
> > +           int64_t maxonlineresize,
> > +           int reservedblockspercentage,
> > +           int mmpupdateinterval,
> > +           const char *journaldevice,        /* 15 */
> > +           const char *label,
> > +           const char *lastmounteddir,
> > +           const char *creatoros,
> > +           const char *fstype,
> > +           const char *usagetype,            /* 20 */
> > +           const char *uuid,
> > +           int forcecreate,
> > +           int writesbandgrouponly,
> > +           int lazyitableinit,
> > +           int lazyjournalinit,              /* 25 */
> > +           int testfs,
> > +           int discard,
> > +           int quotatype,
> > +           int extent,
> > +           int filetype,                     /* 30 */
> > +           int flexbg,
> > +           int hasjournal,
> > +           int journaldev,
> > +           int largefile,
> > +           int quota,                        /* 35 */
> > +           int resizeinode,
> > +           int sparsesuper,
> > +           int uninitbg)
> > +{
> > +  int r;
> > +  char *err = NULL;
> > +  const char *argv[MAX_ARGS];
> > +  char blockscount_s[64];
> > +  char blocksize_s[64];
> > +  char fragsize_s[64];
> > +  char blockspergroup_s[64];
> > +  char numberofgroups_s[64];
> > +  char bytesperinode_s[64];
> > +  char inodesize_s[64];
> > +  char journalsize_s[64];
> > +  char journaldevice_s[256];
> > +  char reservedblockspercentage_s[64];
> > +  char numberofinodes_s[64];
> > +  char mmpupdateinterval_s[84];
> > +  char stridesize_s[74];
> > +  char stripewidth_s[84];
> > +  char maxonlineresize_s[74];
> > +  size_t i = 0;
> > +
> > +  ADD_ARG (argv, i, str_mke2fs);
> > +
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_BLOCKSIZE_BITMASK) {
> > +    if (blocksize < 0) {
> > +      reply_with_error ("blocksize must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (blocksize_s, sizeof blocksize_s, "%" PRIi64, blocksize);
> > +    ADD_ARG (argv, i, "-b");
> > +    ADD_ARG (argv, i, blocksize_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_FRAGSIZE_BITMASK) {
> > +    if (fragsize < 0) {
> > +      reply_with_error ("fragsize must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (fragsize_s, sizeof fragsize_s, "%" PRIi64, fragsize);
> > +    ADD_ARG (argv, i, "-f");
> > +    ADD_ARG (argv, i, fragsize_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_FORCECREATE_BITMASK) {
> > +    if (forcecreate)
> > +      ADD_ARG (argv, i, "-F");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_BLOCKSPERGROUP_BITMASK) {
> > +    if (blockspergroup < 0) {
> > +      reply_with_error ("blockspergroup must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (blockspergroup_s, sizeof blockspergroup_s,
> > +              "%" PRIi64, blockspergroup);
> > +    ADD_ARG (argv, i, "-g");
> > +    ADD_ARG (argv, i, blockspergroup_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_NUMBEROFGROUPS_BITMASK) {
> > +    if (numberofgroups < 0) {
> > +      reply_with_error ("numberofgroups must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (numberofgroups_s, sizeof numberofgroups_s,
> > +              "%" PRIi64, numberofgroups);
> > +    ADD_ARG (argv, i, "-G");
> > +    ADD_ARG (argv, i, numberofgroups_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_BYTESPERINODE_BITMASK) {
> > +    if (bytesperinode < 0) {
> > +      reply_with_error ("bytesperinode must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (bytesperinode_s, sizeof bytesperinode_s, "%" PRIi64, bytesperinode);
> > +    ADD_ARG (argv, i, "-i");
> > +    ADD_ARG (argv, i, bytesperinode_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_INODESIZE_BITMASK) {
> > +    if (inodesize < 0) {
> > +      reply_with_error ("inodesize must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (inodesize_s, sizeof inodesize_s, "%" PRIi64, inodesize);
> > +    ADD_ARG (argv, i, "-I");
> > +    ADD_ARG (argv, i, inodesize_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_JOURNALSIZE_BITMASK) {
> > +    if (journalsize < 0) {
> > +      reply_with_error ("journalsize must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (journalsize_s, sizeof journalsize_s,
> > +              "size=" "%" PRIi64, journalsize);
> > +    ADD_ARG (argv, i, "-J");
> > +    ADD_ARG (argv, i, journalsize_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_JOURNALDEVICE_BITMASK) {
> > +    if (journaldevice) {
> > +      snprintf (journaldevice_s, sizeof journaldevice_s,
> > +                "device=%s", journaldevice);
> > +      ADD_ARG (argv, i, "-J");
> > +      ADD_ARG (argv, i, journaldevice_s);
> > +    }
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_LABEL_BITMASK) {
> > +    if (label) {
> > +      ADD_ARG (argv, i, "-L");
> > +      ADD_ARG (argv, i, label);
> > +    }
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_RESERVEDBLOCKSPERCENTAGE_BITMASK) {
> > +    if (reservedblockspercentage < 0) {
> > +      reply_with_error ("reservedblockspercentage must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (reservedblockspercentage_s, sizeof reservedblockspercentage_s,
> > +              "%" PRIi32, reservedblockspercentage);
> > +    ADD_ARG (argv, i, "-m");
> > +    ADD_ARG (argv, i, reservedblockspercentage_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_LASTMOUNTEDDIR_BITMASK) {
> > +    if (lastmounteddir) {
> > +      ADD_ARG (argv, i, "-M");
> > +      ADD_ARG (argv, i, lastmounteddir);
> > +    }
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_NUMBEROFINODES_BITMASK) {
> > +    if (numberofinodes < 0) {
> > +      reply_with_error ("numberofinodes must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (numberofinodes_s, sizeof numberofinodes_s,
> > +              "%" PRIi64, numberofinodes);
> > +    ADD_ARG (argv, i, "-N");
> > +    ADD_ARG (argv, i, numberofinodes_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_CREATOROS_BITMASK) {
> > +    if (creatoros) {
> > +      ADD_ARG (argv, i, "-o");
> > +      ADD_ARG (argv, i, creatoros);
> > +    }
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_WRITESBANDGROUPONLY_BITMASK) {
> > +    if (writesbandgrouponly)
> > +      ADD_ARG (argv, i, "-S");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_FSTYPE_BITMASK) {
> > +    if (fstype) {
> > +      ADD_ARG (argv, i, "-t");
> > +      ADD_ARG (argv, i, fstype);
> > +    }
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_USAGETYPE_BITMASK) {
> > +    if (usagetype) {
> > +      ADD_ARG (argv, i, "-T");
> > +      ADD_ARG (argv, i, usagetype);
> > +    }
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_UUID_BITMASK) {
> > +    if (uuid) {
> > +      ADD_ARG (argv, i, "-U");
> > +      ADD_ARG (argv, i, uuid);
> > +    }
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_MMPUPDATEINTERVAL_BITMASK) {
> > +    if (mmpupdateinterval < 0) {
> > +      reply_with_error ("mmpupdateinterval must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (mmpupdateinterval_s, sizeof mmpupdateinterval_s,
> > +              "mmp_update_interval=" "%" PRIi32, mmpupdateinterval);
> > +    ADD_ARG (argv, i, "-E");
> > +    ADD_ARG (argv, i, mmpupdateinterval_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_STRIDESIZE_BITMASK) {
> > +    if (stridesize < 0) {
> > +      reply_with_error ("stridesize must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (stridesize_s, sizeof stridesize_s,
> > +              "stride=" "%" PRIi64, stridesize);
> > +    ADD_ARG (argv, i, "-E");
> > +    ADD_ARG (argv, i, stridesize_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_STRIPEWIDTH_BITMASK) {
> > +    if (stripewidth< 0) {
> > +      reply_with_error ("stripewidth must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (stripewidth_s, sizeof stripewidth_s,
> > +              "stripe_width=" "%" PRIi64, stripewidth);
> > +    ADD_ARG (argv, i, "-E");
> > +    ADD_ARG (argv, i, stripewidth_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_MAXONLINERESIZE_BITMASK) {
> > +    if (maxonlineresize < 0) {
> > +      reply_with_error ("maxonlineresize must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (maxonlineresize_s, sizeof maxonlineresize_s,
> > +              "resize=" "%" PRIi64, maxonlineresize);
> > +    ADD_ARG (argv, i, "-E");
> > +    ADD_ARG (argv, i, maxonlineresize_s);
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_LAZYITABLEINIT_BITMASK) {
> > +    ADD_ARG (argv, i, "-E");
> > +    if (lazyitableinit)
> > +      ADD_ARG (argv, i, "lazy_itable_init=1");
> > +    else
> > +      ADD_ARG (argv, i, "lazy_itable_init=0");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_LAZYJOURNALINIT_BITMASK) {
> > +    ADD_ARG (argv, i, "-E");
> > +    if (lazyjournalinit)
> > +      ADD_ARG (argv, i, "lazy_journal_init=1");
> > +    else
> > +      ADD_ARG (argv, i, "lazy_journal_init=0");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_TESTFS_BITMASK) {
> > +    if (testfs) {
> > +      ADD_ARG (argv, i, "-E");
> > +      ADD_ARG (argv, i, "test_fs");
> > +    }
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_DISCARD_BITMASK) {
> > +    ADD_ARG (argv, i, "-E");
> > +    if (discard)
> > +      ADD_ARG (argv, i, "discard");
> > +    else
> > +      ADD_ARG (argv, i, "nodiscard");
> > +  }
> > +
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_EXTENT_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (extent)
> > +      ADD_ARG (argv, i, "extent");
> > +    else
> > +      ADD_ARG (argv, i, "^extent");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_FILETYPE_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (filetype)
> > +      ADD_ARG (argv, i, "filetype");
> > +    else
> > +      ADD_ARG (argv, i, "^filetype");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_FLEXBG_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (flexbg)
> > +      ADD_ARG (argv, i, "flexbg");
> > +    else
> > +      ADD_ARG (argv, i, "^flexbg");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_HASJOURNAL_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (hasjournal)
> > +      ADD_ARG (argv, i, "has_journal");
> > +    else
> > +      ADD_ARG (argv, i, "^has_journal");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_JOURNALDEV_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (journaldev)
> > +      ADD_ARG (argv, i, "journal_dev");
> > +    else
> > +      ADD_ARG (argv, i, "^journal_dev");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_LARGEFILE_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (largefile)
> > +      ADD_ARG (argv, i, "large_file");
> > +    else
> > +      ADD_ARG (argv, i, "^large_file");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_QUOTA_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (quota)
> > +      ADD_ARG (argv, i, "quota");
> > +    else
> > +      ADD_ARG (argv, i, "^quota");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_RESIZEINODE_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (resizeinode)
> > +      ADD_ARG (argv, i, "resize_inode");
> > +    else
> > +      ADD_ARG (argv, i, "^resize_inode");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_SPARSESUPER_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (sparsesuper)
> > +      ADD_ARG (argv, i, "sparse_super");
> > +    else
> > +      ADD_ARG (argv, i, "^sparse_super");
> > +  }
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_UNINITBG_BITMASK) {
> > +    ADD_ARG (argv, i, "-O");
> > +    if (uninitbg)
> > +      ADD_ARG (argv, i, "uninit_bg");
> > +    else
> > +      ADD_ARG (argv, i, "^uninit_bg");
> > +  }
> > +
> > +  ADD_ARG (argv, i, device);
> > +
> > +  if (optargs_bitmask & GUESTFS_MKE2FS_BLOCKSCOUNT_BITMASK) {
> > +    if (blockscount < 0) {
> > +      reply_with_error ("blockscount must be >= 0");
> > +      goto error;
> > +    }
> > +    snprintf (blockscount_s, sizeof blockscount_s, "%" PRIi64, blockscount);
> > +    ADD_ARG (argv, i, blockscount_s);
> > +  }
> > +
> > +  ADD_ARG (argv, i, NULL);
> > +
> > +  r = commandv (NULL, &err, argv);
> > +  if (r == -1) {
> > +    reply_with_error ("%s: %s", device, err);
> > +    goto error;
> > +  }
> > +
> > +  free (err);
> > +  return 0;
> > +
> > +error:
> > +  if (err) free (err);
> > +  return -1;
> > +}
> > diff --git a/generator/actions.ml b/generator/actions.ml
> > index a3ff9ad..43f4837 100644
> > --- a/generator/actions.ml
> > +++ b/generator/actions.ml
> > @@ -6091,13 +6091,28 @@ the requested cluster size." };
> >      name = "mke2journal";
> >      style = RErr, [Int "blocksize"; Device "device"], [];
> >      proc_nr = Some 188;
> > +    deprecated_by = Some "mke2fs";
> >      tests = [
> >        InitEmpty, Always, TestOutput (
> >          [["part_init"; "/dev/sda"; "mbr"];
> >           ["part_add"; "/dev/sda"; "p"; "64"; "204799"];
> >           ["part_add"; "/dev/sda"; "p"; "204800"; "-64"];
> > -         ["mke2journal"; "4096"; "/dev/sda1"];
> > -         ["mke2fs_J"; "ext2"; "4096"; "/dev/sda2"; "/dev/sda1"];
> > +         ["mke2fs"; "/dev/sda1"; ""; "4096"; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; ""; ""; "NOARG";
> > +            "NOARG"; "NOARG"; "NOARG"; "NOARG"; "NOARG";
> > +            "NOARG"; "true"; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; "true"; ""; "";
> > +            ""; ""; ""];
> > +         ["mke2fs"; "/dev/sda2"; ""; "4096"; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; ""; ""; "/dev/sda1";
> > +            "NOARG"; "NOARG"; "NOARG"; "ext2"; "NOARG";
> > +            "NOARG"; "true"; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; ""];
> >           ["mount"; "/dev/sda2"; "/"];
> >           ["write"; "/new"; "new file contents"];
> >           ["cat"; "/new"]], "new file contents")
> > @@ -6113,13 +6128,28 @@ to the command:
> >      name = "mke2journal_L";
> >      style = RErr, [Int "blocksize"; String "label"; Device "device"], [];
> >      proc_nr = Some 189;
> > +    deprecated_by = Some "mke2fs";
> >      tests = [
> >        InitEmpty, Always, TestOutput (
> >          [["part_init"; "/dev/sda"; "mbr"];
> >           ["part_add"; "/dev/sda"; "p"; "64"; "204799"];
> >           ["part_add"; "/dev/sda"; "p"; "204800"; "-64"];
> > -         ["mke2journal_L"; "4096"; "JOURNAL"; "/dev/sda1"];
> > -         ["mke2fs_JL"; "ext2"; "4096"; "/dev/sda2"; "JOURNAL"];
> > +         ["mke2fs"; "/dev/sda1"; ""; "4096"; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; ""; ""; "/dev/sda1";
> > +            "JOURNAL"; "NOARG"; "NOARG"; "ext2"; "NOARG";
> > +            "NOARG"; "true"; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; "true"; ""; "";
> > +            ""; ""; ""];
> > +         ["mke2fs"; "/dev/sda2"; ""; "4096"; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; ""; ""; "LABEL=JOURNAL";
> > +            "JOURNAL"; "NOARG"; "NOARG"; "ext2"; "NOARG";
> > +            "NOARG"; "true"; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; ""];
> >           ["mount"; "/dev/sda2"; "/"];
> >           ["write"; "/new"; "new file contents"];
> >           ["cat"; "/new"]], "new file contents")
> > @@ -6132,6 +6162,7 @@ This creates an ext2 external journal on C<device> with label C<label>." };
> >      name = "mke2journal_U";
> >      style = RErr, [Int "blocksize"; String "uuid"; Device "device"], [];
> >      proc_nr = Some 190;
> > +    deprecated_by = Some "mke2fs";
> >      optional = Some "linuxfsuuid";
> >      tests =
> >        (let uuid = uuidgen () in [
> > @@ -6139,8 +6170,22 @@ This creates an ext2 external journal on C<device> with label C<label>." };
> >            [["part_init"; "/dev/sda"; "mbr"];
> >             ["part_add"; "/dev/sda"; "p"; "64"; "204799"];
> >             ["part_add"; "/dev/sda"; "p"; "204800"; "-64"];
> > -           ["mke2journal_U"; "4096"; uuid; "/dev/sda1"];
> > -           ["mke2fs_JU"; "ext2"; "4096"; "/dev/sda2"; uuid];
> > +           ["mke2fs"; "/dev/sda1"; ""; "4096"; ""; ""; "";
> > +              ""; ""; ""; ""; "";
> > +              ""; ""; ""; ""; "NOARG";
> > +              "NOARG"; "NOARG"; "NOARG"; "NOARG"; "NOARG";
> > +              uuid; "true"; ""; ""; "";
> > +              ""; ""; ""; ""; "";
> > +              ""; ""; ""; ""; "";
> > +              ""; ""; ""];
> > +           ["mke2fs"; "/dev/sda2"; ""; "4096"; ""; ""; "";
> > +              ""; ""; ""; ""; "";
> > +              ""; ""; ""; ""; "UUID=uuid";
> > +              "JOURNAL"; "NOARG"; "NOARG"; "ext2"; "NOARG";
> > +              "NOARG"; "true"; ""; ""; "";
> > +              ""; ""; ""; ""; "";
> > +              ""; ""; ""; ""; "";
> > +              ""; ""; ""];
> >             ["mount"; "/dev/sda2"; "/"];
> >             ["write"; "/new"; "new file contents"];
> >             ["cat"; "/new"]], "new file contents")
> > @@ -6153,6 +6198,7 @@ This creates an ext2 external journal on C<device> with UUID C<uuid>." };
> >      name = "mke2fs_J";
> >      style = RErr, [String "fstype"; Int "blocksize"; Device "device"; Device "journal"], [];
> >      proc_nr = Some 191;
> > +    deprecated_by = Some "mke2fs";
> >      shortdesc = "make ext2/3/4 filesystem with external journal";
> >      longdesc = "\
> >  This creates an ext2/3/4 filesystem on C<device> with
> > @@ -6167,6 +6213,7 @@ See also C<guestfs_mke2journal>." };
> >      name = "mke2fs_JL";
> >      style = RErr, [String "fstype"; Int "blocksize"; Device "device"; String "label"], [];
> >      proc_nr = Some 192;
> > +    deprecated_by = Some "mke2fs";
> >      shortdesc = "make ext2/3/4 filesystem with external journal";
> >      longdesc = "\
> >  This creates an ext2/3/4 filesystem on C<device> with
> > @@ -6178,6 +6225,7 @@ See also C<guestfs_mke2journal_L>." };
> >      name = "mke2fs_JU";
> >      style = RErr, [String "fstype"; Int "blocksize"; Device "device"; String "uuid"], [];
> >      proc_nr = Some 193;
> > +    deprecated_by = Some "mke2fs";
> >      optional = Some "linuxfsuuid";
> >      shortdesc = "make ext2/3/4 filesystem with external journal";
> >      longdesc = "\
> > @@ -9802,6 +9850,31 @@ the resulting filesystem may be inconsistent or corrupt.
> >  The returned status indicates whether filesystem corruption was
> >  detected (returns C<1>) or was not detected (returns C<0>)." };
> >  
> > +  { defaults with
> > +    name = "mke2fs";
> > +    style = RErr, [Device "device"], [OInt64 "blockscount"; OInt64 "blocksize"; OInt64 "fragsize"; OInt64 "blockspergroup"; OInt64 "numberofgroups"; OInt64 "bytesperinode"; OInt64 "inodesize"; OInt64 "journalsize"; OInt64 "numberofinodes"; OInt64 "stridesize"; OInt64 "stripewidth"; OInt64 "maxonlineresize"; OInt "reservedblockspercentage"; OInt "mmpupdateinterval"; OString "journaldevice"; OString "label"; OString "lastmounteddir"; OString "creatoros"; OString "fstype"; OString "usagetype"; OString "uuid"; OBool "forcecreate"; OBool "writesbandgrouponly"; OBool "lazyitableinit"; OBool "lazyjournalinit"; OBool "testfs"; OBool "discard"; OBool "quotatype";  OBool "extent"; OBool "filetype"; OBool "flexbg"; OBool "hasjournal"; OBool "journaldev"; OBool "largefile"; OBool "quota"; OBool "resizeinode"; OBool "sparsesuper"; OBool "uninitbg"];
> > +    proc_nr = Some 367;
> > +    tests = [
> > +      InitEmpty, IfAvailable "ext2", TestRun (
> > +        [["part_disk"; "/dev/sda"; "mbr"];
> > +         ["mke2fs"; "/dev/sda1"; ""; ""; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; ""; ""; ""; "NOARG";
> > +            "NOARG"; "NOARG"; "NOARG"; "ext4"; "NOARG";
> > +            "NOARG"; ""; ""; ""; "";
> > +            ""; ""; ""; ""; "";
> > +            ""; "false"; ""; ""; "";
> > +            ""; ""; ""];
> > +      ])
> > +    ];
> > +    shortdesc = "create an ext2/ext3/ext4 filesystem on device";
> > +    longdesc = "\
> > +C<mke2fs> is used to create an ext2, ext3, or ext4 filesystem,
> > +usually in a disk partition. C<device> is the special file corresponding
> > +to the device (e.g /dev/sdXX). C<blockscount> is the number of blocks
> > +on C<device>. If omitted, C<mke2fs> automagically figures the file system
> > +size." };
> > +
> >  ]
> >  
> >  (* Non-API meta-commands available only in guestfish.
> > diff --git a/gobject/Makefile.inc b/gobject/Makefile.inc
> > index e0d00d5..c4532c9 100644
> > --- a/gobject/Makefile.inc
> > +++ b/gobject/Makefile.inc
> > @@ -80,7 +80,8 @@ guestfs_gobject_headers= \
> >    include/guestfs-gobject/optargs-rsync_out.h \
> >    include/guestfs-gobject/optargs-xfs_admin.h \
> >    include/guestfs-gobject/optargs-hivex_open.h \
> > -  include/guestfs-gobject/optargs-xfs_repair.h
> > +  include/guestfs-gobject/optargs-xfs_repair.h \
> > +  include/guestfs-gobject/optargs-mke2fs.h
> >  
> >  guestfs_gobject_sources= \
> >    src/session.c \
> > @@ -142,4 +143,5 @@ guestfs_gobject_sources= \
> >    src/optargs-rsync_out.c \
> >    src/optargs-xfs_admin.c \
> >    src/optargs-hivex_open.c \
> > -  src/optargs-xfs_repair.c
> > +  src/optargs-xfs_repair.c \
> > +  src/optargs-mke2fs.c
> > diff --git a/guestfs-release-notes.txt b/guestfs-release-notes.txt
> > index e4ddefd..4f3860d 100644
> > --- a/guestfs-release-notes.txt
> > +++ b/guestfs-release-notes.txt
> > @@ -120,6 +120,7 @@ RELEASE NOTES FOR LIBGUESTFS 1.20
> >  
> >      For further information, see
> >      https://bugzilla.redhat.com/show_bug.cgi?id=788642
> > +    <https://bugzilla.redhat.com/show_bug.cgi?id=788642>
> >  
> >   New APIs
> >  
> > @@ -1659,10 +1660,14 @@ BUGS
> >      To get a list of bugs against libguestfs, use this link:
> >      https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=Vi
> >      rtualization+Tools
> > +    <https://bugzilla.redhat.com/buglist.cgi?component=libguestfs&product=V
> > +    irtualization+Tools>
> >  
> >      To report a new bug against libguestfs, use this link:
> >      https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=
> >      Virtualization+Tools
> > +    <https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product
> > +    =Virtualization+Tools>
> >  
> >      When reporting a bug, please supply:
> >  
> > diff --git a/po/POTFILES b/po/POTFILES
> > index 129c80f..548156c 100644
> > --- a/po/POTFILES
> > +++ b/po/POTFILES
> > @@ -155,6 +155,7 @@ gobject/src/optargs-internal_test.c
> >  gobject/src/optargs-internal_test_63_optargs.c
> >  gobject/src/optargs-internal_test_only_optargs.c
> >  gobject/src/optargs-md_create.c
> > +gobject/src/optargs-mke2fs.c
> >  gobject/src/optargs-mkfs.c
> >  gobject/src/optargs-mkfs_btrfs.c
> >  gobject/src/optargs-mkswap.c
> > diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
> > index 4203007..526204c 100644
> > --- a/src/MAX_PROC_NR
> > +++ b/src/MAX_PROC_NR
> > @@ -1 +1 @@
> > -366
> > +367
> > 

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list