checked in (request 43319) OBS-URL: https://build.opensuse.org/request/show/43319 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=27
156 lines
5.8 KiB
Diff
156 lines
5.8 KiB
Diff
---
|
|
include/parted/disk.h | 9 +++++----
|
|
libparted/disk.c | 2 ++
|
|
libparted/labels/dos.c | 8 ++++++++
|
|
parted/parted.c | 24 +++++++++++++++++++++---
|
|
parted/ui.c | 3 +++
|
|
5 files changed, 39 insertions(+), 7 deletions(-)
|
|
|
|
Index: parted-2.1/libparted/disk.c
|
|
===================================================================
|
|
--- parted-2.1.orig/libparted/disk.c 2010-02-02 11:57:03.000000000 +0100
|
|
+++ parted-2.1/libparted/disk.c 2010-02-02 11:57:14.000000000 +0100
|
|
@@ -2429,6 +2429,8 @@ ped_partition_flag_get_name (PedPartitio
|
|
return N_("lba");
|
|
case PED_PARTITION_HPSERVICE:
|
|
return N_("hp-service");
|
|
+ case PED_PARTITION_TYPE:
|
|
+ return N_("type");
|
|
case PED_PARTITION_PALO:
|
|
return N_("palo");
|
|
case PED_PARTITION_PREP:
|
|
Index: parted-2.1/libparted/labels/dos.c
|
|
===================================================================
|
|
--- parted-2.1.orig/libparted/labels/dos.c 2010-02-02 11:57:03.000000000 +0100
|
|
+++ parted-2.1/libparted/labels/dos.c 2010-02-02 11:57:14.000000000 +0100
|
|
@@ -1397,6 +1397,10 @@ msdos_partition_set_flag (PedPartition*
|
|
disk = part->disk;
|
|
|
|
switch (flag) {
|
|
+ case PED_PARTITION_TYPE:
|
|
+ dos_data->system = state;
|
|
+ return 1;
|
|
+
|
|
case PED_PARTITION_HIDDEN:
|
|
if (part->type == PED_PARTITION_EXTENDED) {
|
|
ped_exception_throw (
|
|
@@ -1494,6 +1498,9 @@ msdos_partition_get_flag (const PedParti
|
|
case PED_PARTITION_LBA:
|
|
return dos_data->lba;
|
|
|
|
+ case PED_PARTITION_TYPE:
|
|
+ return dos_data->system;
|
|
+
|
|
case PED_PARTITION_PALO:
|
|
return dos_data->palo;
|
|
|
|
@@ -1515,6 +1522,7 @@ msdos_partition_is_flag_available (const
|
|
case PED_PARTITION_RAID:
|
|
case PED_PARTITION_LVM:
|
|
case PED_PARTITION_LBA:
|
|
+ case PED_PARTITION_TYPE:
|
|
case PED_PARTITION_PALO:
|
|
case PED_PARTITION_PREP:
|
|
return 1;
|
|
Index: parted-2.1/parted/ui.c
|
|
===================================================================
|
|
--- parted-2.1.orig/parted/ui.c 2010-02-02 11:57:03.000000000 +0100
|
|
+++ parted-2.1/parted/ui.c 2010-02-02 12:00:01.000000000 +0100
|
|
@@ -918,6 +918,9 @@ command_line_get_integer (const char* pr
|
|
NULL, 1);
|
|
if (!input)
|
|
return 0;
|
|
+ if (strstr(input, "0x") == input)
|
|
+ valid = sscanf (input, "%x", value);
|
|
+ else
|
|
valid = sscanf (input, "%d", value);
|
|
free (input);
|
|
return valid;
|
|
Index: parted-2.1/include/parted/disk.h
|
|
===================================================================
|
|
--- parted-2.1.orig/include/parted/disk.h 2010-02-02 11:57:03.000000000 +0100
|
|
+++ parted-2.1/include/parted/disk.h 2010-02-02 11:58:02.000000000 +0100
|
|
@@ -65,10 +65,11 @@ enum _PedPartitionFlag {
|
|
PED_PARTITION_LBA=7,
|
|
PED_PARTITION_HPSERVICE=8,
|
|
PED_PARTITION_PALO=9,
|
|
- PED_PARTITION_PREP=10,
|
|
- PED_PARTITION_MSFT_RESERVED=11,
|
|
- PED_PARTITION_BIOS_GRUB=12,
|
|
- PED_PARTITION_APPLE_TV_RECOVERY=13
|
|
+ PED_PARTITION_TYPE=10,
|
|
+ PED_PARTITION_PREP=11,
|
|
+ PED_PARTITION_MSFT_RESERVED=12,
|
|
+ PED_PARTITION_BIOS_GRUB=13,
|
|
+ PED_PARTITION_APPLE_TV_RECOVERY=14
|
|
};
|
|
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
|
|
#define PED_PARTITION_LAST_FLAG PED_PARTITION_APPLE_TV_RECOVERY
|
|
Index: parted-2.1/parted/parted.c
|
|
===================================================================
|
|
--- parted-2.1.orig/parted/parted.c 2010-02-02 11:57:03.000000000 +0100
|
|
+++ parted-2.1/parted/parted.c 2010-02-02 11:57:14.000000000 +0100
|
|
@@ -1234,13 +1234,14 @@ partition_print_flags (PedPartition* par
|
|
const char* name;
|
|
char* res = ped_malloc(1);
|
|
void* _res = res;
|
|
+ int xtype;
|
|
|
|
*res = '\0';
|
|
|
|
first_flag = 1;
|
|
for (flag = ped_partition_flag_next (0); flag;
|
|
flag = ped_partition_flag_next (flag)) {
|
|
- if (ped_partition_get_flag (part, flag)) {
|
|
+ if (xtype = ped_partition_get_flag (part, flag)) {
|
|
if (first_flag)
|
|
first_flag = 0;
|
|
else {
|
|
@@ -1249,7 +1250,16 @@ partition_print_flags (PedPartition* par
|
|
res = _res;
|
|
strncat (res, ", ", 2);
|
|
}
|
|
-
|
|
+ if (flag == PED_PARTITION_TYPE) {
|
|
+ char tmpstr[21];
|
|
+ int len = snprintf(tmpstr,sizeof(tmpstr)-1,"type=%02x",xtype);
|
|
+ _res = res;
|
|
+ ped_realloc (&_res, strlen (res) + 1 +
|
|
+ ((len>sizeof(tmpstr))?sizeof(tmpstr):len) );
|
|
+ res = _res;
|
|
+ strncat (res, tmpstr, 21);
|
|
+ }
|
|
+ else {
|
|
name = _(ped_partition_flag_get_name (flag));
|
|
_res = res;
|
|
ped_realloc (&_res, strlen (res) + 1 + strlen (name));
|
|
@@ -1257,6 +1267,7 @@ partition_print_flags (PedPartition* par
|
|
strcat(res, name);
|
|
}
|
|
}
|
|
+ }
|
|
|
|
return res;
|
|
}
|
|
@@ -2057,12 +2068,19 @@ do_set (PedDevice** dev)
|
|
goto error_destroy_disk;
|
|
if (!command_line_get_part_flag (_("Flag to Invert?"), part, &flag))
|
|
goto error_destroy_disk;
|
|
+ if( flag == PED_PARTITION_TYPE )
|
|
+ state = ped_partition_get_flag (part, flag);
|
|
+ else
|
|
state = (ped_partition_get_flag (part, flag) == 0 ? 1 : 0);
|
|
|
|
- if (!is_toggle_mode) {
|
|
+ if (!is_toggle_mode && flag != PED_PARTITION_TYPE ) {
|
|
if (!command_line_get_state (_("New state?"), &state))
|
|
goto error_destroy_disk;
|
|
}
|
|
+ else if( flag == PED_PARTITION_TYPE ) {
|
|
+ if (!command_line_get_integer (_("New type?"), &state))
|
|
+ goto error_destroy_disk;
|
|
+ }
|
|
|
|
if (!ped_partition_set_flag (part, flag, state))
|
|
goto error_destroy_disk;
|