]>
Commit | Line | Data |
---|---|---|
2391a162 | 1 | #include "squid.h" |
2 | ||
3 | ||
4 | ||
5 | storeIOState * | |
6 | storeOpen(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 | ||
13 | void | |
60df005c | 14 | storeClose(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 | ||
23 | void | |
60df005c | 24 | storeRead(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 | ||
30 | void | |
50f4d6ae | 31 | storeWrite(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 | ||
37 | void | |
38 | storeUnlink(sfileno f) | |
39 | { | |
0e4e0e7d | 40 | SwapDir *SD = &Config.cacheSwap.swapDirs[f >> SWAP_DIR_SHIFT]; |
b2c141d4 | 41 | SD->obj.unlink(f); |
2391a162 | 42 | } |
43 | ||
44 | off_t | |
60df005c | 45 | storeOffset(storeIOState * sio) |
2391a162 | 46 | { |
60df005c | 47 | return sio->offset; |
2391a162 | 48 | } |