* 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:
@@ -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.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||||
@@ -25,7 +25,7 @@ struct elf_image_info {
|
|||||||
char *name;
|
char *name;
|
||||||
image_id id;
|
image_id id;
|
||||||
int32 ref_count;
|
int32 ref_count;
|
||||||
void *vnode;
|
struct vnode *vnode;
|
||||||
elf_region text_region;
|
elf_region text_region;
|
||||||
elf_region data_region;
|
elf_region data_region;
|
||||||
addr_t dynamic_section; // pointer to the dynamic section
|
addr_t dynamic_section; // pointer to the dynamic section
|
||||||
|
|||||||
@@ -26,10 +26,10 @@
|
|||||||
struct cache_module_info {
|
struct cache_module_info {
|
||||||
module_info info;
|
module_info info;
|
||||||
|
|
||||||
void (*node_opened)(void *vnode, int32 fdType, dev_t mountID, ino_t parentID,
|
void (*node_opened)(struct vnode *vnode, int32 fdType, dev_t mountID,
|
||||||
ino_t vnodeID, const char *name, off_t size);
|
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,
|
void (*node_closed)(struct vnode *vnode, int32 fdType, dev_t mountID,
|
||||||
int32 accessType);
|
ino_t vnodeID, int32 accessType);
|
||||||
void (*node_launched)(size_t argCount, char * const *args);
|
void (*node_launched)(size_t argCount, char * const *args);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -37,12 +37,12 @@ struct cache_module_info {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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);
|
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);
|
dev_t mountID, ino_t vnodeID);
|
||||||
extern void cache_node_launched(size_t argCount, char * const *args);
|
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 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_post_boot_device(void);
|
||||||
extern status_t file_cache_init(void);
|
extern status_t file_cache_init(void);
|
||||||
|
|||||||
@@ -78,32 +78,34 @@ int vfs_getrlimit(int resource, struct rlimit * rlp);
|
|||||||
int vfs_setrlimit(int resource, const struct rlimit * rlp);
|
int vfs_setrlimit(int resource, const struct rlimit * rlp);
|
||||||
|
|
||||||
/* calls needed by the VM for paging and by the file cache */
|
/* calls needed by the VM for paging and by the file cache */
|
||||||
int vfs_get_vnode_from_fd(int fd, bool kernel, 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, void **vnode);
|
status_t vfs_get_vnode_from_path(const char *path, bool kernel,
|
||||||
status_t vfs_get_vnode(dev_t mountID, ino_t vnodeID, void **_vnode);
|
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,
|
status_t vfs_entry_ref_to_vnode(dev_t mountID, ino_t directoryID,
|
||||||
const char *name, void **_vnode);
|
const char *name, struct vnode **_vnode);
|
||||||
void vfs_vnode_to_node_ref(void *_vnode, dev_t *_mountID, ino_t *_vnodeID);
|
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);
|
status_t vfs_lookup_vnode(dev_t mountID, ino_t vnodeID, struct vnode **_vnode);
|
||||||
void vfs_put_vnode(void *vnode);
|
void vfs_put_vnode(struct vnode *vnode);
|
||||||
void vfs_acquire_vnode(void *vnode);
|
void vfs_acquire_vnode(struct vnode *vnode);
|
||||||
status_t vfs_get_cookie_from_fd(int fd, void **_cookie);
|
status_t vfs_get_cookie_from_fd(int fd, void **_cookie);
|
||||||
bool vfs_can_page(void *vnode, void *cookie);
|
bool vfs_can_page(struct vnode *vnode, void *cookie);
|
||||||
status_t vfs_read_pages(void *vnode, void *cookie, off_t pos,
|
status_t vfs_read_pages(struct vnode *vnode, void *cookie, off_t pos,
|
||||||
const iovec *vecs, size_t count, size_t *_numBytes, bool mayBlock,
|
const iovec *vecs, size_t count, size_t *_numBytes, bool mayBlock,
|
||||||
bool fsReenter);
|
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,
|
const iovec *vecs, size_t count, size_t *_numBytes, bool mayBlock,
|
||||||
bool fsReenter);
|
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);
|
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);
|
struct file_io_vec *vecs, size_t *_count);
|
||||||
status_t vfs_get_fs_node_from_path(dev_t mountID, const char *path,
|
status_t vfs_get_fs_node_from_path(dev_t mountID, const char *path,
|
||||||
bool kernel, void **_node);
|
bool kernel, void **_node);
|
||||||
status_t vfs_stat_vnode(void *_vnode, struct stat *stat);
|
status_t vfs_stat_vnode(struct vnode *vnode, struct stat *stat);
|
||||||
status_t vfs_get_vnode_name(void *vnode, char *name, size_t nameSize);
|
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);
|
status_t vfs_get_cwd(dev_t *_mountID, ino_t *_vnodeID);
|
||||||
void vfs_unlock_vnode_if_locked(struct file_descriptor *descriptor);
|
void vfs_unlock_vnode_if_locked(struct file_descriptor *descriptor);
|
||||||
status_t vfs_disconnect_vnode(dev_t mountID, ino_t vnodeID);
|
status_t vfs_disconnect_vnode(dev_t mountID, ino_t vnodeID);
|
||||||
|
|||||||
+7
-8
@@ -62,8 +62,8 @@ struct file_map {
|
|||||||
|
|
||||||
struct file_cache_ref {
|
struct file_cache_ref {
|
||||||
vm_cache *cache;
|
vm_cache *cache;
|
||||||
void *vnode;
|
struct vnode *vnode;
|
||||||
void *device;
|
struct vnode *device;
|
||||||
void *cookie;
|
void *cookie;
|
||||||
file_map map;
|
file_map map;
|
||||||
};
|
};
|
||||||
@@ -1063,7 +1063,7 @@ file_cache_control(const char *subsystem, uint32 function, void *buffer,
|
|||||||
|
|
||||||
|
|
||||||
extern "C" void
|
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;
|
vm_cache *cache;
|
||||||
if (vfs_get_vnode_cache(vnode, &cache, false) != B_OK)
|
if (vfs_get_vnode_cache(vnode, &cache, false) != B_OK)
|
||||||
@@ -1137,13 +1137,12 @@ out:
|
|||||||
extern "C" void
|
extern "C" void
|
||||||
cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size)
|
cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size)
|
||||||
{
|
{
|
||||||
void *vnode;
|
|
||||||
|
|
||||||
// ToDo: schedule prefetch
|
// ToDo: schedule prefetch
|
||||||
|
|
||||||
TRACE(("cache_prefetch(vnode %ld:%Ld)\n", mountID, vnodeID));
|
TRACE(("cache_prefetch(vnode %ld:%Ld)\n", mountID, vnodeID));
|
||||||
|
|
||||||
// get the vnode for the object, this also grabs a ref to it
|
// 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)
|
if (vfs_get_vnode(mountID, vnodeID, &vnode) != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1153,8 +1152,8 @@ cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size)
|
|||||||
|
|
||||||
|
|
||||||
extern "C" void
|
extern "C" void
|
||||||
cache_node_opened(void *vnode, int32 fdType, vm_cache *cache, dev_t mountID,
|
cache_node_opened(struct vnode *vnode, int32 fdType, vm_cache *cache,
|
||||||
ino_t parentID, ino_t vnodeID, const char *name)
|
dev_t mountID, ino_t parentID, ino_t vnodeID, const char *name)
|
||||||
{
|
{
|
||||||
if (sCacheModule == NULL || sCacheModule->node_opened == NULL)
|
if (sCacheModule == NULL || sCacheModule->node_opened == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -1173,7 +1172,7 @@ cache_node_opened(void *vnode, int32 fdType, vm_cache *cache, dev_t mountID,
|
|||||||
|
|
||||||
|
|
||||||
extern "C" void
|
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)
|
dev_t mountID, ino_t vnodeID)
|
||||||
{
|
{
|
||||||
if (sCacheModule == NULL || sCacheModule->node_closed == NULL)
|
if (sCacheModule == NULL || sCacheModule->node_closed == NULL)
|
||||||
|
|||||||
@@ -1193,20 +1193,19 @@ load_kernel_add_on(const char *path)
|
|||||||
struct Elf32_Ehdr *elfHeader;
|
struct Elf32_Ehdr *elfHeader;
|
||||||
struct elf_image_info *image;
|
struct elf_image_info *image;
|
||||||
const char *fileName;
|
const char *fileName;
|
||||||
void *vnode = NULL;
|
|
||||||
void *reservedAddress;
|
void *reservedAddress;
|
||||||
addr_t start;
|
addr_t start;
|
||||||
size_t reservedSize;
|
size_t reservedSize;
|
||||||
status_t status;
|
status_t status;
|
||||||
int fd;
|
|
||||||
ssize_t length;
|
ssize_t length;
|
||||||
|
|
||||||
TRACE(("elf_load_kspace: entry path '%s'\n", path));
|
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)
|
if (fd < 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
|
struct vnode *vnode;
|
||||||
status = vfs_get_vnode_from_fd(fd, true, &vnode);
|
status = vfs_get_vnode_from_fd(fd, true, &vnode);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
goto error0;
|
goto error0;
|
||||||
|
|||||||
+409
-458
File diff suppressed because it is too large
Load Diff
@@ -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,
|
size_t size, uint32 protection, uint32 mapping, const char *path,
|
||||||
off_t offset, bool kernel)
|
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: 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: 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
|
// 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);
|
size = PAGE_ALIGN(size);
|
||||||
|
|
||||||
// get the vnode for the object, this also grabs a ref to it
|
// 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)
|
if (status < B_OK)
|
||||||
return status;
|
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
|
// ToDo: this only works for file systems that use the file cache
|
||||||
|
vm_cache *cache;
|
||||||
status = vfs_get_vnode_cache(vnode, &cache, false);
|
status = vfs_get_vnode_cache(vnode, &cache, false);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
vfs_put_vnode(vnode);
|
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);
|
mutex_lock(&cache->lock);
|
||||||
|
|
||||||
|
vm_area *area;
|
||||||
status = map_backing_store(locker.AddressSpace(), cache, _address,
|
status = map_backing_store(locker.AddressSpace(), cache, _address,
|
||||||
offset, size, addressSpec, 0, protection, mapping, &area, name);
|
offset, size, addressSpec, 0, protection, mapping, &area, name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user