Displaying 8 results from an estimated 8 matches for "parted_opt_no_m".
2015 Mar 24
1
Re: [PATCH] New API: part_get_part_type for showing partition type
...ar.
> > 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
2015 Mar 24
1
[PATCH 1/2] parted: introduce enum for whether parted has option -m
...mon/parted.c
index a7bcb99..64a7d3c 100644
--- a/daemon/parted.c
+++ b/daemon/parted.c
@@ -33,6 +33,12 @@ GUESTFSD_EXT_CMD(str_parted, parted);
GUESTFSD_EXT_CMD(str_sfdisk, sfdisk);
GUESTFSD_EXT_CMD(str_sgdisk, sgdisk);
+enum {
+ PARTED_INVALID = -1,
+ /* parted do not support -m option */
+ PARTED_OPT_NO_M,
+ PARTED_OPT_HAS_M};
+
/* Notes:
*
* Parted 1.9 sends error messages to stdout, hence use of the
@@ -320,7 +326,7 @@ get_table_field (const char *line, int n)
static int
test_parted_m_opt (void)
{
- static int result = -1;
+ static int result = PARTED_INVALID;
if (result >= 0)...
2015 Mar 24
4
[PATCH 0/2] New API: part_get_part_type
Chen Hanxiao (2):
parted: introduce enum for whether parted has option -m
New API: part_get_part_type for showing partition type
daemon/parted.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++-----
generator/actions.ml | 18 +++++++
src/MAX_PROC_NR | 2 +-
3 files changed, 143 insertions(+), 13 deletions(-)
--
2.1.0
2015 Mar 24
1
Re: [PATCH 1/2] parted: introduce enum for whether parted has option -m
...rted.c
> > @@ -33,6 +33,12 @@ GUESTFSD_EXT_CMD(str_parted, parted);
> > GUESTFSD_EXT_CMD(str_sfdisk, sfdisk);
> > GUESTFSD_EXT_CMD(str_sgdisk, sgdisk);
> >
> > +enum {
> > + PARTED_INVALID = -1,
> > + /* parted do not support -m option */
> > + PARTED_OPT_NO_M,
> > + PARTED_OPT_HAS_M};
>
> (I didn't have even the time to reply to the question about this enum)
>
> PARTED_INVALID does not make much sense, especially that I was
> referring just to the parameter for print_partition_table, so for it
> only two values (eg PARTED_...
2015 Mar 24
2
Re: [PATCH] New API: part_get_part_type for showing partition type
> -----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
2015 Mar 24
0
Re: [PATCH 1/2] parted: introduce enum for whether parted has option -m
...- a/daemon/parted.c
> +++ b/daemon/parted.c
> @@ -33,6 +33,12 @@ GUESTFSD_EXT_CMD(str_parted, parted);
> GUESTFSD_EXT_CMD(str_sfdisk, sfdisk);
> GUESTFSD_EXT_CMD(str_sgdisk, sgdisk);
>
> +enum {
> + PARTED_INVALID = -1,
> + /* parted do not support -m option */
> + PARTED_OPT_NO_M,
> + PARTED_OPT_HAS_M};
(I didn't have even the time to reply to the question about this enum)
PARTED_INVALID does not make much sense, especially that I was
referring just to the parameter for print_partition_table, so for it
only two values (eg PARTED_OUTPUT_MACHINE and PARTED_OUTPUT_NO...
2015 Oct 05
2
[PATCH] Remove multiple hacks that only apply to RHEL 5.
...;stdint.h>
#include <inttypes.h>
#include <string.h>
@@ -33,13 +34,6 @@ GUESTFSD_EXT_CMD(str_parted, parted);
GUESTFSD_EXT_CMD(str_sfdisk, sfdisk);
GUESTFSD_EXT_CMD(str_sgdisk, sgdisk);
-enum parted_has_m_opt {
- PARTED_INVALID = -1,
- /* parted do not support -m option */
- PARTED_OPT_NO_M = 0,
- PARTED_OPT_HAS_M = 1,
-};
-
/* Notes:
*
* Parted 1.9 sends error messages to stdout, hence use of the
@@ -319,43 +313,14 @@ get_table_field (const char *line, int n)
return q;
}
-/* RHEL 5 parted doesn't have the -m (machine readable) option so we
- * must do a lot more work...
2015 Mar 24
1
[PATCH 2/2] New API: part_get_part_type for showing partition type
...har *part_type;
+
+ parttype = do_part_get_parttype (device);
+ if (parttype == NULL)
+ return NULL;
+
+ /* machine parseable output by 'parted -m' did not provide
+ * partition type info.
+ * Use traditional style.
+ */
+ CLEANUP_FREE char *out = print_partition_table (device, PARTED_OPT_NO_M);
+ if (!out)
+ return NULL;
+
+ CLEANUP_FREE_STRING_LIST char **lines = split_lines (out);
+
+ if (!lines)
+ return NULL;
+
+ size_t start = 0, end = 0, row;
+
+ for (row = 0; lines[row] != NULL; ++row)
+ if (STRPREFIX (lines[row], "Number")) {
+ start = row + 1;
+...