From: wessels <> Date: Tue, 23 May 2006 06:21:47 +0000 (+0000) Subject: Moved STRCB, STFNCB, STIOCB typdefs to inside StoreIOState class itself. X-Git-Tag: SQUID_3_0_PRE4~107 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fcc88762a97b092f1e970cb7d576fdf42f4164a;p=thirdparty%2Fsquid.git Moved STRCB, STFNCB, STIOCB typdefs to inside StoreIOState class itself. This should allow us to use these types as parameters in the callbacks. --- diff --git a/src/StoreIOState.h b/src/StoreIOState.h index aa83eb57c9..63f1dc9c7d 100644 --- a/src/StoreIOState.h +++ b/src/StoreIOState.h @@ -1,6 +1,6 @@ /* - * $Id: StoreIOState.h,v 1.7 2006/05/22 19:58:51 wessels Exp $ + * $Id: StoreIOState.h,v 1.8 2006/05/23 00:21:47 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -34,35 +34,6 @@ #ifndef SQUID_STOREIOSTATE_H #define SQUID_STOREIOSTATE_H -/* - * STRCB is the "store read callback". STRCB functions are passed - * to storeRead(). Examples of STRCB callbacks are: - * storeClientReadBody - * storeClientReadHeader - */ -typedef void STRCB(void *their_data, const char *buf, ssize_t len); - -/* - * STFNCB is the "store file number callback." It is called when - * an underlying storage module has allocated the swap file number - * and also indicates that the swap file has been opened for reading - * or writing. STFNCB functions are passed to storeCreate() and - * storeOpen(). Examples of STFNCB callbacks are: - * storeSwapInFileNotify - * storeSwapOutFileNotify - */ -typedef void STFNCB(void *their_data, int errflag); - -/* - * STIOCB is the "store close callback" for store files. It is - * called when the store file is closed. STIOCB functions are - * passed to storeCreate() and storeOpen(). Examples of STIOCB - * callbacks are: - * storeSwapOutFileClosed - * storeSwapInFileClosed - */ -typedef void STIOCB(void *their_data, int errflag); - #include "RefCount.h" class StoreIOState : public RefCountable @@ -71,6 +42,36 @@ class StoreIOState : public RefCountable public: typedef RefCount Pointer; + /* + * STRCB is the "store read callback". STRCB functions are + * passed to storeRead(). Examples of STRCB callbacks are: + * storeClientReadBody + * storeClientReadHeader + */ + typedef void STRCB(void *their_data, const char *buf, ssize_t len); + + /* + * STFNCB is the "store file number callback." It is called + * when an underlying storage module has allocated the swap + * file number and also indicates that the swap file has been + * opened for reading or writing. STFNCB functions are passed + * to storeCreate() and storeOpen(). Examples of STFNCB callbacks + * are: + * storeSwapInFileNotify + * storeSwapOutFileNotify + */ + typedef void STFNCB(void *their_data, int errflag); + + /* + * STIOCB is the "store close callback" for store files. It + * is called when the store file is closed. STIOCB functions + * are passed to storeCreate() and storeOpen(). Examples of + * STIOCB callbacks are: + * storeSwapOutFileClosed + * storeSwapInFileClosed + */ + typedef void STIOCB(void *their_data, int errflag); + /* StoreIOState does not get mempooled - it's children do */ void *operator new (size_t amount); void operator delete (void *address); @@ -111,10 +112,10 @@ unsigned int closing: flags; }; -StoreIOState::Pointer storeCreate(StoreEntry *, STFNCB *, STIOCB *, void *); -StoreIOState::Pointer storeOpen(StoreEntry *, STFNCB *, STIOCB *, void *); +StoreIOState::Pointer storeCreate(StoreEntry *, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *); +StoreIOState::Pointer storeOpen(StoreEntry *, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *); SQUIDCEXTERN void storeClose(StoreIOState::Pointer); -SQUIDCEXTERN void storeRead(StoreIOState::Pointer, char *, size_t, off_t, STRCB *, void *); +SQUIDCEXTERN void storeRead(StoreIOState::Pointer, char *, size_t, off_t, StoreIOState::STRCB *, void *); SQUIDCEXTERN void storeIOWrite(StoreIOState::Pointer, char const *, size_t, off_t, FREE *); #endif /* SQUID_STOREIOSTATE_H */ diff --git a/src/SwapDir.h b/src/SwapDir.h index db0c87ffe5..53812ee01c 100644 --- a/src/SwapDir.h +++ b/src/SwapDir.h @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.8 2005/01/03 16:08:25 robertc Exp $ + * $Id: SwapDir.h,v 1.9 2006/05/23 00:21:47 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -188,8 +188,8 @@ unsigned int read_only: virtual void dereference(StoreEntry &); /* Unreference this object */ virtual int callback(); /* Handle pending callbacks */ virtual void sync(); /* Sync the store prior to shutdown */ - virtual StoreIOState::Pointer createStoreIO(StoreEntry &, STFNCB *, STIOCB *, void *) = 0; - virtual StoreIOState::Pointer openStoreIO(StoreEntry &, STFNCB *, STIOCB *, void *) = 0; + virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) = 0; + virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) = 0; virtual void unlink (StoreEntry &); bool canLog(StoreEntry const &e)const; virtual void openLog(); diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index 4aea6c549a..6cadb7d6cd 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.73 2006/05/19 20:22:57 wessels Exp $ + * $Id: store_dir_ufs.cc,v 1.74 2006/05/23 00:21:48 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -432,13 +432,13 @@ UFSSwapDir::dereference(StoreEntry & e) } StoreIOState::Pointer -UFSSwapDir::createStoreIO(StoreEntry &e, STFNCB * file_callback, STIOCB * callback, void *callback_data) +UFSSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * callback, void *callback_data) { return IO->create (this, &e, file_callback, callback, callback_data); } StoreIOState::Pointer -UFSSwapDir::openStoreIO(StoreEntry &e, STFNCB * file_callback, STIOCB * callback, void *callback_data) +UFSSwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * callback, void *callback_data) { return IO->open (this, &e, file_callback, callback, callback_data); } diff --git a/src/fs/ufs/store_io_ufs.cc b/src/fs/ufs/store_io_ufs.cc index ca001f9df6..5aa1b73ebb 100644 --- a/src/fs/ufs/store_io_ufs.cc +++ b/src/fs/ufs/store_io_ufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_io_ufs.cc,v 1.30 2006/05/22 19:58:53 wessels Exp $ + * $Id: store_io_ufs.cc,v 1.31 2006/05/23 00:21:48 wessels Exp $ * * DEBUG: section 79 Storage Manager UFS Interface * AUTHOR: Duane Wessels @@ -65,7 +65,7 @@ UFSStrategy::~UFSStrategy () } StoreIOState::Pointer -UFSStrategy::createState(SwapDir *SD, StoreEntry *e, STIOCB * callback, void *callback_data) const +UFSStrategy::createState(SwapDir *SD, StoreEntry *e, StoreIOState::STIOCB * callback, void *callback_data) const { return new UFSStoreState (SD, e, callback, callback_data); } @@ -406,8 +406,8 @@ UFSStoreState::queueWrite(char const *buf, size_t size, off_t offset, FREE * fre } StoreIOState::Pointer -UFSStrategy::open(SwapDir * SD, StoreEntry * e, STFNCB * file_callback, - STIOCB * callback, void *callback_data) +UFSStrategy::open(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_callback, + StoreIOState::STIOCB * callback, void *callback_data) { assert (((UFSSwapDir *)SD)->IO == this); debug(79, 3) ("UFSStrategy::open: fileno %08X\n", e->swap_filen); @@ -441,8 +441,8 @@ UFSStrategy::open(SwapDir * SD, StoreEntry * e, STFNCB * file_callback, } StoreIOState::Pointer -UFSStrategy::create(SwapDir * SD, StoreEntry * e, STFNCB * file_callback, - STIOCB * callback, void *callback_data) +UFSStrategy::create(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB * file_callback, + StoreIOState::STIOCB * callback, void *callback_data) { assert (((UFSSwapDir *)SD)->IO == this); /* Allocate a number */ diff --git a/src/fs/ufs/ufscommon.h b/src/fs/ufs/ufscommon.h index 161253001a..4a9777e9a1 100644 --- a/src/fs/ufs/ufscommon.h +++ b/src/fs/ufs/ufscommon.h @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.4 2006/05/22 19:58:53 wessels Exp $ + * $Id: ufscommon.h,v 1.5 2006/05/23 00:21:48 wessels Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -70,8 +70,8 @@ public: virtual int canStore(StoreEntry const &)const; virtual void reference(StoreEntry &); virtual void dereference(StoreEntry &); - virtual StoreIOState::Pointer createStoreIO(StoreEntry &, STFNCB *, STIOCB *, void *); - virtual StoreIOState::Pointer openStoreIO(StoreEntry &, STFNCB *, STIOCB *, void *); + virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *); + virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *); virtual void openLog(); virtual void closeLog(); virtual int writeCleanStart(); @@ -167,13 +167,13 @@ public: virtual int load(); - StoreIOState::Pointer createState(SwapDir *SD, StoreEntry *e, STIOCB * callback, void *callback_data) const; + StoreIOState::Pointer createState(SwapDir *SD, StoreEntry *e, StoreIOState::STIOCB * callback, void *callback_data) const; /* UFS specific */ virtual RefCount newFile (char const *path); - StoreIOState::Pointer open(SwapDir *, StoreEntry *, STFNCB *, - STIOCB *, void *); - StoreIOState::Pointer create(SwapDir *, StoreEntry *, STFNCB *, - STIOCB *, void *); + StoreIOState::Pointer open(SwapDir *, StoreEntry *, StoreIOState::STFNCB *, + StoreIOState::STIOCB *, void *); + StoreIOState::Pointer create(SwapDir *, StoreEntry *, StoreIOState::STFNCB *, + StoreIOState::STIOCB *, void *); virtual void unlinkFile (char const *); virtual void sync(); diff --git a/src/store_client.cc b/src/store_client.cc index f5b701fabb..2ec96c2154 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.144 2005/11/07 22:00:38 wessels Exp $ + * $Id: store_client.cc,v 1.145 2006/05/23 00:21:47 wessels Exp $ * * DEBUG: section 90 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -55,8 +55,8 @@ * 'Body' refers to the swapfile body, which is the full * HTTP reply (including HTTP headers and body). */ -static STRCB storeClientReadBody; -static STRCB storeClientReadHeader; +static StoreIOState::STRCB storeClientReadBody; +static StoreIOState::STRCB storeClientReadHeader; static void storeClientCopy2(StoreEntry * e, store_client * sc); static EVH storeClientCopyEvent; static int CheckQuickAbort2(StoreEntry * entry); diff --git a/src/store_io.cc b/src/store_io.cc index 21a9f7c612..6d3a58774f 100644 --- a/src/store_io.cc +++ b/src/store_io.cc @@ -28,7 +28,7 @@ OBJH storeIOStats; * to select different polices depending on object size or type. */ StoreIOState::Pointer -storeCreate(StoreEntry * e, STFNCB * file_callback, STIOCB * close_callback, void *callback_data) +storeCreate(StoreEntry * e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * close_callback, void *callback_data) { assert (e); ssize_t objsize; @@ -72,7 +72,7 @@ storeCreate(StoreEntry * e, STFNCB * file_callback, STIOCB * close_callback, voi * storeOpen() is purely for reading .. */ StoreIOState::Pointer -storeOpen(StoreEntry * e, STFNCB * file_callback, STIOCB * callback, +storeOpen(StoreEntry * e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * callback, void *callback_data) { return dynamic_cast(e->store().getRaw())->openStoreIO(*e, file_callback, callback, callback_data); @@ -90,7 +90,7 @@ storeClose(StoreIOState::Pointer sio) } void -storeRead(StoreIOState::Pointer sio, char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data) +storeRead(StoreIOState::Pointer sio, char *buf, size_t size, off_t offset, StoreIOState::STRCB * callback, void *callback_data) { sio->read_(buf, size, offset, callback, callback_data); } diff --git a/src/store_swapin.cc b/src/store_swapin.cc index b780c9086e..cd2633bfe2 100644 --- a/src/store_swapin.cc +++ b/src/store_swapin.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapin.cc,v 1.37 2006/05/22 19:58:51 wessels Exp $ + * $Id: store_swapin.cc,v 1.38 2006/05/23 00:21:47 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapin Functions * AUTHOR: Duane Wessels @@ -37,8 +37,8 @@ #include "StoreClient.h" #include "Store.h" -static STIOCB storeSwapInFileClosed; -static STFNCB storeSwapInFileNotify; +static StoreIOState::STIOCB storeSwapInFileClosed; +static StoreIOState::STFNCB storeSwapInFileNotify; void storeSwapInStart(store_client * sc) diff --git a/src/store_swapout.cc b/src/store_swapout.cc index 4d3089890b..b6566cd5b9 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.cc,v 1.104 2006/05/22 19:58:51 wessels Exp $ + * $Id: store_swapout.cc,v 1.105 2006/05/23 00:21:47 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -42,8 +42,8 @@ #include "SwapDir.h" static void storeSwapOutStart(StoreEntry * e); -static STIOCB storeSwapOutFileClosed; -static STFNCB storeSwapOutFileNotify; +static StoreIOState::STIOCB storeSwapOutFileClosed; +static StoreIOState::STFNCB storeSwapOutFileNotify; /* start swapping object to disk */ static void