From owner-p4-projects@FreeBSD.ORG Sat Mar 19 19:55:20 2005 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9044016A4D0; Sat, 19 Mar 2005 19:55:20 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 67B1316A4CE for ; Sat, 19 Mar 2005 19:55:20 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2DBF643D1D for ; Sat, 19 Mar 2005 19:55:20 +0000 (GMT) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j2JJtKZ0034205 for ; Sat, 19 Mar 2005 19:55:20 GMT (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j2JJtJd2034202 for perforce@freebsd.org; Sat, 19 Mar 2005 19:55:19 GMT (envelope-from jmallett@freebsd.org) Date: Sat, 19 Mar 2005 19:55:19 GMT Message-Id: <200503191955.j2JJtJd2034202@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 73532 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Mar 2005 19:55:21 -0000 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);