Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Mar 2005 19:55:19 GMT
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 73532 for review
Message-ID:  <200503191955.j2JJtJd2034202@repoman.freebsd.org>

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

Change 73532 by jmallett@jmallett_windward on 2005/03/19 19:54:18

	Reduce diffs with other GEOM modules.

Affected files ...

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

Differences ...

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

@@ -57,7 +57,8 @@
 #define FX_CLASS_NAME	"FX"
 
 struct g_fx_softc {
-	struct volhdr	sc_volhdr;
+	u_int		sectorsize;
+	struct volhdr	volhdr;
 };
 
 static void
@@ -119,10 +120,7 @@
 	int error, i, npart;
 	u_char *buf;
 	struct g_fx_softc *ms;
-	off_t mediasize;
-	u_int sectorsize;
 	struct g_slicer *gsp;
-	struct volhdr *label;
 	struct volpart *vp;
 
 	g_trace(G_T_TOPOLOGY, "g_fx_taste(%s,%s)", mp->name, pp->name);
@@ -134,24 +132,29 @@
 	if (gp == NULL)
 		return (NULL);
 	gsp = gp->softc;
-	gp->dumpconf = g_fx_dumpconf;
 	npart = 0;
-	while (1) {	/* a trick to allow us to use break */
+	do {
 		if (gp->rank != 2 && flags == G_TF_NORMAL)
 			break;
-		sectorsize = cp->provider->sectorsize;
-		if (sectorsize < 512)
+		ms->sectorsize = cp->provider->sectorsize;
+		if (ms->sectorsize < 512)
 			break;
-		mediasize = cp->provider->mediasize;
 		g_topology_unlock();
 		buf = g_read_data(cp, 0, sizeof (struct volhdr), &error);
 		g_topology_lock();
 		if (buf == NULL || error != 0)
 			break;
-		label = (struct volhdr *)buf;
-		if (be32dec((u_char *)&label->vh_magic) != FX_LABEL_MAGIC)
+
+		ms->volhdr = *(struct volhdr *)buf;
+		g_free(buf);
+
+		/*
+		 * XXX/juli
+		 * Need to split out to another function like sunlabel.
+		 */
+		if (be32dec((u_char *)&ms->volhdr.vh_magic) != FX_LABEL_MAGIC)
 			break;
-		error = g_fx_cksum(label);
+		error = g_fx_cksum(&ms->volhdr);
 		if (error != 0) {
 			if (bootverbose) {
 				printf("Found a bad label on %s (sum %d)\n",
@@ -159,15 +162,15 @@
 			}
 			break;
 		}
-		ms->sc_volhdr = *label;
 		for (i = 0; i < FX_NPARTS; i++) {
-			vp = &label->vh_part[i];
+			vp = &ms->volhdr.vh_part[i];
 			g_fx_swap_volpart(vp);
 			if (!vp->vp_size)
 				continue;
 			g_slice_config(gp, i, G_SLICE_CONFIG_SET,
 			    ((off_t)vp->vp_begin) << 9ULL,
-			    ((off_t)vp->vp_size) << 9ULL, sectorsize,
+			    ((off_t)vp->vp_size) << 9ULL,
+			    ms->sectorsize,
 			    "%s%c", pp->name, 'a' + i);
 			if (bootverbose) {
 				printf("Added %s%c of type %d (%s)\n",
@@ -181,7 +184,7 @@
 			       npart, pp->name);
 		}
 		break;
-	}
+	} while (0);
 	g_access(cp, -1, 0, 0);
 	if (LIST_EMPTY(&gp->provider)) {
 		g_slice_spoiled(cp);
@@ -192,7 +195,9 @@
 
 static struct g_class g_fx_class = {
 	.name = FX_CLASS_NAME,
+	.version = G_VERSION,
 	.taste = g_fx_taste,
+	.dumpconf = g_fx_dumpconf,
 };
 
 DECLARE_GEOM_CLASS(g_fx_class, g_fx);



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