rem: dir = thedevfs->root_vnode;
add: dir = gDeviceFileSystem->root_vnode;
context: devfs_publish_device(const char *path, void *ident, device_hooks *calls){	int err = 0;	int i, last;	char temp[SYS_MAX_PATH_LEN+1];	struct devfs_vnode *dir;	struct devfs_vnode *v;	bool at_leaf;	TRACE(("devfs_publish_device: entry path '%s', hooks 0x%x\n", path, calls));	if (!thedevfs) {		panic("devfs_publish_device called before devfs mounted\n");		return ERR_GENERAL;	}	// copy the path over to a temp buffer so we can munge it	strncpy(temp, path, SYS_MAX_PATH_LEN);	temp[SYS_MAX_PATH_LEN] = 0;	mutex_lock(&thedevfs->lock);	// create the path leading to the device	// parse the path passed in, stripping out '/'	dir = thedevfs->root_vnode;	v = NULL;	i = 0;	last = 0;	at_leaf = false;	for(;;) {		if(temp[i] == 0) {			at_leaf = true; // we'll be done after this one		} else if(temp[i] == '/') {			temp[i] = 0;			i++;		} else {			i++;			continue;		}		TRACE(("\tpath component '%s'\n", &temp[last]));		// we have a path component		v = devfs_find_in_dir(dir, &temp[last]);		if (v) {			if(!at_leaf) {				// we are not at the leaf of the path, so as long as				// this is a dir we're okay				if(v->stream.type == STREAM_TYPE_DIR) {					last = i;					dir = v;					continue;				}			}			// we are at the leaf and hit another node			// or we aren't but hit a non-dir node.			// we're screwed			err = ERR_VFS_ALREADY_EXISTS;			goto err;		} else {			v = devfs_create_vnode(thedevfs, &temp[last]);			if(!v) {				err = ENOMEM;				goto err;			}		}		// set up the new vnode		if (at_leaf) {			// this is the last component			v->stream.type = STREAM_TYPE_DEVICE;			v->stream.u.dev.ident = ident;			v->stream.u.dev.calls = calls;		} else {			// this is a dir			v->stream.type = STREAM_TYPE_DIR;			v->stream.u.dir.dir_head = NULL;			v->stream.u.dir.jar_head = NULL;		}		hash_insert(thedevfs->vnode_list_hash, v);		devfs_insert_in_dir(dir, v);		if (at_leaf)			break;		last = i;		dir = v;	}err:	mutex_unlock(&thedevfs->lock);	return err;}