On Tue, Mar 24, 2015 at 09:19:06AM +0000, Chen, Hanxiao wrote: > > > > -----Original Message----- > > From: [email protected] [mailto:[email protected]] > > On > > Behalf Of Pino Toscano > > Sent: Tuesday, March 24, 2015 4:44 PM > > To: [email protected] > > Subject: Re: [Libguestfs] [PATCH] New API: part_get_part_type for showing > > partition > > type > > > > On Tuesday 24 March 2015 05:25:51 Chen, Hanxiao wrote: > > > > > > > -----Original Message----- > > > > From: Richard W.M. Jones [mailto:[email protected]] > > > > Sent: Monday, March 23, 2015 9:29 PM > > > > To: Chen, Hanxiao/陈 晗霄 > > > > Cc: [email protected] > > > > Subject: Re: [Libguestfs] [PATCH] New API: part_get_part_type for > > > > showing > > partition > > > > type > > > > > > > > On Tue, Mar 17, 2015 at 02:45:46AM -0400, Chen Hanxiao wrote: > > > > > This patch will add support for getting partition type > > > > > of a partiton numbered device. > > > > > > > > > > Signed-off-by: Chen Hanxiao <[email protected]> > > > > > --- > > > > > daemon/parted.c | 112 > > > > +++++++++++++++++++++++++++++++++++++++++++++++++++ > > > > > generator/actions.ml | 18 +++++++++ > > > > > src/MAX_PROC_NR | 2 +- > > > > > 3 files changed, 131 insertions(+), 1 deletion(-) > > > > > > > > > > diff --git a/daemon/parted.c b/daemon/parted.c > > > > > index a7bcb99..0ae6e5c 100644 > > > > > --- a/daemon/parted.c > > > > > +++ b/daemon/parted.c > > > > > @@ -33,6 +33,10 @@ GUESTFSD_EXT_CMD(str_parted, parted); > > > > > GUESTFSD_EXT_CMD(str_sfdisk, sfdisk); > > > > > GUESTFSD_EXT_CMD(str_sgdisk, sgdisk); > > > > > > > > > > +#ifndef PARTED_NO_M > > > > > +# define PARTED_NO_M 0 > > > > > +#endif > > > > > > > > What does this bit do? > > > > > > I want to use print_partition_table(xxx, 0) > > > but do not want to pass a raw '0'. > > > Maybe the name is not so clear. > > > I'll rename it to PARTED_NOT_USE_M in the next version. > > > > Improving the readability of a raw integer is a good thing; however, > > I'd suggest switching to an enum instead. > > > > Hi, > > How about: > enum { > PARTED_INVALID = -1, > /* parted do not support -m option */ > PARTED_OPT_NO_M, > PARTED_OPT_M}; > > print_partition_table(xxx, PARTED_OPT_NO_M)
Seems good to me. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
