Date: Sun, 08 Mar 1998 19:36:48 -0800 From: Mike Smith <mike@smith.net.au> To: Robert Watson <robert+freebsd@cyrus.watson.org> Cc: Mike Smith <mike@smith.net.au>, stable@FreeBSD.ORG Subject: Re: *HEADS UP* Important change warning. (short version) Message-ID: <199803090336.TAA12799@dingo.cdrom.com> In-Reply-To: Your message of "Sun, 08 Mar 1998 22:18:57 EST." <Pine.BSF.3.96.980308221757.14187B-100000@trojanhorse.pr.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
>
> When can we expect this change to appear in the -stable branch? I would
> like to upgrade my stable systems to right before that change (I was mid
> cvsup when I read your email) and then bring the change up on a test
> machine first.
The change to mount was committed a couple of hours ago; specifically
revision 1.6.6.2 of src/sbin/mount/mount_ufs.c and revision 1.2.8.1 of
src/sbin/mount/Makefile.
My intention was to have the kernel side of the changes lag a little
behind, but I had aimed to have them in before the 2.2.6-BETA goes down,
which would most likely see them going out later this evening.
If you are cvsupping the CVS repo, the files that you will want to
watch are:
src/sbin/mount/mount_ufs.c
src/sbin/mount/Makefile
src/sys/sys/reboot.h
src/sys/i386/i386/autoconf.c
Note that the last two haven't changed yet. All of the diffs are
attached, should you want to get stuck into a test machine sooner. I
would greatly appreciate any feedback that anyone has on this.
[-- Attachment #2 --]
Index: i386/i386/autoconf.c
===================================================================
RCS file: /local1/ncvs/src/sys/i386/i386/autoconf.c,v
retrieving revision 1.56.2.8
diff -u -r1.56.2.8 autoconf.c
--- autoconf.c 1998/01/08 12:30:28 1.56.2.8
+++ autoconf.c 1998/03/08 07:41:08
@@ -410,25 +410,26 @@
static void
setroot()
{
- int majdev, mindev, unit, part, adaptor;
+ int majdev, mindev, unit, part, adaptor, slice;
dev_t orootdev;
/*printf("howto %x bootdev %x ", boothowto, bootdev);*/
if (boothowto & RB_DFLTROOT ||
(bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
return;
- majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
+ majdev = B_TYPE(bootdev);
+ adaptor = B_ADAPTOR(bootdev);
+ unit = B_UNIT(bootdev);
+ slice = B_SLICE(bootdev);
if (majdev > sizeof(devname) / sizeof(devname[0]))
return;
- adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK;
- unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
if (majdev == FDMAJOR) {
part = RAW_PART;
mindev = unit << FDUNITSHIFT;
}
else {
part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
- mindev = (unit << PARTITIONSHIFT) + part;
+ mindev = (slice << 16) + (unit << PARTITIONSHIFT) + part;
}
orootdev = rootdev;
rootdev = makedev(majdev, mindev);
@@ -438,9 +439,10 @@
*/
if (rootdev == orootdev)
return;
- printf("changing root device to %c%c%d%c\n",
+ printf("changing root device to %c%c%ds%d%c\n",
devname[majdev][0], devname[majdev][1],
- mindev >> (majdev == FDMAJOR ? FDUNITSHIFT : PARTITIONSHIFT),
+ (mindev & 0xf) >> (majdev == FDMAJOR ? FDUNITSHIFT : PARTITIONSHIFT),
+ slice,
part + 'a');
}
Index: sys/reboot.h
===================================================================
RCS file: /local1/ncvs/src/sys/sys/reboot.h,v
retrieving revision 1.14
diff -u -r1.14 reboot.h
--- reboot.h 1996/10/16 00:19:39 1.14
+++ reboot.h 1998/03/08 07:40:49
@@ -82,6 +82,9 @@
#define B_CONTROLLERSHIFT 20
#define B_CONTROLLERMASK 0xf
#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
+#define B_SLICESHIFT 20
+#define B_SLICEMASK 0xff
+#define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK)
#define B_UNITSHIFT 16
#define B_UNITMASK 0xf
#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK)
[-- Attachment #3 --]
Index: Makefile
===================================================================
RCS file: /local1/ncvs/src/sbin/mount/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile 1994/08/05 02:42:04 1.2
+++ Makefile 1998/03/08 06:34:53
@@ -5,4 +5,7 @@
MAN8= mount.8
# We do NOT install the getmntopts.3 man page.
+# We support the ROOTSLICE_HUNT hack
+CFLAGS+=-DROOTSLICE_HUNT
+
.include <bsd.prog.mk>
Index: mount_ufs.c
===================================================================
RCS file: /local1/ncvs/src/sbin/mount/mount_ufs.c,v
retrieving revision 1.6.6.1
diff -u -r1.6.6.1 mount_ufs.c
--- mount_ufs.c 1997/12/04 07:36:10 1.6.6.1
+++ mount_ufs.c 1998/03/08 07:23:17
@@ -76,6 +76,10 @@
int ch, mntflags;
char *fs_name;
struct vfsconf *vfc;
+#ifdef ROOTSLICE_HUNT
+ int unit, slice, result;
+ char part, devbuf[MAXPATHLEN], devpfx[MAXPATHLEN];
+#endif
mntflags = 0;
optind = optreset = 1; /* Reset for parse of new argv. */
@@ -117,8 +121,37 @@
/*warnx("ufs: filesystem not found");*/
}
}
-
+#ifdef ROOTSLICE_HUNT
+ result = -1;
+ /*
+ * If we are mounting root, and we have a mount of something that
+ * might be the compatability slice, try mounting other slices
+ * first. If the kernel has done the right thing and mounted
+ * the slice because the disk is really sliced, this will find
+ * the real root filesystem. If not, we'll try what was supplied.
+ */
+ if (!strcmp(fs_name, "/") &&
+ (sscanf(args.fspec, "%[^0-9]%d%c", devpfx, &unit, &part) == 3) &&
+ (part >= 'a') &&
+ (part <= 'h')) {
+ for (slice = 1; (slice < 32) && (result < 0); slice++) {
+ sprintf(devbuf, "%s%ds%d%c",
+ devpfx, unit, slice, part);
+ args.fspec = devbuf;
+ result = mount(vfc ? vfc->vfc_index : MOUNT_UFS,
+ fs_name, mntflags, &args);
+ }
+ args.fspec = argv[0];
+ }
+ if (result == 0)
+ warnx("*** update /etc/fstab entry for %s to use %s ***",
+ fs_name, devbuf);
+ /* Try the mount as originally planned */
+ if ((result < 0) &&
+ (mount(vfc ? vfc->vfc_index : MOUNT_UFS, fs_name, mntflags, &args) < 0)) {
+#else
if (mount(vfc ? vfc->vfc_index : MOUNT_UFS, fs_name, mntflags, &args) < 0) {
+#endif
(void)fprintf(stderr, "%s on %s: ", args.fspec, fs_name);
switch (errno) {
case EMFILE:
[-- Attachment #4 --]
\\ Sometimes you're ahead, \\ Mike Smith
\\ sometimes you're behind. \\ mike@smith.net.au
\\ The race is long, and in the \\ msmith@freebsd.org
\\ end it's only with yourself. \\ msmith@cdrom.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803090336.TAA12799>
