Added a basic unpublishing function for drivers, not yet tested, though (and even

though it looks so simple, I see no reason why it shouldn't work 8-)).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16906 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-03-28 00:13:44 +00:00
parent 2828c4d1d7
commit 065aa7f66c
2 changed files with 13 additions and 2 deletions

View File

@ -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);

View File

@ -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)
{