Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/sys Pull up following revision(s) (requested by tsutsui i...
details: https://anonhg.NetBSD.org/src/rev/3c4d4b5af275
branches: netbsd-6
changeset: 774307:3c4d4b5af275
user: riz <riz%NetBSD.org@localhost>
date: Thu Jul 05 17:36:31 2012 +0000
description:
Pull up following revision(s) (requested by tsutsui in ticket #395):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.95
sys/arch/atari/atari/autoconf.c: revision 1.62
sys/dev/md.c: revision 1.67
Add a dirty hack for atari's ancient installation ramdisk:
Forcibly configure md0, md1, and md2 devices before setroot()
for atari's traditional "auto-load from floppy on open" md_root device
which loads installation ramdisk image from floppy.
md(4) has been changed dynamically configured at first open after 5.0
and md devices won't appear in "root device:" prompt without this hack.
Tested on TT030.
Should be pulled up to netbsd-6.
Make sure that disklabel of md(4) device is initialized
in the case where it's configured in MD md_open_hook().
Without this, msdosfs_mountfs() (which is called from msdosfs_mountroot())
will be called with uninitialized disklabel (d_secsize == 0) and
it gets "panic: buf mem pool index 23" later on atari.
This is because getdisksize() doesn't check returned d_secsize value
and msdosfs_mountfs() blindly calls bread(9) with size==0 in that case.
Should be pulled up to netbsd-6 (at least for atari).
Add a sanity check if secsize returned from getdisksize() isn't bogus.
This prevent possible panic "panic: buf mem pool index 23" later in
vfs_bio.c:buf_mempoolidx().
(I'm not sure if it's okay for getdisksize() to assume that
partinfo taken from DIOCGPART is properly initialized
on all disk(9) devices or not)
See also:
http://mail-index.NetBSD.org/source-changes/2012/06/30/msg035298.html
diffstat:
sys/arch/atari/atari/autoconf.c | 48 +++++++++++++++++++++++++++++++++++++++-
sys/dev/md.c | 11 +++++++-
sys/fs/msdosfs/msdosfs_vfsops.c | 6 ++--
3 files changed, 58 insertions(+), 7 deletions(-)
diffs (147 lines):
diff -r 7bead0d753c6 -r 3c4d4b5af275 sys/arch/atari/atari/autoconf.c
--- a/sys/arch/atari/atari/autoconf.c Thu Jul 05 17:33:59 2012 +0000
+++ b/sys/arch/atari/atari/autoconf.c Thu Jul 05 17:36:31 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.61 2011/06/05 17:09:18 matt Exp $ */
+/* $NetBSD: autoconf.c,v 1.61.8.1 2012/07/05 17:36:31 riz Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.61 2011/06/05 17:09:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.61.8.1 2012/07/05 17:36:31 riz Exp $");
+
+#include "opt_md.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -41,10 +43,17 @@
#include <sys/device.h>
#include <sys/disklabel.h>
#include <sys/disk.h>
+#include <sys/malloc.h>
#include <machine/disklabel.h>
#include <machine/cpu.h>
#include <atari/atari/device.h>
+#if defined(MEMORY_DISK_HOOKS)
+#include <dev/md.h>
+#endif
+
+#include "ioconf.h"
+
static void findroot(void);
int mbmatch(device_t, cfdata_t, void *);
void mbattach(device_t, device_t, void *);
@@ -75,6 +84,41 @@
{
findroot();
+#if defined(MEMORY_DISK_HOOKS)
+ /*
+ * XXX
+ * quick hacks for atari's traditional "auto-load from floppy on open"
+ * installation md(4) ramdisk.
+ * See sys/arch/atari/dev/md_root.c for details.
+ */
+#define RAMD_NDEV 3 /* XXX */
+
+ if ((boothowto & RB_ASKNAME) != 0) {
+ int md_major, i;
+ dev_t md_dev;
+ cfdata_t cf;
+ struct md_softc *sc;
+
+ md_major = devsw_name2blk("md", NULL, 0);
+ if (md_major >= 0) {
+ for (i = 0; i < RAMD_NDEV; i++) {
+ md_dev = MAKEDISKDEV(md_major, i, RAW_PART);
+ cf = malloc(sizeof(*cf), M_DEVBUF,
+ M_ZERO|M_WAITOK);
+ if (cf == NULL)
+ break; /* XXX */
+ cf->cf_name = md_cd.cd_name;
+ cf->cf_atname = md_cd.cd_name;
+ cf->cf_unit = i;
+ cf->cf_fstate = FSTATE_STAR;
+ /* XXX mutex */
+ sc = device_private(config_attach_pseudo(cf));
+ if (sc == NULL)
+ break; /* XXX */
+ }
+ }
+ }
+#endif
setroot(booted_device, booted_partition);
}
diff -r 7bead0d753c6 -r 3c4d4b5af275 sys/dev/md.c
--- a/sys/dev/md.c Thu Jul 05 17:33:59 2012 +0000
+++ b/sys/dev/md.c Thu Jul 05 17:36:31 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.66 2010/11/25 08:53:30 hannken Exp $ */
+/* $NetBSD: md.c,v 1.66.14.1 2012/07/05 17:36:31 riz Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.66 2010/11/25 08:53:30 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.66.14.1 2012/07/05 17:36:31 riz Exp $");
#ifdef _KERNEL_OPT
#include "opt_md.h"
@@ -243,6 +243,9 @@
cfdata_t cf;
struct md_softc *sc;
struct disk *dk;
+#ifdef MEMORY_DISK_HOOKS
+ bool configured;
+#endif
mutex_enter(&md_device_lock);
unit = MD_UNIT(dev);
@@ -274,7 +277,11 @@
#ifdef MEMORY_DISK_HOOKS
/* Call the open hook to allow loading the device. */
+ configured = (sc->sc_type != MD_UNCONFIGURED);
md_open_hook(unit, &sc->sc_md);
+ /* initialize disklabel if the device is configured in open hook */
+ if (!configured && sc->sc_type != MD_UNCONFIGURED)
+ md_set_disklabel(sc);
#endif
/*
diff -r 7bead0d753c6 -r 3c4d4b5af275 sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c Thu Jul 05 17:33:59 2012 +0000
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c Thu Jul 05 17:36:31 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msdosfs_vfsops.c,v 1.93 2011/11/14 18:35:13 hannken Exp $ */
+/* $NetBSD: msdosfs_vfsops.c,v 1.93.6.1 2012/07/05 17:36:31 riz Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.93 2011/11/14 18:35:13 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.93.6.1 2012/07/05 17:36:31 riz Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -491,7 +491,7 @@
goto error_exit;
error = getdisksize(devvp, &psize, &secsize);
- if (error) {
+ if (error || secsize == 0) {
if (argp->flags & MSDOSFSMNT_GEMDOSFS)
goto error_exit;
Home |
Main Index |
Thread Index |
Old Index