mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
devfs changes to allow old (better) and newer (braindamaged) behaviour.
I'm going to try migrate back, while keeping the newer code.
This commit is contained in:
parent
c6850a7698
commit
72963672f5
1 changed files with 24 additions and 10 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue