Accepting request 1143286 from Base:System
OBS-URL: https://build.opensuse.org/request/show/1143286 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/parted?expand=0&rev=141
This commit is contained in:
commit
4ce797dfa2
@ -1,557 +0,0 @@
|
||||
From 1d798715b5998cd4afd184beb88ebdbe1a2642e8 Mon Sep 17 00:00:00 2001
|
||||
From: Arvin Schnell <aschnell@suse.de>
|
||||
Date: Thu, 14 Oct 2021 16:29:06 +0200
|
||||
Subject: [PATCH] allow direct handling of partition type id and uuid
|
||||
|
||||
---
|
||||
include/parted/disk.in.h | 23 +++++-
|
||||
libparted/disk.c | 86 ++++++++++++++++++++++
|
||||
libparted/labels/dasd.c | 4 ++
|
||||
libparted/labels/dos.c | 30 +++++++-
|
||||
libparted/labels/gpt.c | 40 ++++++++++-
|
||||
parted/parted.c | 146 +++++++++++++++++++++++++++++++++++++-
|
||||
tests/t0800-json-gpt.sh | 2 +
|
||||
tests/t0801-json-msdos.sh | 5 +-
|
||||
8 files changed, 329 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
|
||||
index 303f59c..d7fde12 100644
|
||||
--- a/include/parted/disk.in.h
|
||||
+++ b/include/parted/disk.in.h
|
||||
@@ -32,6 +32,7 @@
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
+#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Disk flags
|
||||
@@ -91,9 +92,11 @@ enum _PedPartitionFlag {
|
||||
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
|
||||
PED_DISK_TYPE_PARTITION_NAME=2, /**< supports partition names */
|
||||
- PED_DISK_TYPE_SYSTEM_NAME=4 /**< supports system names */
|
||||
+ PED_DISK_TYPE_SYSTEM_NAME=4, /**< supports system names */
|
||||
+ PED_DISK_TYPE_PARTITION_TYPE_ID=8, /**< supports partition type-ids */
|
||||
+ PED_DISK_TYPE_PARTITION_TYPE_UUID=16, /**< supports partition type-uuids */
|
||||
};
|
||||
#define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED
|
||||
-#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_SYSTEM_NAME
|
||||
+#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_TYPE_UUID
|
||||
|
||||
struct _PedDisk;
|
||||
struct _PedPartition;
|
||||
@@ -247,6 +250,13 @@ struct _PedDiskOps {
|
||||
PedPartitionFlag flag);
|
||||
void (*partition_set_name) (PedPartition* part, const char* name);
|
||||
const char* (*partition_get_name) (const PedPartition* part);
|
||||
+
|
||||
+ int (*partition_set_type_id) (PedPartition* part, uint8_t id);
|
||||
+ uint8_t (*partition_get_type_id) (const PedPartition* part);
|
||||
+
|
||||
+ int (*partition_set_type_uuid) (PedPartition* part, const uint8_t* uuid);
|
||||
+ uint8_t* (*partition_get_type_uuid) (const PedPartition* part);
|
||||
+
|
||||
int (*partition_align) (PedPartition* part,
|
||||
const PedConstraint* constraint);
|
||||
int (*partition_enumerate) (PedPartition* part);
|
||||
@@ -347,6 +357,10 @@ extern int ped_partition_set_system (PedPartition* part,
|
||||
extern int ped_partition_set_system_name (PedPartition* part, const char* name);
|
||||
extern const char* ped_partition_get_name (const PedPartition* part);
|
||||
extern const char* ped_partition_get_system_name (const PedPartition* part);
|
||||
+extern int ped_partition_set_type_id (PedPartition* part, uint8_t id);
|
||||
+extern uint8_t ped_partition_get_type_id (const PedPartition* part);
|
||||
+extern int ped_partition_set_type_uuid (PedPartition* part, const uint8_t* uuid);
|
||||
+extern uint8_t* ped_partition_get_type_uuid (const PedPartition* part);
|
||||
extern int ped_partition_is_busy (const PedPartition* part);
|
||||
extern char* ped_partition_get_path (const PedPartition* part);
|
||||
|
||||
diff --git a/libparted/disk.c b/libparted/disk.c
|
||||
index 8496fc0..80f3154 100644
|
||||
--- a/libparted/disk.c
|
||||
+++ b/libparted/disk.c
|
||||
@@ -1458,6 +1458,36 @@ _assert_partition_name_feature (const PedDiskType* disk_type)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+static int
|
||||
+_assert_partition_type_id_feature (const PedDiskType* disk_type)
|
||||
+{
|
||||
+ if (!ped_disk_type_check_feature (
|
||||
+ disk_type, PED_DISK_TYPE_PARTITION_TYPE_ID)) {
|
||||
+ ped_exception_throw (
|
||||
+ PED_EXCEPTION_ERROR,
|
||||
+ PED_EXCEPTION_CANCEL,
|
||||
+ "%s disk labels do not support partition type-ids.",
|
||||
+ disk_type->name);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+_assert_partition_type_uuid_feature (const PedDiskType* disk_type)
|
||||
+{
|
||||
+ if (!ped_disk_type_check_feature (
|
||||
+ disk_type, PED_DISK_TYPE_PARTITION_TYPE_UUID)) {
|
||||
+ ped_exception_throw (
|
||||
+ PED_EXCEPTION_ERROR,
|
||||
+ PED_EXCEPTION_CANCEL,
|
||||
+ "%s disk labels do not support partition type-uuids.",
|
||||
+ disk_type->name);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Sets the name of a partition.
|
||||
*
|
||||
@@ -1510,6 +1540,62 @@ ped_partition_get_name (const PedPartition* part)
|
||||
return part->disk->type->ops->partition_get_name (part);
|
||||
}
|
||||
|
||||
+int
|
||||
+ped_partition_set_type_id (PedPartition *part, uint8_t id)
|
||||
+{
|
||||
+ PED_ASSERT (part != NULL);
|
||||
+ PED_ASSERT (part->disk != NULL);
|
||||
+ PED_ASSERT (ped_partition_is_active (part));
|
||||
+
|
||||
+ if (!_assert_partition_type_id_feature (part->disk->type))
|
||||
+ return 0;
|
||||
+
|
||||
+ PED_ASSERT (part->disk->type->ops->partition_set_type_id != NULL);
|
||||
+ return part->disk->type->ops->partition_set_type_id (part, id);
|
||||
+}
|
||||
+
|
||||
+uint8_t
|
||||
+ped_partition_get_type_id (const PedPartition *part)
|
||||
+{
|
||||
+ PED_ASSERT (part != NULL);
|
||||
+ PED_ASSERT (part->disk != NULL);
|
||||
+ PED_ASSERT (ped_partition_is_active (part));
|
||||
+
|
||||
+ if (!_assert_partition_type_id_feature (part->disk->type))
|
||||
+ return 0;
|
||||
+
|
||||
+ PED_ASSERT (part->disk->type->ops->partition_set_type_id != NULL);
|
||||
+ return part->disk->type->ops->partition_get_type_id (part);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+ped_partition_set_type_uuid (PedPartition *part, const uint8_t* uuid)
|
||||
+{
|
||||
+ PED_ASSERT (part != NULL);
|
||||
+ PED_ASSERT (part->disk != NULL);
|
||||
+ PED_ASSERT (ped_partition_is_active (part));
|
||||
+
|
||||
+ if (!_assert_partition_type_uuid_feature (part->disk->type))
|
||||
+ return 0;
|
||||
+
|
||||
+ PED_ASSERT (part->disk->type->ops->partition_set_type_uuid != NULL);
|
||||
+ return part->disk->type->ops->partition_set_type_uuid (part, uuid);
|
||||
+}
|
||||
+
|
||||
+uint8_t*
|
||||
+ped_partition_get_type_uuid (const PedPartition *part)
|
||||
+{
|
||||
+ PED_ASSERT (part != NULL);
|
||||
+ PED_ASSERT (part->disk != NULL);
|
||||
+ PED_ASSERT (ped_partition_is_active (part));
|
||||
+
|
||||
+ if (!_assert_partition_type_uuid_feature (part->disk->type))
|
||||
+ return NULL;
|
||||
+
|
||||
+ PED_ASSERT (part->disk->type->ops->partition_set_type_uuid != NULL);
|
||||
+ return part->disk->type->ops->partition_get_type_uuid (part);
|
||||
+}
|
||||
+
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
|
||||
index 6b0b10d..1747202 100644
|
||||
--- a/libparted/labels/dasd.c
|
||||
+++ b/libparted/labels/dasd.c
|
||||
@@ -117,6 +117,10 @@ static PedDiskOps dasd_disk_ops = {
|
||||
|
||||
partition_set_name: NULL,
|
||||
partition_get_name: NULL,
|
||||
+ partition_set_type_id: NULL,
|
||||
+ partition_get_type_id: NULL,
|
||||
+ partition_set_type_uuid: NULL,
|
||||
+ partition_get_type_uuid: NULL,
|
||||
disk_set_flag: dasd_disk_set_flag,
|
||||
disk_get_flag: dasd_disk_get_flag,
|
||||
disk_is_flag_available: dasd_disk_is_flag_available,
|
||||
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
|
||||
index b44ccaf..44c8cfc 100644
|
||||
--- a/libparted/labels/dos.c
|
||||
+++ b/libparted/labels/dos.c
|
||||
@@ -1754,6 +1754,30 @@ msdos_partition_is_flag_available (const PedPartition* part,
|
||||
}
|
||||
}
|
||||
|
||||
+
|
||||
+int
|
||||
+msdos_partition_set_type_id (PedPartition *part, uint8_t id)
|
||||
+{
|
||||
+ DosPartitionData *dos_part_data = part->disk_specific;
|
||||
+
|
||||
+ dos_part_data->system = id;
|
||||
+
|
||||
+ // TODO set the correct flag but there is no function for that. better cleanup flags
|
||||
+ // and use system directly (like in gpt.c)
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+uint8_t _GL_ATTRIBUTE_PURE
|
||||
+msdos_partition_get_type_id (const PedPartition *part)
|
||||
+{
|
||||
+ const DosPartitionData *dos_part_data = part->disk_specific;
|
||||
+
|
||||
+ return dos_part_data->system;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static PedGeometry*
|
||||
_try_constraint (const PedPartition* part, const PedConstraint* external,
|
||||
PedConstraint* internal)
|
||||
@@ -2590,6 +2614,10 @@ static PedDiskOps msdos_disk_ops = {
|
||||
|
||||
partition_set_name: NULL,
|
||||
partition_get_name: NULL,
|
||||
+ partition_set_type_id: msdos_partition_set_type_id,
|
||||
+ partition_get_type_id: msdos_partition_get_type_id,
|
||||
+ partition_set_type_uuid: NULL,
|
||||
+ partition_get_type_uuid: NULL,
|
||||
|
||||
PT_op_function_initializers (msdos)
|
||||
};
|
||||
@@ -2598,7 +2626,7 @@ static PedDiskType msdos_disk_type = {
|
||||
next: NULL,
|
||||
name: "msdos",
|
||||
ops: &msdos_disk_ops,
|
||||
- features: PED_DISK_TYPE_EXTENDED
|
||||
+ features: PED_DISK_TYPE_EXTENDED | PED_DISK_TYPE_PARTITION_TYPE_ID
|
||||
};
|
||||
|
||||
void
|
||||
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
||||
index c5d7bb3..db18790 100644
|
||||
--- a/libparted/labels/gpt.c
|
||||
+++ b/libparted/labels/gpt.c
|
||||
@@ -1685,6 +1685,45 @@ gpt_partition_get_name (const PedPartition *part)
|
||||
return gpt_part_data->translated_name;
|
||||
}
|
||||
|
||||
+
|
||||
+static int
|
||||
+gpt_partition_set_type_uuid (PedPartition *part, const uint8_t* uuid)
|
||||
+{
|
||||
+ GPTPartitionData *gpt_part_data = part->disk_specific;
|
||||
+
|
||||
+ efi_guid_t* type_uuid = &gpt_part_data->type;
|
||||
+ memcpy(type_uuid, uuid, sizeof (efi_guid_t));
|
||||
+
|
||||
+ /* type_uuid is always LE, while uint8_t is always kind of BE */
|
||||
+
|
||||
+ type_uuid->time_low = PED_SWAP32(type_uuid->time_low);
|
||||
+ type_uuid->time_mid = PED_SWAP16(type_uuid->time_mid);
|
||||
+ type_uuid->time_hi_and_version = PED_SWAP16(type_uuid->time_hi_and_version);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static uint8_t*
|
||||
+gpt_partition_get_type_uuid (const PedPartition *part)
|
||||
+{
|
||||
+ const GPTPartitionData *gpt_part_data = part->disk_specific;
|
||||
+
|
||||
+ efi_guid_t type_uuid = gpt_part_data->type;
|
||||
+
|
||||
+ /* type_uuid is always LE, while uint8_t is always kind of BE */
|
||||
+
|
||||
+ type_uuid.time_low = PED_SWAP32(type_uuid.time_low);
|
||||
+ type_uuid.time_mid = PED_SWAP16(type_uuid.time_mid);
|
||||
+ type_uuid.time_hi_and_version = PED_SWAP16(type_uuid.time_hi_and_version);
|
||||
+
|
||||
+ uint8_t* buf = ped_malloc(sizeof (uuid_t));
|
||||
+ memcpy(buf, &type_uuid, sizeof (uuid_t));
|
||||
+
|
||||
+ return buf;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
gpt_get_max_primary_partition_count (const PedDisk *disk)
|
||||
{
|
||||
@@ -1780,6 +1814,10 @@ static PedDiskOps gpt_disk_ops =
|
||||
|
||||
partition_set_name: gpt_partition_set_name,
|
||||
partition_get_name: gpt_partition_get_name,
|
||||
+ partition_set_type_id: NULL,
|
||||
+ partition_get_type_id: NULL,
|
||||
+ partition_set_type_uuid: gpt_partition_set_type_uuid,
|
||||
+ partition_get_type_uuid: gpt_partition_get_type_uuid,
|
||||
disk_set_flag: gpt_disk_set_flag,
|
||||
disk_get_flag: gpt_disk_get_flag,
|
||||
disk_is_flag_available: gpt_disk_is_flag_available,
|
||||
@@ -1792,7 +1830,7 @@ static PedDiskType gpt_disk_type =
|
||||
next: NULL,
|
||||
name: "gpt",
|
||||
ops: &gpt_disk_ops,
|
||||
- features: PED_DISK_TYPE_PARTITION_NAME
|
||||
+ features: PED_DISK_TYPE_PARTITION_NAME | PED_DISK_TYPE_PARTITION_TYPE_UUID
|
||||
};
|
||||
|
||||
void
|
||||
diff --git a/parted/parted.c b/parted/parted.c
|
||||
index 310f011..f840037 100644
|
||||
--- a/parted/parted.c
|
||||
+++ b/parted/parted.c
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <stdbool.h>
|
||||
+#include <uuid/uuid.h>
|
||||
|
||||
#include "argmatch.h"
|
||||
#include "closeout.h"
|
||||
@@ -174,6 +175,8 @@ static const char* end_msg = N_("END is disk location, such as "
|
||||
static const char* state_msg = N_("STATE is one of: on, off\n");
|
||||
static const char* device_msg = N_("DEVICE is usually /dev/hda or /dev/sda\n");
|
||||
static const char* name_msg = N_("NAME is any word you want\n");
|
||||
+static const char* type_id_msg = N_("TYPE_ID is a value between 0x01 and 0xff\n");
|
||||
+static const char* type_uuid_msg = N_("TYPE_UUID is a non-null uuid\n");
|
||||
|
||||
static const char* copyright_msg = N_(
|
||||
"Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n"
|
||||
@@ -917,6 +920,110 @@ error:
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int
|
||||
+do_type_id (PedDevice** dev, PedDisk** diskp)
|
||||
+{
|
||||
+ PedPartition* part = NULL;
|
||||
+ char* input = NULL;
|
||||
+
|
||||
+ if (!*diskp)
|
||||
+ *diskp = ped_disk_new (*dev);
|
||||
+ if (!*diskp)
|
||||
+ goto error;
|
||||
+
|
||||
+ if (!ped_disk_type_check_feature((*diskp)->type, PED_DISK_TYPE_PARTITION_TYPE_ID)) {
|
||||
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
|
||||
+ _("%s disk labels do not support partition type-id."),
|
||||
+ (*diskp)->type->name);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
|
||||
+ goto error;
|
||||
+
|
||||
+ uint8_t type_id = ped_partition_get_type_id (part);
|
||||
+
|
||||
+ static char buf[8];
|
||||
+ snprintf(buf, 8, "0x%02x", type_id);
|
||||
+
|
||||
+ input = command_line_get_word (_("Partition type-id?"), buf, NULL, 0);
|
||||
+ if (!input)
|
||||
+ goto error;
|
||||
+
|
||||
+ unsigned int tmp = strtol (input, (char**) NULL, 0);
|
||||
+ if (tmp == 0 || tmp > 0xff) {
|
||||
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
|
||||
+ _("Invalid id."));
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ if (!ped_partition_set_type_id (part, tmp))
|
||||
+ goto error_free_input;
|
||||
+
|
||||
+ free (input);
|
||||
+
|
||||
+ if (!ped_disk_commit (*diskp))
|
||||
+ goto error;
|
||||
+ return 1;
|
||||
+
|
||||
+error_free_input:
|
||||
+ free (input);
|
||||
+error:
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_type_uuid (PedDevice** dev, PedDisk** diskp)
|
||||
+{
|
||||
+ PedPartition* part = NULL;
|
||||
+ char* input = NULL;
|
||||
+
|
||||
+ if (!*diskp)
|
||||
+ *diskp = ped_disk_new (*dev);
|
||||
+ if (!*diskp)
|
||||
+ goto error;
|
||||
+
|
||||
+ if (!ped_disk_type_check_feature((*diskp)->type, PED_DISK_TYPE_PARTITION_TYPE_UUID)) {
|
||||
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
|
||||
+ _("%s disk labels do not support partition type-uuid."),
|
||||
+ (*diskp)->type->name);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
|
||||
+ goto error;
|
||||
+
|
||||
+ uint8_t* type_uuid = ped_partition_get_type_uuid (part);
|
||||
+ static char buf[UUID_STR_LEN];
|
||||
+ uuid_unparse_lower (type_uuid, buf);
|
||||
+ free (type_uuid);
|
||||
+
|
||||
+ input = command_line_get_word (_("Partition type-uuid?"), buf, NULL, 0);
|
||||
+ if (!input)
|
||||
+ goto error;
|
||||
+
|
||||
+ uuid_t tmp;
|
||||
+ if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) {
|
||||
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
|
||||
+ _("Invalid uuid."));
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ if (!ped_partition_set_type_uuid (part, tmp))
|
||||
+ goto error_free_input;
|
||||
+
|
||||
+ free (input);
|
||||
+
|
||||
+ if (!ped_disk_commit (*diskp))
|
||||
+ goto error;
|
||||
+ return 1;
|
||||
+
|
||||
+error_free_input:
|
||||
+ free (input);
|
||||
+error:
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static char*
|
||||
partition_print_flags (PedPartition const *part)
|
||||
{
|
||||
@@ -1161,6 +1268,8 @@ do_print (PedDevice** dev, PedDisk** diskp)
|
||||
Table* table;
|
||||
int has_extended;
|
||||
int has_name;
|
||||
+ int has_id;
|
||||
+ int has_uuid;
|
||||
int has_devices_arg = 0;
|
||||
int has_free_arg = 0;
|
||||
int has_list_arg = 0;
|
||||
@@ -1270,6 +1379,10 @@ do_print (PedDevice** dev, PedDisk** diskp)
|
||||
PED_DISK_TYPE_EXTENDED);
|
||||
has_name = ped_disk_type_check_feature ((*diskp)->type,
|
||||
PED_DISK_TYPE_PARTITION_NAME);
|
||||
+ has_id = ped_disk_type_check_feature ((*diskp)->type,
|
||||
+ PED_DISK_TYPE_PARTITION_TYPE_ID);
|
||||
+ has_uuid = ped_disk_type_check_feature ((*diskp)->type,
|
||||
+ PED_DISK_TYPE_PARTITION_TYPE_UUID);
|
||||
|
||||
PedPartition* part;
|
||||
if (opt_output_mode == HUMAN) {
|
||||
@@ -1407,6 +1520,21 @@ do_print (PedDevice** dev, PedDisk** diskp)
|
||||
|
||||
if (!(part->type & PED_PARTITION_FREESPACE)) {
|
||||
|
||||
+ if (has_id) {
|
||||
+ uint8_t type_id = ped_partition_get_type_id (part);
|
||||
+ static char buf[8];
|
||||
+ snprintf(buf, 8, "0x%02x", type_id);
|
||||
+ ul_jsonwrt_value_s (&json, "type-id", buf);
|
||||
+ }
|
||||
+
|
||||
+ if (has_uuid) {
|
||||
+ uint8_t* type_uuid = ped_partition_get_type_uuid (part);
|
||||
+ static char buf[UUID_STR_LEN];
|
||||
+ uuid_unparse_lower (type_uuid, buf);
|
||||
+ ul_jsonwrt_value_s (&json, "type-uuid", buf);
|
||||
+ free (type_uuid);
|
||||
+ }
|
||||
+
|
||||
if (has_name) {
|
||||
name = ped_partition_get_name (part);
|
||||
if (strcmp (name, "") != 0)
|
||||
@@ -2218,6 +2346,22 @@ _("name NUMBER NAME name partition NUMBER as NAME"),
|
||||
NULL),
|
||||
str_list_create (_(number_msg), _(name_msg), NULL), 1));
|
||||
|
||||
+command_register (commands, command_create (
|
||||
+ str_list_create_unique ("type-id", _("type-id"), NULL),
|
||||
+ do_type_id,
|
||||
+ str_list_create (
|
||||
+_("type-id NUMBER TYPE-ID type-id set TYPE-ID of partition NUMBER"),
|
||||
+NULL),
|
||||
+ str_list_create (_(number_msg), _(type_id_msg), NULL), 1));
|
||||
+
|
||||
+command_register (commands, command_create (
|
||||
+ str_list_create_unique ("type-uuid", _("type-uuid"), NULL),
|
||||
+ do_type_uuid,
|
||||
+ str_list_create (
|
||||
+_("type-uuid NUMBER TYPE-UUID type-uuid set TYPE-UUID of partition NUMBER"),
|
||||
+NULL),
|
||||
+ str_list_create (_(number_msg), _(type_uuid_msg), NULL), 1));
|
||||
+
|
||||
command_register (commands, command_create (
|
||||
str_list_create_unique ("print", _("print"), NULL),
|
||||
do_print,
|
||||
diff --git a/tests/t0800-json-gpt.sh b/tests/t0800-json-gpt.sh
|
||||
index 8dd1862..354c0bd 100755
|
||||
--- a/tests/t0800-json-gpt.sh
|
||||
+++ b/tests/t0800-json-gpt.sh
|
||||
@@ -62,6 +62,7 @@ cat <<EOF > exp || fail=1
|
||||
"end": "20479s",
|
||||
"size": "10240s",
|
||||
"type": "primary",
|
||||
+ "type-uuid": "0fc63daf-8483-4772-8e79-3d69d8477de4",
|
||||
"name": "test1"
|
||||
},{
|
||||
"number": 2,
|
||||
@@ -69,6 +70,7 @@ cat <<EOF > exp || fail=1
|
||||
"end": "61439s",
|
||||
"size": "40960s",
|
||||
"type": "primary",
|
||||
+ "type-uuid": "a19d880f-05fc-4d3b-a006-743f0f84911e",
|
||||
"name": "test2",
|
||||
"flags": [
|
||||
"raid"
|
||||
diff --git a/tests/t0801-json-msdos.sh b/tests/t0801-json-msdos.sh
|
||||
index a14a5af..c5446d8 100755
|
||||
--- a/tests/t0801-json-msdos.sh
|
||||
+++ b/tests/t0801-json-msdos.sh
|
||||
@@ -52,13 +52,15 @@ cat <<EOF > exp || fail=1
|
||||
"start": "5.00MiB",
|
||||
"end": "10.0MiB",
|
||||
"size": "5.00MiB",
|
||||
- "type": "primary"
|
||||
+ "type": "primary",
|
||||
+ "type-id": "0x83"
|
||||
},{
|
||||
"number": 2,
|
||||
"start": "10.0MiB",
|
||||
"end": "30.0MiB",
|
||||
"size": "20.0MiB",
|
||||
"type": "extended",
|
||||
+ "type-id": "0x0f",
|
||||
"flags": [
|
||||
"lba"
|
||||
]
|
||||
@@ -68,6 +70,7 @@ cat <<EOF > exp || fail=1
|
||||
"end": "20.0MiB",
|
||||
"size": "10.0MiB",
|
||||
"type": "logical",
|
||||
+ "type-id": "0x8e",
|
||||
"flags": [
|
||||
"lvm"
|
||||
]
|
@ -1,136 +0,0 @@
|
||||
From: Sebastian Parschauer <sparschauer@suse.de>
|
||||
Date: Thu, 15 Jun 2017 19:04:41 +0200
|
||||
Subject: libparted/dasd: add swap flag handling for DASD-CDL
|
||||
References: fate#314888, bsc#1044536
|
||||
Patch-mainline: no, upstream wants to drop the swap flag
|
||||
|
||||
The way how the linux-swap partition type is handled is not how
|
||||
fdasd handles it. It is only set if there is a linux-swap file
|
||||
system set with mkpart or if there is a swap file system created
|
||||
by mkswap on disk. But we want to know the partition type on disk.
|
||||
|
||||
So introduce a swap flag which behaves like the other flags. The
|
||||
parted function do_mkpart() sets this flag for us if creating a
|
||||
partition with FS type name "linux-swap*".
|
||||
|
||||
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
|
||||
---
|
||||
libparted/labels/dasd.c | 42 +++++++++++++++++++++++++-----------------
|
||||
1 file changed, 25 insertions(+), 17 deletions(-)
|
||||
|
||||
Index: parted-3.3/libparted/labels/dasd.c
|
||||
===================================================================
|
||||
--- parted-3.3.orig/libparted/labels/dasd.c
|
||||
+++ parted-3.3/libparted/labels/dasd.c
|
||||
@@ -65,6 +65,7 @@ extern void ped_disk_dasd_done ();
|
||||
typedef struct {
|
||||
int type;
|
||||
int system;
|
||||
+ int swap;
|
||||
int raid;
|
||||
int lvm;
|
||||
} DasdPartitionData;
|
||||
@@ -316,6 +317,7 @@ dasd_read (PedDisk* disk)
|
||||
part->num = 1;
|
||||
part->fs_type = ped_file_system_probe (&part->geom);
|
||||
dasd_data = part->disk_specific;
|
||||
+ dasd_data->swap = 0;
|
||||
dasd_data->raid = 0;
|
||||
dasd_data->lvm = 0;
|
||||
dasd_data->type = 0;
|
||||
@@ -400,6 +402,7 @@ dasd_read (PedDisk* disk)
|
||||
part->num = 1;
|
||||
part->fs_type = ped_file_system_probe (&part->geom);
|
||||
dasd_data = part->disk_specific;
|
||||
+ dasd_data->swap = 0;
|
||||
dasd_data->raid = 0;
|
||||
dasd_data->lvm = 0;
|
||||
dasd_data->type = 0;
|
||||
@@ -457,18 +460,11 @@ dasd_read (PedDisk* disk)
|
||||
}
|
||||
|
||||
dasd_data = part->disk_specific;
|
||||
+ dasd_data->swap = !strncmp(PART_TYPE_SWAP, str, 6);
|
||||
dasd_data->raid = !strncmp(PART_TYPE_RAID, str, 6);
|
||||
dasd_data->lvm = !strncmp(PART_TYPE_LVM, str, 6);
|
||||
dasd_partition_set_system(part, part->fs_type);
|
||||
|
||||
- if (strncmp(PART_TYPE_SWAP, str, 6) == 0) {
|
||||
- fs = ped_file_system_probe(&part->geom);
|
||||
- if (fs && is_linux_swap(fs->name)) {
|
||||
- dasd_data->system = PARTITION_LINUX_SWAP;
|
||||
- PDEBUG;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44);
|
||||
|
||||
dasd_data->type = 0;
|
||||
@@ -749,14 +745,25 @@ dasd_partition_set_flag (PedPartition* p
|
||||
dasd_data = part->disk_specific;
|
||||
|
||||
switch (flag) {
|
||||
+ case PED_PARTITION_SWAP:
|
||||
+ if (state) {
|
||||
+ dasd_data->raid = 0;
|
||||
+ dasd_data->lvm = 0;
|
||||
+ }
|
||||
+ dasd_data->swap = state;
|
||||
+ return ped_partition_set_system(part, part->fs_type);
|
||||
case PED_PARTITION_RAID:
|
||||
- if (state)
|
||||
+ if (state) {
|
||||
+ dasd_data->swap = 0;
|
||||
dasd_data->lvm = 0;
|
||||
+ }
|
||||
dasd_data->raid = state;
|
||||
return ped_partition_set_system(part, part->fs_type);
|
||||
case PED_PARTITION_LVM:
|
||||
- if (state)
|
||||
+ if (state) {
|
||||
+ dasd_data->swap = 0;
|
||||
dasd_data->raid = 0;
|
||||
+ }
|
||||
dasd_data->lvm = state;
|
||||
return ped_partition_set_system(part, part->fs_type);
|
||||
default:
|
||||
@@ -774,6 +781,8 @@ dasd_partition_get_flag (const PedPartit
|
||||
dasd_data = part->disk_specific;
|
||||
|
||||
switch (flag) {
|
||||
+ case PED_PARTITION_SWAP:
|
||||
+ return dasd_data->swap;
|
||||
case PED_PARTITION_RAID:
|
||||
return dasd_data->raid;
|
||||
case PED_PARTITION_LVM:
|
||||
@@ -802,6 +811,8 @@ dasd_partition_is_flag_available (const
|
||||
return 0;
|
||||
|
||||
switch (flag) {
|
||||
+ case PED_PARTITION_SWAP:
|
||||
+ return 1;
|
||||
case PED_PARTITION_RAID:
|
||||
return 1;
|
||||
case PED_PARTITION_LVM:
|
||||
@@ -985,17 +996,14 @@ dasd_partition_set_system (PedPartition*
|
||||
return 1;
|
||||
}
|
||||
|
||||
- if (!fs_type) {
|
||||
- dasd_data->system = PARTITION_LINUX;
|
||||
- PDEBUG;
|
||||
- } else if (is_linux_swap (fs_type->name)) {
|
||||
+ if (dasd_data->swap) {
|
||||
dasd_data->system = PARTITION_LINUX_SWAP;
|
||||
PDEBUG;
|
||||
- } else {
|
||||
- dasd_data->system = PARTITION_LINUX;
|
||||
- PDEBUG;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
+ dasd_data->system = PARTITION_LINUX;
|
||||
+ PDEBUG;
|
||||
return 1;
|
||||
}
|
||||
|
@ -11,16 +11,17 @@ Index: parted-3.3/include/parted/disk.in.h
|
||||
===================================================================
|
||||
--- parted-3.3.orig/include/parted/disk.in.h
|
||||
+++ parted-3.3/include/parted/disk.in.h
|
||||
@@ -38,9 +38,11 @@ enum _PedDiskFlag {
|
||||
@@ -38,10 +38,12 @@ enum _PedDiskFlag {
|
||||
PED_DISK_CYLINDER_ALIGNMENT=1,
|
||||
/* This flag controls whether the boot flag of a GPT PMBR is set */
|
||||
PED_DISK_GPT_PMBR_BOOT=2,
|
||||
+ /* This flag indicates that there is an implicit (aka fake) partition on the DASD disk */
|
||||
+ PED_DISK_DASD_IMPLICIT_PARTITION=3,
|
||||
};
|
||||
#define PED_DISK_FIRST_FLAG PED_DISK_CYLINDER_ALIGNMENT
|
||||
-#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT
|
||||
+#define PED_DISK_LAST_FLAG PED_DISK_DASD_IMPLICIT_PARTITION
|
||||
// NOTE: DO NOT define using enums
|
||||
#define PED_DISK_FIRST_FLAG 1 // PED_DISK_CYLINDER_ALIGNMENT
|
||||
-#define PED_DISK_LAST_FLAG 2 // PED_DISK_GPT_PMBR_BOOT
|
||||
+#define PED_DISK_LAST_FLAG 3 // PED_DISK_DASD_IMPLICIT_PARTITION
|
||||
|
||||
/**
|
||||
* Partition types
|
||||
@ -60,10 +61,10 @@ Index: parted-3.3/libparted/labels/dasd.c
|
||||
#include "pt-common.h"
|
||||
PT_define_limit_functions (dasd)
|
||||
|
||||
@@ -116,6 +121,9 @@ static PedDiskOps dasd_disk_ops = {
|
||||
|
||||
partition_set_name: NULL,
|
||||
partition_get_name: NULL,
|
||||
@@ -122,6 +122,9 @@
|
||||
partition_get_type_id: NULL,
|
||||
partition_set_type_uuid: NULL,
|
||||
partition_get_type_uuid: NULL,
|
||||
+ disk_set_flag: dasd_disk_set_flag,
|
||||
+ disk_get_flag: dasd_disk_get_flag,
|
||||
+ disk_is_flag_available: dasd_disk_is_flag_available,
|
||||
|
@ -1,44 +0,0 @@
|
||||
From: Andre Wild <wild@linux.vnet.ibm.com>
|
||||
Date: Fri, 24 Mar 2017 03:11:11 +0100
|
||||
Subject: libparted/dasd: improve lvm/raid flag handling for DASD-CDL
|
||||
References: bsc#1040163, fate#314888
|
||||
Patch-mainline: submitted, 2017-05-23
|
||||
|
||||
This commit corrects the reading of lvm/raid flags on DASD/CDL formatted
|
||||
disks. Previously, users were not able to see what was the actual flags
|
||||
stored on the disk. Now the file system check is removed and this issue
|
||||
is corrected.
|
||||
|
||||
Fixes: c8873b0044c8 ("When reading the DASD disk label, ...")
|
||||
Signed-off-by: Andre Wild <wild@linux.vnet.ibm.com>
|
||||
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
|
||||
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
|
||||
Acked-by: Sebastian Parschauer <sparschauer@suse.de>
|
||||
---
|
||||
libparted/labels/dasd.c | 15 +++------------
|
||||
1 file changed, 3 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/libparted/labels/dasd.c
|
||||
+++ b/libparted/labels/dasd.c
|
||||
@@ -457,18 +457,9 @@ dasd_read (PedDisk* disk)
|
||||
}
|
||||
|
||||
dasd_data = part->disk_specific;
|
||||
-
|
||||
- if ((strncmp(PART_TYPE_RAID, str, 6) == 0) &&
|
||||
- (ped_file_system_probe(&part->geom) == NULL))
|
||||
- ped_partition_set_flag(part, PED_PARTITION_RAID, 1);
|
||||
- else
|
||||
- ped_partition_set_flag(part, PED_PARTITION_RAID, 0);
|
||||
-
|
||||
- if ((strncmp(PART_TYPE_LVM, str, 6) == 0) &&
|
||||
- (ped_file_system_probe(&part->geom) == NULL))
|
||||
- ped_partition_set_flag(part, PED_PARTITION_LVM, 1);
|
||||
- else
|
||||
- ped_partition_set_flag(part, PED_PARTITION_LVM, 0);
|
||||
+ dasd_data->raid = !strncmp(PART_TYPE_RAID, str, 6);
|
||||
+ dasd_data->lvm = !strncmp(PART_TYPE_LVM, str, 6);
|
||||
+ dasd_partition_set_system(part, part->fs_type);
|
||||
|
||||
if (strncmp(PART_TYPE_SWAP, str, 6) == 0) {
|
||||
fs = ped_file_system_probe(&part->geom);
|
@ -4,7 +4,7 @@ References: bnc#657360
|
||||
Patch-mainline: no
|
||||
|
||||
This patch should make parted's process of informing the kernel
|
||||
about changes of partition table sligtly more reliable.
|
||||
about changes of partition table slightly more reliable.
|
||||
It consists of 2 quite unrelated parts:
|
||||
|
||||
* increase the max sleep time if partition is busy from 1 to 2 seconds
|
||||
|
BIN
parted-3.5.tar.xz
(Stored with Git LFS)
BIN
parted-3.5.tar.xz
(Stored with Git LFS)
Binary file not shown.
@ -1,11 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAABCgAdFiEEtMa0UeT6i0IyyhkeEX6MFo7+On8FAmJduCkACgkQEX6MFo7+
|
||||
On9cLAgAmAn86lYjZj+Ka5EHrVtaFgh1Nvz84EOwZd0TVRTJyP/u56QrOXxRYFFr
|
||||
6SiJuI1sWfpkzMGG8RYhcr/hu0Os4rtDdhwXXA75QexpSZamPRSo/EU7skrPW0ZD
|
||||
ycw6jUIBO5de4kCLmM/4byl6LV5eFixJYJ5zfD+SnQsMJvO6/fBo0Dv+pNGF/m5F
|
||||
mQeLWmgfqCNZ3INoHLPxuP08gpA9aELp6UFipbqBZqeRIk4K+jGSWlLu62mwl2sQ
|
||||
1OYIIdKacBrh14ZhRqXZKGKHk94RxiFtD/7CLXK/qzEFylKUMQ/XpUB0QkZNHVZW
|
||||
l2kRXsEGC1c7dWSbMX8lgy02HjfuVQ==
|
||||
=7scj
|
||||
-----END PGP SIGNATURE-----
|
BIN
parted-3.6.tar.xz
(Stored with Git LFS)
Normal file
BIN
parted-3.6.tar.xz
(Stored with Git LFS)
Normal file
Binary file not shown.
11
parted-3.6.tar.xz.sig
Normal file
11
parted-3.6.tar.xz.sig
Normal file
@ -0,0 +1,11 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQFDBAABCgAtFiEEtMa0UeT6i0IyyhkeEX6MFo7+On8FAmQ0njkPHGJjbEByZWRo
|
||||
YXQuY29tAAoJEBF+jBaO/jp/IpcH/jLOvn+dQCMp0rJnX4DZmPyFfaRdiqxQCd1a
|
||||
czIOd5TZlS7nMbmpL8+8uyCPxTpcaPR83uSuTZtTNoq5PjGrK41ErF1JnparPbBe
|
||||
4LThHPNnL6VQFy1OSZ0MjI5bGKryasZG3ZAdCzYqWz5Lquzm46OsTNtfRAI7nDlX
|
||||
SFEdNxV+WpUQXu9HgHvI/qHR59X9bdx9LLOt4beQauz/G2lQChGs/a3DrfPpRXG5
|
||||
0eBWS5zAfvHFJzZEnTDfDbYkBzQ7GF5quqcDiEDU7xJwDwKL5G/Ke1jaGZpOCFMu
|
||||
U/wF74657pKna3YStrGTPYJ/Ig3Cg71PI99wK3dGAETDfKZ7hXU=
|
||||
=ObPo
|
||||
-----END PGP SIGNATURE-----
|
@ -12,21 +12,20 @@ Index: parted-3.3/include/parted/disk.in.h
|
||||
===================================================================
|
||||
--- parted-3.3.orig/include/parted/disk.in.h
|
||||
+++ parted-3.3/include/parted/disk.in.h
|
||||
@@ -83,10 +83,11 @@ enum _PedPartitionFlag {
|
||||
|
||||
enum _PedDiskTypeFeature {
|
||||
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
|
||||
- PED_DISK_TYPE_PARTITION_NAME=2 /**< supports partition names */
|
||||
+ PED_DISK_TYPE_PARTITION_NAME=2, /**< supports partition names */
|
||||
+ PED_DISK_TYPE_SYSTEM_NAME=4 /**< supports system names */
|
||||
@@ -101,10 +101,11 @@
|
||||
PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */
|
||||
PED_DISK_TYPE_DISK_UUID=16, /**< supports disk uuids */
|
||||
PED_DISK_TYPE_PARTITION_UUID=32, /**< supports partition uuids */
|
||||
+ PED_DISK_TYPE_SYSTEM_NAME=64 /**< supports system names */
|
||||
};
|
||||
#define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED
|
||||
-#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_NAME
|
||||
+#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_SYSTEM_NAME
|
||||
// NOTE: DO NOT define using enums
|
||||
#define PED_DISK_TYPE_FIRST_FEATURE 1 // PED_DISK_TYPE_EXTENDED
|
||||
-#define PED_DISK_TYPE_LAST_FEATURE 32 // PED_DISK_TYPE_PARTITION_UUID
|
||||
+#define PED_DISK_TYPE_LAST_FEATURE 64 // PED_DISK_TYPE_SYSTEM_NAME
|
||||
|
||||
struct _PedDisk;
|
||||
struct _PedPartition;
|
||||
@@ -246,6 +247,8 @@ struct _PedDiskOps {
|
||||
@@ -274,6 +275,8 @@
|
||||
/* other */
|
||||
int (*alloc_metadata) (PedDisk* disk);
|
||||
int (*get_max_primary_partition_count) (const PedDisk* disk);
|
||||
@ -35,15 +34,15 @@ Index: parted-3.3/include/parted/disk.in.h
|
||||
bool (*get_max_supported_partition_count) (const PedDisk* disk,
|
||||
int* supported);
|
||||
PedAlignment *(*get_partition_alignment)(const PedDisk *disk);
|
||||
@@ -337,7 +340,9 @@ extern int ped_partition_is_flag_availab
|
||||
extern int ped_partition_set_system (PedPartition* part,
|
||||
const PedFileSystemType* fs_type);
|
||||
@@ -369,6 +372,9 @@
|
||||
extern int ped_partition_set_name (PedPartition* part, const char* name);
|
||||
+extern int ped_partition_set_system_name (PedPartition* part, const char* name);
|
||||
extern const char* ped_partition_get_name (const PedPartition* part);
|
||||
|
||||
+extern int ped_partition_set_system_name (PedPartition* part, const char* name);
|
||||
+extern const char* ped_partition_get_system_name (const PedPartition* part);
|
||||
extern int ped_partition_is_busy (const PedPartition* part);
|
||||
extern char* ped_partition_get_path (const PedPartition* part);
|
||||
+
|
||||
extern int ped_partition_set_type_id (PedPartition* part, uint8_t id);
|
||||
extern uint8_t ped_partition_get_type_id (const PedPartition* part);
|
||||
|
||||
Index: parted-3.3/libparted/disk.c
|
||||
===================================================================
|
||||
|
@ -1,3 +1,21 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 31 11:13:02 CET 2024 - aschnell@suse.com
|
||||
|
||||
- update to version 3.6:
|
||||
- Support GPT partition attribute bit 63 as no_automount flag
|
||||
- Add type commands to set type-id on MS-DOS and type-uuid on GPT
|
||||
- Add swap flag support to the dasd disklabel
|
||||
- Add display of GPT disk and partition UUIDs in JSON output
|
||||
refreshed patches:
|
||||
- parted-mac.patch
|
||||
- libparted-dasd-implicit-partition-disk-flag.patch
|
||||
- tests-disable.patch
|
||||
removed patches:
|
||||
- direct-handling-of-partition-type-id-and-uuid.patch
|
||||
- type-command.patch
|
||||
- libparted-dasd-improve-lvm-raid-flag-handling.patch
|
||||
- libparted-dasd-add-swap-flag-handling-for-DASD-CDL.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 05 11:18:18 CEST 2023 - aschnell@suse.com
|
||||
|
||||
@ -134,8 +152,8 @@ Fri Nov 22 14:25:28 UTC 2019 - Anna Maresova <anicka@suse.com>
|
||||
- Fix set and disk_set to not crash when there are no flags to set.
|
||||
- Fix a udev cookie leak when using resizepart on device-mapper devices.
|
||||
- Fix a gettext crash/error sometimes when using localized languages.
|
||||
- Fix fat resize to preverve boot code, and thus not render the
|
||||
filesystem unreconized by Windows.
|
||||
- Fix fat resize to preserve boot code, and thus not render the
|
||||
filesystem unrecognized by Windows.
|
||||
- Fix rescue command: the rescue command often failed to find
|
||||
filesystems due to leaving on cylinder alignment.
|
||||
- libparted-fs-resize: Prevent crash resizing FAT file systems with very
|
||||
@ -224,7 +242,7 @@ Mon Jul 1 14:14:36 UTC 2019 - Anna Maresova <anicka@suse.com>
|
||||
5a61f15, clean the disk information when commands fail in
|
||||
interactive mode
|
||||
- add: parted-ui-remove-unneccesary-information-of-command.patch
|
||||
0b7946a, remove unneccesary information of command line
|
||||
0b7946a, remove unnecessary information of command line
|
||||
- add: parted-fix-wrong-error-label-jump-in-mkpart.patch
|
||||
af150f6, fix wrong error label jump in mkpart
|
||||
- refresh: libparted-dasd-unify-vtoc-handling-for-cdl-ldl.patch
|
||||
@ -1371,7 +1389,7 @@ Fri Jul 13 11:38:09 CEST 2007 - olh@suse.de
|
||||
Thu Jul 5 12:55:37 CEST 2007 - sassmann@suse.de
|
||||
|
||||
- fix parted to generate parseable output (#289049)
|
||||
added check to test if tty is availabe, if no tty is available
|
||||
added check to test if tty is available, if no tty is available
|
||||
readline functions are omitted
|
||||
|
||||
-------------------------------------------------------------------
|
||||
@ -1773,7 +1791,7 @@ Mon Sep 23 18:11:04 CEST 2002 - meissner@suse.de
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 2 15:44:17 CEST 2002 - fehr@suse.de
|
||||
|
||||
- fix bug occuring sometimes when resizing reiserfs from YaST2
|
||||
- fix bug occurring sometimes when resizing reiserfs from YaST2
|
||||
(bug was in patch always-resize-part.dif)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
13
parted.spec
13
parted.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package parted
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: parted
|
||||
Version: 3.5
|
||||
Version: 3.6
|
||||
Release: 0
|
||||
Summary: GNU partitioner
|
||||
License: GPL-3.0-or-later
|
||||
@ -49,10 +49,7 @@ Patch22: libparted-open-the-device-RO-and-lazily-switch-to-RW.patch
|
||||
Patch23: parted-implement-wipesignatures-option.patch
|
||||
# bsc#982169
|
||||
Patch24: libparted-fix-nvme-partition-naming.patch
|
||||
# fate#314888
|
||||
Patch25: libparted-dasd-improve-lvm-raid-flag-handling.patch
|
||||
Patch26: parted-mkpart-set-a-swap-flag-if-available.patch
|
||||
Patch27: libparted-dasd-add-swap-flag-handling-for-DASD-CDL.patch
|
||||
Patch29: libparted-fix-NVDIMM-partition-naming.patch
|
||||
Patch31: parted-add-ignore-busy-option.patch
|
||||
Patch32: parted-fix-resizepart-and-rm-command.patch
|
||||
@ -62,8 +59,6 @@ Patch34: libparted-canonicalize-dev-md-paths.patch
|
||||
Patch36: libparted-linux-pmem-path.patch
|
||||
# bsc#1164260
|
||||
Patch37: parted-print-max-partitions-for-yast.patch
|
||||
Patch38: direct-handling-of-partition-type-id-and-uuid.patch
|
||||
Patch39: type-command.patch
|
||||
# bsc#1164907
|
||||
# Fatresize
|
||||
Patch100: parted-fatresize-autoconf.patch
|
||||
@ -147,9 +142,7 @@ to develop applications that require these.
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch29 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
@ -157,8 +150,6 @@ to develop applications that require these.
|
||||
%patch34 -p1
|
||||
%patch36 -p1
|
||||
%patch37 -p1
|
||||
%patch38 -p1
|
||||
%patch39 -p1
|
||||
%patch100 -p1
|
||||
%patch156 -p1
|
||||
%patch157 -p1
|
||||
|
@ -2,20 +2,22 @@ diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
|
||||
index c92a3a3..915bbc4 100644
|
||||
--- a/libparted/tests/Makefile.am
|
||||
+++ b/libparted/tests/Makefile.am
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
@@ -4,7 +4,7 @@
|
||||
# This file may be modified and/or distributed without restriction.
|
||||
|
||||
-TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh
|
||||
+TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh
|
||||
TESTS = t1000-label.sh t1001-flags.sh t2000-disk.sh t2100-zerolen.sh \
|
||||
- t3000-symlink.sh t4000-volser.sh
|
||||
+ t3000-symlink.sh
|
||||
EXTRA_DIST = $(TESTS)
|
||||
check_PROGRAMS = label disk zerolen symlink volser
|
||||
check_PROGRAMS = label disk zerolen symlink volser flags
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||
|
||||
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index f9340aa..9d0d08f 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -60,7 +60,6 @@ TESTS = \
|
||||
@@ -63,7 +63,6 @@
|
||||
t3200-type-change.sh \
|
||||
t3210-gpt-type-change.sh \
|
||||
t3300-palo-prep.sh \
|
||||
|
@ -1,117 +0,0 @@
|
||||
--- a/parted/parted.c 2022-05-18 09:11:33.731616339 +0200
|
||||
+++ b/parted/parted.c 2022-05-18 09:16:40.517372633 +0200
|
||||
@@ -187,6 +187,8 @@
|
||||
static const char* name_msg = N_("NAME is any word you want\n");
|
||||
static const char* type_id_msg = N_("TYPE_ID is a value between 0x01 and 0xff\n");
|
||||
static const char* type_uuid_msg = N_("TYPE_UUID is a non-null uuid\n");
|
||||
+static const char* type_msg = N_("TYPE_ID is a value between 0x01 and 0xff, "
|
||||
+ "TYPE_UUID is a UUID\n");
|
||||
|
||||
static const char* copyright_msg = N_(
|
||||
"Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n"
|
||||
@@ -1090,6 +1092,90 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int
|
||||
+do_type (PedDevice** dev, PedDisk** diskp)
|
||||
+{
|
||||
+ if (!*diskp)
|
||||
+ *diskp = ped_disk_new (*dev);
|
||||
+ if (!*diskp)
|
||||
+ goto error;
|
||||
+
|
||||
+ bool has_type_id = ped_disk_type_check_feature ((*diskp)->type,
|
||||
+ PED_DISK_TYPE_PARTITION_TYPE_ID);
|
||||
+ bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type,
|
||||
+ PED_DISK_TYPE_PARTITION_TYPE_UUID);
|
||||
+
|
||||
+ PED_ASSERT (!(has_type_id && has_type_uuid));
|
||||
+
|
||||
+ if (!has_type_id && !has_type_uuid) {
|
||||
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
|
||||
+ _("%s disk labels do not support partition type."),
|
||||
+ (*diskp)->type->name);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ PedPartition* part = NULL;
|
||||
+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part))
|
||||
+ goto error;
|
||||
+
|
||||
+ char* input = NULL;
|
||||
+
|
||||
+ if (has_type_id) {
|
||||
+ uint8_t type_id = ped_partition_get_type_id (part);
|
||||
+ static char buf[8];
|
||||
+ snprintf(buf, 8, "0x%02x", type_id);
|
||||
+
|
||||
+ input = command_line_get_word (_("Partition type-id?"), buf, NULL, 0);
|
||||
+ if (!input)
|
||||
+ goto error;
|
||||
+
|
||||
+ unsigned int tmp = strtol (input, (char**) NULL, 16);
|
||||
+ if (tmp < 0x01 || tmp > 0xff) {
|
||||
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
|
||||
+ _("Invalid type-id."));
|
||||
+ goto error_free_input;
|
||||
+ }
|
||||
+
|
||||
+ if (!ped_partition_set_type_id (part, tmp))
|
||||
+ goto error_free_input;
|
||||
+ }
|
||||
+
|
||||
+ if (has_type_uuid) {
|
||||
+ uint8_t* type_uuid = ped_partition_get_type_uuid (part);
|
||||
+ static char buf[UUID_STR_LEN];
|
||||
+ uuid_unparse_lower (type_uuid, buf);
|
||||
+ free (type_uuid);
|
||||
+
|
||||
+ input = command_line_get_word (_("Partition type-uuid?"), buf, NULL, 0);
|
||||
+ if (!input)
|
||||
+ goto error;
|
||||
+
|
||||
+ uuid_t tmp;
|
||||
+ if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) {
|
||||
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
|
||||
+ _("Invalid type-uuid."));
|
||||
+ goto error_free_input;
|
||||
+ }
|
||||
+
|
||||
+ if (!ped_partition_set_type_uuid (part, tmp))
|
||||
+ goto error_free_input;
|
||||
+ }
|
||||
+
|
||||
+ free (input);
|
||||
+
|
||||
+ // Reset the fs_type based on the filesystem, if it exists
|
||||
+ part->fs_type = ped_file_system_probe (&part->geom);
|
||||
+
|
||||
+ if (!ped_disk_commit (*diskp))
|
||||
+ goto error;
|
||||
+ return 1;
|
||||
+
|
||||
+error_free_input:
|
||||
+ free (input);
|
||||
+error:
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static char*
|
||||
partition_print_flags (PedPartition const *part)
|
||||
{
|
||||
@@ -2581,6 +2667,14 @@
|
||||
str_list_create (_(number_msg), flag_msg, NULL), 1));
|
||||
|
||||
command_register (commands, command_create (
|
||||
+ str_list_create_unique ("type", _("type"), NULL),
|
||||
+ do_type,
|
||||
+ str_list_create (
|
||||
+_("type NUMBER TYPE-ID or TYPE-UUID type set TYPE-ID or TYPE-UUID of partition NUMBER"),
|
||||
+NULL),
|
||||
+ str_list_create (_(number_msg), _(type_msg), NULL), 1));
|
||||
+
|
||||
+command_register (commands, command_create (
|
||||
str_list_create_unique ("unit", _("unit"), NULL),
|
||||
do_unit,
|
||||
str_list_create (
|
Loading…
x
Reference in New Issue
Block a user