* Merged vm_cache_ref and vm_cache to a single structure (Axel & Ingo).
* Renamed vm_cache.c to vm_cache.cpp git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21642 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -37,9 +37,9 @@ struct cache_module_info {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void cache_node_opened(void *vnode, int32 fdType, vm_cache_ref *cache,
|
||||
extern void cache_node_opened(void *vnode, int32 fdType, vm_cache *cache,
|
||||
dev_t mountID, ino_t parentID, ino_t vnodeID, const char *name);
|
||||
extern void cache_node_closed(void *vnode, int32 fdType, vm_cache_ref *cache,
|
||||
extern void cache_node_closed(void *vnode, int32 fdType, vm_cache *cache,
|
||||
dev_t mountID, ino_t vnodeID);
|
||||
extern void cache_node_launched(size_t argCount, char * const *args);
|
||||
extern void cache_prefetch_vnode(void *vnode, off_t offset, size_t size);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#define MAX_NODE_MONITORS 65536
|
||||
|
||||
struct kernel_args;
|
||||
struct vm_cache_ref;
|
||||
struct vm_cache;
|
||||
struct file_descriptor;
|
||||
struct selectsync;
|
||||
struct pollfd;
|
||||
@@ -91,7 +91,7 @@ status_t vfs_read_pages(void *vnode, void *cookie, off_t pos,
|
||||
const iovec *vecs, size_t count, size_t *_numBytes, bool fsReenter);
|
||||
status_t vfs_write_pages(void *vnode, void *cookie, off_t pos,
|
||||
const iovec *vecs, size_t count, size_t *_numBytes, bool fsReenter);
|
||||
status_t vfs_get_vnode_cache(void *vnode, struct vm_cache_ref **_cache, bool allocate);
|
||||
status_t vfs_get_vnode_cache(void *vnode, struct vm_cache **_cache, bool allocate);
|
||||
status_t vfs_get_file_map( void *_vnode, off_t offset, size_t size,
|
||||
struct file_io_vec *vecs, size_t *_count);
|
||||
status_t vfs_get_fs_node_from_path(dev_t mountID, const char *path,
|
||||
|
||||
@@ -55,6 +55,8 @@ area_id vm_map_physical_memory(team_id team, const char *name, void **address,
|
||||
area_id vm_map_file(team_id aid, const char *name, void **address,
|
||||
uint32 addressSpec, addr_t size, uint32 protection, uint32 mapping,
|
||||
const char *path, off_t offset);
|
||||
vm_cache *vm_area_get_locked_cache(vm_area *area);
|
||||
void vm_area_put_locked_cache(vm_cache *cache);
|
||||
area_id vm_create_null_area(team_id team, const char *name, void **address,
|
||||
uint32 addressSpec, addr_t size);
|
||||
area_id vm_copy_area(team_id team, const char *name, void **_address,
|
||||
@@ -63,7 +65,7 @@ area_id vm_clone_area(team_id team, const char *name, void **address,
|
||||
uint32 addressSpec, uint32 protection, uint32 mapping,
|
||||
area_id sourceArea);
|
||||
status_t vm_delete_area(team_id aid, area_id id);
|
||||
status_t vm_create_vnode_cache(void *vnode, vm_cache_ref **_cacheRef);
|
||||
status_t vm_create_vnode_cache(void *vnode, vm_cache **_cache);
|
||||
vm_area *vm_area_lookup(vm_address_space *addressSpace, addr_t address);
|
||||
status_t vm_set_area_memory_type(area_id id, addr_t physicalBase, uint32 type);
|
||||
status_t vm_get_page_mapping(team_id team, addr_t vaddr, addr_t *paddr);
|
||||
|
||||
@@ -21,19 +21,18 @@ extern "C" {
|
||||
|
||||
status_t vm_cache_init(struct kernel_args *args);
|
||||
vm_cache *vm_cache_create(vm_store *store);
|
||||
status_t vm_cache_ref_create(vm_cache *cache, bool acquireLock);
|
||||
void vm_cache_acquire_ref(vm_cache_ref *cache_ref);
|
||||
void vm_cache_release_ref(vm_cache_ref *cache_ref);
|
||||
vm_page *vm_cache_lookup_page(vm_cache_ref *cacheRef, off_t page);
|
||||
void vm_cache_insert_page(vm_cache_ref *cacheRef, vm_page *page, off_t offset);
|
||||
void vm_cache_remove_page(vm_cache_ref *cacheRef, vm_page *page);
|
||||
void vm_cache_remove_consumer(vm_cache_ref *cacheRef, vm_cache *consumer);
|
||||
void vm_cache_add_consumer_locked(vm_cache_ref *cacheRef, vm_cache *consumer);
|
||||
status_t vm_cache_write_modified(vm_cache_ref *ref, bool fsReenter);
|
||||
status_t vm_cache_set_minimal_commitment_locked(vm_cache_ref *ref, off_t commitment);
|
||||
status_t vm_cache_resize(vm_cache_ref *cacheRef, off_t newSize);
|
||||
status_t vm_cache_insert_area_locked(vm_cache_ref *cacheRef, vm_area *area);
|
||||
status_t vm_cache_remove_area(vm_cache_ref *cacheRef, vm_area *area);
|
||||
void vm_cache_acquire_ref(vm_cache *cache);
|
||||
void vm_cache_release_ref(vm_cache *cache);
|
||||
vm_page *vm_cache_lookup_page(vm_cache *cache, off_t page);
|
||||
void vm_cache_insert_page(vm_cache *cache, vm_page *page, off_t offset);
|
||||
void vm_cache_remove_page(vm_cache *cache, vm_page *page);
|
||||
void vm_cache_remove_consumer(vm_cache *cache, vm_cache *consumer);
|
||||
void vm_cache_add_consumer_locked(vm_cache *cache, vm_cache *consumer);
|
||||
status_t vm_cache_write_modified(vm_cache *cache, bool fsReenter);
|
||||
status_t vm_cache_set_minimal_commitment_locked(vm_cache *cache, off_t commitment);
|
||||
status_t vm_cache_resize(vm_cache *cache, off_t newSize);
|
||||
status_t vm_cache_insert_area_locked(vm_cache *cache, vm_area *area);
|
||||
status_t vm_cache_remove_area(vm_cache *cache, vm_area *area);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -125,23 +125,15 @@ enum {
|
||||
CACHE_TYPE_NULL
|
||||
};
|
||||
|
||||
// vm_cache_ref
|
||||
typedef struct vm_cache_ref {
|
||||
struct vm_cache *cache;
|
||||
mutex lock;
|
||||
|
||||
struct vm_area *areas;
|
||||
|
||||
vint32 ref_count;
|
||||
} vm_cache_ref;
|
||||
|
||||
// vm_cache
|
||||
typedef struct vm_cache {
|
||||
mutex lock;
|
||||
struct vm_area *areas;
|
||||
vint32 ref_count;
|
||||
struct list_link consumer_link;
|
||||
struct list consumers;
|
||||
// list of caches that use this cache as a source
|
||||
vm_page *page_list;
|
||||
vm_cache_ref *ref;
|
||||
struct vm_cache *source;
|
||||
struct vm_store *store;
|
||||
off_t virtual_base;
|
||||
@@ -165,7 +157,8 @@ typedef struct vm_area {
|
||||
uint16 memory_type;
|
||||
vint32 ref_count;
|
||||
|
||||
struct vm_cache_ref *cache_ref;
|
||||
struct vm_cache *cache;
|
||||
vint32 no_cache_change;
|
||||
off_t cache_offset;
|
||||
uint32 cache_type;
|
||||
vm_area_mappings mappings;
|
||||
|
||||
Reference in New Issue
Block a user