1 #ifndef __CACHEFSRCACHE_H
2 #define __CACHEFSRCACHE_H
5 #include <wvhashtable.h>
8 #include "wvdiskcache.h"
9 #include "cachefsicache.h"
11 typedef unsigned long int fino_t
;
19 WaiterHelper(size_t _index
, WvStream
*_waiter
)
20 : index(_index
), waiter(_waiter
) {}
25 DeclareWvDict(WaiterHelper
, size_t, index
);
30 RNode(ReadCache
*_rcache
, int _fd
, WvStringParm _parm
, size_t _fsize
);
33 void maybe_schedule_readblock(CacheFS
*cachefs
, size_t index
);
34 void update_page_status(size_t index
, int status
);
35 int wait_on_block(size_t index
, WvStream
*waiter
);
36 int do_read(char *buf
, size_t size
, size_t offset
);
39 bool isok() { return m_data
&& m_header
&& fsize
; }
48 char *m_data
, *m_header
;
52 WaiterHelperDict waiters
;
55 DeclareWvDict(RNode
, int, fd
);
57 class ReadCache
: public ICache
61 ReadCache(UniConf _cfg
);
62 virtual ~ReadCache() {};
64 void rcache_do_open(WvStringParm path
, int fd
);
65 void rcache_do_close(int fd
);
66 void rcache_do_invalidate(int fd
);
67 void rcache_do_invalidate(WvStringParm path
);
69 int rcache_do_read(WvStream
*waiter
, int fd
, char *buf
, size_t size
,
71 void update_page_status(int fd
, size_t index
, int status
);
73 void diskcache_callback(WvStringParm path
);
77 WvDiskCache diskcache
;