haiku/headers/os/drivers/fs_cache.h
Ingo Weinhold 1fbe3ccd4e * Reformatted to honor 80 chars/line limit.
* Renamed a few parameters of the FS module hooks:
  - *file in the attribute functions to *vnode
  - v to vnode
  - I could barely restrain myself from renaming the "_*" parameters. I
    understand this marks return parameters, but I'd prefer a nicer prefix
    or suffix (that doesn't makes you think this is a private/internal
    identifier) like "out", "ret", "return", "result", or something similar.

I'd also like to propose renaming {read,write}_link() to
{read,write}_symlink(). Er, and do we need write_link() at all?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20226 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-02-24 23:05:18 +00:00

79 lines
3.0 KiB
C

/* File System File and Block Caches
*
* Copyright 2004-2005, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _FS_CACHE_H
#define _FS_CACHE_H
#include <fs_interface.h>
typedef void (*transaction_notification_hook)(int32 id, void *data);
#ifdef __cplusplus
extern "C" {
#endif
/* transactions */
extern int32 cache_start_transaction(void *_cache);
extern status_t cache_sync_transaction(void *_cache, int32 id);
extern status_t cache_end_transaction(void *_cache, int32 id,
transaction_notification_hook hook, void *data);
extern status_t cache_abort_transaction(void *_cache, int32 id);
extern int32 cache_detach_sub_transaction(void *_cache, int32 id,
transaction_notification_hook hook, void *data);
extern status_t cache_abort_sub_transaction(void *_cache, int32 id);
extern status_t cache_start_sub_transaction(void *_cache, int32 id);
extern status_t cache_next_block_in_transaction(void *_cache, int32 id,
uint32 *_cookie, off_t *_blockNumber, void **_data,
void **_unchangedData);
extern int32 cache_blocks_in_transaction(void *_cache, int32 id);
extern int32 cache_blocks_in_sub_transaction(void *_cache, int32 id);
/* block cache */
extern void block_cache_delete(void *_cache, bool allowWrites);
extern void *block_cache_create(int fd, off_t numBlocks, size_t blockSize,
bool readOnly);
extern status_t block_cache_sync(void *_cache);
extern status_t block_cache_make_writable(void *_cache, off_t blockNumber,
int32 transaction);
extern void *block_cache_get_writable_etc(void *_cache, off_t blockNumber,
off_t base, off_t length, int32 transaction);
extern void *block_cache_get_writable(void *_cache, off_t blockNumber,
int32 transaction);
extern void *block_cache_get_empty(void *_cache, off_t blockNumber,
int32 transaction);
extern const void *block_cache_get_etc(void *_cache, off_t blockNumber,
off_t base, off_t length);
extern const void *block_cache_get(void *_cache, off_t blockNumber);
extern status_t block_cache_set_dirty(void *_cache, off_t blockNumber,
bool isDirty, int32 transaction);
extern void block_cache_put(void *_cache, off_t blockNumber);
/* file cache */
extern void *file_cache_create(mount_id mountID, vnode_id vnodeID, off_t size,
int fd);
extern void file_cache_delete(void *_cacheRef);
extern status_t file_cache_set_size(void *_cacheRef, off_t size);
extern status_t file_cache_sync(void *_cache);
extern status_t file_cache_invalidate_file_map(void *_cacheRef, off_t offset,
off_t size);
extern status_t file_cache_read_pages(void *_cacheRef, off_t offset,
const iovec *vecs, size_t count, size_t *_numBytes);
extern status_t file_cache_write_pages(void *_cacheRef, off_t offset,
const iovec *vecs, size_t count, size_t *_numBytes);
extern status_t file_cache_read(void *_cacheRef, off_t offset, void *bufferBase,
size_t *_size);
extern status_t file_cache_write(void *_cacheRef, off_t offset,
const void *buffer, size_t *_size);
#ifdef __cplusplus
}
#endif
#endif /* _FS_CACHE_H */