-----Original Message----- From: libguestfs-bounces@redhat.com [mailto:libguestfs-bounces@redhat.com] On Behalf Of Pino Toscano Sent: Tuesday, March 24, 2015 4:44 PM To: libguestfs@redhat.com 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:rjones@redhat.com] Sent: Monday, March 23, 2015 9:29 PM To: Chen, Hanxiao/陈 晗霄 Cc: libguestfs@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@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.
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) Regards, - Chen