search for: str_sgdisk

Displaying 20 results from an estimated 32 matches for "str_sgdisk".

2015 Dec 01
3
[PATCHv2] New API: part_expand_gpt.
...{ + CLEANUP_FREE char *err = NULL; + + /* If something is broken, sgdisk may try to correct it. + * (e.g. recreate partition table and so on). + * We do not want such behavior, so dry-run at first.*/ + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, "--pretend", "-e", device, NULL); + + if (r == -1) { + reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err); + return -1; + } + if (err && strlen(err) != 0) { + /* Unexpected actions. */ + reply_with_error ("%s --pretend -e...
2016 Jan 18
1
[PATCH] New API: part_get_disk_guid and part_set_disk_guid.
...dup failed"); return NULL; } + +char * +do_part_get_disk_guid (const char *device) +{ + const char *pattern = "Disk identifier (GUID):"; + size_t i; + + CLEANUP_FREE char *err = NULL; + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, device, "-p", NULL); + if (r == -1) { + reply_with_error ("%s %s -p: %s", str_sgdisk, device, err); + return NULL; + } + + CLEANUP_FREE_STRING_LIST char **lines = split_lines (err); + if (lines == NULL) { + reply_with_error ("'%s %s -p' returned no out...
2012 Dec 14
1
[PATCH] Add support for getting and setting GPT partition type GUIDs
...dosfstools file findutils gawk +gdisk grep gzip jfsutils diff --git a/daemon/parted.c b/daemon/parted.c index cc9a84b..01ae91c 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -30,6 +30,7 @@ GUESTFSD_EXT_CMD(str_parted, parted); GUESTFSD_EXT_CMD(str_sfdisk, sfdisk); +GUESTFSD_EXT_CMD(str_sgdisk, sgdisk); /* Notes: * @@ -802,3 +803,131 @@ do_part_set_mbr_id (const char *device, int partnum, int idbyte) return 0; } + +int +do_part_set_gpt_type(const char *device, int partnum, const char *guid) +{ + if (partnum <= 0) { + reply_with_error ("partition number must be >...
2016 Jan 19
0
[PATCHv2 1/3] New API: part_get_disk_guid and part_set_disk_guid.
...dup failed"); return NULL; } + +char * +do_part_get_disk_guid (const char *device) +{ + const char *pattern = "Disk identifier (GUID):"; + size_t i; + + CLEANUP_FREE char *err = NULL; + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, device, "-p", NULL); + if (r == -1) { + reply_with_error ("%s %s -p: %s", str_sgdisk, device, err); + return NULL; + } + + CLEANUP_FREE_STRING_LIST char **lines = split_lines (err); + if (lines == NULL) { + reply_with_error ("'%s %s -p' returned no out...
2015 Nov 25
1
[PATCH] New API: part_expand_gpt.
...{ + CLEANUP_FREE char *err = NULL; + + /* If something is broken, sgdisk may try to correct it. + * (e.g. recreate partition table and so on). + * We do not want such behavior, so dry-run at first.*/ + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, "--pretend", "-e", device, NULL); + + if (r == -1) { + reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err); + return -1; + } + if (err && strlen(err) != 0) { + /* Unexpected actions. */ + reply_with_error ("%s --pretend -e...
2016 Jan 19
4
[PATCHv2 0/3] Get/set disk GPT GUID API and support in virt-resize.
Some OSes (e.g. Windows Server 2012 R2) fail to boot after virt-resize due to changed disk guid. To fix it, we add new APIs: part_get_disk_guid part_set_disk_guid part_set_disk_guid_random We also preserve disk GUID in virt-resize. Maxim Perevedentsev (3): New API: part_get_disk_guid and part_set_disk_guid. New API: part_set_disk_guid_random. resize: preserve GPT disk GUID.
2015 Dec 22
0
Re: [PATCHv2] New API: part_expand_gpt.
...NULL; > + > + /* If something is broken, sgdisk may try to correct it. > + * (e.g. recreate partition table and so on). > + * We do not want such behavior, so dry-run at first.*/ > + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, > + str_sgdisk, "--pretend", "-e", device, NULL); > + > + if (r == -1) { > + reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err); > + return -1; > + } > + if (err && strlen(err) != 0) { > + /* Unexpected actions. */ > +...
2016 Jan 20
1
[PATCHv2] New API: part_expand_gpt.
...{ + CLEANUP_FREE char *err = NULL; + + /* If something is broken, sgdisk may try to correct it. + * (e.g. recreate partition table and so on). + * We do not want such behavior, so dry-run at first.*/ + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, "--pretend", "-e", device, NULL); + + if (r == -1) { + reply_with_error ("%s --pretend -e %s: %s", str_sgdisk, device, err); + return -1; + } + if (err && strlen(err) != 0) { + /* Unexpected actions. */ + reply_with_error ("%s --pretend -e...
2017 Mar 02
2
[PATCH] parted: add more udev_settle calls.
...{ int errcode = 0; @@ -665,6 +670,8 @@ sgdisk_info_extract_field (const char *device, int partnum, const char *field, return NULL; } + udev_settle (); + CLEANUP_FREE char *err = NULL; int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, str_sgdisk, device, "-i", partnum_str, NULL); @@ -674,6 +681,8 @@ sgdisk_info_extract_field (const char *device, int partnum, const char *field, return NULL; } + udev_settle (); + CLEANUP_FREE_STRING_LIST char **lines = split_lines (err); if (lines == NULL) { reply_with_error (...
2017 Jul 27
0
[PATCH v2] daemon: Remove GUESTFSD_EXT_CMD.
...it a/daemon/parted.c b/daemon/parted.c index 03e83cb32..7446bc93e 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -30,10 +30,6 @@ #include "actions.h" #include "optgroups.h" -GUESTFSD_EXT_CMD(str_parted, parted); -GUESTFSD_EXT_CMD(str_sfdisk, sfdisk); -GUESTFSD_EXT_CMD(str_sgdisk, sgdisk); - /* Notes: * * Parted 1.9 sends error messages to stdout, hence use of the @@ -88,7 +84,7 @@ do_part_init (const char *device, const char *parttype) udev_settle (); r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, - str_parted, "-s",...
2016 Jan 19
0
[PATCHv2 2/3] New API: part_set_disk_guid_random.
...on/parted.c @@ -988,3 +988,18 @@ do_part_set_disk_guid (const char *device, const char *guid) return 0; } + +int +do_part_set_disk_guid_random (const char *device) +{ + CLEANUP_FREE char *err = NULL; + int r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, + str_sgdisk, device, "-U", "R", NULL); + + if (r == -1) { + reply_with_error ("%s %s -U R: %s", str_sgdisk, device, err); + return -1; + } + + return 0; +} diff --git a/generator/actions.ml b/generator/actions.ml index 62c4839..d345175 100644 --- a/generator/actions.ml ++...
2017 Jul 24
0
[PATCH 2/2] daemon: Replace GUESTFSD_EXT_CMD with --print-external-commands.
...git a/daemon/parted.c b/daemon/parted.c index 03e83cb32..f93d710c5 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -30,9 +30,7 @@ #include "actions.h" #include "optgroups.h" -GUESTFSD_EXT_CMD(str_parted, parted); -GUESTFSD_EXT_CMD(str_sfdisk, sfdisk); -GUESTFSD_EXT_CMD(str_sgdisk, sgdisk); +DECLARE_EXTERNAL_COMMANDS ("parted", "sfdisk", "sgdisk") /* Notes: * @@ -88,7 +86,7 @@ do_part_init (const char *device, const char *parttype) udev_settle (); r = commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR, - str...
2015 Mar 24
2
Re: [PATCH] New API: part_get_part_type for showing partition type
...> 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...
2015 Mar 24
1
Re: [PATCH] New API: part_get_part_type for showing partition type
...; > > 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...
2015 Mar 24
1
Re: [PATCH 1/2] parted: introduce enum for whether parted has option -m
...> diff --git a/daemon/parted.c b/daemon/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}; > > (I didn't have even the time to reply to the question about this enum) > > PARTED_INVALID...
2015 Mar 24
1
[PATCH 1/2] parted: introduce enum for whether parted has option -m
...------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/daemon/parted.c b/daemon/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_op...
2015 Mar 17
4
[PATCH] New API: part_get_part_type for showing partition type
...| 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 + /* Notes: * * Parted 1.9 sends error messages to stdout, hence use of the @@ -1022,3 +1026,111 @@ do_part_get_name (const char *device, int partnum) reply_with_error ("cannot get the partition name from '%s' lay...
2015 Feb 05
5
resize: Preserve GPT GUID so we don't break EFI bootloaders (RHBZ#1189284)
virt-resize didn't preserve the per-partition GPT GUID. Now that guests using UEFI are becoming common (basically it's the default on aarch64) we need to take into account that sometimes the partition GUID is used by the bootloader NVRAM variables to identify the boot partition, so it must be preserved across resize. This bug caused the 'virt-builder --size' option to fail on
2017 Jul 27
3
[PATCH v2] daemon: Remove GUESTFSD_EXT_CMD.
This is a simpler patch that removes GUESTFSD_EXT_CMD completely.
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