Displaying 20 results from an estimated 36 matches for "print_partition_table".
2017 Mar 02
2
[PATCH] parted: add more udev_settle calls.
add udev_settle calls to print_partition_table and
sgdisk_info_extract_field because the inspect-os calls
guestfs_part_get_parttype and guestfs_part_get_gpt_guid for all
parition devices found and this causes intermittent with opening block
devices that are certainly present yet RESOLVE_DEVICE macro would fail
wiht ENOENT.
---
daemon/parted.c...
2015 Mar 24
1
[PATCH 1/2] parted: introduce enum for whether parted has option -m
...t >= 0)
return result;
@@ -334,9 +340,9 @@ test_parted_m_opt (void)
}
if (err && strstr (err, "invalid option -- m"))
- result = 0;
+ result = PARTED_OPT_NO_M;
else
- result = 1;
+ result = PARTED_OPT_HAS_M;
return result;
}
@@ -347,7 +353,7 @@ print_partition_table (const char *device, int parted_has_m_opt)
CLEANUP_FREE char *err = NULL;
int r;
- if (parted_has_m_opt)
+ if (PARTED_OPT_HAS_M == parted_has_m_opt)
r = command (&out, &err, str_parted, "-m", "--", device,
"unit", "b",...
2015 Oct 05
2
[PATCH] Remove multiple hacks that only apply to RHEL 5.
...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 to parse the output in
- * print_partition_table below. Test for this option the first time
- * this function is called.
- */
-static enum parted_has_m_opt
-test_parted_m_opt (void)
-{
- static enum parted_has_m_opt result = PARTED_INVALID;
-
- if (result >= 0)
- return result;
-
- CLEANUP_FREE char *err = NULL;
- int r = commandr (NUL...
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] New API: part_get_part_type for showing partition type
...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 inst...
2015 Mar 24
2
Re: [PATCH] New API: part_get_part_type for showing partition type
...t; @@ -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.
>
> > /* Notes:
> > *
> > * Parted 1.9 sends error messages to stdout, hence use of the
> > @@ -1022,3 +1026,111 @@ do_par...
2015 Jun 17
2
[PATCH] daemon: parted: Always use -s option even with -m.
See: https://bugzilla.redhat.com/show_bug.cgi?id=1232241#c3
---
daemon/parted.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon/parted.c b/daemon/parted.c
index a36e4e7..59760b4 100644
--- a/daemon/parted.c
+++ b/daemon/parted.c
@@ -356,7 +356,7 @@ print_partition_table (const char *device,
int r;
if (PARTED_OPT_HAS_M == parted_has_m_opt)
- r = command (&out, &err, str_parted, "-m", "--", device,
+ r = command (&out, &err, str_parted, "-m", "-s", "--", device,
"u...
2017 Jul 14
0
[PATCH 20/27] daemon: Reimplement ‘part_list’ API in OCaml.
...ff --git a/daemon/parted.c b/daemon/parted.c
index a1e5c81cf..125aec60b 100644
--- a/daemon/parted.c
+++ b/daemon/parted.c
@@ -387,62 +387,6 @@ do_part_get_parttype (const char *device)
return r;
}
-guestfs_int_partition_list *
-do_part_list (const char *device)
-{
- CLEANUP_FREE char *out = print_partition_table (device, true);
- if (!out)
- return NULL;
-
- CLEANUP_FREE_STRING_LIST char **lines = split_lines (out);
-
- if (!lines)
- return NULL;
-
- guestfs_int_partition_list *r;
-
- /* lines[0] is "BYT;", lines[1] is the device line which we ignore,
- * lines[2..] are the partition...
2015 Mar 24
1
Re: [PATCH 1/2] parted: introduce enum for whether parted has option -m
...* 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_NORMAL)
> are enough.
>
>
> > +
> > /* Notes:
> > *
> > * Parted 1.9 sends error messages to stdout, hence use of the
> > @@ -320,7 +326,7 @@ get_table_field (const char *line,...
2015 Mar 17
4
[PATCH] New API: part_get_part_type for showing partition type
...if (part_type == NULL) {
+ reply_with_error ("strdup failed");
+ return NULL;
+ }
+ return part_type;
+ }
+
+ /* machine parseable output by 'parted -m' did not provide
+ * partition type info.
+ * Use traditional style.
+ */
+ CLEANUP_FREE char *out = print_partition_table (device, PARTED_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")) {
+ s...
2015 Mar 13
2
[PATCH] part-list: add support for show partition type
...rror messages to stdout, hence use of the
@@ -451,11 +455,7 @@ do_part_get_parttype (const char *device)
guestfs_int_partition_list *
do_part_list (const char *device)
{
- int parted_has_m_opt = test_parted_m_opt ();
- if (parted_has_m_opt == -1)
- return NULL;
-
- CLEANUP_FREE char *out = print_partition_table (device, parted_has_m_opt);
+ CLEANUP_FREE char *out = print_partition_table (device, PARTED_NO_M);
if (!out)
return NULL;
@@ -466,88 +466,86 @@ do_part_list (const char *device)
guestfs_int_partition_list *r;
- if (parted_has_m_opt) {
- /* New-style parsing using the "ma...
2015 Jun 18
3
[PATCH v2 0/3] daemon: parted: Always use -s option even with -m.
version 2:
- Turn the "unrecognised disk label" error into errno == EINVAL
- Fix virt-alignment-scan
- Rework the fix for virt-v2v bug 1232192 (see description of patch 3/3)
2015 Mar 13
0
Re: [PATCH] part-list: add support for show partition type
...; @@ -451,11 +455,7 @@ do_part_get_parttype (const char *device)
> guestfs_int_partition_list *
> do_part_list (const char *device)
> {
> - int parted_has_m_opt = test_parted_m_opt ();
> - if (parted_has_m_opt == -1)
> - return NULL;
> -
> - CLEANUP_FREE char *out = print_partition_table (device, parted_has_m_opt);
> + CLEANUP_FREE char *out = print_partition_table (device, PARTED_NO_M);
> if (!out)
> return NULL;
>
> @@ -466,88 +466,86 @@ do_part_list (const char *device)
>
> guestfs_int_partition_list *r;
>
> - if (parted_has_m_opt) {...
2015 Jun 17
0
Re: [PATCH] daemon: parted: Always use -s option even with -m.
...redhat.com/show_bug.cgi?id=1232241#c3
> ---
> daemon/parted.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/daemon/parted.c b/daemon/parted.c
> index a36e4e7..59760b4 100644
> --- a/daemon/parted.c
> +++ b/daemon/parted.c
> @@ -356,7 +356,7 @@ print_partition_table (const char *device,
> int r;
>
> if (PARTED_OPT_HAS_M == parted_has_m_opt)
> - r = command (&out, &err, str_parted, "-m", "--", device,
> + r = command (&out, &err, str_parted, "-m", "-s", "--", device,...
2015 Mar 24
0
Re: [PATCH] New API: part_get_part_type for showing partition type
...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
2015 Mar 24
0
Re: [PATCH 1/2] parted: introduce enum for whether parted has option -m
...; + 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_NORMAL)
are enough.
> +
> /* 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_o...
2015 Mar 23
0
Re: [PATCH] New API: part_get_part_type for showing partition type
...or ("strdup failed");
> + return NULL;
> + }
> + return part_type;
> + }
> +
> + /* machine parseable output by 'parted -m' did not provide
> + * partition type info.
> + * Use traditional style.
> + */
> + CLEANUP_FREE char *out = print_partition_table (device, PARTED_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)
> +...
2015 Mar 24
1
[PATCH 2/2] New API: part_get_part_type for showing partition type
...EANUP_FREE char *parttype;
+ char *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")) {
+...
2018 Jan 28
0
[PATCH v3 1/3] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.
...EANUP_FREE char *parttype;
- char *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, false);
- 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 =...
2018 Jan 28
9
guestfs_list_filesystems: skip block devices which cannot hold file system
Initial discussion is here: https://www.redhat.com/archives/libguestfs/2018-January/msg00188.html.
v2 was posted here: https://www.redhat.com/archives/libguestfs/2018-January/msg00246.html.
v3 comparing to v2 is just a rebase with slightly changed commits comments.