--------------------- PatchSet 362 Date: 2002/12/13 22:59:36 Author: rbcollins Branch: unify-io Tag: (none) Log: make callback a method Members: src/SwapDir.cc:1.1.2.14->1.1.2.15 src/SwapDir.h:1.1.2.19->1.1.2.20 src/store_dir.cc:1.4.10.6->1.4.10.7 src/fs/aufs/async_io.cc:1.3->1.3.12.1 src/fs/aufs/store_asyncufs.h:1.2.12.38->1.2.12.39 src/fs/aufs/store_dir_aufs.cc:1.2.12.21->1.2.12.22 src/fs/coss/store_coss.h:1.3.10.17->1.3.10.18 src/fs/coss/store_dir_coss.cc:1.4.10.18->1.4.10.19 src/fs/diskd/store_dir_diskd.cc:1.2.16.29->1.2.16.30 src/fs/diskd/store_diskd.h:1.1.20.39->1.1.20.40 src/fs/ufs/store_dir_ufs.cc:1.1.20.24->1.1.20.25 Index: squid3/src/SwapDir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -u -r1.1.2.14 -r1.1.2.15 --- squid3/src/SwapDir.cc 13 Dec 2002 22:29:35 -0000 1.1.2.14 +++ squid3/src/SwapDir.cc 13 Dec 2002 22:59:36 -0000 1.1.2.15 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.cc,v 1.1.2.14 2002/12/13 22:29:35 rbcollins Exp $ + * $Id: SwapDir.cc,v 1.1.2.15 2002/12/13 22:59:36 rbcollins Exp $ * * DEBUG: section ?? Swap Dir base object * AUTHOR: Robert Collins @@ -77,3 +77,9 @@ void SwapDir::dereference(StoreEntry &){} + +int +SwapDir::callback() +{ + return 0; +} Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.19 retrieving revision 1.1.2.20 diff -u -r1.1.2.19 -r1.1.2.20 --- squid3/src/SwapDir.h 13 Dec 2002 22:29:35 -0000 1.1.2.19 +++ squid3/src/SwapDir.h 13 Dec 2002 22:59:36 -0000 1.1.2.20 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.19 2002/12/13 22:29:35 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.20 2002/12/13 22:59:36 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -34,8 +34,6 @@ #ifndef SQUID_SWAPDIR_H #define SQUID_SWAPDIR_H -typedef void STDONE(void); -typedef int STCALLBACK(SwapDir *); typedef void STSYNC(SwapDir *); #include "StoreIOState.h" @@ -78,7 +76,7 @@ /* These two are notifications */ virtual void reference(StoreEntry &); /* Reference this object */ virtual void dereference(StoreEntry &); /* Unreference this object */ - STCALLBACK *callback; /* Handle pending callbacks */ + virtual int callback(); /* Handle pending callbacks */ STSYNC *sync; /* Sync the directory */ struct { STOBJCREATE *create; Index: squid3/src/store_dir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_dir.cc,v retrieving revision 1.4.10.6 retrieving revision 1.4.10.7 diff -u -r1.4.10.6 -r1.4.10.7 --- squid3/src/store_dir.cc 13 Dec 2002 22:03:37 -0000 1.4.10.6 +++ squid3/src/store_dir.cc 13 Dec 2002 22:59:36 -0000 1.4.10.7 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.cc,v 1.4.10.6 2002/12/13 22:03:37 rbcollins Exp $ + * $Id: store_dir.cc,v 1.4.10.7 2002/12/13 22:59:36 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -476,9 +476,7 @@ ndir = ndir % Config.cacheSwap.n_configured; SD = INDEXSD(ndir); ++ndir; - if (NULL == SD->callback) - continue; - j += SD->callback(SD); + j += SD->callback(); } } while (j > 0); ndir++; Index: squid3/src/fs/aufs/async_io.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/async_io.cc,v retrieving revision 1.3 retrieving revision 1.3.12.1 diff -u -r1.3 -r1.3.12.1 --- squid3/src/fs/aufs/async_io.cc 16 Nov 2002 03:13:16 -0000 1.3 +++ squid3/src/fs/aufs/async_io.cc 13 Dec 2002 22:59:38 -0000 1.3.12.1 @@ -1,6 +1,6 @@ /* - * $Id: async_io.cc,v 1.3 2002/11/16 03:13:16 squidadm Exp $ + * $Id: async_io.cc,v 1.3.12.1 2002/12/13 22:59:38 rbcollins Exp $ * * DEBUG: section 32 Asynchronous Disk I/O * AUTHOR: Pete Bentley @@ -293,7 +293,7 @@ int -aioCheckCallbacks(SwapDir * SD) +AUFSSwapDir::callback() { squidaio_result_t *resultp; squidaio_ctrl_t *ctrlp; @@ -387,7 +387,7 @@ /* Flush all pending operations */ debug(32, 1) ("aioSync: flushing pending I/O operations\n"); do { - aioCheckCallbacks(SD); + SD->callback(); } while (squidaio_sync()); debug(32, 1) ("aioSync: done\n"); } Index: squid3/src/fs/aufs/store_asyncufs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_asyncufs.h,v retrieving revision 1.2.12.38 retrieving revision 1.2.12.39 diff -u -r1.2.12.38 -r1.2.12.39 --- squid3/src/fs/aufs/store_asyncufs.h 13 Dec 2002 22:03:37 -0000 1.2.12.38 +++ squid3/src/fs/aufs/store_asyncufs.h 13 Dec 2002 22:59:38 -0000 1.2.12.39 @@ -76,7 +76,6 @@ void aioStat(char *, struct stat *, AIOCB *, void *); void aioUnlink(const char *, AIOCB *, void *); void aioTruncate(const char *, off_t length, AIOCB *, void *); -int aioCheckCallbacks(SwapDir *); void aioSync(SwapDir *); int aioQueueSize(void); @@ -159,6 +158,7 @@ virtual void dump(StoreEntry &)const; virtual void unlink(StoreEntry &); virtual int canStore(StoreEntry const &)const; + virtual int callback(); }; #include "IOStrategy.h" Index: squid3/src/fs/aufs/store_dir_aufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_dir_aufs.cc,v retrieving revision 1.2.12.21 retrieving revision 1.2.12.22 diff -u -r1.2.12.21 -r1.2.12.22 --- squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 22:29:35 -0000 1.2.12.21 +++ squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 22:59:38 -0000 1.2.12.22 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.21 2002/12/13 22:29:35 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.22 2002/12/13 22:59:38 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -188,7 +188,6 @@ aioinfo->map = NULL; /* Debugging purposes */ aioinfo->suggest = 0; aioinfo->io.storeDirUnlinkFile = storeAufsDirIOUnlinkFile; - sd->callback = aioCheckCallbacks; sd->sync = aioSync; sd->obj.create = commonUFSCreate; sd->obj.open = commonUFSOpen; Index: squid3/src/fs/coss/store_coss.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/coss/store_coss.h,v retrieving revision 1.3.10.17 retrieving revision 1.3.10.18 diff -u -r1.3.10.17 -r1.3.10.18 --- squid3/src/fs/coss/store_coss.h 13 Dec 2002 22:03:37 -0000 1.3.10.17 +++ squid3/src/fs/coss/store_coss.h 13 Dec 2002 22:59:38 -0000 1.3.10.18 @@ -113,6 +113,7 @@ virtual void unlink (StoreEntry &); virtual void statfs (StoreEntry &)const; virtual int canStore(StoreEntry const &)const; + virtual int callback(); }; extern off_t storeCossAllocate(SwapDir * SD, const StoreEntry * e, int which); Index: squid3/src/fs/coss/store_dir_coss.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/coss/store_dir_coss.cc,v retrieving revision 1.4.10.18 retrieving revision 1.4.10.19 diff -u -r1.4.10.18 -r1.4.10.19 --- squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 22:29:35 -0000 1.4.10.18 +++ squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 22:59:39 -0000 1.4.10.19 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.18 2002/12/13 22:29:35 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.19 2002/12/13 22:59:39 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -84,7 +84,6 @@ static STLOGWRITE storeCossDirSwapLog; static STFSPARSE storeCossDirParse; static STFSRECONFIGURE storeCossDirReconfigure; -static STCALLBACK storeCossDirCallback; /* The "only" externally visible function */ STSETUP storeFsSetup_coss; @@ -697,10 +696,10 @@ /* * storeCossDirCallback - do the IO completions */ -static int -storeCossDirCallback(SwapDir * SD) +int +CossSwapDir::callback() { - CossInfo *cs = (CossInfo *) SD->fsdata; + CossInfo *cs = (CossInfo *) fsdata; return a_file_callback(&cs->aq); } @@ -757,7 +756,6 @@ cs->fd = -1; cs->swaplog_fd = -1; - sd->callback = storeCossDirCallback; sd->sync = storeCossSync; sd->obj.create = storeCossCreate; Index: squid3/src/fs/diskd/store_dir_diskd.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/diskd/Attic/store_dir_diskd.cc,v retrieving revision 1.2.16.29 retrieving revision 1.2.16.30 diff -u -r1.2.16.29 -r1.2.16.30 --- squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 22:29:36 -0000 1.2.16.29 +++ squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 22:59:39 -0000 1.2.16.30 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.29 2002/12/13 22:29:36 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.30 2002/12/13 22:59:39 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -154,7 +154,7 @@ IO->away); lastmsg = squid_curtime; } - storeDiskdDirCallback(SD); + SD->callback(); } } @@ -167,14 +167,14 @@ * don't get a message. */ int -storeDiskdDirCallback(SwapDir * SD) +DiskdSwapDir::callback() { diomsg M; int x; int retval = 0; - DiskdIO *IO = dynamic_cast(SD->IO); - if (IO->away >= IO->magic2) { + DiskdIO *DIO = dynamic_cast(IO); + if (DIO->away >= DIO->magic2) { diskd_stats.block_queue_len++; retval = 1; /* We might not have anything to do, but our queue * is full.. */ @@ -187,7 +187,7 @@ #ifdef ALWAYS_ZERO_BUFFERS memset(&M, '\0', sizeof(M)); #endif - x = msgrcv(IO->rmsgid, &M, msg_snd_rcv_sz, 0, IPC_NOWAIT); + x = msgrcv(DIO->rmsgid, &M, msg_snd_rcv_sz, 0, IPC_NOWAIT); if (x < 0) break; else if (x != msg_snd_rcv_sz) { @@ -196,11 +196,11 @@ break; } diskd_stats.recv_count++; - --IO->away; + --DIO->away; storeDiskdHandle(&M); retval = 1; /* Return that we've actually done some work */ if (M.shm_offset > -1) - IO->shm.put ((off_t) M.shm_offset); + DIO->shm.put ((off_t) M.shm_offset); } return retval; } @@ -394,7 +394,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeDiskdDirIOUnlinkFile; - sd->callback = storeDiskdDirCallback; sd->sync = storeDiskdDirSync; sd->obj.create = commonUFSCreate; sd->obj.open = commonUFSOpen; Index: squid3/src/fs/diskd/store_diskd.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/diskd/Attic/store_diskd.h,v retrieving revision 1.1.20.39 retrieving revision 1.1.20.40 diff -u -r1.1.20.39 -r1.1.20.40 --- squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 22:03:38 -0000 1.1.20.39 +++ squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 22:59:40 -0000 1.1.20.40 @@ -127,7 +127,6 @@ static const int msg_snd_rcv_sz = sizeof(diomsg) - sizeof(mtyp_t); extern void storeDiskdHandle(diomsg * M); -extern int storeDiskdDirCallback(SwapDir *); #include "SwapDir.h" @@ -145,6 +144,7 @@ virtual void unlink(StoreEntry &); virtual void statfs (StoreEntry &) const; virtual int canStore(StoreEntry const &) const; + virtual int callback(); }; #define SHMBUF_BLKSZ SM_PAGE_SIZE Index: squid3/src/fs/ufs/store_dir_ufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/store_dir_ufs.cc,v retrieving revision 1.1.20.24 retrieving revision 1.1.20.25 diff -u -r1.1.20.24 -r1.1.20.25 --- squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 22:29:36 -0000 1.1.20.24 +++ squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 22:59:41 -0000 1.1.20.25 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.24 2002/12/13 22:29:36 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.25 2002/12/13 22:59:41 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -169,7 +169,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeUfsDirIOUnlinkFile; - sd->callback = NULL; sd->sync = NULL; sd->obj.create = commonUFSCreate; sd->obj.open = commonUFSOpen;