* struct vnode is an opaque type now, removed void* where it was used incorrectly.

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22461 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-10-06 15:33:12 +00:00
parent 2caa43976d
commit 80f5469291
7 changed files with 448 additions and 499 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006, Haiku Inc. All Rights Reserved.
* Copyright 2002-2007, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -25,7 +25,7 @@ struct elf_image_info {
char *name;
image_id id;
int32 ref_count;
void *vnode;
struct vnode *vnode;
elf_region text_region;
elf_region data_region;
addr_t dynamic_section; // pointer to the dynamic section
+7 -7
View File
@@ -26,10 +26,10 @@
struct cache_module_info {
module_info info;
void (*node_opened)(void *vnode, int32 fdType, dev_t mountID, ino_t parentID,
ino_t vnodeID, const char *name, off_t size);
void (*node_closed)(void *vnode, int32 fdType, dev_t mountID, ino_t vnodeID,
int32 accessType);
void (*node_opened)(struct vnode *vnode, int32 fdType, dev_t mountID,
ino_t parentID, ino_t vnodeID, const char *name, off_t size);
void (*node_closed)(struct vnode *vnode, int32 fdType, dev_t mountID,
ino_t vnodeID, int32 accessType);
void (*node_launched)(size_t argCount, char * const *args);
};
@@ -37,12 +37,12 @@ struct cache_module_info {
extern "C" {
#endif
extern void cache_node_opened(void *vnode, int32 fdType, vm_cache *cache,
extern void cache_node_opened(struct vnode *vnode, int32 fdType, vm_cache *cache,
dev_t mountID, ino_t parentID, ino_t vnodeID, const char *name);
extern void cache_node_closed(void *vnode, int32 fdType, vm_cache *cache,
extern void cache_node_closed(struct vnode *vnode, int32 fdType, vm_cache *cache,
dev_t mountID, ino_t vnodeID);
extern void cache_node_launched(size_t argCount, char * const *args);
extern void cache_prefetch_vnode(void *vnode, off_t offset, size_t size);
extern void cache_prefetch_vnode(struct vnode *vnode, off_t offset, size_t size);
extern void cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size);
extern status_t file_cache_init_post_boot_device(void);
extern status_t file_cache_init(void);
+17 -15
View File
@@ -78,32 +78,34 @@ int vfs_getrlimit(int resource, struct rlimit * rlp);
int vfs_setrlimit(int resource, const struct rlimit * rlp);
/* calls needed by the VM for paging and by the file cache */
int vfs_get_vnode_from_fd(int fd, bool kernel, void **vnode);
status_t vfs_get_vnode_from_path(const char *path, bool kernel, void **vnode);
status_t vfs_get_vnode(dev_t mountID, ino_t vnodeID, void **_vnode);
int vfs_get_vnode_from_fd(int fd, bool kernel, struct vnode **_vnode);
status_t vfs_get_vnode_from_path(const char *path, bool kernel,
struct vnode **_vnode);
status_t vfs_get_vnode(dev_t mountID, ino_t vnodeID, struct vnode **_vnode);
status_t vfs_entry_ref_to_vnode(dev_t mountID, ino_t directoryID,
const char *name, void **_vnode);
void vfs_vnode_to_node_ref(void *_vnode, dev_t *_mountID, ino_t *_vnodeID);
const char *name, struct vnode **_vnode);
void vfs_vnode_to_node_ref(struct vnode *vnode, dev_t *_mountID,
ino_t *_vnodeID);
status_t vfs_lookup_vnode(dev_t mountID, ino_t vnodeID, void **_vnode);
void vfs_put_vnode(void *vnode);
void vfs_acquire_vnode(void *vnode);
status_t vfs_lookup_vnode(dev_t mountID, ino_t vnodeID, struct vnode **_vnode);
void vfs_put_vnode(struct vnode *vnode);
void vfs_acquire_vnode(struct vnode *vnode);
status_t vfs_get_cookie_from_fd(int fd, void **_cookie);
bool vfs_can_page(void *vnode, void *cookie);
status_t vfs_read_pages(void *vnode, void *cookie, off_t pos,
bool vfs_can_page(struct vnode *vnode, void *cookie);
status_t vfs_read_pages(struct vnode *vnode, void *cookie, off_t pos,
const iovec *vecs, size_t count, size_t *_numBytes, bool mayBlock,
bool fsReenter);
status_t vfs_write_pages(void *vnode, void *cookie, off_t pos,
status_t vfs_write_pages(struct vnode *vnode, void *cookie, off_t pos,
const iovec *vecs, size_t count, size_t *_numBytes, bool mayBlock,
bool fsReenter);
status_t vfs_get_vnode_cache(void *vnode, struct vm_cache **_cache,
status_t vfs_get_vnode_cache(struct vnode *vnode, struct vm_cache **_cache,
bool allocate);
status_t vfs_get_file_map( void *_vnode, off_t offset, size_t size,
status_t vfs_get_file_map(struct vnode *vnode, off_t offset, size_t size,
struct file_io_vec *vecs, size_t *_count);
status_t vfs_get_fs_node_from_path(dev_t mountID, const char *path,
bool kernel, void **_node);
status_t vfs_stat_vnode(void *_vnode, struct stat *stat);
status_t vfs_get_vnode_name(void *vnode, char *name, size_t nameSize);
status_t vfs_stat_vnode(struct vnode *vnode, struct stat *stat);
status_t vfs_get_vnode_name(struct vnode *vnode, char *name, size_t nameSize);
status_t vfs_get_cwd(dev_t *_mountID, ino_t *_vnodeID);
void vfs_unlock_vnode_if_locked(struct file_descriptor *descriptor);
status_t vfs_disconnect_vnode(dev_t mountID, ino_t vnodeID);
+7 -8
View File
@@ -62,8 +62,8 @@ struct file_map {
struct file_cache_ref {
vm_cache *cache;
void *vnode;
void *device;
struct vnode *vnode;
struct vnode *device;
void *cookie;
file_map map;
};
@@ -1063,7 +1063,7 @@ file_cache_control(const char *subsystem, uint32 function, void *buffer,
extern "C" void
cache_prefetch_vnode(void *vnode, off_t offset, size_t size)
cache_prefetch_vnode(struct vnode *vnode, off_t offset, size_t size)
{
vm_cache *cache;
if (vfs_get_vnode_cache(vnode, &cache, false) != B_OK)
@@ -1137,13 +1137,12 @@ out:
extern "C" void
cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size)
{
void *vnode;
// ToDo: schedule prefetch
TRACE(("cache_prefetch(vnode %ld:%Ld)\n", mountID, vnodeID));
// get the vnode for the object, this also grabs a ref to it
struct vnode *vnode;
if (vfs_get_vnode(mountID, vnodeID, &vnode) != B_OK)
return;
@@ -1153,8 +1152,8 @@ cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size)
extern "C" void
cache_node_opened(void *vnode, int32 fdType, vm_cache *cache, dev_t mountID,
ino_t parentID, ino_t vnodeID, const char *name)
cache_node_opened(struct vnode *vnode, int32 fdType, vm_cache *cache,
dev_t mountID, ino_t parentID, ino_t vnodeID, const char *name)
{
if (sCacheModule == NULL || sCacheModule->node_opened == NULL)
return;
@@ -1173,7 +1172,7 @@ cache_node_opened(void *vnode, int32 fdType, vm_cache *cache, dev_t mountID,
extern "C" void
cache_node_closed(void *vnode, int32 fdType, vm_cache *cache,
cache_node_closed(struct vnode *vnode, int32 fdType, vm_cache *cache,
dev_t mountID, ino_t vnodeID)
{
if (sCacheModule == NULL || sCacheModule->node_closed == NULL)
+2 -3
View File
@@ -1193,20 +1193,19 @@ load_kernel_add_on(const char *path)
struct Elf32_Ehdr *elfHeader;
struct elf_image_info *image;
const char *fileName;
void *vnode = NULL;
void *reservedAddress;
addr_t start;
size_t reservedSize;
status_t status;
int fd;
ssize_t length;
TRACE(("elf_load_kspace: entry path '%s'\n", path));
fd = _kern_open(-1, path, O_RDONLY, 0);
int fd = _kern_open(-1, path, O_RDONLY, 0);
if (fd < 0)
return fd;
struct vnode *vnode;
status = vfs_get_vnode_from_fd(fd, true, &vnode);
if (status < B_OK)
goto error0;
File diff suppressed because it is too large Load Diff
+4 -6
View File
@@ -1812,11 +1812,6 @@ _vm_map_file(team_id team, const char *name, void **_address, uint32 addressSpec
size_t size, uint32 protection, uint32 mapping, const char *path,
off_t offset, bool kernel)
{
vm_cache *cache;
vm_area *area;
void *vnode;
status_t status;
// ToDo: maybe attach to an FD, not a path (or both, like VFS calls)
// ToDo: check file access permissions (would be already done if the above were true)
// ToDo: for binary files, we want to make sure that they get the
@@ -1830,7 +1825,8 @@ _vm_map_file(team_id team, const char *name, void **_address, uint32 addressSpec
size = PAGE_ALIGN(size);
// get the vnode for the object, this also grabs a ref to it
status = vfs_get_vnode_from_path(path, kernel, &vnode);
struct vnode *vnode;
status_t status = vfs_get_vnode_from_path(path, kernel, &vnode);
if (status < B_OK)
return status;
@@ -1841,6 +1837,7 @@ _vm_map_file(team_id team, const char *name, void **_address, uint32 addressSpec
}
// ToDo: this only works for file systems that use the file cache
vm_cache *cache;
status = vfs_get_vnode_cache(vnode, &cache, false);
if (status < B_OK) {
vfs_put_vnode(vnode);
@@ -1849,6 +1846,7 @@ _vm_map_file(team_id team, const char *name, void **_address, uint32 addressSpec
mutex_lock(&cache->lock);
vm_area *area;
status = map_backing_store(locker.AddressSpace(), cache, _address,
offset, size, addressSpec, 0, protection, mapping, &area, name);