>>> Robert Swindells <r...@fdy2.co.uk> wrote > > "Michael van Elst" <mlelstv%netbsd.org@localhost> wrote: > >Module Name: src > >Committed By: mlelstv > >Date: Wed Nov 1 19:34:46 UTC 2017 > > > >Modified Files: > > src/sys/dev: files.dev > > src/sys/dev/ata: ata_raid_adaptec.c ata_raid_intel.c > > ata_raid_jmicron.c > > ata_raid_nvidia.c ata_raid_promise.c ata_raid_via.c wd.c wdvar.h > > > >Log Message: > >refactor wd and ataraid drivers to use common disk subroutines. > > Should this work if wedges are not being used ? > > Without any DKWEDGE_* options I now get: > > ... > opendisk: can't open dev wd0 (5) > opendisk: can't open dev wd0 (5) > opendisk: can't open dev wd0 (5) > boot device: <unknown> > root on wd0a dumps on wd0b > vfs_mountroot: can't open root device > cannot mount root, error = 5
errno 5 is EIO. This is why we check WDF_LOADED is not set and !RAW_PART or !S_IFCHR in wdopen(). WDF_LOADED is set only in wd_fistopen(), so we cannot open disks unless open with RAW_PART and S_IFCHR in the first time. Possible fix is remove useless check as follows or introduce WDF_OPEN if we want to mimic the sd(4). Index: wd.c =================================================================== RCS file: /cvsroot/src/sys/dev/ata/wd.c,v retrieving revision 1.434 diff -u -d -r1.434 wd.c --- wd.c 1 Nov 2017 19:34:46 -0000 1.434 +++ wd.c 3 Nov 2017 00:10:33 -0000 @@ -964,7 +964,7 @@ { struct wd_softc *wd; struct dk_softc *dksc; - int unit, part, error; + int unit, error; ATADEBUG_PRINT(("wdopen\n"), DEBUG_FUNCS); unit = WDUNIT(dev); @@ -976,20 +976,9 @@ if (! device_is_active(dksc->sc_dev)) return (ENODEV); - part = WDPART(dev); - if (wd->sc_capacity == 0) return (ENODEV); - /* - * If any partition is open, but the disk has been invalidated, - * disallow further opens. - */ - if ((wd->sc_flags & WDF_LOADED) == 0) { - if (part != RAW_PART || fmt != S_IFCHR) - return EIO; - } - error = dk_open(dksc, dev, flag, fmt, l); return error; -- Takeshi Nakayama