more devfs cleanups..

if this keeps simplifying there won't be any left :)
This commit is contained in:
Julian Elischer 1995-09-06 09:29:19 +00:00
parent 7212976732
commit a8ea97ec7f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10582
5 changed files with 29 additions and 22 deletions

View file

@ -1,19 +1,19 @@
/* THIS FILE PRODUCED AUTOMATICALLY */ /* THIS FILE PRODUCED AUTOMATICALLY */
void devfs_sinit() /*proto*/; void devfs_sinit() /*proto*/;
int dev_finddir(char *orig_path, dn_p dirnode, int create, dn_p *dn_pp) /*proto*/; int dev_finddir(char *orig_path, dn_p dirnode, int create, dn_p *dn_pp) /*proto*/;
int dev_add_node(char *name, dn_p dirnode, int entrytype, union typeinfo *by, devnm_p *devnm_pp) /*proto*/; int dev_add_node(char *name, dn_p dirnode,devnm_p back, int entrytype, union typeinfo *by, devnm_p *devnm_pp) /*proto*/;
int dev_remove(devnm_p devbp) /*proto*/; int dev_remove(devnm_p devnmp) /*proto*/;
int dev_touch(devnm_p key) /* update the node for this dev */ /*proto*/; int dev_touch(devnm_p key) /* update the node for this dev */ /*proto*/;
void devfs_dn_free(dn_p dnp) /*proto*/; void devfs_dn_free(dn_p dnp) /*proto*/;
int get_cdev_major_num(caddr_t addr) /*proto*/; int get_cdev_major_num(caddr_t addr) /*proto*/;
int get_bdev_major_num(caddr_t addr) /*proto*/; int get_bdev_major_num(caddr_t addr) /*proto*/;
int devfs_add_fronts(devnm_p parent,devnm_p child) /*proto*/; int devfs_add_fronts(devnm_p parent,devnm_p child) /*proto*/;
dn_p dev_findfront(dn_p dir,char *name) /*proto*/; dn_p dev_findname(dn_p dir,char *name) /*proto*/;
int dev_mk_front(dn_p parent,devnm_p back,devnm_p *devnm_pp , struct devfsmount *dvm) /*proto*/; int dev_mk_front(dn_p parent, devnm_p back, devnm_p *dnm_pp, struct devfsmount *dvm) /*proto*/;
int devfs_make_plane(struct devfsmount *devfs_mp_p) /*proto*/; int devfs_make_plane(struct devfsmount *devfs_mp_p) /*proto*/;
void devfs_free_plane(struct devfsmount *devfs_mp_p) /*proto*/; void devfs_free_plane(struct devfsmount *devfs_mp_p) /*proto*/;
void devfs_remove_fronts(devnm_p devbp) /*proto*/; void devfs_remove_fronts(devnm_p devnmp) /*proto*/;
void dev_free_front(devnm_p devfp) /*proto*/; void dev_free_name(devnm_p devnmp) /*proto*/;
int devfs_vntodn(struct vnode *vn_p, dn_p *dn_pp) /*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 devfs_dntovn(dn_p dnp, struct vnode **vn_pp) /*proto*/;
int devfs_init(void) /*proto*/; int devfs_init(void) /*proto*/;

View file

@ -2,7 +2,7 @@
/* /*
* Written by Julian Elischer (julian@DIALix.oz.au) * Written by Julian Elischer (julian@DIALix.oz.au)
* *
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_front.c,v 1.5 1995/09/03 08:39:26 julian Exp $ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.1 1995/09/06 08:26:51 julian Exp $
*/ */
#include "param.h" #include "param.h"
@ -40,10 +40,13 @@ void devfs_sinit() /*proto*/
* call the right routine at the right time with the right args.... * call the right routine at the right time with the right args....
*/ */
retval = dev_add_node("root",NULL,NULL,DEV_DIR,NULL,&dev_root); retval = dev_add_node("root",NULL,NULL,DEV_DIR,NULL,&dev_root);
#ifdef PARANOID
if(retval) panic("devfs_sinit: dev_add_node failed ");
#endif
devfs_hidden_mount = (struct mount *)malloc(sizeof(struct mount), devfs_hidden_mount = (struct mount *)malloc(sizeof(struct mount),
M_MOUNT,M_NOWAIT); M_MOUNT,M_NOWAIT);
#ifdef PARANOID #ifdef PARANOID
if(!devfs_hidden_mount) panic("devfs-main-mount: malloc failed"); if(!devfs_hidden_mount) panic("devfs_sinit: malloc failed");
#endif #endif
bzero(devfs_hidden_mount,sizeof(struct mount)); bzero(devfs_hidden_mount,sizeof(struct mount));
devfs_mount(devfs_hidden_mount,"dummy",NULL,NULL,NULL); devfs_mount(devfs_hidden_mount,"dummy",NULL,NULL,NULL);
@ -176,7 +179,6 @@ int dev_add_node(char *name, dn_p dirnode,devnm_p back, int entrytype, union typ
dnp = dev_findname(dirnode,name); dnp = dev_findname(dirnode,name);
if(dnp) /* if we actually found it.. */ if(dnp) /* if we actually found it.. */
return(EEXIST); return(EEXIST);
dnp = NULL; /*just want the return code..*/
} }
/* /*
* make sure the name is legal * make sure the name is legal
@ -291,9 +293,11 @@ int dev_add_node(char *name, dn_p dirnode,devnm_p back, int entrytype, union typ
/* inherrit our parent's mount info */ /* inherrit our parent's mount info */
if(dirnode) { if(dirnode) {
dnp->dvm = dirnode->dvm; dnp->dvm = dirnode->dvm;
if(!dnp->dvm) printf("parent had null dvm ");
} }
} else { } else {
dnp = back->dnp; dnp = back->dnp;
if(!dnp->dvm) printf("node has null dvm ");
} }
/* /*

View file

@ -1,7 +1,7 @@
/* /*
* Written by Julian Elischer (julian@DIALix.oz.au) * Written by Julian Elischer (julian@DIALix.oz.au)
* *
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vfsops.c,v 1.3 1995/05/30 08:06:52 rgrimes Exp $ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vfsops.c,v 1.4 1995/09/03 05:43:42 julian Exp $
* *
* *
*/ */
@ -70,10 +70,14 @@ DBPRINT(("mount "));
* as best we can with whatever we can think of at the time * as best we can with whatever we can think of at the time
*/ */
devfs_mp_p = (struct devfsmount *)mp->mnt_data; devfs_mp_p = (struct devfsmount *)mp->mnt_data;
if(devfs_up_and_going) {
copyinstr(path, (caddr_t)mp->mnt_stat.f_mntonname, copyinstr(path, (caddr_t)mp->mnt_stat.f_mntonname,
sizeof(mp->mnt_stat.f_mntonname)-1, &size); sizeof(mp->mnt_stat.f_mntonname)-1, &size);
bzero(mp->mnt_stat.f_mntonname + size, bzero(mp->mnt_stat.f_mntonname + size,
sizeof(mp->mnt_stat.f_mntonname) - size); sizeof(mp->mnt_stat.f_mntonname) - size);
} else {
bcopy("dummy_mount", (caddr_t)mp->mnt_stat.f_mntonname,12);
}
bzero(mp->mnt_stat.f_mntfromname , MNAMELEN ); bzero(mp->mnt_stat.f_mntfromname , MNAMELEN );
bcopy("devfs",mp->mnt_stat.f_mntfromname, 5); bcopy("devfs",mp->mnt_stat.f_mntfromname, 5);
(void)devfs_statfs(mp, &mp->mnt_stat, p); (void)devfs_statfs(mp, &mp->mnt_stat, p);
@ -137,7 +141,6 @@ DBPRINT(("unmount "));
/* return the address of the root vnode in *vpp */ /* return the address of the root vnode in *vpp */
int devfs_root(struct mount *mp, struct vnode **vpp) /*proto*/ int devfs_root(struct mount *mp, struct vnode **vpp) /*proto*/
{ {
struct denode *ndep;
struct devfsmount *devfs_mp_p = (struct devfsmount *)(mp->mnt_data); struct devfsmount *devfs_mp_p = (struct devfsmount *)(mp->mnt_data);
DBPRINT(("root ")); DBPRINT(("root "));

View file

@ -1,7 +1,7 @@
/* /*
* Written by Julian Elischer (julian@DIALix.oz.au) * Written by Julian Elischer (julian@DIALix.oz.au)
* *
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.7 1995/09/02 07:09:01 julian Exp $ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.8 1995/09/04 00:20:30 dyson Exp $
* *
* symlinks can wait 'til later. * symlinks can wait 'til later.
*/ */
@ -174,7 +174,7 @@ DBPRINT(("errr, maybe not cached "));
heldchar = cnp->cn_nameptr[cnp->cn_namelen]; heldchar = cnp->cn_nameptr[cnp->cn_namelen];
cnp->cn_nameptr[cnp->cn_namelen] = '\0'; cnp->cn_nameptr[cnp->cn_namelen] = '\0';
new_node = dev_findfront(dir_node,cnp->cn_nameptr); new_node = dev_findname(dir_node,cnp->cn_nameptr);
cnp->cn_nameptr[cnp->cn_namelen] = heldchar; cnp->cn_nameptr[cnp->cn_namelen] = heldchar;
if(new_node) if(new_node)
{ {

View file

@ -1,3 +1,4 @@
#define DEVFS_DEBUG 1
#ifdef DEVFS_DEBUG #ifdef DEVFS_DEBUG
#define DBPRINT(A) printf(A) #define DBPRINT(A) printf(A)
#else #else
@ -7,11 +8,13 @@
/* /*
* Written by Julian Elischer (julian@DIALIX.oz.au) * Written by Julian Elischer (julian@DIALIX.oz.au)
* *
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfsdefs.h,v 1.3 1995/05/03 23:06:31 julian Exp $ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfsdefs.h,v 1.4 1995/05/30 08:06:55 rgrimes Exp $
*/ */
/* first a couple of defines for compatibility with inodes */ /* first a couple of defines for compatibility with inodes */
#define M_DEVFSNAME M_DEVFSBACK
#define ISUID 04000 /* set user identifier when exec'ing */ #define ISUID 04000 /* set user identifier when exec'ing */
#define ISGID 02000 /* set group identifier when exec'ing */ #define ISGID 02000 /* set group identifier when exec'ing */
#define ISVTX 01000 /* save execution information on exit */ #define ISVTX 01000 /* save execution information on exit */
@ -132,21 +135,18 @@ struct dev_name
union { union {
struct { struct {
devnm_p aliases; /* aliase chain (kill with us)*/ devnm_p aliases; /* aliase chain (kill with us)*/
int alias_count; /* # 'alias' nodes for us. */
} back; } back;
struct { struct {
devnm_p realthing; /* ptr to the backing node */ devnm_p realthing; /* ptr to the backing node */
devnm_p file_node; /* our file node */
} front; } front;
} as; } as;
/*-----------------------the front-back chain-------------*/ /*-----------------------the front-back chain-------------*/
devnm_p next_front; /* the linked list of all our front nodes */ devnm_p next_front; /* the linked list of all our front nodes */
devnm_p *prev_frontp; /* the end of the front node chain */ devnm_p *prev_frontp; /* the end of the front node chain */
int frontcount; /* number of front nodes that reference us*/
}; };
typedef struct dev_name devnm_t; typedef struct dev_name devnm_t;
extern int devfs_up_and_going;
extern devnm_p dev_root; extern devnm_p dev_root;