]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Moved STRCB, STFNCB, STIOCB typdefs to inside StoreIOState class itself.
authorwessels <>
Tue, 23 May 2006 06:21:47 +0000 (06:21 +0000)
committerwessels <>
Tue, 23 May 2006 06:21:47 +0000 (06:21 +0000)
This should allow us to use these types as parameters in the callbacks.

src/StoreIOState.h
src/SwapDir.h
src/fs/ufs/store_dir_ufs.cc
src/fs/ufs/store_io_ufs.cc
src/fs/ufs/ufscommon.h
src/store_client.cc
src/store_io.cc
src/store_swapin.cc
src/store_swapout.cc

index aa83eb57c91934482c63356dcbf47c34dd020ae8..63f1dc9c7de833c0225a8464c167b0e1e1b63bcd 100644 (file)
@@ -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/
 #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<StoreIOState> 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 */
index db0c87ffe5596d9691d78e232e0a38ab616a7f23..53812ee01cca0900201d692e6601fb3956f215c3 100644 (file)
@@ -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();
index 4aea6c549ada9d1a2af7172b5060ea0f37f51dc1..6cadb7d6cd41dafe4bcecdcaa3aae784e5777066 100644 (file)
@@ -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);
 }
index ca001f9df6537d1e8fa34c0f3a0ca904484c21bb..5aa1b73ebb54c5db70a2020d03facf4de3b50dbc 100644 (file)
@@ -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 */
index 161253001aee49a99ec4b8647601b5d8973e6f47..4a9777e9a101a4230b3e3c60d2f23cd3904803ec 100644 (file)
@@ -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<DiskFile> 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();
index f5b701fabb737ea29f2b4b04c07c33d09b565a9d..2ec96c2154c4e967058a96a16a44a8fc6d061823 100644 (file)
@@ -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);
index 21a9f7c612e04c585cc5b4cbef15ef18a26ca8db..6d3a58774f069863fb6d3ce4a845d952d879d4dd 100644 (file)
@@ -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<SwapDir *>(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);
 }
index b780c9086e19e96b26d36695590e69b30f9606bd..cd2633bfe213bfb638e18ba57b5c51fce85f8cd7 100644 (file)
@@ -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)
index 4d3089890b02db9bd931265827c947b40435bad9..b6566cd5b9643c2a946f1fa54acaad208df72da0 100644 (file)
@@ -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