Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jan 2002 13:05:43 -0800
From:      "Crist J . Clark" <cristjc@earthlink.net>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: conf/20436: Can't make only cd0 under 4.1-STABLE
Message-ID:  <20020110130543.A11553@blossom.cjclark.org>
In-Reply-To: <20020110235151.U12236-100000@gamplex.bde.org>; from bde@zeta.org.au on Fri, Jan 11, 2002 at 12:07:56AM %2B1100
References:  <200201100900.g0A903H39165@freefall.freebsd.org> <20020110235151.U12236-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 11, 2002 at 12:07:56AM +1100, Bruce Evans wrote:
> On Thu, 10 Jan 2002, Crist J . Clark wrote:
> 
> >  So... This make everyone happy?
> >
> >  Index: src/etc/MAKEDEV
> >  ===================================================================
> >  RCS file: /export/ncvs/src/etc/MAKEDEV,v
> >  retrieving revision 1.320
> >  diff -u -r1.320 MAKEDEV
> >  --- src/etc/MAKEDEV	27 Dec 2001 22:41:35 -0000	1.320
> >  +++ src/etc/MAKEDEV	10 Jan 2002 08:42:46 -0000
> >  @@ -831,7 +831,7 @@
> >   	scd*) units=`expr $i : '...\(.*\)'`; name=scd; chr=45;;
> >   	esac
> >   	if [ -z "${units}" -o "${units}" -le 0 ]; then
> >  -		units=1
> >  +		units=0
> >   	fi
> >   	if [ "${units}" -le 31 ]; then
> >   		i=0
> 
> No :).
> 
> (1) "sh MAKEDEV cdN" still makes N units numbered 0 to N-1 instead of unit
>     N like one would expect.

Actually, it makes devices 0 to N.

> (2) The bug is also in acd*t*.

Several other devices are made this way like the vty's. Then there are
some really weird unit numbers, like the pty's.

However, I could see going to only creating node 'N' since this is
what the HDD devices (da, ad) and even wcd and matcd do.

So if we are actually going to go an change this behavior,

Index: src/etc/MAKEDEV
===================================================================
RCS file: /export/ncvs/src/etc/MAKEDEV,v
retrieving revision 1.320
diff -u -r1.320 MAKEDEV
--- src/etc/MAKEDEV	27 Dec 2001 22:41:35 -0000	1.320
+++ src/etc/MAKEDEV	10 Jan 2002 21:02:38 -0000
@@ -792,32 +792,25 @@
 
 acd*t*)
 	umask $disk_umask
-	units=`expr $i : '...\(.*\)t'`;
+	unit=`expr $i : '...\(.*\)t'`;
 	tracks=`expr $i : '.*t\(.*\)'`;
 	name=acd;
 	chr=117;
-	if [ -z "${units}" -o "${units}" -le 0 ]; then
-		units=1
-	fi
 	if [ -z "${tracks}" -o "${tracks}" -le 0 ]; then
 		tracks=100
 	fi
-	if [ "${units}" -le 31 -a "${tracks}" -le 169 ]; then
-		i=0
-		while [ $i -le $units ]; do
-			dname=$name$i
-			rm -rf ${dname}t*
-			j=1
-			while [ $j -le ${tracks} ]; do
-				mknod ${dname}t$j c $chr \
-					$((($i * 8) + (65536 * $j))) \
-					root:operator
-				j=$(($j + 1))
-			done
-			i=$(($i + 1))
+	if [ "${unit}" -ge 0 -a "${unit}" -le 31 -a "${tracks}" -le 169 ]; then
+		dname=$name$unit
+		rm -rf ${dname}t*
+		j=1
+		while [ $j -le ${tracks} ]; do
+			mknod ${dname}t$j c $chr \
+				$((($unit * 8) + (65536 * $j))) \
+				root:operator
+			j=$(($j + 1))
 		done
 	else
-		echo "$i is invalid -- can't have more than 32 cd devices or 169 tracks"
+		echo "$unit is invalid -- can't have more than 32 cd devices or 169 tracks"
 	fi
 	umask 77
 	;;
@@ -825,27 +818,20 @@
 acd*|cd*|mcd*|scd*)
 	umask $disk_umask
 	case $i in
-	acd*) units=`expr $i : '...\(.*\)'`; name=acd; chr=117;;
-	cd*) units=`expr $i : '..\(.*\)'`; name=cd; chr=15;;
-	mcd*) units=`expr $i : '...\(.*\)'`; name=mcd; chr=29;;
-	scd*) units=`expr $i : '...\(.*\)'`; name=scd; chr=45;;
+	acd*) unit=`expr $i : '...\(.*\)'`; name=acd; chr=117;;
+	cd*) unit=`expr $i : '..\(.*\)'`; name=cd; chr=15;;
+	mcd*) unit=`expr $i : '...\(.*\)'`; name=mcd; chr=29;;
+	scd*) unit=`expr $i : '...\(.*\)'`; name=scd; chr=45;;
 	esac
-	if [ -z "${units}" -o "${units}" -le 0 ]; then
-		units=1
-	fi
-	if [ "${units}" -le 31 ]; then
-		i=0
-		while [ $i -le $units ]; do
-			dname=$name$i
-			rm -rf ${dname}[!t]* r${dname}*
-			mknod ${dname}a c $chr $(($i * 8)) root:operator
-			mknod ${dname}c c $chr $(($i * 8 + 2)) root:operator
-			ln -f ${dname}a r${dname}a
-			ln -f ${dname}c r${dname}c
-			i=$(($i + 1))
-		done
+	if [ "${unit}" -ge 0 -a "${unit}" -le 31 ]; then
+		dname=$name$unit
+		rm -rf ${dname}[!t]* r${dname}*
+		mknod ${dname}a c $chr $(($unit * 8)) root:operator
+		mknod ${dname}c c $chr $(($unit * 8 + 2)) root:operator
+		ln -f ${dname}a r${dname}a
+		ln -f ${dname}c r${dname}c
 	else
-		echo "$i is invalid -- can't have more than 32 cd devices"
+		echo "$unit is invalid -- can't have more than 32 cd devices"
 	fi
 	umask 77
 	;;

-- 
"It's always funny until someone gets hurt. Then it's hilarious."

Crist J. Clark                     |     cjclark@alum.mit.edu
                                   |     cjclark@jhu.edu
http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020110130543.A11553>