{
struct fdisk_parttype *t;
char str[37];
+ struct gpt_guid guid = e->type;
- guid_to_string(&e->type, str);
+ guid_to_string(&guid, str);
t = fdisk_label_get_parttype_from_string(cxt->label, str);
return t ? : fdisk_new_unknown_parttype(0, str);
}
static void gpt_entry_set_type(struct gpt_entry *e, struct gpt_guid *uuid)
{
e->type = *uuid;
- DBG(LABEL, gpt_debug_uuid("new type", &(e->type)));
+ DBG(LABEL, gpt_debug_uuid("new type", uuid));
}
static void gpt_entry_set_name(struct gpt_entry *e, char *str)
static char *gpt_get_header_id(struct gpt_header *header)
{
char str[37];
+ struct gpt_guid guid = header->disk_guid;
- guid_to_string(&header->disk_guid, str);
+ guid_to_string(&guid, str);
return strdup(str);
}
if (cxt->script) {
const char *id = fdisk_script_get_header(cxt->script, "label-id");
- if (id && string_to_guid(id, &header->disk_guid) == 0)
+ struct gpt_guid guid = header->disk_guid;
+ if (id && string_to_guid(id, &guid) == 0)
has_id = 1;
+ header->disk_guid = guid;
}
if (!has_id) {
+ struct gpt_guid guid;
+
uuid_generate_random((unsigned char *) &header->disk_guid);
- swap_efi_guid(&header->disk_guid);
+ guid = header->disk_guid;
+ swap_efi_guid(&guid);
}
return 0;
}
struct gpt_entry *e;
char u_str[37];
int rc = 0;
+ struct gpt_guid guid;
assert(cxt);
assert(cxt->label);
pa->size = gpt_partition_size(e);
pa->type = gpt_partition_parttype(cxt, e);
- if (guid_to_string(&e->partition_guid, u_str)) {
+ guid = e->partition_guid;
+ if (guid_to_string(&guid, u_str)) {
pa->uuid = strdup(u_str);
if (!pa->uuid) {
rc = -errno;
if (pa->uuid) {
char new_u[37], old_u[37];
+ struct gpt_guid guid;
- guid_to_string(&e->partition_guid, old_u);
+ guid = e->partition_guid;
+ guid_to_string(&guid, old_u);
rc = gpt_entry_set_uuid(e, pa->uuid);
if (rc)
return rc;
- guid_to_string(&e->partition_guid, new_u);
+ guid = e->partition_guid;
+ guid_to_string(&guid, new_u);
fdisk_info(cxt, _("Partition UUID changed from %s to %s."),
old_u, new_u);
}
* generated for that partition, and every partition is guaranteed
* to have a unique GUID.
*/
+ struct gpt_guid guid;
+
uuid_generate_random((unsigned char *) &e->partition_guid);
- swap_efi_guid(&e->partition_guid);
+ guid = e->partition_guid;
+ swap_efi_guid(&guid);
}
if (pa && pa->name && *pa->name)
size_t esz = 0;
char str[37];
struct fdisk_gpt_label *gpt;
+ struct gpt_guid guid;
assert(cxt);
assert(cxt->label);
cxt->label->nparts_max = gpt_get_nentries(gpt);
cxt->label->nparts_cur = 0;
- guid_to_string(&gpt->pheader->disk_guid, str);
+ guid = gpt->pheader->disk_guid;
+ guid_to_string(&guid, str);
fdisk_label_set_changed(cxt->label, 1);
fdisk_info(cxt, _("Created a new GPT disklabel (GUID: %s)."), str);
done: