summaryrefslogtreecommitdiffstats
path: root/sys/miscfs
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-12-09 09:11:25 +0000
committerjulian <julian@FreeBSD.org>1995-12-09 09:11:25 +0000
commit024d9b147e9d37cff49c3a8d3bb49524f8e92591 (patch)
tree34f9b606ff29b54150992119d72901fdf34ff07b /sys/miscfs
parent9212ef9542fbb04967c6f2fbffbea5a5f679cbda (diff)
downloadFreeBSD-src-024d9b147e9d37cff49c3a8d3bb49524f8e92591.zip
FreeBSD-src-024d9b147e9d37cff49c3a8d3bb49524f8e92591.tar.gz
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?
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/devfs/devfs_proto.h2
-rw-r--r--sys/miscfs/devfs/devfs_tree.c107
2 files changed, 16 insertions, 93 deletions
diff --git a/sys/miscfs/devfs/devfs_proto.h b/sys/miscfs/devfs/devfs_proto.h
index 01dd194..e8571e8 100644
--- a/sys/miscfs/devfs/devfs_proto.h
+++ b/sys/miscfs/devfs/devfs_proto.h
@@ -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*/;
diff --git a/sys/miscfs/devfs/devfs_tree.c b/sys/miscfs/devfs/devfs_tree.c
index 6f32322..746305e 100644
--- a/sys/miscfs/devfs/devfs_tree.c
+++ b/sys/miscfs/devfs/devfs_tree.c
@@ -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)
OpenPOWER on IntegriCloud