retire nonsymbolic rootdev, dev2name
This commit is contained in:
parent
71d5865b10
commit
62aac7f191
9 changed files with 8 additions and 110 deletions
|
@ -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 \
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
PROG= dev2name
|
||||
BINDIR= /bin
|
||||
MAN=
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
/* Translate internal FS device number to a /dev/ name. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <minix/config.h>
|
||||
#include <minix/const.h>
|
||||
|
||||
#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 <major> <minor>\n"
|
||||
"%s <devicenumber>\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;
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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).
|
Loading…
Reference in a new issue