]>
Commit | Line | Data |
---|---|---|
fc54b8d2 | 1 | /* |
b8ae064d | 2 | * Copyright (C) 1996-2023 The Squid Software Foundation and contributors |
fc54b8d2 | 3 | * |
bbc27441 AJ |
4 | * Squid software is distributed under GPLv2+ license and includes |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
fc54b8d2 FC |
7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 06 Disk I/O Routines */ |
10 | ||
2745fea5 AR |
11 | #ifndef SQUID_FS_IO_H_ |
12 | #define SQUID_FS_IO_H_ | |
fc54b8d2 | 13 | |
6f5dc9e4 | 14 | #include "mem/forward.h" |
b56b37cf | 15 | #include "sbuf/forward.h" |
6f5dc9e4 | 16 | #include "typedefs.h" //DRCB, DWCB |
fc54b8d2 FC |
17 | |
18 | class MemBuf; | |
65914896 | 19 | |
1328cfb7 | 20 | // POD |
65914896 FC |
21 | class dread_ctrl |
22 | { | |
23 | public: | |
24 | int fd; | |
25 | off_t offset; | |
26 | int req_len; | |
27 | char *buf; | |
28 | int end_of_file; | |
29 | DRCB *handler; | |
30 | void *client_data; | |
31 | }; | |
32 | ||
1328cfb7 FC |
33 | // POD |
34 | class dwrite_q | |
35 | { | |
36 | public: | |
37 | off_t file_offset; | |
38 | char *buf; | |
39 | size_t len; | |
40 | size_t buf_offset; | |
41 | dwrite_q *next; | |
42 | FREE *free_func; | |
43 | }; | |
fc54b8d2 | 44 | |
8a648e8d FC |
45 | int file_open(const char *path, int mode); |
46 | void file_close(int fd); | |
8a648e8d FC |
47 | void file_write(int, off_t, void const *, int len, DWCB *, void *, FREE *); |
48 | void file_write_mbuf(int fd, off_t, MemBuf mb, DWCB * handler, void *handler_data); | |
49 | void file_read(int, char *, int, off_t, DRCB *, void *); | |
8a648e8d | 50 | void safeunlink(const char *path, int quiet); |
b56b37cf AJ |
51 | |
52 | /* | |
53 | * Wrapper for rename(2) which complains if something goes wrong; | |
54 | * the caller is responsible for handing and explaining the | |
55 | * consequences of errors. | |
56 | * | |
57 | * \retval true successful rename | |
2f8abb64 | 58 | * \retval false an error occurred |
b56b37cf AJ |
59 | */ |
60 | bool FileRename(const SBuf &from, const SBuf &to); | |
2745fea5 AR |
61 | |
62 | int fsBlockSize(const char *path, int *blksize); | |
63 | int fsStats(const char *, int *, int *, int *, int *); | |
fc54b8d2 | 64 | |
2745fea5 | 65 | #endif /* SQUID_FS_IO_H_ */ |
f53969cc | 66 |