* create_vnode() now panicks when it could not find the freshly created vnode

in the vnode hash; that's a bug in the FS that shouldn't be ignored that way.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21262 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-05-28 14:17:18 +00:00
parent aac3ed8c03
commit f415aa28be
+20 -21
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2006, Axel Dörfler, [email protected]. * Copyright 2002-2007, Axel Dörfler, [email protected].
* 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.
@@ -3550,16 +3550,16 @@ vfs_init(kernel_args *args)
} }
// #pragma mark - // #pragma mark - fd_ops implementations
// The filetype-dependent implementations (fd_ops + open/create/rename/remove, ...)
/** Calls fs_open() on the given vnode and returns a new /*!
* file descriptor for it Calls fs_open() on the given vnode and returns a new
*/ file descriptor for it
*/
static int static int
create_vnode(struct vnode *directory, const char *name, int openMode, int perms, bool kernel) create_vnode(struct vnode *directory, const char *name, int openMode,
int perms, bool kernel)
{ {
struct vnode *vnode; struct vnode *vnode;
fs_cookie cookie; fs_cookie cookie;
@@ -3569,7 +3569,8 @@ create_vnode(struct vnode *directory, const char *name, int openMode, int perms,
if (FS_CALL(directory, create) == NULL) if (FS_CALL(directory, create) == NULL)
return EROFS; return EROFS;
status = FS_CALL(directory, create)(directory->mount->cookie, directory->private_node, name, openMode, perms, &cookie, &newID); status = FS_CALL(directory, create)(directory->mount->cookie,
directory->private_node, name, openMode, perms, &cookie, &newID);
if (status < B_OK) if (status < B_OK)
return status; return status;
@@ -3578,8 +3579,9 @@ create_vnode(struct vnode *directory, const char *name, int openMode, int perms,
mutex_unlock(&sVnodeMutex); mutex_unlock(&sVnodeMutex);
if (vnode == NULL) { if (vnode == NULL) {
dprintf("vfs: fs_create() returned success but there is no vnode!\n"); panic("vfs: fs_create() returned success but there is no vnode, mount ID %ld!\n",
return EINVAL; directory->device);
return B_BAD_VALUE;
} }
if ((status = get_new_fd(FDTYPE_FILE, NULL, vnode, cookie, openMode, kernel)) >= 0) if ((status = get_new_fd(FDTYPE_FILE, NULL, vnode, cookie, openMode, kernel)) >= 0)
@@ -3597,10 +3599,10 @@ create_vnode(struct vnode *directory, const char *name, int openMode, int perms,
} }
/** Calls fs_open() on the given vnode and returns a new /*!
* file descriptor for it Calls fs_open() on the given vnode and returns a new
*/ file descriptor for it
*/
static int static int
open_vnode(struct vnode *vnode, int openMode, bool kernel) open_vnode(struct vnode *vnode, int openMode, bool kernel)
{ {
@@ -5232,8 +5234,7 @@ query_rewind(struct file_descriptor *descriptor)
} }
// #pragma mark - // #pragma mark - General File System functions
// General File System functions
static dev_t static dev_t
@@ -5877,8 +5878,7 @@ err:
} }
// #pragma mark - // #pragma mark - kernel mirrored syscalls
// Calls from within the kernel
dev_t dev_t
@@ -6560,8 +6560,7 @@ _kern_setcwd(int fd, const char *path)
} }
// #pragma mark - // #pragma mark - userland syscalls
// Calls from userland (with extra address checks)
dev_t dev_t