* Cleanup, no functional change.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41118 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2011-03-26 20:23:21 +00:00
parent 2545ff58c1
commit 31cf5e520a
1 changed files with 113 additions and 115 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de. * Copyright 2002-2011, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@ -147,7 +147,7 @@ static status_t publish_device(struct devfs *fs, const char *path,
BaseDevice* device); BaseDevice* device);
/* the one and only allowed devfs instance */ // The one and only allowed devfs instance
static struct devfs* sDeviceFileSystem = NULL; static struct devfs* sDeviceFileSystem = NULL;
@ -274,7 +274,7 @@ static status_t
devfs_delete_vnode(struct devfs* fs, struct devfs_vnode* vnode, devfs_delete_vnode(struct devfs* fs, struct devfs_vnode* vnode,
bool forceDelete) bool forceDelete)
{ {
// cant delete it if it's in a directory or is a directory // Can't delete it if it's in a directory or is a directory
// and has children // and has children
if (!forceDelete && ((S_ISDIR(vnode->stream.type) if (!forceDelete && ((S_ISDIR(vnode->stream.type)
&& vnode->stream.u.dir.dir_head != NULL) && vnode->stream.u.dir.dir_head != NULL)
@ -867,7 +867,7 @@ dump_cookie(int argc, char** argv)
static status_t static status_t
devfs_mount(fs_volume* volume, const char* devfs, uint32 flags, devfs_mount(fs_volume* volume, const char* devfs, uint32 flags,
const char *args, ino_t *root_vnid) const char* args, ino_t* _rootNodeID)
{ {
struct devfs_vnode* vnode; struct devfs_vnode* vnode;
struct devfs* fs; struct devfs* fs;
@ -920,7 +920,7 @@ devfs_mount(fs_volume *volume, const char *devfs, uint32 flags,
hash_insert(fs->vnode_hash, vnode); hash_insert(fs->vnode_hash, vnode);
publish_vnode(volume, vnode->id, vnode, &kVnodeOps, vnode->stream.type, 0); publish_vnode(volume, vnode->id, vnode, &kVnodeOps, vnode->stream.type, 0);
*root_vnid = vnode->id; *_rootNodeID = vnode->id;
sDeviceFileSystem = fs; sDeviceFileSystem = fs;
return B_OK; return B_OK;
@ -1545,10 +1545,9 @@ devfs_ioctl(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, uint32 op,
case B_GET_PATH_FOR_DEVICE: case B_GET_PATH_FOR_DEVICE:
{ {
char path[256]; char path[256];
/* TODO: we might want to actually find the mountpoint // TODO: we might want to actually find the mountpoint
* of that instance of devfs... // of that instance of devfs...
* but for now we assume it's mounted on /dev // but for now we assume it's mounted on /dev
*/
strcpy(path, "/dev/"); strcpy(path, "/dev/");
get_device_name(vnode, path + 5, sizeof(path) - 5); get_device_name(vnode, path + 5, sizeof(path) - 5);
if (length && (length <= strlen(path))) if (length && (length <= strlen(path)))
@ -2113,17 +2112,16 @@ extern "C" status_t
devfs_rename_partition(const char* devicePath, const char* oldName, devfs_rename_partition(const char* devicePath, const char* oldName,
const char* newName) const char* newName)
{ {
status_t status;
devfs_vnode *device, *node;
if (oldName == NULL || newName == NULL) if (oldName == NULL || newName == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
status = get_node_for_path(sDeviceFileSystem, devicePath, &device); devfs_vnode* device;
status_t status = get_node_for_path(sDeviceFileSystem, devicePath, &device);
if (status != B_OK) if (status != B_OK)
return status; return status;
RecursiveLocker locker(sDeviceFileSystem->lock); RecursiveLocker locker(sDeviceFileSystem->lock);
node = devfs_find_in_dir(device->parent, oldName); devfs_vnode* node = devfs_find_in_dir(device->parent, oldName);
if (node == NULL) if (node == NULL)
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;