The file cache now has another init method that is called after the boot

device becomes available.
Currently, it opens the "launch_speedup" module (if available), later it
should consult a settings file for what to do.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13894 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-08-03 17:25:03 +00:00
parent 677abc798a
commit 95839f5c92
3 changed files with 18 additions and 4 deletions

View File

@ -44,6 +44,7 @@ extern void cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache,
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(mount_id mountID, vnode_id vnodeID, off_t offset, size_t size);
extern status_t file_cache_init_post_boot_device(void);
extern status_t file_cache_init(void);
extern vm_store *vm_create_vnode_store(void *vnode);

View File

@ -898,7 +898,7 @@ extern "C" void
cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache, mount_id mountID,
vnode_id parentID, vnode_id vnodeID, const char *name)
{
if (sCacheModule == NULL)
if (sCacheModule == NULL || sCacheModule->node_opened == NULL)
return;
off_t size = -1;
@ -916,7 +916,7 @@ extern "C" void
cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache,
mount_id mountID, vnode_id vnodeID)
{
if (sCacheModule == NULL)
if (sCacheModule == NULL || sCacheModule->node_closed == NULL)
return;
int32 accessType = 0;
@ -931,7 +931,7 @@ cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache,
extern "C" void
cache_node_launched(size_t argCount, char * const *args)
{
if (sCacheModule == NULL)
if (sCacheModule == NULL || sCacheModule->node_launched == NULL)
return;
sCacheModule->node_launched(argCount, args);
@ -939,10 +939,22 @@ cache_node_launched(size_t argCount, char * const *args)
extern "C" status_t
file_cache_init(void)
file_cache_init_post_boot_device(void)
{
// ToDo: get cache module out of driver settings
if (get_module("file_cache/launch_speedup/v1", (module_info **)&sCacheModule) == B_OK) {
dprintf("** opened launch speedup\n");
} else
dprintf("** could not open launch speedup!\n");
return B_OK;
}
extern "C" status_t
file_cache_init(void)
{
register_generic_syscall(CACHE_SYSCALLS, file_cache_control, 1, 0);
return B_OK;
}

View File

@ -2867,6 +2867,7 @@ vfs_mount_boot_file_system(kernel_args *args)
_kern_create_symlink(-1, path, "/boot", 0);
}
file_cache_init_post_boot_device();
return B_OK;
}