All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: add option for MSR partition.
@ 2011-11-11 16:52 Namjae Jeon
  2011-11-11 19:04 ` H. Peter Anvin
       [not found] ` <20111111171446.GA13144@emperor.us.dell.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Namjae Jeon @ 2011-11-11 16:52 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, Matt_Domsch, eugeneteo, davej, Warns, 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.

Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Cc: Eugene Teo <eugeneteo@kernel.sg>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Timo Warns <Warns@pre-sense.de>
---
 fs/partitions/Kconfig |   10 ++++++++++
 fs/partitions/efi.c   |   15 ++++++++++-----
 include/linux/efi.h   |    3 +++
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig
index cb5f0a3..c97f4f2 100644
--- a/fs/partitions/Kconfig
+++ b/fs/partitions/Kconfig
@@ -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
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
index 6296b40..473832d 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -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);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 2362a0b..44fbe4d 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -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;
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] efi: add option for MSR partition.
  2011-11-11 16:52 [PATCH] efi: add option for MSR partition Namjae Jeon
@ 2011-11-11 19:04 ` H. Peter Anvin
       [not found] ` <20111111171446.GA13144@emperor.us.dell.com>
  1 sibling, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2011-11-11 19:04 UTC (permalink / raw)
  To: Namjae Jeon; +Cc: akpm, linux-kernel, Matt_Domsch, eugeneteo, davej, Warns

On 11/11/2011 08:52 AM, Namjae Jeon wrote:
> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] efi: add option for MSR partition.
       [not found] ` <20111111171446.GA13144@emperor.us.dell.com>
@ 2011-11-11 22:47   ` NamJae Jeon
  0 siblings, 0 replies; 3+ messages in thread
From: NamJae Jeon @ 2011-11-11 22:47 UTC (permalink / raw)
  To: Matt Domsch
  Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	eugeneteo@kernel.sg, davej@codemonkey.org.uk, Warns@pre-sense.de

2011/11/12 Matt Domsch <Matt_Domsch@dell.com>:
> On Fri, Nov 11, 2011 at 10:52:55AM -0600, Namjae Jeon wrote:
>> 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".
>
> As such, I cannot recommend your patch be applied.
Hi Matt.
Thanks for your opinion. I got your point.
>
> Thanks,
> Matt
>
>
> --
> Matt Domsch
> Technology Strategist
> Dell | Office of the CTO
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-11 22:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-11 16:52 [PATCH] efi: add option for MSR partition Namjae Jeon
2011-11-11 19:04 ` H. Peter Anvin
     [not found] ` <20111111171446.GA13144@emperor.us.dell.com>
2011-11-11 22:47   ` NamJae Jeon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.