]> git.ipfire.org Git - thirdparty/squid.git/blob - src/fs_io.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / fs_io.h
1 /*
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 /* DEBUG: section 06 Disk I/O Routines */
10
11 #ifndef SQUID_FS_IO_H_
12 #define SQUID_FS_IO_H_
13
14 #include "mem/forward.h"
15 #include "sbuf/forward.h"
16 #include "typedefs.h" //DRCB, DWCB
17
18 class MemBuf;
19
20 // POD
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
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 };
44
45 int file_open(const char *path, int mode);
46 void file_close(int fd);
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 *);
50 void safeunlink(const char *path, int quiet);
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
58 * \retval false an error occured
59 */
60 bool FileRename(const SBuf &from, const SBuf &to);
61
62 int fsBlockSize(const char *path, int *blksize);
63 int fsStats(const char *, int *, int *, int *, int *);
64
65 #endif /* SQUID_FS_IO_H_ */
66