Date: Tue, 2 May 1995 07:51:37 -0400 (EDT) From: Peter Dufault <dufault@hda.com> To: bde@zeta.org.au (Bruce Evans) Cc: current@FreeBSD.org, joerg@FreeBSD.org Subject: opening dead devices and slices Message-ID: <199505021151.HAA26220@hda.com> In-Reply-To: <199505020515.PAA21076@godzilla.zeta.org.au> from "Bruce Evans" at May 2, 95 03:15:44 pm
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans writes: > > >The problem in question is: > > >sd1(bt0:1:0): MEDIUM ERROR asc:31,0 Medium format corrupted field replaceable unit: 31 > >, retries:4 > >... > >sd1: error reading primary partition table reading fsbn 0 (sd1 bn 0; cn 0 tn 0 sn 0) > > > >...a chicken-and-egg problem. How to format a disk that is not > >accessible since its not formatted properly? > > There will have to be no such thing as an error in xdopen(whole_disk_dev) > (again :-(). There will have to be verbose error messages instead :-). > > Why don't we have O_IOCTLONLY or O_NOACCESS access modes? Because of permissions issues? I like having the ability to protect the ioctl-only devices using the usual permissions. Plus I've never heard of O_IOCTLONLY mode :). Joerg's suggestion for O_NONBLOCK is reasonable if you read the SCSI spec: "If O_NONBLOCK is set: The open() shall return without waiting for the device to be ready or available. Subsequent behavior of the device is device-specific". I've made this change locally in scsiconf.h and want to commit it; is there anyway we can make it play with slices? /* Device number fields: * * NON-FIXED SCSI devices: * * FC?? ???? ???? ???? MMMMMMMM mmmmmmmm * * F: Fixed device (nexus in number): must be 0. * C: Control device; only user mode ioctl is supported. * ?: Don't know; those bits didn't use to exist, currently always 0. * M: Major device number. * m: Old style minor device number. * * FIXED SCSI devices: * * XXX Conflicts with the slice code. Maybe the slice code can be * changed to respect the F bit? * * FC?? ?BBB TTTT ?LLL MMMMMMMM mmmmmmmm * * F: Fixed device (nexus in number); must be 1. * C: Control device; only user mode ioctl is supported. * B: SCSI bus * T: SCSI target ID * L: Logical unit * M: Major device number * m: Old style minor device number. */ #define SCSI_FIXED(DEV) (((DEV) & 0x80000000) >> 31) #define SCSI_CONTROL(DEV) (((DEV) & 0x40000000) >> 30) #define SCSI_BUS(DEV) (((DEV) & 0x07000000) >> 24) #define SCSI_ID(DEV) (((DEV) & 0x00F00000) >> 20) #define SCSI_LUN(DEV) (((DEV) & 0x00070000) >> 16) #define SCSI_MKFIXED(B, T, L) ( \ ((B) << 24) | \ ((T) << 20) | \ ((L) << 16) | \ ( 1 << 31) ) -- Peter Dufault Real Time Machine Control and Simulation HD Associates, Inc. Voice: 508 433 6936 dufault@hda.com Fax: 508 433 5267
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505021151.HAA26220>