This should allow us to use these types as parameters in the callbacks.
/*
- * $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
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);
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 */
/*
- * $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/
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();
/*
- * $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
}
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);
}
/*
- * $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
}
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);
}
}
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);
}
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 */
/*
- * $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/
* ----------------------------------------------------------
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();
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();
/*
- * $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
* '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);
* 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;
* 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);
}
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);
}
/*
- * $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
#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)
/*
- * $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
#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