Skip to contentSkip to conversation

efi: add option for MSR partition.

PATCH In review Namjae Jeon 2 participants 3 messages Nov 11, 2011 1 message not in the archive EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi: add option for MSR partition.

After formatting GUID table on MS windows, MSR(Windows Reserved Partition) is not visible on MS windows. But this partition is visible in linux. User don't want to see the stranged partitin. So I try to add option that user can select MSR partition to be visible or not in linux.

Cc Andrew Morton <[email protected]>
Cc Matt Domsch <[email protected]>
Cc Eugene Teo <[email protected]>
Cc Dave Jones <[email protected]>
Cc Timo Warns <[email protected]>
---
 fs/partitions/Kconfig |   10 ++++++++++
 fs/partitions/efi.c   |   15 ++++++++++-----
 include/linux/efi.h   |    3 +++
 3 files changed, 23 insertions(+), 5 deletions(-)
fs/partitions/Kconfig +10 -0
index cb5f0a3..c97f4f2 100644
@@ -241,6 +241,16 @@ config EFI_PARTITION
 	  Say Y here if you would like to use hard disks under Linux which
 	  were partitioned using EFI GPT.
 
+config MSR_PARTITION_VISIBLE
+        bool "Visible MSR Partition"
+        depends on EFI_PARTITION
+        default y
+        help
+          If you say Y here Microsoft Reserved Partition is visible in
+	  GUID Partitions.
+          Initial size of MSR is 32 MB on disks smaller than 16 GB, or
+	  128 MB on other disks
+
 config SYSV68_PARTITION
 	bool "SYSV68 partition table support" if PARTITION_ADVANCED
 	default y if VME
fs/partitions/efi.c +10 -5
index 6296b40..473832d 100644
@@ -618,7 +618,7 @@ int efi_partition(struct parsed_partitions *state)
 {
 	gpt_header *gpt = NULL;
 	gpt_entry *ptes = NULL;
-	u32 i;
+	u32 i, part_num = 0;
 	unsigned ssz = bdev_logical_block_size(state->bdev) / 512;
 	u8 unparsed_guid[37];
 
@@ -641,14 +641,19 @@ int efi_partition(struct parsed_partitions *state)
 		if (!is_pte_valid(&ptes[i], last_lba(state->bdev)))
 			continue;
 
-		put_partition(state, i+1, start * ssz, size * ssz);
+#ifdef CONFIG_MSR_PARTITION_VISIBLE
+		if (!efi_guidcmp(ptes[i].partition_type_guid,
+				 PARTITION_WINDOWS_RESERVED))
+			continue;
+#endif
+		put_partition(state, ++part_num, start * ssz, size * ssz);
 
 		/* If this is a RAID volume, tell md */
 		if (!efi_guidcmp(ptes[i].partition_type_guid,
 				 PARTITION_LINUX_RAID_GUID))
-			state->parts[i + 1].flags = ADDPART_FLAG_RAID;
+			state->parts[part_num].flags = ADDPART_FLAG_RAID;
 
-		info = &state->parts[i + 1].info;
+		info = &state->parts[part_num].info;
 		/* Instead of doing a manual swap to big endian, reuse the
 		 * common ASCII hex format as the interim.
 		 */
@@ -666,7 +671,7 @@ int efi_partition(struct parsed_partitions *state)
 			info->volname[label_count] = c;
 			label_count++;
 		}
-		state->parts[i + 1].has_info = true;
+		state->parts[part_num].has_info = true;
 	}
 	kfree(ptes);
 	kfree(gpt);
include/linux/efi.h +3 -0
index 2362a0b..44fbe4d 100644
@@ -236,6 +236,9 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
 #define LINUX_EFI_CRASH_GUID \
     EFI_GUID(  0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 )
 
+#define PARTITION_WINDOWS_RESERVED \
+    EFI_GUID(0xE3C9E316, 0x0B5C, 0x4DB8, 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE)
+
 typedef struct {
 	efi_guid_t guid;
 	unsigned long table;
Signature · 1 line
1.7.4.4
#1 lore raw
Quoted 1 line · Namjae Jeon

After formatting GUID table on MS windows, MSR(Windows Reserved Partition) is not visible on MS windows. But this partition is visible in linux. User don't want to see the stranged partitin. So I try to add option that user can select MSR partition to be visible or not in linux.

You're joking, right?

-hpa

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

2011/11/12 Matt Domsch <[email protected]>:

Quoted 18 lines · Namjae Jeon
Quoted 5 lines

After formatting GUID table on MS windows, MSR(Windows Reserved Partition) is not visible on MS windows. But this partition is visible in linux. User don't want to see the stranged partitin. So I try to add option that user can select MSR partition to be visible or not in linux.

Hello Namjae.  Thank you for your patch, however, I do not agree with your reasoning.  I understand Windows wishes to hide this partition from its users.  That is entirely their choice.  Linux, on the other hand, has not hidden this partition from users since it GPT was first created over a decade ago.  Your patch changes user-visible behavior.  Furthermore, disk partitioning tools such as GNU Parted, which parse GPT, will be highly confused when the partition table on disk has indices 1..N, but /proc/partitions now reports indices 1..(N-1), where the first partition was skipped, and now the whole list is "off by one".

Quoted 1 line

As such, I cannot recommend your patch be applied.

Hi Matt.
Thanks for your opinion. I got your point.

Quoted 10 lines

Thanks,
Matt

--
Matt Domsch
Technology Strategist
Dell | Office of the CTO