summaryrefslogtreecommitdiffstats
path: root/sys/miscfs
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1997-09-16 09:10:18 +0000
committerjulian <julian@FreeBSD.org>1997-09-16 09:10:18 +0000
commit35b575df346c55297cfc7dd21021aade4f39bf82 (patch)
treee253e5cd6a1d6d25f0c7fd08420876e15bb37440 /sys/miscfs
parent7d18d9665bc99443b6dc4cd95a950129eafb1767 (diff)
downloadFreeBSD-src-35b575df346c55297cfc7dd21021aade4f39bf82.zip
FreeBSD-src-35b575df346c55297cfc7dd21021aade4f39bf82.tar.gz
devfs changes to allow old (better) and newer (braindamaged) behaviour.
I'm going to try migrate back, while keeping the newer code.
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/devfs/devfs_tree.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/sys/miscfs/devfs/devfs_tree.c b/sys/miscfs/devfs/devfs_tree.c
index 798bfdd..8a17d01 100644
--- a/sys/miscfs/devfs/devfs_tree.c
+++ b/sys/miscfs/devfs/devfs_tree.c
@@ -1,8 +1,8 @@
-
+#define SPLIT_DEVS 1
/*
* Written by Julian Elischer (julian@DIALix.oz.au)
*
- * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.39 1997/09/07 13:49:56 bde Exp $
+ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.40 1997/09/07 16:20:50 bde Exp $
*/
#include "opt_devfs.h"
@@ -332,16 +332,18 @@ dev_add_name(char *name, dn_p dirnode, devnm_p back, dn_p dnp,
/***********************************************************************\
-* Add a new element to the devfs backing structure. *
+* Add a new element to the devfs plane. *
* *
-* Creates a new dev_node to go with it *
-* 'by' gives us info to make our node *
+* Creates a new dev_node to go with it if the prototype should not be *
+* reused. (Is a DIR, or we select SPLIT_DEVS at compile time) *
+* 'by' gives us info to make our node if we don't have a prototype. *
* If 'by is null and proto exists, then the 'by' field of *
-* the proto is used intead *
+* the proto is used intead in the CREATE case. *
* note the 'links' count is 0 (except if a dir) *
* but it is only cleared on a transition *
* so this is ok till we link it to something *
-* If the node already exists on the wanted plane, just return it *
+* Even in SPLIT_DEVS mode, *
+* if the node already exists on the wanted plane, just return it *
\***********************************************************************/
/*proto*/
int
@@ -351,6 +353,7 @@ dev_add_node(int entrytype, union typeinfo *by, dn_p proto,
dn_p dnp;
DBPRINT(("dev_add_node\n"));
+#if defined SPLIT_DEVS
/*
* If we have a prototype, then check if there is already a sibling
* on the mount plane we are looking at, if so, just return it.
@@ -367,6 +370,17 @@ dev_add_node(int entrytype, union typeinfo *by, dn_p proto,
if (by == NULL)
by = &(proto->by);
}
+#else /* SPLIT_DEVS */
+ if ( proto ) {
+ switch (proto->type) {
+ case DEV_BDEV:
+ case DEV_CDEV:
+ case DEV_DDEV:
+ *dn_pp = proto;
+ return 0;
+ }
+ }
+#endif /* SPLIT_DEVS */
if(!(dnp = (dn_p)malloc(sizeof(devnode_t),
M_DEVFSNODE, M_NOWAIT)))
{
@@ -666,14 +680,14 @@ dev_dup_entry(dn_p parent, devnm_p back, devnm_p *dnm_pp,
devnm_p newfront;
int error;
dn_p dnp = back->dnp;
- int type = back->dnp->type;
+ int type = dnp->type;
DBPRINT((" dev_dup_entry\n"));
/*
* go get the node made (if we need to)
* use the back one as a prototype
*/
- if ( error = dev_add_entry(back->name, parent, dnp->type,
+ if ( error = dev_add_entry(back->name, parent, type,
NULL, dnp,
parent?parent->dvm:dvm, &newnmp)) {
printf("duplicating %s failed\n",back->name);
@@ -692,7 +706,7 @@ dev_dup_entry(dn_p parent, devnm_p back, devnm_p *dnm_pp,
* subnodes in it....
* note that this time we don't pass on the mount info..
*/
- if ( newnmp->dnp->type == DEV_DIR)
+ if (type == DEV_DIR)
{
for(newback = back->dnp->by.Dir.dirlist;
newback; newback = newback->next)
OpenPOWER on IntegriCloud