Re: New ofpath and yabootconfig: Added devfs support, PLEASE TEST
On Thu, May 24, 2001 at 03:16:28PM -0800, Ethan Benson wrote:
> On Thu, May 24, 2001 at 12:22:03PM -0700, Tom Rini wrote:
> > On Wed, May 23, 2001 at 11:18:58PM -0800, Ethan Benson wrote:
> > > On Wed, May 23, 2001 at 06:12:46PM -0700, Tom Rini wrote:
> > > >
> > > > Well, the problem is that my fstab has /dev/hda10, but df shows the
> > > > devfs name. I've (almost) got something done which will turn
> > > > /dev/ide/host0/bus0/target0/lun0/partX into /dev/hdaX and so on (at least
> > > > as much as we have OF aliases for).
> > >
> > > i am not opposed to ofpath supporting devfs, there are some criteria
> > > that MUST be met for me to accept a patch:
> >
> > Okay, I think I managed to meet all of these. Doesn't need anything
> > not already in use, should be nice and POSIX compliant, and makes devfs
> > look like 'standard', not the other way around.
> >
> > I'm not quite happy about how the translation for SCSI went, but that wasn't
> > something I could fix (since unlike IDE, /dev/sdb could be anywhere.)
>
> it appears that it requires devfsd to be running, i don't really care
> but some people might like it if you could convert the name without
> it...
I would too. I just couldn't think of any way to do that.
> i have made a couple changes to your patch, in fixdevfs() i changed
> all instances of $KERNDEV to $1 so that i can simply call it with an
> argument. i also redirect stderr to /dev/null for all the ls -l
> variables in the scsi part, this way if devfsd is not there i won't
> spew a dozen `No such file or directory' error messages. i also added
> a falloff else to that section informing the user that convertion
> failed.
Okay.
> i have not tested the devfs changes since i don't run devfs (or even
> 2.4 for that matter). i have uploaded new versions of both ofpath and
> yabootconfig, please test them on both devfs and *especially* devfs
> systems using both normal and devfs names. you must run the new
> ofpath with the new yabootconfig so you may need to move
> /usr/sbin/ofpath out of the way temporarily while you test.
> (yabootconfig resets PATH).
Okay, here's more patches to make devfs happy again. For getting the
PARTITION, is it a posix thing where ${KERNDEV##*[a-z]} won't work for
devfs? It was doing fine in pdksh.. The rest of the patch makes fixdevfs
happy to change /dev/.../disc into something too. I did it this was so you
can still do ofpath /dev/ide/.../partX and get back an alias.
I get the sneaking suspicion that if we have devfs but _not_ the new
devfs-style names, we need to know and treat it like a normal system.
--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
--- yabootconfig.orig Thu May 24 16:45:07 2001
+++ yabootconfig Thu May 24 17:05:23 2001
@@ -385,12 +385,7 @@
## of the whole disk.
KERNDEV="$(v=`df "$KERNEL" 2> /dev/null | grep ^/dev/` ; echo ${v%%[ ]*})"
KERNDIR="$(v=`df "$KERNEL" 2> /dev/null | grep ^/dev/` ; echo ${v##*[ ]})"
-
-if ckdevfs "$KERNDEV" ; then
- PARTITION="$(v=${KERNDEV##*/} ; echo ${v##*[a-z]})"
-else
- PARTITION="${KERNDEV##*[a-z]}"
-fi
+PARTITION="${KERNDEV##*[a-z]}"
if ckdevfs "$KERNDEV" ; then
KERNELDISK="${KERNDEV%/*}/disc"
--- /usr/sbin/ofpath.new-orig Thu May 24 16:46:08 2001
+++ /usr/sbin/ofpath Thu May 24 17:06:22 2001
@@ -534,16 +534,23 @@
## convert devfs names into normal short ones, written by Tom Rini.
fixdevfs()
{
+ # Find the disc. We do this encase we get handed /dev/.../partX
+ if [ "$(v=${device#/dev/*/lun*/} ; echo $v)" == "disc" ]; then
+ DISC=${1%disc}part
+ else
+ DISC=$1
+ fi
# Find the bus type
- TYPE=${1#/dev/}
+ TYPE=${DISC#/dev/}
TYPE=${TYPE%/host*}
+
# Partition number
- PARTNUM=${1#/dev/*/part}
+ PARTNUM=${DISC#/dev/*/part}
case "$TYPE" in
ide)
- DRIVE=${1#/dev/ide/}
+ DRIVE=${DISC#/dev/ide/}
DRIVE=${DRIVE%/bus*}
- BUS=${1#/dev/ide/host*/}
+ BUS=${DISC#/dev/ide/host*/}
BUS=${BUS%/target*}
case "$DRIVE" in
host0)
@@ -573,7 +580,7 @@
DEV=${DEV}$PARTNUM
;;
scsi)
- BASEDEV=${1#/dev/}
+ BASEDEV=${DISC#/dev/}
SDA=`ls -l /dev/sda$PARTNUM 2>/dev/null`
SDA=${SDA#l*> }
SDB=`ls -l /dev/sdb$PARTNUM 2>/dev/null`
Reply to: