]> git.ipfire.org Git - thirdparty/squid.git/blame - src/store_io.cc
Fixed a small patch merge error
[thirdparty/squid.git] / src / store_io.cc
CommitLineData
2391a162 1#include "squid.h"
2
3
4
5storeIOState *
6storeOpen(sfileno f, mode_t mode, STIOCB * callback, void *callback_data)
7{
0e4e0e7d 8 SwapDir *SD = &Config.cacheSwap.swapDirs[f >> SWAP_DIR_SHIFT];
2391a162 9 assert(mode == O_RDONLY || mode == O_WRONLY);
b2c141d4 10 return SD->obj.open(f, mode, callback, callback_data);
2391a162 11}
12
13void
60df005c 14storeClose(storeIOState * sio)
2391a162 15{
0e4e0e7d 16 SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT];
5bd1abac 17 if (sio->flags.closing)
18 return;
2391a162 19 sio->flags.closing = 1;
b2c141d4 20 SD->obj.close(sio);
2391a162 21}
22
23void
60df005c 24storeRead(storeIOState * sio, char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data)
2391a162 25{
0e4e0e7d 26 SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT];
b2c141d4 27 SD->obj.read(sio, buf, size, offset, callback, callback_data);
2391a162 28}
29
30void
50f4d6ae 31storeWrite(storeIOState * sio, char *buf, size_t size, off_t offset, FREE * free_func)
2391a162 32{
0e4e0e7d 33 SwapDir *SD = &Config.cacheSwap.swapDirs[sio->swap_file_number >> SWAP_DIR_SHIFT];
b2c141d4 34 SD->obj.write(sio, buf, size, offset, free_func);
2391a162 35}
36
37void
38storeUnlink(sfileno f)
39{
0e4e0e7d 40 SwapDir *SD = &Config.cacheSwap.swapDirs[f >> SWAP_DIR_SHIFT];
b2c141d4 41 SD->obj.unlink(f);
2391a162 42}
43
44off_t
60df005c 45storeOffset(storeIOState * sio)
2391a162 46{
60df005c 47 return sio->offset;
2391a162 48}