Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Feb 2003 19:20:26 -0800 (PST)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 24867 for review
Message-ID:  <200302090320.h193KQno012954@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=24867

Change 24867 by jmallett@jmallett_dalek on 2003/02/08 19:20:15

	Add a missing GEOM topology lock.  Add some bootverbose tomfoolery
	for printing the slices added, and their types, also include a table
	of strings representing the different partition types, using the same
	text as NetBSD for consistency.

Affected files ...

.. //depot/projects/mips/sys/geom/geom_fx.c#3 edit

Differences ...

==== //depot/projects/mips/sys/geom/geom_fx.c#3 (text+ko) ====

@@ -61,6 +61,23 @@
 #define	FX_LABEL_MAGIC	0xbe5a941
 #define	FX_NPARTS	16
 
+static const char *fx_typename[] = {
+	"Volume Header",
+	"Repl Trks",
+	"Repl Secs",
+	"Raw",
+	"4.2BSD",
+	"SysV",
+	"Volume",
+	"EFS",
+	"LVol",
+	"RLVol",
+	"XFS",
+	"XFSLog",
+	"XLV",
+	"XVM"
+};
+
 struct dparms {
 	u_int8_t	dp_skew;
 	u_int8_t	dp_gap1;
@@ -122,6 +139,17 @@
 	vp->vp_type = g_dec_be4((u_char *)&vp->vp_type);
 }
 
+static const char *
+g_fx_type(int32_t type)
+{
+	static size_t ntypes = sizeof fx_typename / sizeof fx_typename[0];
+
+	if (type < 0 || type >= ntypes) {
+		return ("Erroneous partition type.");
+	}
+	return (fx_typename[type]);
+}
+
 static int
 g_fx_start(struct bio *bp)
 {
@@ -193,14 +221,21 @@
 		if (g_dec_be4((u_char *)&label->vh_magic) != FX_LABEL_MAGIC)
 			break;
 		for (i = 0; i < FX_NPARTS; i++) {
-			npart++;
 			vp = &label->vh_part[i];
 			g_fx_swap_volpart(vp);
 			if (!vp->vp_size)
 				continue;
+			g_topology_lock();
 			g_slice_config(gp, i, G_SLICE_CONFIG_SET,
 			    vp->vp_begin, vp->vp_size, sectorsize,
 			    "%s%c", pp->name, 'a' + i);
+			g_topology_unlock();
+			if (bootverbose) {
+				printf("Added %s%c of type %d (%s)\n",
+				       pp->name, 'a' + i, vp->vp_type,
+				       g_fx_type(vp->vp_type));
+			}
+			npart++;
 		}
 		break;
 	}

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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