Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2018 00:29:08 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r332521 - stable/11/sys/geom/part
Message-ID:  <201804160029.w3G0T8mC014953@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Mon Apr 16 00:29:07 2018
New Revision: 332521
URL: https://svnweb.freebsd.org/changeset/base/332521

Log:
  MFC r323108, r323125, r326047-r326049
  
  r323108:
  Add efimedia attribute for all GPT partitions.
  
  r323125:
  The hard drive media device path contains the size of the partition,
  not its end. This makes the GEOM efimedia attribute match the
  FreeBSD:Boot1Device environment variable now.
  
  r326047:
  Implement efi media tagging for MBR partitioning types.
  
  r326048:
  Remove trailing whitespace (one I just introduced and a bunch of
  others in the same directory).
  
  r326049:
  While the EFI spec allows numbers to be in many forms, libefivar
  produces hex numbers for the dsn. Since that come is from EDK2, change
  this for symmetry, by generating the dsn as a hex number.
  
  [Missed as part of the efivar/efibootmgr MFCs]
  
  Reported by:	Oliver Pinter <oliver.pinter@hardenedbsd.org>

Modified:
  stable/11/sys/geom/part/g_part.c
  stable/11/sys/geom/part/g_part_apm.c
  stable/11/sys/geom/part/g_part_bsd.c
  stable/11/sys/geom/part/g_part_bsd64.c
  stable/11/sys/geom/part/g_part_ebr.c
  stable/11/sys/geom/part/g_part_gpt.c
  stable/11/sys/geom/part/g_part_mbr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/geom/part/g_part.c
==============================================================================
--- stable/11/sys/geom/part/g_part.c	Mon Apr 16 00:18:57 2018	(r332520)
+++ stable/11/sys/geom/part/g_part.c	Mon Apr 16 00:29:07 2018	(r332521)
@@ -1363,7 +1363,7 @@ g_part_ctl_resize(struct gctl_req *req, struct g_part_
 			/* Deny shrinking of an opened partition. */
 			gctl_error(req, "%d", EBUSY);
 			return (EBUSY);
-		} 
+		}
 	}
 
 	error = G_PART_RESIZE(table, entry, gpp);

Modified: stable/11/sys/geom/part/g_part_apm.c
==============================================================================
--- stable/11/sys/geom/part/g_part_apm.c	Mon Apr 16 00:18:57 2018	(r332520)
+++ stable/11/sys/geom/part/g_part_apm.c	Mon Apr 16 00:29:07 2018	(r332521)
@@ -207,7 +207,7 @@ apm_read_ent(struct g_consumer *cp, uint32_t blk, stru
 }
 
 static int
-g_part_apm_add(struct g_part_table *basetable, struct g_part_entry *baseentry, 
+g_part_apm_add(struct g_part_table *basetable, struct g_part_entry *baseentry,
     struct g_part_parms *gpp)
 {
 	struct g_part_apm_entry *entry;

Modified: stable/11/sys/geom/part/g_part_bsd.c
==============================================================================
--- stable/11/sys/geom/part/g_part_bsd.c	Mon Apr 16 00:18:57 2018	(r332520)
+++ stable/11/sys/geom/part/g_part_bsd.c	Mon Apr 16 00:29:07 2018	(r332521)
@@ -72,7 +72,7 @@ static int g_part_bsd_destroy(struct g_part_table *, s
 static void g_part_bsd_dumpconf(struct g_part_table *, struct g_part_entry *,
     struct sbuf *, const char *);
 static int g_part_bsd_dumpto(struct g_part_table *, struct g_part_entry *);
-static int g_part_bsd_modify(struct g_part_table *, struct g_part_entry *,  
+static int g_part_bsd_modify(struct g_part_table *, struct g_part_entry *,
     struct g_part_parms *);
 static const char *g_part_bsd_name(struct g_part_table *, struct g_part_entry *,
     char *, size_t);
@@ -256,7 +256,7 @@ g_part_bsd_destroy(struct g_part_table *basetable, str
 }
 
 static void
-g_part_bsd_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry, 
+g_part_bsd_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
     struct sbuf *sb, const char *indent)
 {
 	struct g_part_bsd_entry *entry;
@@ -275,7 +275,7 @@ g_part_bsd_dumpconf(struct g_part_table *table, struct
 }
 
 static int
-g_part_bsd_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)  
+g_part_bsd_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
 {
 	struct g_part_bsd_entry *entry;
 
@@ -471,7 +471,7 @@ g_part_bsd_read(struct g_part_table *basetable, struct
 }
 
 static const char *
-g_part_bsd_type(struct g_part_table *basetable, struct g_part_entry *baseentry, 
+g_part_bsd_type(struct g_part_table *basetable, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)
 {
 	struct g_part_bsd_entry *entry;

Modified: stable/11/sys/geom/part/g_part_bsd64.c
==============================================================================
--- stable/11/sys/geom/part/g_part_bsd64.c	Mon Apr 16 00:18:57 2018	(r332520)
+++ stable/11/sys/geom/part/g_part_bsd64.c	Mon Apr 16 00:29:07 2018	(r332521)
@@ -127,7 +127,7 @@ static int g_part_bsd64_destroy(struct g_part_table *,
 static void g_part_bsd64_dumpconf(struct g_part_table *, struct g_part_entry *,
     struct sbuf *, const char *);
 static int g_part_bsd64_dumpto(struct g_part_table *, struct g_part_entry *);
-static int g_part_bsd64_modify(struct g_part_table *, struct g_part_entry *,  
+static int g_part_bsd64_modify(struct g_part_table *, struct g_part_entry *,
     struct g_part_parms *);
 static const char *g_part_bsd64_name(struct g_part_table *, struct g_part_entry *,
     char *, size_t);
@@ -409,7 +409,7 @@ g_part_bsd64_dumpconf(struct g_part_table *basetable,
 }
 
 static int
-g_part_bsd64_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)  
+g_part_bsd64_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
 {
 	struct g_part_bsd64_entry *entry;
 
@@ -577,7 +577,7 @@ invalid_label:
 }
 
 static const char *
-g_part_bsd64_type(struct g_part_table *basetable, struct g_part_entry *baseentry, 
+g_part_bsd64_type(struct g_part_table *basetable, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)
 {
 	struct g_part_bsd64_entry *entry;

Modified: stable/11/sys/geom/part/g_part_ebr.c
==============================================================================
--- stable/11/sys/geom/part/g_part_ebr.c	Mon Apr 16 00:18:57 2018	(r332520)
+++ stable/11/sys/geom/part/g_part_ebr.c	Mon Apr 16 00:29:07 2018	(r332521)
@@ -80,7 +80,7 @@ static int g_part_ebr_dumpto(struct g_part_table *, st
 static void g_part_ebr_fullname(struct g_part_table *, struct g_part_entry *,
     struct sbuf *, const char *);
 #endif
-static int g_part_ebr_modify(struct g_part_table *, struct g_part_entry *,  
+static int g_part_ebr_modify(struct g_part_table *, struct g_part_entry *,
     struct g_part_parms *);
 static const char *g_part_ebr_name(struct g_part_table *, struct g_part_entry *,
     char *, size_t);
@@ -322,11 +322,11 @@ g_part_ebr_destroy(struct g_part_table *basetable, str
 }
 
 static void
-g_part_ebr_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry, 
+g_part_ebr_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
     struct sbuf *sb, const char *indent)
 {
 	struct g_part_ebr_entry *entry;
- 
+
 	entry = (struct g_part_ebr_entry *)baseentry;
 	if (indent == NULL) {
 		/* conftxt: libdisk compatibility */
@@ -343,7 +343,7 @@ g_part_ebr_dumpconf(struct g_part_table *table, struct
 }
 
 static int
-g_part_ebr_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)  
+g_part_ebr_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
 {
 	struct g_part_ebr_entry *entry;
 
@@ -595,7 +595,7 @@ g_part_ebr_setunset(struct g_part_table *table, struct
 }
 
 static const char *
-g_part_ebr_type(struct g_part_table *basetable, struct g_part_entry *baseentry, 
+g_part_ebr_type(struct g_part_table *basetable, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)
 {
 	struct g_part_ebr_entry *entry;
@@ -667,7 +667,7 @@ g_part_ebr_write(struct g_part_table *basetable, struc
 		p[7] = entry->ent.dp_ecyl;
 		le32enc(p + 8, entry->ent.dp_start);
 		le32enc(p + 12, entry->ent.dp_size);
- 
+
 		next = LIST_NEXT(baseentry, gpe_entry);
 		while (next != NULL && next->gpe_deleted)
 			next = LIST_NEXT(next, gpe_entry);

Modified: stable/11/sys/geom/part/g_part_gpt.c
==============================================================================
--- stable/11/sys/geom/part/g_part_gpt.c	Mon Apr 16 00:18:57 2018	(r332520)
+++ stable/11/sys/geom/part/g_part_gpt.c	Mon Apr 16 00:29:07 2018	(r332521)
@@ -699,11 +699,11 @@ g_part_gpt_destroy(struct g_part_table *basetable, str
 }
 
 static void
-g_part_gpt_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry, 
+g_part_gpt_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
     struct sbuf *sb, const char *indent)
 {
 	struct g_part_gpt_entry *entry;
- 
+
 	entry = (struct g_part_gpt_entry *)baseentry;
 	if (indent == NULL) {
 		/* conftxt: libdisk compatibility */
@@ -731,13 +731,19 @@ g_part_gpt_dumpconf(struct g_part_table *table, struct
 		sbuf_printf(sb, "%s<rawuuid>", indent);
 		sbuf_printf_uuid(sb, &entry->ent.ent_uuid);
 		sbuf_printf(sb, "</rawuuid>\n");
+		sbuf_printf(sb, "%s<efimedia>", indent);
+		sbuf_printf(sb, "HD(%d,GPT,", entry->base.gpe_index);
+		sbuf_printf_uuid(sb, &entry->ent.ent_uuid);
+		sbuf_printf(sb, ",%#jx,%#jx)", (intmax_t)entry->base.gpe_start,
+		    (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1));
+		sbuf_printf(sb, "</efimedia>\n");
 	} else {
 		/* confxml: scheme information */
 	}
 }
 
 static int
-g_part_gpt_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)  
+g_part_gpt_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
 {
 	struct g_part_gpt_entry *entry;
 
@@ -860,7 +866,7 @@ g_part_gpt_probe(struct g_part_table *table, struct g_
 	    &error);
 	if (buf == NULL)
 		return (error);
-	res = memcmp(buf, GPT_HDR_SIG, 8); 
+	res = memcmp(buf, GPT_HDR_SIG, 8);
 	g_free(buf);
 	return ((res == 0) ? pri : ENXIO);
 }
@@ -1102,13 +1108,13 @@ g_part_gpt_setunset(struct g_part_table *basetable,
 }
 
 static const char *
-g_part_gpt_type(struct g_part_table *basetable, struct g_part_entry *baseentry, 
+g_part_gpt_type(struct g_part_table *basetable, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)
 {
 	struct g_part_gpt_entry *entry;
 	struct uuid *type;
 	struct g_part_uuid_alias *uap;
- 
+
 	entry = (struct g_part_gpt_entry *)baseentry;
 	type = &entry->ent.ent_type;
 	for (uap = &gpt_uuid_alias_match[0]; uap->uuid; uap++)

Modified: stable/11/sys/geom/part/g_part_mbr.c
==============================================================================
--- stable/11/sys/geom/part/g_part_mbr.c	Mon Apr 16 00:18:57 2018	(r332520)
+++ stable/11/sys/geom/part/g_part_mbr.c	Mon Apr 16 00:29:07 2018	(r332521)
@@ -77,7 +77,7 @@ static int g_part_mbr_destroy(struct g_part_table *, s
 static void g_part_mbr_dumpconf(struct g_part_table *, struct g_part_entry *,
     struct sbuf *, const char *);
 static int g_part_mbr_dumpto(struct g_part_table *, struct g_part_entry *);
-static int g_part_mbr_modify(struct g_part_table *, struct g_part_entry *,  
+static int g_part_mbr_modify(struct g_part_table *, struct g_part_entry *,
     struct g_part_parms *);
 static const char *g_part_mbr_name(struct g_part_table *, struct g_part_entry *,
     char *, size_t);
@@ -303,11 +303,14 @@ g_part_mbr_destroy(struct g_part_table *basetable, str
 }
 
 static void
-g_part_mbr_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry, 
+g_part_mbr_dumpconf(struct g_part_table *basetable, struct g_part_entry *baseentry,
     struct sbuf *sb, const char *indent)
 {
 	struct g_part_mbr_entry *entry;
- 
+	struct g_part_mbr_table *table;
+	uint32_t dsn;
+
+	table = (struct g_part_mbr_table *)basetable;
 	entry = (struct g_part_mbr_entry *)baseentry;
 	if (indent == NULL) {
 		/* conftxt: libdisk compatibility */
@@ -318,13 +321,18 @@ g_part_mbr_dumpconf(struct g_part_table *table, struct
 		    entry->ent.dp_typ);
 		if (entry->ent.dp_flag & 0x80)
 			sbuf_printf(sb, "%s<attrib>active</attrib>\n", indent);
+		dsn = le32dec(table->mbr + DOSDSNOFF);
+		sbuf_printf(sb, "%s<efimedia>HD(%d,MBR,%#08x,%#jx,%#jx)", indent,
+		    entry->base.gpe_index, dsn, (intmax_t)entry->base.gpe_start,
+		    (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1));
+		sbuf_printf(sb, "</efimedia>\n");
 	} else {
 		/* confxml: scheme information */
 	}
 }
 
 static int
-g_part_mbr_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)  
+g_part_mbr_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
 {
 	struct g_part_mbr_entry *entry;
 
@@ -552,7 +560,7 @@ g_part_mbr_setunset(struct g_part_table *table, struct
 }
 
 static const char *
-g_part_mbr_type(struct g_part_table *basetable, struct g_part_entry *baseentry, 
+g_part_mbr_type(struct g_part_table *basetable, struct g_part_entry *baseentry,
     char *buf, size_t bufsz)
 {
 	struct g_part_mbr_entry *entry;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804160029.w3G0T8mC014953>