1/* 2 * Copyright 2004-2008, 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/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 26struct cache_module_info { 27 module_info info; 28 29 void (*node_opened)(struct vnode *vnode, int32 fdType, dev_t mountID, 30 ino_t parentID, ino_t vnodeID, const char *name, off_t size); 31 void (*node_closed)(struct vnode *vnode, int32 fdType, dev_t mountID, 32 ino_t vnodeID, int32 accessType); 33 void (*node_launched)(size_t argCount, char * const *args); 34}; 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40extern void cache_node_opened(struct vnode *vnode, int32 fdType, VMCache *cache, 41 dev_t mountID, ino_t parentID, ino_t vnodeID, const char *name); 42extern void cache_node_closed(struct vnode *vnode, int32 fdType, VMCache *cache, 43 dev_t mountID, ino_t vnodeID); 44extern void cache_node_launched(size_t argCount, char * const *args); 45extern void cache_prefetch_vnode(struct vnode *vnode, off_t offset, size_t size); 46extern void cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size); 47 48extern status_t file_map_init(void); 49extern status_t file_cache_init_post_boot_device(void); 50extern status_t file_cache_init(void); 51 52#ifdef __cplusplus 53} 54#endif 55 56#endif /* _KRENEL_FILE_CACHE_H */ 57