From 025b3675029d788f419e8497a2f8659c70ab6700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 3 Apr 2008 08:24:50 +0000 Subject: [PATCH] * Renamed publish_node() to new_node(). * Introduced a new publish_node() which then actually publishs the node, similar to the VFS's new_vnode(), and publish_vnode() semantics. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24762 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/fs/devfs.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/system/kernel/fs/devfs.cpp b/src/system/kernel/fs/devfs.cpp index bdf3f6f9c2..81df8cd365 100644 --- a/src/system/kernel/fs/devfs.cpp +++ b/src/system/kernel/fs/devfs.cpp @@ -1176,7 +1176,7 @@ out: static status_t -publish_node(struct devfs *fs, const char *path, struct devfs_vnode **_node, +new_node(struct devfs *fs, const char *path, struct devfs_vnode **_node, struct devfs_vnode **_dir) { ASSERT_LOCKED_MUTEX(&fs->lock); @@ -1242,7 +1242,7 @@ publish_node(struct devfs *fs, const char *path, struct devfs_vnode **_node, vnode->stream.u.dir.dir_head = NULL; list_init(&vnode->stream.u.dir.cookies); - hash_insert(sDeviceFileSystem->vnode_hash, vnode); + hash_insert(fs->vnode_hash, vnode); devfs_insert_in_dir(dir, vnode); } else { // this is the last component @@ -1265,6 +1265,14 @@ out: } +static void +publish_node(devfs *fs, devfs_vnode *dirNode, struct devfs_vnode *node) +{ + hash_insert(fs->vnode_hash, node); + devfs_insert_in_dir(dirNode, node); +} + + static status_t publish_device(struct devfs *fs, const char *path, device_node_info *deviceNode, pnp_devfs_driver_info *info, driver_entry *driver, device_hooks *ops, @@ -1300,7 +1308,7 @@ publish_device(struct devfs *fs, const char *path, device_node_info *deviceNode, RecursiveLocker locker(&fs->lock); - status = publish_node(fs, path, &node, &dirNode); + status = new_node(fs, path, &node, &dirNode); if (status != B_OK) return status; @@ -1330,8 +1338,7 @@ publish_device(struct devfs *fs, const char *path, device_node_info *deviceNode, } // the node is now fully valid and we may insert it into the dir - hash_insert(sDeviceFileSystem->vnode_hash, node); - devfs_insert_in_dir(dirNode, node); + publish_node(fs, dirNode, node); return B_OK; } @@ -1803,7 +1810,7 @@ devfs_open(fs_volume _fs, fs_vnode _vnode, int openMode, fs_cookie *_cookie) // TODO: we might want to check if the current node does still exist // (it should fail in the driver's open(), though, if it doesn't) if (driver != NULL - && (driver->devices_used == 0) + && driver->devices_used == 0 && (driver->image < 0 || driver->binary_updated)) { status = reload_driver(driver); if (status < B_OK) @@ -2889,7 +2896,7 @@ devfs_publish_file_device(const char *path, const char *filePath) RecursiveLocker locker(&sDeviceFileSystem->lock); - status = publish_node(sDeviceFileSystem, path, &node, &dirNode); + status = new_node(sDeviceFileSystem, path, &node, &dirNode); if (status != B_OK) return status; @@ -2899,8 +2906,7 @@ devfs_publish_file_device(const char *path, const char *filePath) node->stream.u.symlink.length = strlen(filePath); // the node is now fully valid and we may insert it into the dir - hash_insert(sDeviceFileSystem->vnode_hash, node); - devfs_insert_in_dir(dirNode, node); + publish_node(sDeviceFileSystem, dirNode, node); return B_OK; }