-#if 0
-/***********************************************************************\
-* Given a starting node (0 for root) and a pathname, return the node *
-* for the end item on the path. It MUST BE A DIRECTORY. If the 'CREATE' *
-* option is true, then create any missing nodes in the path and create *
-* and return the final node as well. *
-* This is used to set up a directory, before making nodes in it.. *
-* *
-* Warning: This function is RECURSIVE. *
-\***********************************************************************/
-int
-dev_finddir(char * orig_path, /* find this dir (err if not dir) */
- devnode_t * dirnode, /* starting point */
- int create, /* create path? */
- devnode_t * * dn_pp) /* returned */
-{
- devdirent_t * dirent_p;
- devnode_t * dnp = NULL;
- char pathbuf[DEVMAXPATHSIZE];
- char *path;
- char *name;
- register char *cp;
- int retval;
-
-
- /***************************************\
- * If no parent directory is given *
- * then start at the root of the tree *
- \***************************************/
- if(!dirnode) dirnode = dev_root->de_dnp;
-
- /***************************************\
- * Sanity Checks *
- \***************************************/
- if (dirnode->dn_type != DEV_DIR) return ENOTDIR;
- if(strlen(orig_path) > (DEVMAXPATHSIZE - 1)) return ENAMETOOLONG;
-
-
- path = pathbuf;
- strcpy(path,orig_path);
-
- /***************************************\
- * 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 *
- \***************************************/
- cp = name = path;
- while((*cp != '/') && (*cp != 0)) {
- cp++;
- }
-
- /***********************************************\
- * Check to see if it's the last component *
- \***********************************************/
- if(*cp) {
- path = cp + 1; /* path refers to the rest */
- *cp = 0; /* name is now a separate string */
- if(!(*path)) {
- path = (char *)0; /* was trailing slash */
- }
- } else {
- path = NULL; /* no more to do */
- }
-
- /***************************************\
- * Start scanning along the linked list *
- \***************************************/
- dirent_p = dev_findname(dirnode,name);
- if(dirent_p) { /* check it's a directory */
- dnp = dirent_p->de_dnp;
- if(dnp->dn_type != DEV_DIR) return ENOTDIR;
- } else {
- /***************************************\
- * The required element does not exist *
- * So we will add it if asked to. *
- \***************************************/
- if(!create) return ENOENT;
-
- if((retval = dev_add_entry(name, dirnode,
- DEV_DIR, NULL, NULL, NULL,
- &dirent_p)) != 0) {
- return retval;
- }
- dnp = dirent_p->de_dnp;
- devfs_propogate(dirnode->dn_typeinfo.Dir.myname,dirent_p);
- }
- if(path != NULL) { /* decide whether to recurse more or return */
- return (dev_finddir(path,dnp,create,dn_pp));
- } else {
- *dn_pp = dnp;
- return 0;
- }
-}
-#endif 0
-/***********************************************************************\
-* Given a starting node (0 for root) and a pathname, return the node *
-* for the end item on the path. It MUST BE A DIRECTORY. If the 'CREATE' *
-* option is true, then create any missing nodes in the path and create *
-* and return the final node as well. *
-* This is used to set up a directory, before making nodes in it.. *
-\***********************************************************************/
-/* proto */
-int
-dev_finddir(char * path,