]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/fs/coss/CossSwapDir.h
1 #ifndef __COSSSWAPDIR_H__
2 #define __COSSSWAPDIR_H__
9 class ConfigOptionVector
;
13 #include "DiskIO/IORequestor.h"
16 #ifndef COSS_MEMBUF_SZ
17 #define COSS_MEMBUF_SZ 1048576
20 /* Note that swap_filen in sio/e are actually disk offsets too! */
22 /* What we're doing in storeCossAllocate() */
23 #define COSS_ALLOC_ALLOCATE 1
24 #define COSS_ALLOC_REALLOC 2
28 class CossSwapDir
: public SwapDir
, public IORequestor
34 virtual void create();
35 virtual void dump(StoreEntry
&)const;
37 virtual StoreSearch
*search(String
const url
, HttpRequest
*);
38 virtual void unlink (StoreEntry
&);
39 virtual void statfs (StoreEntry
&)const;
40 virtual bool canStore(const StoreEntry
&e
, int64_t diskSpaceNeeded
, int &load
) const;
41 virtual int callback();
43 virtual StoreIOState::Pointer
createStoreIO(StoreEntry
&, StoreIOState::STFNCB
*, StoreIOState::STIOCB
*, void *);
44 virtual StoreIOState::Pointer
openStoreIO(StoreEntry
&, StoreIOState::STFNCB
*, StoreIOState::STIOCB
*, void *);
45 virtual void openLog();
46 virtual void closeLog();
47 virtual int writeCleanStart();
48 virtual void writeCleanDone();
49 virtual void logEntry(const StoreEntry
& e
, int op
) const;
50 virtual void parse (int index
, char *path
);
51 virtual void reconfigure (int, char *);
53 virtual off_t
storeCossFilenoToDiskOffset(sfileno
);
54 virtual sfileno
storeCossDiskOffsetToFileno(off_t
);
55 virtual CossMemBuf
*storeCossFilenoToMembuf(sfileno f
);
56 /* IORequestor routines */
57 virtual void ioCompletedNotification();
58 virtual void closeCompleted();
59 virtual void readCompleted(const char *buf
, int len
, int errflag
, RefCount
<ReadRequest
>);
60 virtual void writeCompleted(int errflag
, size_t len
, RefCount
<WriteRequest
>);
66 CossMemBuf
*current_membuf
;
67 off_t current_offset
; /* in Blocks */
70 unsigned int blksz_bits
;
71 unsigned int blksz_mask
; /* just 1<<blksz_bits - 1*/
73 RefCount
<DiskFile
> theFile
;
74 char *storeCossMemPointerFromDiskOffset(off_t offset
, CossMemBuf
** mb
);
75 void storeCossMemBufUnlock(StoreIOState::Pointer
);
76 CossMemBuf
*createMemBuf(off_t start
, sfileno curfn
, int *collision
);
77 sfileno
allocate(const StoreEntry
* e
, int which
);
81 void changeIO(DiskIOModule
*module
);
82 bool optionIOParse(char const *option
, const char *value
, int reconfiguring
);
83 void optionIODump(StoreEntry
* e
) const;
84 void optionBlockSizeDump(StoreEntry
*) const;
85 bool optionBlockSizeParse(const char *, const char *, int);
86 char const *stripePath() const;
87 ConfigOption
* getOptionTree() const;
89 mutable ConfigOptionVector
*currentIOOptions
;
90 const char *stripe_path
;
94 extern void storeCossAdd(CossSwapDir
*, StoreEntry
*);
96 extern void storeCossRemove(CossSwapDir
*, StoreEntry
*);
98 extern void storeCossStartMembuf(CossSwapDir
* SD
);
101 #include "StoreSearch.h"
104 class StoreSearchCoss
: public StoreSearch
108 StoreSearchCoss(RefCount
<CossSwapDir
> sd
);
109 StoreSearchCoss(StoreSearchCoss
const &);
111 /* Iterator API - garh, wrong place */
112 /* callback the client when a new StoreEntry is available
115 virtual void next(void (callback
)(void *cbdata
), void *cbdata
);
116 /* return true if a new StoreEntry is immediately available */
118 virtual bool error() const;
119 virtual bool isDone() const;
120 virtual StoreEntry
*currentItem();
123 CBDATA_CLASS2(StoreSearchCoss
);
124 RefCount
<CossSwapDir
> sd
;
125 void (*callback
)(void *cbdata
);
128 dlink_node
* current
;