]> git.ipfire.org Git - thirdparty/squid.git/blame - src/fs_io.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / fs_io.h
CommitLineData
fc54b8d2 1/*
77b1029d 2 * Copyright (C) 1996-2020 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
18class MemBuf;
65914896 19
1328cfb7 20// POD
65914896
FC
21class dread_ctrl
22{
23public:
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
34class dwrite_q
35{
36public:
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
45int file_open(const char *path, int mode);
46void file_close(int fd);
8a648e8d
FC
47void file_write(int, off_t, void const *, int len, DWCB *, void *, FREE *);
48void file_write_mbuf(int fd, off_t, MemBuf mb, DWCB * handler, void *handler_data);
49void file_read(int, char *, int, off_t, DRCB *, void *);
8a648e8d 50void 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
58 * \retval false an error occured
59 */
60bool FileRename(const SBuf &from, const SBuf &to);
2745fea5
AR
61
62int fsBlockSize(const char *path, int *blksize);
63int fsStats(const char *, int *, int *, int *, int *);
fc54b8d2 64
2745fea5 65#endif /* SQUID_FS_IO_H_ */
f53969cc 66