7fc0182f62
- tests: Add a libparted test for ped_partition_set_system on msdos - parted: Add display of GPT UUIDs in JSON output - Add no_automount flag support - increase xfs size to 300M
146 lines
5.5 KiB
Diff
146 lines
5.5 KiB
Diff
From 55e4775c989af42d629401b9aa22c60ba2993e7d Mon Sep 17 00:00:00 2001
|
|
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
Date: Tue, 13 Dec 2022 12:53:07 +0000
|
|
Subject: [PATCH] gpt: Add no_automount partition flag
|
|
|
|
Add user requested support for GPT partition type attribute bit 63 [1]
|
|
so the no-auto flag in the systemd originated Discoverable Partitions
|
|
Specification [2] can be manipulated. The UEFI specification [3] says
|
|
partition attribute bits 48 to 63 are partition type specific, however
|
|
the DPS [2] and Microsoft [4] use the bit 63 to mean no automounting /
|
|
assign no drive letter and apply it to multiple partition types so don't
|
|
restrict its application.
|
|
|
|
[1] Request for GPT partition attribute bit 63 "no automount" editing
|
|
support
|
|
https://gitlab.gnome.org/GNOME/gparted/-/issues/214
|
|
[2] The Discoverable Partitions Specification (DPS),
|
|
Partition Attribute Flags
|
|
https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
|
|
[3] UEFI Specification, version 2.8,
|
|
Table 24. Defined GPT Partition Entry - Attributes
|
|
https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
|
|
[4] CREATE_PARTITION_PARAMETERS structure (vds.h)
|
|
https://learn.microsoft.com/en-gb/windows/win32/api/vds/ns-vds-create_partition_parameters
|
|
|
|
Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
|
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
---
|
|
NEWS | 2 ++
|
|
doc/C/parted.8 | 2 +-
|
|
include/parted/disk.in.h | 3 ++-
|
|
libparted/disk.c | 2 ++
|
|
libparted/labels/gpt.c | 12 ++++++++++--
|
|
5 files changed, 17 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/NEWS b/NEWS
|
|
index 099f8bd..ac759fe 100644
|
|
--- a/NEWS
|
|
+++ b/NEWS
|
|
@@ -4,6 +4,8 @@ GNU parted NEWS -*- outline -*-
|
|
|
|
** New Features
|
|
|
|
+ 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.
|
|
|
|
* Noteworthy changes in release 3.5 (2022-04-18) [stable]
|
|
diff --git a/doc/C/parted.8 b/doc/C/parted.8
|
|
index ab34be7..3069c33 100644
|
|
--- a/doc/C/parted.8
|
|
+++ b/doc/C/parted.8
|
|
@@ -120,7 +120,7 @@ or an LVM logical volume if necessary.
|
|
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
|
|
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
|
|
"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", "linux-home",
|
|
-"bios_grub", and "palo".
|
|
+"no_automount", "bios_grub", and "palo".
|
|
\fIstate\fP should be either "on" or "off".
|
|
.TP
|
|
.B unit \fIunit\fP
|
|
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
|
|
index f649bcc..402d78a 100644
|
|
--- a/include/parted/disk.in.h
|
|
+++ b/include/parted/disk.in.h
|
|
@@ -88,10 +88,11 @@ enum _PedPartitionFlag {
|
|
PED_PARTITION_CHROMEOS_KERNEL=19,
|
|
PED_PARTITION_BLS_BOOT=20,
|
|
PED_PARTITION_LINUX_HOME=21,
|
|
+ PED_PARTITION_NO_AUTOMOUNT=22,
|
|
};
|
|
// NOTE: DO NOT define using enums
|
|
#define PED_PARTITION_FIRST_FLAG 1 // PED_PARTITION_BOOT
|
|
-#define PED_PARTITION_LAST_FLAG 21 // PED_PARTITION_LINUX_HOME
|
|
+#define PED_PARTITION_LAST_FLAG 22 // PED_PARTITION_NO_AUTOMOUNT
|
|
|
|
enum _PedDiskTypeFeature {
|
|
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
|
|
diff --git a/libparted/disk.c b/libparted/disk.c
|
|
index 0ed3d91..45f35fd 100644
|
|
--- a/libparted/disk.c
|
|
+++ b/libparted/disk.c
|
|
@@ -2579,6 +2579,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
|
|
return N_("bls_boot");
|
|
case PED_PARTITION_LINUX_HOME:
|
|
return N_("linux-home");
|
|
+ case PED_PARTITION_NO_AUTOMOUNT:
|
|
+ return N_("no_automount");
|
|
|
|
default:
|
|
ped_exception_throw (
|
|
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
|
index 1993863..780fb70 100644
|
|
--- a/libparted/labels/gpt.c
|
|
+++ b/libparted/labels/gpt.c
|
|
@@ -252,7 +252,8 @@ struct __attribute__ ((packed)) _GuidPartitionEntryAttributes_t
|
|
uint64_t NoBlockIOProtocol:1;
|
|
uint64_t LegacyBIOSBootable:1;
|
|
uint64_t Reserved:45;
|
|
- uint64_t GuidSpecific:16;
|
|
+ uint64_t GuidSpecific:15;
|
|
+ uint64_t NoAutomount:1;
|
|
#else
|
|
# warning "Using crippled partition entry type"
|
|
uint32_t RequiredToFunction:1;
|
|
@@ -260,7 +261,8 @@ struct __attribute__ ((packed)) _GuidPartitionEntryAttributes_t
|
|
uint32_t LegacyBIOSBootable:1;
|
|
uint32_t Reserved:30;
|
|
uint32_t LOST:5;
|
|
- uint32_t GuidSpecific:16;
|
|
+ uint32_t GuidSpecific:15;
|
|
+ uint32_t NoAutomount:1;
|
|
#endif
|
|
};
|
|
|
|
@@ -1637,6 +1639,9 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
|
|
case PED_PARTITION_LEGACY_BOOT:
|
|
gpt_part_data->attributes.LegacyBIOSBootable = state;
|
|
return 1;
|
|
+ case PED_PARTITION_NO_AUTOMOUNT:
|
|
+ gpt_part_data->attributes.NoAutomount = state;
|
|
+ return 1;
|
|
case PED_PARTITION_ROOT:
|
|
case PED_PARTITION_LBA:
|
|
default:
|
|
@@ -1662,6 +1667,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
|
|
return gpt_part_data->attributes.RequiredToFunction;
|
|
case PED_PARTITION_LEGACY_BOOT:
|
|
return gpt_part_data->attributes.LegacyBIOSBootable;
|
|
+ case PED_PARTITION_NO_AUTOMOUNT:
|
|
+ return gpt_part_data->attributes.NoAutomount;
|
|
case PED_PARTITION_LBA:
|
|
case PED_PARTITION_ROOT:
|
|
default:
|
|
@@ -1681,6 +1688,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
|
|
{
|
|
case PED_PARTITION_HIDDEN:
|
|
case PED_PARTITION_LEGACY_BOOT:
|
|
+ case PED_PARTITION_NO_AUTOMOUNT:
|
|
return 1;
|
|
case PED_PARTITION_ROOT:
|
|
case PED_PARTITION_LBA:
|
|
--
|
|
2.38.1
|
|
|