]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/fs/ufs/UFSStoreState.h
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_FS_UFS_UFSSTORESTATE_H
10 #define SQUID_FS_UFS_UFSSTORESTATE_H
12 #include "DiskIO/IORequestor.h"
13 #include "SquidList.h"
14 #include "StoreIOState.h"
21 class UFSStoreState
: public StoreIOState
, public IORequestor
24 UFSStoreState(SwapDir
* SD
, StoreEntry
* anEntry
, STIOCB
* callback_
, void *callback_data_
);
26 virtual void close(int how
);
27 virtual void closeCompleted();
29 virtual void ioCompletedNotification();
30 virtual void readCompleted(const char *buf
, int len
, int errflag
, RefCount
<ReadRequest
>);
31 virtual void writeCompleted(int errflag
, size_t len
, RefCount
<WriteRequest
>);
32 RefCount
<DiskFile
> theFile
;
38 /* StoreIOState API */
39 void read_(char *buf
, size_t size
, off_t offset
, STRCB
* callback
, void *callback_data
);
40 virtual bool write(char const *buf
, size_t size
, off_t offset
, FREE
* free_func
);
43 virtual void doCloseCallback (int errflag
);
47 MEMPROXY_CLASS(UFSStoreState::_queued_read
);
59 MEMPROXY_CLASS(UFSStoreState::_queued_write
);
68 /** \todo These should be in the IO strategy */
73 * the write_draining flag is used to avoid recursion inside
74 * the UFSStoreState::drainWriteQueue() method.
79 * The try_closing flag is set by UFSStoreState::tryClosing()
80 * when UFSStoreState wants to close the file, but cannot
81 * because of pending I/Os. If set, UFSStoreState will
82 * try to close again in the I/O callbacks.
86 link_list
*pending_reads
;
87 link_list
*pending_writes
;
88 void queueRead(char *, size_t, off_t
, STRCB
*, void *);
89 void queueWrite(char const *, size_t, off_t
, FREE
*);
91 void drainWriteQueue();
99 CBDATA_CLASS2(UFSStoreState
);
105 #endif /* SQUID_FS_UFS_UFSSTORESTATE_H */