Improved capabilities of the file cache modules.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11209 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-02-02 06:30:07 +00:00
parent 3af4214aeb
commit 92ce7b918a
2 changed files with 33 additions and 10 deletions

View File

@ -682,28 +682,46 @@ out:
extern "C" void
cache_node_opened(vm_cache_ref *cache, mount_id mountID, vnode_id vnodeID)
cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache, mount_id mountID,
vnode_id parentID, vnode_id vnodeID, const char *name)
{
if (cache == NULL)
if (sCacheModule == NULL)
return;
file_cache_ref *ref = (file_cache_ref *)((vnode_store *)cache->cache->store)->file_cache_ref;
off_t size = -1;
if (cache != NULL) {
file_cache_ref *ref = (file_cache_ref *)((vnode_store *)cache->cache->store)->file_cache_ref;
if (ref != NULL)
size = ref->cache->cache->virtual_size;
}
if (ref != NULL && sCacheModule != NULL)
sCacheModule->node_opened(mountID, vnodeID, ref->cache->cache->virtual_size);
sCacheModule->node_opened(vnode, fdType, mountID, parentID, vnodeID, name, size);
}
extern "C" void
cache_node_closed(vm_cache_ref *cache, mount_id mountID, vnode_id vnodeID)
cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache,
mount_id mountID, vnode_id vnodeID)
{
if (cache == NULL)
if (sCacheModule == NULL)
return;
file_cache_ref *ref = (file_cache_ref *)((vnode_store *)cache->cache->store)->file_cache_ref;
int32 accessType = 0;
if (cache != NULL) {
// ToDo: set accessType
}
if (ref != NULL && sCacheModule != NULL)
sCacheModule->node_closed(mountID, vnodeID);
sCacheModule->node_closed(vnode, fdType, mountID, vnodeID, accessType);
}
extern "C" void
cache_node_launched(size_t argCount, char * const *args)
{
if (sCacheModule == NULL)
return;
sCacheModule->node_launched(argCount, args);
}

View File

@ -25,6 +25,7 @@
#include <kernel.h>
#include <vm.h>
#include <vfs.h>
#include <file_cache.h>
#include <sys/wait.h>
#include <string.h>
@ -1014,6 +1015,8 @@ load_image_etc(int32 argCount, char **args, int32 envCount, char **env, int32 pr
if (err < B_OK)
goto err3;
cache_node_launched(argCount, args);
// cut the path from the main thread name
threadName = strrchr(args[0], '/');
if (threadName != NULL)
@ -1099,6 +1102,8 @@ exec_team(int32 argCount, char **args, int32 envCount, char **env)
remove_images(team);
vfs_exec_io_context(team->io_context);
cache_node_launched(argCount, args);
// rename the team
strlcpy(team->name, args[0], B_OS_NAME_LENGTH);