0ad/source/lib/res/file/file_cache.h
janwas 04b72b29b4 archive: new rule for choosing whether to compress files or not: leans heavily toward the former because that uses less memory when loading (less loss due to internal fragmentation)
everything else: bugfix: buffers added to extant list via
file_buf_retrieve (i.e. moved from cache to extant list) didn't have
their long_lived flag carried over; this caused a "not freed
immediately" warning.

This was SVN commit r3580.
2006-03-02 02:21:55 +00:00

42 lines
1.2 KiB
C

struct BlockId
{
const char* atom_fn;
u32 block_num;
};
extern bool block_eq(BlockId b1, BlockId b2);
// create an id for use with the cache that uniquely identifies
// the block from the file <atom_fn> starting at <ofs>.
extern BlockId block_cache_make_id(const char* atom_fn, const off_t ofs);
extern void* block_cache_alloc(BlockId id);
extern void block_cache_mark_completed(BlockId id);
extern void* block_cache_find(BlockId id);
extern void block_cache_release(BlockId id);
extern LibError file_buf_get(FileIOBuf* pbuf, size_t size,
const char* atom_fn, uint flags, FileIOCB cb);
extern void file_buf_add_padding(FileIOBuf buf, size_t padding);
extern LibError file_buf_set_real_fn(FileIOBuf buf, const char* atom_fn);
extern FileIOBuf file_cache_find(const char* atom_fn, size_t* size);
extern FileIOBuf file_cache_retrieve(const char* atom_fn, size_t* size, bool long_lived);
extern LibError file_cache_add(FileIOBuf buf, size_t size, const char* atom_fn);
extern LibError file_cache_invalidate(const char* fn);
extern void file_cache_reset();
extern void file_cache_init();
extern void file_cache_shutdown();