1 /* 2 * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _KERNEL_FILE_CACHE_H 6 #define _KERNEL_FILE_CACHE_H 7 8 9 #include <vfs.h> 10 #include <vm_types.h> 11 #include <module.h> 12 13 14 // temporary/optional cache syscall API 15 #define CACHE_SYSCALLS "cache" 16 17 #define CACHE_CLEAR 1 // takes no parameters 18 #define CACHE_SET_MODULE 2 // gets the module name as parameter 19 20 #define CACHE_MODULES_NAME "file_cache" 21 22 #define FILE_CACHE_SEQUENTIAL_ACCESS 0x01 23 #define FILE_CACHE_LOADED_COMPLETELY 0x02 24 #define FILE_CACHE_NO_IO 0x04 25 26 struct cache_module_info { 27 module_info info; 28 29 void (*node_opened)(void *vnode, int32 fdType, mount_id mountID, vnode_id parentID, 30 vnode_id vnodeID, const char *name, off_t size); 31 void (*node_closed)(void *vnode, int32 fdType, mount_id mountID, vnode_id vnodeID, 32 int32 accessType); 33 void (*node_launched)(size_t argCount, char * const *args); 34 }; 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 extern void cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache, 41 mount_id mountID, vnode_id parentID, vnode_id vnodeID, const char *name); 42 extern void cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache, 43 mount_id mountID, vnode_id vnodeID); 44 extern void cache_node_launched(size_t argCount, char * const *args); 45 extern void cache_prefetch_vnode(void *vnode, off_t offset, size_t size); 46 extern void cache_prefetch(mount_id mountID, vnode_id vnodeID, off_t offset, size_t size); 47 extern status_t file_cache_init_post_boot_device(void); 48 extern status_t file_cache_init(void); 49 50 extern vm_store *vm_create_vnode_store(void *vnode); 51 52 #ifdef __cplusplus 53 } 54 #endif 55 56 #endif /* _KRENEL_FILE_CACHE_H */ 57