From: Ben Gras Date: Thu, 1 Nov 2012 18:40:56 +0000 (+0100) Subject: retire nonsymbolic rootdev, dev2name X-Git-Tag: v3.2.1~246 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/syslog.conf.5.html?a=commitdiff_plain;h=62aac7f191e39989004bec875344918f293b3e4a;p=minix.git retire nonsymbolic rootdev, dev2name --- diff --git a/commands/Makefile b/commands/Makefile index 9c00fdcae..c237994a0 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -6,7 +6,7 @@ SUBDIR= add_route arp ash at backup banner basename btrace cal \ cawf cd cdprobe cpp \ chmod chown ci cleantmp clear cmp co \ comm compress cp crc cron crontab cut \ - dd decomp16 DESCRIBE dev2name devmand devsize df dhcpd \ + dd decomp16 DESCRIBE devmand devsize df dhcpd \ dhrystone diff dirname diskctl dumpcore \ eject elvis env expand factor fbdctl \ find finger fingerd fix fold format fortune fsck.mfs \ diff --git a/commands/dev2name/Makefile b/commands/dev2name/Makefile deleted file mode 100644 index 797001247..000000000 --- a/commands/dev2name/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -PROG= dev2name -BINDIR= /bin -MAN= - -.include diff --git a/commands/dev2name/dev2name.c b/commands/dev2name/dev2name.c deleted file mode 100644 index 0e83357cd..000000000 --- a/commands/dev2name/dev2name.c +++ /dev/null @@ -1,54 +0,0 @@ - -/* Translate internal FS device number to a /dev/ name. */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define PATH_DEV "/dev" - -int -main(int argc, char *argv[]) -{ - DIR *dev; - struct dirent *e; - int dev_n; - if(argc <= 1 || argc > 3) { - fprintf(stderr, "Usage: \n" - "%s \n" - "%s \n", argv[0], argv[0]); - return 1; - } else if(argc == 2) dev_n = atoi(argv[1]); - else if(argc == 3) dev_n = (atoi(argv[1]) << MAJOR) | atoi(argv[2]); - - if(chdir(PATH_DEV) < 0) { - perror(PATH_DEV " chdir"); - return 1; - } - - if(!(dev=opendir("."))) { - perror(". in " PATH_DEV); - return 1; - } - - while((e=readdir(dev))) { - struct stat st; - if(stat(e->d_name, &st) < 0) { - continue; - } - if((st.st_mode & (S_IFBLK | S_IFCHR)) && dev_n == st.st_rdev) { - printf("%s/%s\n", PATH_DEV, e->d_name); - return 0; - } - } - - return 1; -} - diff --git a/drivers/ramdisk/Makefile b/drivers/ramdisk/Makefile index d0a6e58fe..d5a4ee9f8 100644 --- a/drivers/ramdisk/Makefile +++ b/drivers/ramdisk/Makefile @@ -8,7 +8,7 @@ install: all: PROG_DRIVERS=at_wini floppy pci -PROG_COMMANDS=cdprobe dev2name loadramdisk mount fsck.mfs sysenv sh \ +PROG_COMMANDS=cdprobe loadramdisk mount fsck.mfs sysenv sh \ service PROG_SERVERS=mfs procfs PROG_USRSBIN=pwd_mkdb diff --git a/drivers/ramdisk/proto b/drivers/ramdisk/proto index 555aebf7c..d11887884 100644 --- a/drivers/ramdisk/proto +++ b/drivers/ramdisk/proto @@ -3,7 +3,6 @@ boot d--755 0 0 bin d--755 0 0 cdprobe ---755 0 0 cdprobe - dev2name ---755 0 0 dev2name fsck.mfs ---755 0 0 fsck.mfs mount ---755 0 0 mount sh ---755 0 0 sh diff --git a/drivers/ramdisk/proto.small b/drivers/ramdisk/proto.small index 7389c70e9..001dee5b3 100644 --- a/drivers/ramdisk/proto.small +++ b/drivers/ramdisk/proto.small @@ -3,7 +3,6 @@ boot d--755 0 0 bin d--755 0 0 cdprobe ---755 0 0 cdprobe - dev2name ---755 0 0 dev2name loadramdisk ---755 0 0 loadramdisk mount ---755 0 0 mount sh ---755 0 0 sh diff --git a/drivers/ramdisk/rc b/drivers/ramdisk/rc index 67d177159..8cc64e14d 100644 --- a/drivers/ramdisk/rc +++ b/drivers/ramdisk/rc @@ -24,12 +24,9 @@ fi /bin/service up /sbin/procfs || echo "WARNING: couldn't start procfs" if /bin/sysenv rootdevname >/dev/null -then - rootdevname=/dev/`/bin/sysenv rootdevname` -else - rootdev=`/bin/sysenv rootdev` || echo 'No rootdev?' - rootdevname=`/bin/dev2name "$rootdev"` || - { echo 'No device name for root device'; exit 1; } +then rootdevname=/dev/`/bin/sysenv rootdevname` +else echo "rootdevname not set" + exit 1 fi if [ "`sysenv bin_img`" = 1 ] @@ -49,19 +46,11 @@ then loadramdisk "$cddev"p1 elif [ "$rootdevname" = "/dev/ram" ] then - if /bin/sysenv rootdevname >/dev/null - then - ramimagename=/dev/`/bin/sysenv ramimagename` - else - ramimagedev=`/bin/sysenv ramimagedev` || - { echo 'ramimagedev not found'; exit 1; } - ramimagename=`/bin/dev2name "$ramimagedev"` || - { echo 'No device name for ramimagedev'; exit 1; } - fi - + ramimagename=/dev/`/bin/sysenv ramimagename` echo "Loading ramdisk from $ramimagename" loadramdisk "$ramimagename" || echo "WARNING: loadramdisk failed" fi + echo "Root device name is $rootdevname" if [ -e $FSCK ] then $FSCK -p $rootdevname diff --git a/man/man1/Makefile b/man/man1/Makefile index 48c7371c2..b0563b34c 100644 --- a/man/man1/Makefile +++ b/man/man1/Makefile @@ -1,7 +1,7 @@ MAN= ash.1 at.1 banner.1 basename.1 \ bsfilt.1 cal.1 cawf.1 chgrp.1 \ chmod.1 cksum.1 clear.1 cmp.1 comm.1 compress.1 \ - cp.1 crc.1 crontab.1 ctags.1 dd.1 dev2name.1 \ + cp.1 crc.1 crontab.1 ctags.1 dd.1 \ df.1 dhrystone.1 dosdir.1 dosread.1 doswrite.1 \ dumpcore.1 echo.1 eject.1 elvis.1 elvrec.1 \ env.1 expand.1 expr.1 factor.1 \ diff --git a/man/man1/dev2name.1 b/man/man1/dev2name.1 deleted file mode 100644 index 13dcff7b6..000000000 --- a/man/man1/dev2name.1 +++ /dev/null @@ -1,30 +0,0 @@ -.TH DEV2NAME 1 -.SH NAME -dev2name \- obtain device name given its number -.SH SYNOPSIS -\fBdev2name\fR \fIdeviceno\fR -.br -\fBdev2name\fR \fImajor\fR \fIminor\fR -.br -.de FL -.TP -\\fB\\$1\\fR -\\$2 -.. -.SH OPTIONS -.TP 5 -.B \fImajor\fR -# Major device number for which to obtain device name -.TP 5 -.B \fIminor\fR -# Minor device number for which to obtain device name -.TP 5 -.B \fIdeviceno\fR -# Full device number for which to obtain device name (specifies the minor device number in the low-order byte and the major device number in the remainder) -.SH DESCRIPTION -.PP -This utility locates a file in \fB/dev\fR that represents the device with the specified major/minor device number and prints its name to the standard output. The exit code is zero if such a device is found and non-zero if no such device was found. -.SH "SEE ALSO" -.BR mknod (1), -.BR DESCRIBE (1), -.BR MAKEDEV (1).