clean a few DEVFS things..

fix a bug where you couldn't place devices in the root directory
of devfs

remove deprecated routines

On my machine devfs now shows:
julian@erf.tfs.com:
julian@erf.tfs.com: ls -RF
bpf0            mem             ptypb           spkr            ttyp8
bpf1            null            ptypc           stderr          ttyp9
bpf2            pcaudio         ptypd           stdin           ttypa
bpf3            pcaudioctl      ptype           stdout          ttypb
console         pt              ptypf           tty             ttypc
cuaa0           ptyp0           random          ttyd0           ttypd
cuaia0          ptyp1           rsd0            ttyid0          ttype
cuala0          ptyp2           rsd1            ttyld0          ttypf
fd/             ptyp3           rvn             ttyp0           tun0
fd0.1440        ptyp4           rworm           ttyp1           urandom
fd1.1200        ptyp5           scsi/           ttyp2           vn
io              ptyp6           sd0             ttyp3           zero
kmem            ptyp7           sd1             ttyp4
lkm             ptyp8           snp0            ttyp5
log             ptyp9           snp1            ttyp6
lpt0            ptypa           snp2            ttyp7

./fd:
0       15      21      28      34      40      47      53      6       9
1       16      22      29      35      41      48      54      60
10      17      23      3       36      42      49      55      61
11      18      24      30      37      43      5       56      62
12      19      25      31      38      44      50      57      63
13      2       26      32      39      45      51      58      7
14      20      27      33      4       46      52      59      8

./scsi:
sctarg  ssc
julian@erf.tfs.com:

which is all devices really there except for disk slices/partitions..
(if I don't have it it's not there, which has GOT to be an improvement..)

no DEVFS fixes from device maintainers yet?
This commit is contained in:
Julian Elischer 1995-12-09 09:11:25 +00:00
parent d888004745
commit 4d92e19833
6 changed files with 41 additions and 128 deletions

View File

@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.73 1995/12/08 11:14:10 julian Exp $
* $Id: fd.c,v 1.74 1995/12/08 23:20:26 phk Exp $
*
*/
@ -714,7 +714,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"1.2MB (1200K) 5.25in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.1200",fdu);
sprintf(name,"rfd%d.1200",fdu);
#endif /* DEVFS */
break;
case RTCFDT_144M:
@ -723,7 +723,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"1.44MB (1440K) 3.5in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.1440",fdu);
sprintf(name,"rfd%d.1440",fdu);
#endif /* DEVFS */
break;
case RTCFDT_288M:
@ -733,7 +733,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"2.88MB (2880K) 3.5in floppy disk drive in 1.44 mode";
#ifdef DEVFS
sprintf(name,"fd%d.1440",fdu);
sprintf(name,"rfd%d.1440",fdu);
#endif /* DEVFS */
break;
case RTCFDT_360K:
@ -742,7 +742,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"360KB 5.25in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.360",fdu);
sprintf(name,"rfd%d.360",fdu);
#endif /* DEVFS */
break;
case RTCFDT_720K:
@ -751,14 +751,14 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"720KB 3.5in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.720",fdu);
sprintf(name,"rfd%d.720",fdu);
#endif /* DEVFS */
break;
default:
printf("unknown\n");
fd->type = NO_TYPE;
#ifdef DEVFS
sprintf(name,"fd%d.xxxx",fdu);
sprintf(name,"rfd%d.xxxx",fdu);
#endif /* DEVFS */
break;
}
@ -768,7 +768,7 @@ fdattach(struct isa_device *dev)
"/",name,&fd_cdevsw, fdu * 8,
DV_CHR,0,0,0644);
fd->fd_devfs_token = devfs_add_devsw(
"/",name, &fd_bdevsw, fdu * 8,
"/",name+1, &fd_bdevsw, fdu * 8,
DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {

View File

@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.73 1995/12/08 11:14:10 julian Exp $
* $Id: fd.c,v 1.74 1995/12/08 23:20:26 phk Exp $
*
*/
@ -714,7 +714,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"1.2MB (1200K) 5.25in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.1200",fdu);
sprintf(name,"rfd%d.1200",fdu);
#endif /* DEVFS */
break;
case RTCFDT_144M:
@ -723,7 +723,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"1.44MB (1440K) 3.5in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.1440",fdu);
sprintf(name,"rfd%d.1440",fdu);
#endif /* DEVFS */
break;
case RTCFDT_288M:
@ -733,7 +733,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"2.88MB (2880K) 3.5in floppy disk drive in 1.44 mode";
#ifdef DEVFS
sprintf(name,"fd%d.1440",fdu);
sprintf(name,"rfd%d.1440",fdu);
#endif /* DEVFS */
break;
case RTCFDT_360K:
@ -742,7 +742,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"360KB 5.25in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.360",fdu);
sprintf(name,"rfd%d.360",fdu);
#endif /* DEVFS */
break;
case RTCFDT_720K:
@ -751,14 +751,14 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"720KB 3.5in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.720",fdu);
sprintf(name,"rfd%d.720",fdu);
#endif /* DEVFS */
break;
default:
printf("unknown\n");
fd->type = NO_TYPE;
#ifdef DEVFS
sprintf(name,"fd%d.xxxx",fdu);
sprintf(name,"rfd%d.xxxx",fdu);
#endif /* DEVFS */
break;
}
@ -768,7 +768,7 @@ fdattach(struct isa_device *dev)
"/",name,&fd_cdevsw, fdu * 8,
DV_CHR,0,0,0644);
fd->fd_devfs_token = devfs_add_devsw(
"/",name, &fd_bdevsw, fdu * 8,
"/",name+1, &fd_bdevsw, fdu * 8,
DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {

View File

@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.73 1995/12/08 11:14:10 julian Exp $
* $Id: fd.c,v 1.74 1995/12/08 23:20:26 phk Exp $
*
*/
@ -714,7 +714,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"1.2MB (1200K) 5.25in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.1200",fdu);
sprintf(name,"rfd%d.1200",fdu);
#endif /* DEVFS */
break;
case RTCFDT_144M:
@ -723,7 +723,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"1.44MB (1440K) 3.5in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.1440",fdu);
sprintf(name,"rfd%d.1440",fdu);
#endif /* DEVFS */
break;
case RTCFDT_288M:
@ -733,7 +733,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"2.88MB (2880K) 3.5in floppy disk drive in 1.44 mode";
#ifdef DEVFS
sprintf(name,"fd%d.1440",fdu);
sprintf(name,"rfd%d.1440",fdu);
#endif /* DEVFS */
break;
case RTCFDT_360K:
@ -742,7 +742,7 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"360KB 5.25in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.360",fdu);
sprintf(name,"rfd%d.360",fdu);
#endif /* DEVFS */
break;
case RTCFDT_720K:
@ -751,14 +751,14 @@ fdattach(struct isa_device *dev)
kdc_fd[fdu].kdc_description =
"720KB 3.5in floppy disk drive";
#ifdef DEVFS
sprintf(name,"fd%d.720",fdu);
sprintf(name,"rfd%d.720",fdu);
#endif /* DEVFS */
break;
default:
printf("unknown\n");
fd->type = NO_TYPE;
#ifdef DEVFS
sprintf(name,"fd%d.xxxx",fdu);
sprintf(name,"rfd%d.xxxx",fdu);
#endif /* DEVFS */
break;
}
@ -768,7 +768,7 @@ fdattach(struct isa_device *dev)
"/",name,&fd_cdevsw, fdu * 8,
DV_CHR,0,0,0644);
fd->fd_devfs_token = devfs_add_devsw(
"/",name, &fd_bdevsw, fdu * 8,
"/",name+1, &fd_bdevsw, fdu * 8,
DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {

View File

@ -14,8 +14,6 @@ int dev_dup_entry(dn_p parent, devnm_p back, devnm_p *dnm_pp, struct devfsmount
void dev_free_name(devnm_p devnmp) /*proto*/;
int devfs_vntodn(struct vnode *vn_p, dn_p *dn_pp) /*proto*/;
int devfs_dntovn(dn_p dnp, struct vnode **vn_pp) /*proto*/;
int get_cdev_major_num(caddr_t addr) /*proto*/;
int get_bdev_major_num(caddr_t addr) /*proto*/;
int dev_add_entry(char *name, dn_p parent, int type, union typeinfo *by, devnm_p *nm_pp) /*proto*/ ;
int devfs_init(void) /*proto*/;
int devfs_mount( struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct proc *p) /*proto*/;

View File

@ -2,7 +2,7 @@
/*
* Written by Julian Elischer (julian@DIALix.oz.au)
*
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.9 1995/11/29 10:48:36 julian Exp $
* $Header: /u1/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.10 1995/12/08 11:17:33 julian Exp $
*/
#include "param.h"
@ -134,7 +134,19 @@ int dev_finddir(char *orig_path, dn_p dirnode, int create, dn_p *dn_pp) /*proto*
path = pathbuf;
strcpy(path,orig_path);
while(*path == '/') path++; /* always absolute, skip leading / */
/***************************************\
* always absolute, skip leading / *
* get rid of / or // or /// etc. *
\***************************************/
while(*path == '/') path++;
/***************************************\
* If nothing left, then parent was it.. *
\***************************************/
if ( *path == '\0' ) {
*dn_pp = dirnode;
return 0;
}
/***************************************\
* find the next segment of the name *
\***************************************/
@ -143,6 +155,7 @@ int dev_finddir(char *orig_path, dn_p dirnode, int create, dn_p *dn_pp) /*proto*
{
cp++;
}
/***********************************************\
* Check to see if it's the last component *
\***********************************************/
@ -838,48 +851,7 @@ DBPRINT(("(New vnode)"));
}
/***********************************************************************\
* UTILITY routine: *
* Return the major number for the cdevsw entry containing the given *
* address. *
\***********************************************************************/
int get_cdev_major_num(caddr_t addr) /*proto*/
{
int index = 0;
DBPRINT(("get_cdev_major_num\n"));
while (index < nchrdev)
{
if(((caddr_t)(cdevsw[index].d_open) == addr)
||((caddr_t)(cdevsw[index].d_read) == addr)
||((caddr_t)(cdevsw[index].d_ioctl) == addr))
{
return index;
}
index++;
}
return -1;
}
int get_bdev_major_num(caddr_t addr) /*proto*/
{
int index = 0;
DBPRINT(("get_bdev_major_num\n"));
while (index < nblkdev)
{
if(((caddr_t)(bdevsw[index].d_open) == addr)
||((caddr_t)(bdevsw[index].d_strategy) == addr)
||((caddr_t)(bdevsw[index].d_ioctl) == addr))
{
return index;
}
index++;
}
return -1;
}
/***********************************************************************\
* add a whole device, with not prototype.. make name element and node *
* add a whole device, with no prototype.. make name element and node *
\***********************************************************************/
int dev_add_entry(char *name, dn_p parent, int type, union typeinfo *by, devnm_p *nm_pp) /*proto*/
{
@ -957,53 +929,6 @@ void *devfs_add_devsw(char *path,
/***********************************************************************\
* Add the named device entry into the given directory, and make it *
* The appropriate type... (called (sometimes indirectly) by drivers..) *
\***********************************************************************/
void *dev_add(char *path,
char *name,
void *funct,
int minor,
int chrblk,
uid_t uid,
gid_t gid,
int perms)
{
devnm_p new_dev;
dn_p dnp; /* devnode for parent directory */
int retval;
int major ;
union typeinfo by;
DBPRINT(("dev_add\n"));
retval = dev_finddir(path,NULL,1,&dnp);
if (retval) return 0;
switch(chrblk)
{
case DV_CHR:
major = get_cdev_major_num(funct);
by.Cdev.cdevsw = cdevsw + major;
by.Cdev.dev = makedev(major, minor);
if( dev_add_entry(name, dnp, DEV_CDEV, &by,&new_dev))
return NULL;
break;
case DV_BLK:
major = get_bdev_major_num(funct);
by.Bdev.bdevsw = bdevsw + major;
by.Bdev.dev = makedev(major, minor);
if( dev_add_entry(name, dnp, DEV_BDEV, &by, &new_dev))
return NULL;
break;
default:
return NULL;
}
new_dev->dnp->gid = gid;
new_dev->dnp->uid = uid;
new_dev->dnp->mode |= perms;
return new_dev;
}
/***********************************************************************\
* Add the named device entry into the given directory, and make it *
* a link to the already created device given as an arg.. *
\***********************************************************************/
void *dev_link(char *path, char *name, void *original)

View File

@ -1,7 +1,7 @@
/* usual BSD style copyright here */
/* Written by Julian Elischer (julian@dialix.oz.au)*/
/*
* $Id: devfsext.h,v 1.3 1995/11/29 10:49:13 julian Exp $
* $Id: devfsext.h,v 1.4 1995/12/08 11:19:28 julian Exp $
*/
#ifndef _SYS_DEVFSECT_H_
@ -15,16 +15,6 @@ void *devfs_add_devsw(char *path,
gid_t gid,
int perms) ;
/* deprecated.. don't use.. */
void *dev_add(char *path,
char *name,
void *funct,
int minor,
int chrblk,
uid_t uid,
gid_t gid,
int perms) ;
void *dev_link(char *path,
char *name,
void *original); /* the result of a previous dev_link