#include "squid.h"
#include "comm/Loops.h"
#include "fd.h"
#include "fde.h"
#include "fs_io.h"
#include "globals.h"
#include "MemBuf.h"
#include "StatCounters.h"
#include <cerrno>
Go to the source code of this file.
Macros | |
#define | fsbtoblk(num, fsbs, bs) |
Functions | |
static void | cxx_xfree (void *ptr) |
int | file_open (const char *path, int mode) |
void | file_close (int fd) |
static void | diskCombineWrites (_fde_disk *fdd) |
static void | diskHandleWrite (int fd, void *) |
void | file_write (int fd, off_t file_offset, void const *ptr_to_buf, int len, DWCB *handle, void *handle_data, FREE *free_func) |
void | file_write_mbuf (int fd, off_t off, MemBuf mb, DWCB *handler, void *handler_data) |
static void | diskHandleRead (int fd, void *data) |
void | file_read (int fd, char *buf, int req_len, off_t offset, DRCB *handler, void *client_data) |
void | safeunlink (const char *s, int quiet) |
bool | FileRename (const SBuf &from, const SBuf &to) |
int | fsBlockSize (const char *path, int *blksize) |
int | fsStats (const char *path, int *totl_kb, int *free_kb, int *totl_in, int *free_in) |
Variables | |
static PF | diskHandleRead |
static PF | diskHandleWrite |
Macro Definition Documentation
◆ fsbtoblk
#define fsbtoblk | ( | num, | |
fsbs, | |||
bs | |||
) |
Function Documentation
◆ cxx_xfree()
|
static |
◆ diskCombineWrites()
|
static |
Definition at line 127 of file fs_io.cc.
References dwrite_q::buf, dwrite_q::buf_offset, cxx_xfree(), dwrite_q::free_func, dwrite_q::len, MEM_DWRITE_Q, memAllocate(), memFree(), dwrite_q::next, _fde_disk::write_q, _fde_disk::write_q_tail, and xmalloc.
Referenced by diskHandleWrite().
◆ diskHandleRead()
|
static |
Definition at line 381 of file fs_io.cc.
References dread_ctrl::buf, cbdataReferenceDone, cbdataReferenceValid(), dread_ctrl::client_data, COMM_SELECT_READ, DBG_IMPORTANT, debugs, StatCounters::disk, DISK_EOF, DISK_ERROR, DISK_OK, diskHandleRead, F(), fd_bytes(), FD_READ, FD_READ_METHOD(), fd_table, dread_ctrl::handler, ignoreErrno(), MEM_DREAD_CTRL, memFree(), dread_ctrl::offset, StatCounters::reads, dread_ctrl::req_len, StatCounters::seeks, Comm::SetSelect(), statCounter, StatCounters::syscalls, and xstrerr().
◆ diskHandleWrite()
|
static |
Definition at line 175 of file fs_io.cc.
References assert, dwrite_q::buf, dwrite_q::buf_offset, cbdataReferenceValidDone, COMM_SELECT_WRITE, DBG_IMPORTANT, debugs, StatCounters::disk, DISK_ERROR, DISK_NO_SPACE_LEFT, DISK_OK, diskCombineWrites(), diskHandleWrite, do_close(), F(), fatal(), fd_bytes(), fd_table, FD_WRITE, FD_WRITE_METHOD(), file_close(), dwrite_q::file_offset, dwrite_q::free_func, ignoreErrno(), dwrite_q::len, MEM_DWRITE_Q, memFree(), dwrite_q::next, Comm::SetSelect(), statCounter, StatCounters::syscalls, _fde_disk::write_q, _fde_disk::write_q_tail, StatCounters::writes, _fde_disk::wrt_handle, _fde_disk::wrt_handle_data, and xstrerr().
◆ file_close()
void file_close | ( | int | fd | ) |
Definition at line 73 of file fs_io.cc.
References assert, StatCounters::closes, debugs, StatCounters::disk, diskHandleWrite, F(), fd_close(), fd_table, statCounter, and StatCounters::syscalls.
Referenced by Rock::Rebuild::~Rebuild(), Fs::Ufs::UFSSwapDir::~UFSSwapDir(), Fs::Ufs::UFSSwapDir::closeLog(), Fs::Ufs::UFSSwapDir::closeTmpSwapLog(), DiskerClose(), diskHandleWrite(), BlockingFile::doClose(), DiskThreadsDiskFile::doClose(), MmappedFile::doClose(), MimeIcon::load(), TemplateFile::loadFromFile(), logfile_mod_stdio_close(), logfile_mod_stdio_rotate(), logfile_mod_udp_close(), netdbReloadState(), Fs::Ufs::UFSSwapDir::openTmpSwapLog(), Fs::Ufs::RebuildState::rebuildFromDirectory(), UFSCleanLog::write(), and Fs::Ufs::UFSSwapDir::writeCleanDone().
◆ file_open()
Definition at line 45 of file fs_io.cc.
References commSetCloseOnExec(), debugs, StatCounters::disk, DISK_ERROR, FD_FILE, fd_open(), FILE_MODE, StatCounters::opens, statCounter, StatCounters::syscalls, and xstrerr().
Referenced by Fs::Ufs::UFSSwapDir::closeTmpSwapLog(), DiskThreadsDiskFile::create(), DiskerOpen(), Fs::Ufs::RebuildState::getNextFile(), MimeIcon::load(), TemplateFile::loadFromFile(), logfile_mod_stdio_open(), logfile_mod_stdio_rotate(), netdbReloadState(), BlockingFile::open(), DiskThreadsDiskFile::open(), MmappedFile::open(), Fs::Ufs::UFSSwapDir::openLog(), Fs::Ufs::UFSSwapDir::openTmpSwapLog(), Rock::Rebuild::start(), Fs::Ufs::UFSSwapDir::writeCleanDone(), and Fs::Ufs::UFSSwapDir::writeCleanStart().
◆ file_read()
void file_read | ( | int | fd, |
char * | buf, | ||
int | req_len, | ||
off_t | offset, | ||
DRCB * | handler, | ||
void * | client_data | ||
) |
Definition at line 453 of file fs_io.cc.
References assert, dread_ctrl::buf, cbdataReference, dread_ctrl::client_data, diskHandleRead, dread_ctrl::end_of_file, dread_ctrl::fd, dread_ctrl::handler, handler(), MEM_DREAD_CTRL, memAllocate(), dread_ctrl::offset, and dread_ctrl::req_len.
Referenced by BlockingFile::read(), and DiskThreadsDiskFile::read().
◆ file_write()
void file_write | ( | int | fd, |
off_t | file_offset, | ||
void const * | ptr_to_buf, | ||
int | len, | ||
DWCB * | handle, | ||
void * | handle_data, | ||
FREE * | free_func | ||
) |
Definition at line 326 of file fs_io.cc.
References assert, dwrite_q::buf, dwrite_q::buf_offset, cbdataReference, diskHandleWrite, F(), fd_table, dwrite_q::file_offset, dwrite_q::free_func, handle, dwrite_q::len, MEM_DWRITE_Q, memAllocate(), and dwrite_q::next.
Referenced by file_write_mbuf(), Fs::Ufs::UFSSwapDir::logEntry(), Fs::Ufs::UFSSwapDir::openTmpSwapLog(), BlockingFile::write(), and DiskThreadsDiskFile::write().
◆ file_write_mbuf()
Definition at line 374 of file fs_io.cc.
References MemBuf::buf, file_write(), MemBuf::freeFunc(), handler(), and MemBuf::size.
◆ FileRename()
Definition at line 480 of file fs_io.cc.
References SBuf::c_str(), DBG_IMPORTANT, debugs, SBuf::length(), SBuf::rawContent(), and xstrerr().
Referenced by Fs::Ufs::UFSSwapDir::closeTmpSwapLog(), logfile_mod_stdio_rotate(), and Fs::Ufs::UFSSwapDir::writeCleanDone().
◆ fsBlockSize()
Definition at line 503 of file fs_io.cc.
References DBG_IMPORTANT, debugs, statvfs::f_frsize, int, xstatvfs(), and xstrerr().
Referenced by Fs::Ufs::UFSSwapDir::init().
◆ fsStats()
Definition at line 527 of file fs_io.cc.
References DBG_IMPORTANT, debugs, statvfs::f_bfree, statvfs::f_blocks, statvfs::f_ffree, statvfs::f_files, statvfs::f_frsize, fsbtoblk, int, xstatvfs(), and xstrerr().
Referenced by Fs::Ufs::UFSSwapDir::statfs().
◆ safeunlink()
void safeunlink | ( | const char * | s, |
int | quiet | ||
) |
Definition at line 469 of file fs_io.cc.
References DBG_IMPORTANT, debugs, StatCounters::disk, statCounter, StatCounters::syscalls, StatCounters::unlinks, and xstrerr().
Referenced by Fs::Ufs::UFSSwapDir::DirClean(), Fs::Ufs::UFSSwapDir::openTmpSwapLog(), RemoveInstance(), and unlinkdUnlink().
Variable Documentation
◆ diskHandleRead
|
static |
Definition at line 22 of file fs_io.cc.
Referenced by diskHandleRead(), and file_read().
◆ diskHandleWrite
|
static |
Definition at line 23 of file fs_io.cc.
Referenced by diskHandleWrite(), file_close(), and file_write().