diff --git a/headers/private/kernel/fs/devfs.h b/headers/private/kernel/fs/devfs.h index 2f854ad8e0..10d1e173ef 100644 --- a/headers/private/kernel/fs/devfs.h +++ b/headers/private/kernel/fs/devfs.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -24,6 +24,7 @@ status_t devfs_publish_file_device(const char *path, const char *filePath); status_t devfs_unpublish_partition(const char *path); status_t devfs_publish_partition(const char *path, const partition_info *info); +status_t devfs_unpublish_device(const char *path); status_t devfs_publish_device(const char *path, void *ident, device_hooks *calls); status_t devfs_publish_directory(const char *path); diff --git a/src/system/kernel/fs/devfs.cpp b/src/system/kernel/fs/devfs.cpp index 9d80d758fc..437ef8a6d1 100644 --- a/src/system/kernel/fs/devfs.cpp +++ b/src/system/kernel/fs/devfs.cpp @@ -387,7 +387,7 @@ devfs_delete_vnode(struct devfs *fs, struct devfs_vnode *vnode, bool force_delet if (!force_delete && ((S_ISDIR(vnode->stream.type) && vnode->stream.u.dir.dir_head != NULL) || vnode->dir_next != NULL)) - return EPERM; + return B_NOT_ALLOWED; // remove it from the global hash table hash_remove(fs->vnode_hash, vnode); @@ -396,6 +396,8 @@ devfs_delete_vnode(struct devfs *fs, struct devfs_vnode *vnode, bool force_delet // for partitions, we have to release the raw device if (vnode->stream.u.dev.partition) put_vnode(fs->id, vnode->stream.u.dev.partition->raw_device->id); + else + delete vnode->stream.u.dev.scheduler; // remove API conversion from old to new drivers if (vnode->stream.u.dev.node == NULL) @@ -2114,6 +2116,14 @@ devfs_publish_partition(const char *path, const partition_info *info) } +extern "C" status_t +devfs_unpublish_device(const char *path) +{ + // TODO: disconnect any open file handles! + return unpublish_node(sDeviceFileSystem, path, S_IFCHR); +} + + extern "C" status_t devfs_publish_device(const char *path, void *obsolete, device_hooks *ops) {