[Libguestfs] [PATCH] New API: part_get_part_type for showing partition type

Pino Toscano ptoscano at redhat.com
Tue Mar 24 08:44:08 UTC 2015


On Tuesday 24 March 2015 05:25:51 Chen, Hanxiao wrote:
> 
> > -----Original Message-----
> > From: Richard W.M. Jones [mailto:rjones at redhat.com]
> > Sent: Monday, March 23, 2015 9:29 PM
> > To: Chen, Hanxiao/陈 晗霄
> > Cc: libguestfs at redhat.com
> > 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 <chenhanxiao at cn.fujitsu.com>
> > > ---
> > >  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.

-- 
Pino Toscano




More information about the Libguestfs mailing list