This is a discussion on Re: raidframe testing needed within the mailing.openbsd.tech forums, part of the OpenBSD category; --> On Fri, Jun 01, 2007 at 11:16:52PM -0400, Kenneth R Westerback wrote: > Make raidframe do a more 'normal' ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| On Fri, Jun 01, 2007 at 11:16:52PM -0400, Kenneth R Westerback wrote: > Make raidframe do a more 'normal' *getdisklabel() dance, a la sd. > This allows the elimination of the last (?) RAW_PART manual > initialization outside of readdisklabel(). > > Compiles, but that's all I know. I need some adventurous raidframe > user(s) to try this out and see if I've stomped on raidframe > unwritten rules. > > .... Ken Are there no adventurous raidframe users? If no one is able/willing to test, this will have to be committed to be 'tested' involuntarily at your next upgrade ... ..... Ken > > Index: rf_openbsdkintf.c > ================================================== ================= > RCS file: /cvs/src/sys/dev/raidframe/rf_openbsdkintf.c,v > retrieving revision 1.35 > diff -u -p -r1.35 rf_openbsdkintf.c > --- rf_openbsdkintf.c 28 Apr 2007 12:32:13 -0000 1.35 > +++ rf_openbsdkintf.c 2 Jun 2007 02:07:36 -0000 > @@ -270,7 +270,7 @@ struct raid_softc **raid_scPtrs; > > void rf_shutdown_hook(RF_ThreadArg_t); > void raidgetdefaultlabel(RF_Raid_t *, struct raid_softc *, struct disklabel *); > -void raidgetdisklabel(dev_t); > +void raidgetdisklabel(dev_t, struct disklabel *, struct cpu_disklabel *, int); > void raidmakedisklabel(struct raid_softc *); > > int raidlock(struct raid_softc *); > @@ -623,7 +623,6 @@ raidopen(dev_t dev, int flags, int fmt, > { > int unit = DISKUNIT(dev); > struct raid_softc *rs; > - struct disklabel *lp; > int part,pmask; > int error = 0; > > @@ -633,7 +632,6 @@ raidopen(dev_t dev, int flags, int fmt, > > if ((error = raidlock(rs)) != 0) > return (error); > - lp = rs->sc_dkdev.dk_label; > > part = DISKPART(dev); > pmask = (1 << part); > @@ -643,15 +641,17 @@ raidopen(dev_t dev, int flags, int fmt, > > > if ((rs->sc_flags & RAIDF_INITED) && (rs->sc_dkdev.dk_openmask == 0)) > - raidgetdisklabel(dev); > + raidgetdisklabel(dev, rs->sc_dkdev.dk_label, > + rs->sc_dkdev.dk_cpulabel, 0); > > /* Make sure that this partition exists. */ > > if (part != RAW_PART) { > db1_printf(("Not a raw partition..\n")); > if (((rs->sc_flags & RAIDF_INITED) == 0) || > - ((part >= lp->d_npartitions) || > - (lp->d_partitions[part].p_fstype == FS_UNUSED))) { > + ((part >= rs->sc_dkdev.dk_label->d_npartitions) || > + (rs->sc_dkdev.dk_label->d_partitions[part].p_fstype == > + FS_UNUSED))) { > error = ENXIO; > raidunlock(rs); > db1_printf(("Bailing out...\n")); > @@ -1601,9 +1601,11 @@ raidioctl(dev_t dev, u_long cmd, caddr_t > rs->sc_flags &= ~RAIDF_WLABEL; > break; > > - case DIOCGPDINFO: > - raidgetdefaultlabel(raidPtr, rs, (struct disklabel *) data); > - break; > + case DIOCGPDINFO: { > + struct cpu_disklabel osdep; > + raidgetdisklabel(dev, (struct disklabel *)data, &osdep, 1); > + break; > + } > > default: > retcode = ENOTTY; > @@ -2111,11 +2113,6 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr, > lp->d_interleave = 1; > lp->d_flags = 0; > > - lp->d_partitions[RAW_PART].p_offset = 0; > - lp->d_partitions[RAW_PART].p_size = raidPtr->totalSectors; > - lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED; > - lp->d_npartitions = RAW_PART + 1; > - > lp->d_magic = DISKMAGIC; > lp->d_magic2 = DISKMAGIC; > lp->d_checksum = dkcksum(rs->sc_dkdev.dk_label); > @@ -2126,19 +2123,19 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr, > * If one is not present, fake one up. > */ > void > -raidgetdisklabel(dev_t dev) > +raidgetdisklabel(dev_t dev, struct disklabel *lp, struct cpu_disklabel *clp, > + int spoofonly) > { > int unit = DISKUNIT(dev); > struct raid_softc *rs = &raid_softc[unit]; > char *errstring; > - struct disklabel *lp = rs->sc_dkdev.dk_label; > - struct cpu_disklabel *clp = rs->sc_dkdev.dk_cpulabel; > RF_Raid_t *raidPtr; > int i; > struct partition *pp; > > db1_printf(("Getting the disklabel...\n")); > > + bzero(lp, sizeof(*lp)); > bzero(clp, sizeof(*clp)); > > raidPtr = raidPtrs[unit]; > @@ -2149,7 +2146,7 @@ raidgetdisklabel(dev_t dev) > * Call the generic disklabel extraction routine. > */ > errstring = readdisklabel(DISKLABELDEV(dev), raidstrategy, lp, > - rs->sc_dkdev.dk_cpulabel, 0); > + clp, spoofonly); > if (errstring) { > /*printf("%s: %s\n", rs->sc_xname, errstring);*/ > return; |