]> git.ipfire.org Git - thirdparty/squid.git/blob - src/disk.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / disk.h
1 /*
2 * Copyright (C) 1996-2015 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_DISK_H_
12 #define SQUID_DISK_H_
13
14 #include "typedefs.h"
15
16 class MemBuf;
17
18 // POD
19 class dread_ctrl
20 {
21 public:
22 int fd;
23 off_t offset;
24 int req_len;
25 char *buf;
26 int end_of_file;
27 DRCB *handler;
28 void *client_data;
29 };
30
31 // POD
32 class dwrite_q
33 {
34 public:
35 off_t file_offset;
36 char *buf;
37 size_t len;
38 size_t buf_offset;
39 dwrite_q *next;
40 FREE *free_func;
41 };
42
43 int file_open(const char *path, int mode);
44 void file_close(int fd);
45
46 /* Adapter file_write for object callbacks */
47 template <class O>
48 void
49 FreeObject(void *address)
50 {
51 O *anObject = static_cast <O *>(address);
52 delete anObject;
53 }
54
55 void file_write(int, off_t, void const *, int len, DWCB *, void *, FREE *);
56 void file_write_mbuf(int fd, off_t, MemBuf mb, DWCB * handler, void *handler_data);
57 void file_read(int, char *, int, off_t, DRCB *, void *);
58 void disk_init(void);
59 void safeunlink(const char *path, int quiet);
60 int xrename(const char *from, const char *to); //disk.cc
61
62 #endif /* SQUID_DISK_H_ */
63