--------------------- PatchSet 353 Date: 2002/12/13 20:43:36 Author: rbcollins Branch: unify-io Tag: (none) Log: make close a method Members: src/StoreIOState.h:1.1.2.7->1.1.2.8 src/SwapDir.h:1.1.2.13->1.1.2.14 src/store_io.cc:1.3.10.7->1.3.10.8 src/ufscommon.h:1.1.20.37->1.1.20.38 src/fs/aufs/store_asyncufs.h:1.2.12.36->1.2.12.37 src/fs/aufs/store_dir_aufs.cc:1.2.12.15->1.2.12.16 src/fs/aufs/store_io_aufs.cc:1.3.12.36->1.3.12.37 src/fs/coss/store_coss.h:1.3.10.14->1.3.10.15 src/fs/coss/store_dir_coss.cc:1.4.10.12->1.4.10.13 src/fs/coss/store_io_coss.cc:1.3.10.10->1.3.10.11 src/fs/diskd/store_dir_diskd.cc:1.2.16.22->1.2.16.23 src/fs/diskd/store_diskd.h:1.1.20.36->1.1.20.37 src/fs/diskd/store_io_diskd.cc:1.1.20.41->1.1.20.42 src/fs/ufs/store_dir_ufs.cc:1.1.20.16->1.1.20.17 src/fs/ufs/store_io_ufs.cc:1.3.10.42->1.3.10.43 src/fs/ufs/store_ufs.h:1.1.20.27->1.1.20.28 Index: squid3/src/StoreIOState.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/StoreIOState.h,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- squid3/src/StoreIOState.h 11 Dec 2002 21:45:22 -0000 1.1.2.7 +++ squid3/src/StoreIOState.h 13 Dec 2002 20:43:36 -0000 1.1.2.8 @@ -1,6 +1,6 @@ /* - * $Id: StoreIOState.h,v 1.1.2.7 2002/12/11 21:45:22 rbcollins Exp $ + * $Id: StoreIOState.h,v 1.1.2.8 2002/12/13 20:43:36 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -50,6 +50,7 @@ virtual void read_(char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data) = 0; virtual void write(char *buf, size_t size, off_t offset, FREE * free_func) = 0; + virtual void close() = 0; sdirno swap_dirn; sfileno swap_filen; Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.13 retrieving revision 1.1.2.14 diff -u -r1.1.2.13 -r1.1.2.14 --- squid3/src/SwapDir.h 13 Dec 2002 12:17:21 -0000 1.1.2.13 +++ squid3/src/SwapDir.h 13 Dec 2002 20:43:39 -0000 1.1.2.14 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.13 2002/12/13 12:17:21 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.14 2002/12/13 20:43:39 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -87,7 +87,6 @@ struct { STOBJCREATE *create; STOBJOPEN *open; - STOBJCLOSE *close; } obj; virtual void unlink (StoreEntry &); struct { Index: squid3/src/store_io.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_io.cc,v retrieving revision 1.3.10.7 retrieving revision 1.3.10.8 diff -u -r1.3.10.7 -r1.3.10.8 --- squid3/src/store_io.cc 13 Dec 2002 12:17:21 -0000 1.3.10.7 +++ squid3/src/store_io.cc 13 Dec 2002 20:43:40 -0000 1.3.10.8 @@ -69,11 +69,10 @@ void storeClose(StoreIOState::Pointer sio) { - SwapDir *SD = INDEXSD(sio->swap_dirn); if (sio->flags.closing) return; sio->flags.closing = 1; - SD->obj.close(SD, sio.getRaw()); + sio->close(); } void Index: squid3/src/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.h,v retrieving revision 1.1.20.37 retrieving revision 1.1.20.38 diff -u -r1.1.20.37 -r1.1.20.38 --- squid3/src/ufscommon.h 13 Dec 2002 12:17:21 -0000 1.1.20.37 +++ squid3/src/ufscommon.h 13 Dec 2002 20:43:43 -0000 1.1.20.38 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.1.20.37 2002/12/13 12:17:21 rbcollins Exp $ + * $Id: ufscommon.h,v 1.1.20.38 2002/12/13 20:43:43 rbcollins Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -89,6 +89,7 @@ void unlinkFile(sfileno f); // move down when unlink is a virtual method +//protected: char *fullPath(sfileno, char *) const; private: static EVH CleanEvent; @@ -98,7 +99,6 @@ int createDirectory(const char *path, int); void createSwapSubDirs(); void dumpEntry(StoreEntry &) const; -// char *fullPath(sfileno, char *) const; }; #include "RefCount.h" 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.36 retrieving revision 1.2.12.37 diff -u -r1.2.12.36 -r1.2.12.37 --- squid3/src/fs/aufs/store_asyncufs.h 13 Dec 2002 12:17:21 -0000 1.2.12.36 +++ squid3/src/fs/aufs/store_asyncufs.h 13 Dec 2002 20:43:45 -0000 1.2.12.37 @@ -132,6 +132,7 @@ squidaiostate_t(SwapDir *, StoreEntry *, STIOCB *, void *); ~squidaiostate_t(); + void close(); int fd; struct { unsigned int write_kicking:1; @@ -152,8 +153,6 @@ * Store IO stuff */ #include "SwapDir.h" -extern STOBJCLOSE storeAufsClose; - class AUFSSwapDir : public UFSSwapDir { public: 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.15 retrieving revision 1.2.12.16 diff -u -r1.2.12.15 -r1.2.12.16 --- squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 12:17:21 -0000 1.2.12.15 +++ squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 20:43:46 -0000 1.2.12.16 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.15 2002/12/13 12:17:21 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.16 2002/12/13 20:43:46 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -198,7 +198,6 @@ sd->sync = aioSync; sd->obj.create = commonUFSCreate; sd->obj.open = commonUFSOpen; - sd->obj.close = storeAufsClose; sd->log.open = commonUfsDirOpenSwapLog; sd->log.close = commonUfsDirCloseSwapLog; sd->log.write = commonUfsDirSwapLog; Index: squid3/src/fs/aufs/store_io_aufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_io_aufs.cc,v retrieving revision 1.3.12.36 retrieving revision 1.3.12.37 diff -u -r1.3.12.36 -r1.3.12.37 --- squid3/src/fs/aufs/store_io_aufs.cc 13 Dec 2002 12:17:21 -0000 1.3.12.36 +++ squid3/src/fs/aufs/store_io_aufs.cc 13 Dec 2002 20:43:47 -0000 1.3.12.37 @@ -237,17 +237,16 @@ /* Close */ void -storeAufsClose(SwapDir * SD, storeIOState * sio) +squidaiostate_t::close() { - squidaiostate_t *aiostate = dynamic_cast (sio); debug(79, 3) ("storeAufsClose: dirno %d, fileno %08X, FD %d\n", - sio->swap_dirn, sio->swap_filen, aiostate->fd); + swap_dirn, swap_filen, fd); /* mark the object to be closed on the next io that completes */ - if (storeAufsNeedCompletetion(sio)) { - aiostate->closing = true; + if (storeAufsNeedCompletetion(this)) { + closing = true; return; } - storeAufsIOCallback(sio, DISK_OK); + storeAufsIOCallback(this, DISK_OK); } bool 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.14 retrieving revision 1.3.10.15 diff -u -r1.3.10.14 -r1.3.10.15 --- squid3/src/fs/coss/store_coss.h 13 Dec 2002 12:17:21 -0000 1.3.10.14 +++ squid3/src/fs/coss/store_coss.h 13 Dec 2002 20:43:50 -0000 1.3.10.15 @@ -58,13 +58,14 @@ }; +class CossSwapDir; /* Per-storeiostate info */ class CossState : public storeIOState { public: virtual void deleteSelf() const {delete this;} void * operator new (size_t); void operator delete (void *); - CossState(); + CossState(CossSwapDir *); ~CossState(); char *readbuffer; @@ -79,6 +80,9 @@ size_t st_size; void read_(char *buf, size_t size, off_t offset, STRCB * callback, void *callback_data); void write(char *buf, size_t size, off_t offset, FREE * free_func); + void close(); + + CossSwapDir *SD; private: static MemPool *Pool; }; @@ -97,7 +101,6 @@ */ extern STOBJCREATE storeCossCreate; extern STOBJOPEN storeCossOpen; -extern STOBJCLOSE storeCossClose; extern STSYNC storeCossSync; class CossSwapDir : public SwapDir 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.12 retrieving revision 1.4.10.13 diff -u -r1.4.10.12 -r1.4.10.13 --- squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 12:17:21 -0000 1.4.10.12 +++ squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 20:43:52 -0000 1.4.10.13 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.12 2002/12/13 12:17:21 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.13 2002/12/13 20:43:52 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -769,7 +769,6 @@ sd->obj.create = storeCossCreate; sd->obj.open = storeCossOpen; - sd->obj.close = storeCossClose; sd->log.open = storeCossDirOpenSwapLog; sd->log.close = storeCossDirCloseSwapLog; Index: squid3/src/fs/coss/store_io_coss.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/coss/store_io_coss.cc,v retrieving revision 1.3.10.10 retrieving revision 1.3.10.11 diff -u -r1.3.10.10 -r1.3.10.11 --- squid3/src/fs/coss/store_io_coss.cc 13 Dec 2002 12:17:21 -0000 1.3.10.10 +++ squid3/src/fs/coss/store_io_coss.cc 13 Dec 2002 20:43:55 -0000 1.3.10.11 @@ -1,6 +1,6 @@ /* - * $Id: store_io_coss.cc,v 1.3.10.10 2002/12/13 12:17:21 rbcollins Exp $ + * $Id: store_io_coss.cc,v 1.3.10.11 2002/12/13 20:43:55 rbcollins Exp $ * * DEBUG: section 79 Storage Manager COSS Interface * AUTHOR: Eric Stern @@ -91,7 +91,7 @@ memPoolFree (Pool, address); } -CossState::CossState() +CossState::CossState(CossSwapDir *aCSD):SD (aCSD) { } @@ -173,12 +173,13 @@ storeCossRemove(this, &e); } - StoreIOState::Pointer storeCossCreate(SwapDir * SD, StoreEntry * e, STFNCB * file_callback, STIOCB * callback, void *callback_data) { CossState *cstate; - StoreIOState::Pointer sio = new CossState; + CossSwapDir *CSD = dynamic_cast(SD); + assert (CSD); + StoreIOState::Pointer sio = new CossState(CSD); cstate = dynamic_cast(sio.getRaw()); sio->offset_ = 0; sio->mode = O_WRONLY | O_BINARY; @@ -226,7 +227,9 @@ debug(79, 3) ("storeCossOpen: offset %d\n", f); - StoreIOState::Pointer sio = new CossState; + CossSwapDir *CSD = dynamic_cast(SD); + assert (CSD); + StoreIOState::Pointer sio = new CossState (CSD); cstate = dynamic_cast(sio.getRaw()); sio->swap_filen = f; @@ -294,12 +297,12 @@ } void -storeCossClose(SwapDir * SD, storeIOState * sio) +CossState::close() { - debug(79, 3) ("storeCossClose: offset %d\n", sio->swap_filen); - if (FILE_MODE(sio->mode) == O_WRONLY) - storeCossMemBufUnlock(SD, sio); - storeCossIOCallback(sio, 0); + debug(79, 3) ("storeCossClose: offset %d\n", swap_filen); + if (FILE_MODE(mode) == O_WRONLY) + storeCossMemBufUnlock(SD, this); + storeCossIOCallback(this, 0); } void 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.22 retrieving revision 1.2.16.23 diff -u -r1.2.16.22 -r1.2.16.23 --- squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 12:17:21 -0000 1.2.16.22 +++ squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 20:43:57 -0000 1.2.16.23 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.22 2002/12/13 12:17:21 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.23 2002/12/13 20:43:57 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -405,7 +405,6 @@ sd->sync = storeDiskdDirSync; sd->obj.create = commonUFSCreate; sd->obj.open = commonUFSOpen; - sd->obj.close = storeDiskdClose; sd->log.open = commonUfsDirOpenSwapLog; sd->log.close = commonUfsDirCloseSwapLog; sd->log.write = commonUfsDirSwapLog; 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.36 retrieving revision 1.1.20.37 diff -u -r1.1.20.36 -r1.1.20.37 --- squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 12:17:21 -0000 1.1.20.36 +++ squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 20:43:58 -0000 1.1.20.37 @@ -72,6 +72,8 @@ void operator delete (void *); diskdstate_t(SwapDir *SD, StoreEntry *e, STIOCB * callback, void *callback_data); ~diskdstate_t(); + + void close(); void ioCompletedNotification(); void readCompleted(const char *buf, int len, int errflag); @@ -134,7 +136,6 @@ */ extern STOBJCREATE storeDiskdCreate; extern STOBJOPEN storeDiskdOpen; -extern STOBJCLOSE storeDiskdClose; class DiskdSwapDir : public UFSSwapDir { Index: squid3/src/fs/diskd/store_io_diskd.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/diskd/Attic/store_io_diskd.cc,v retrieving revision 1.1.20.41 retrieving revision 1.1.20.42 diff -u -r1.1.20.41 -r1.1.20.42 --- squid3/src/fs/diskd/store_io_diskd.cc 13 Dec 2002 12:17:21 -0000 1.1.20.41 +++ squid3/src/fs/diskd/store_io_diskd.cc 13 Dec 2002 20:44:00 -0000 1.1.20.42 @@ -1,6 +1,6 @@ /* - * $Id: store_io_diskd.cc,v 1.1.20.41 2002/12/13 12:17:21 rbcollins Exp $ + * $Id: store_io_diskd.cc,v 1.1.20.42 2002/12/13 20:44:00 rbcollins Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -475,13 +475,12 @@ } void -storeDiskdClose(SwapDir * SD, storeIOState * sio) +diskdstate_t::close() { - diskdstate_t *diskdstate = dynamic_cast(sio); - debug(79, 3) ("storeDiskdClose: dirno %d, fileno %08X\n", SD->index, - sio->swap_filen); - diskdstate->closing = true; - ((DiskdFile *)diskdstate->theFile.getRaw())->close(); + debug(79, 3) ("storeDiskdClose: dirno %d, fileno %08X\n", swap_dirn, + swap_filen); + closing = true; + ((DiskdFile *)theFile.getRaw())->close(); } void 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.16 retrieving revision 1.1.20.17 diff -u -r1.1.20.16 -r1.1.20.17 --- squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 12:17:21 -0000 1.1.20.16 +++ squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 20:44:02 -0000 1.1.20.17 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.16 2002/12/13 12:17:21 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.17 2002/12/13 20:44:02 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -179,7 +179,6 @@ sd->sync = NULL; sd->obj.create = commonUFSCreate; sd->obj.open = commonUFSOpen; - sd->obj.close = storeUfsClose; sd->log.open = commonUfsDirOpenSwapLog; sd->log.close = commonUfsDirCloseSwapLog; sd->log.write = commonUfsDirSwapLog; Index: squid3/src/fs/ufs/store_io_ufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/store_io_ufs.cc,v retrieving revision 1.3.10.42 retrieving revision 1.3.10.43 diff -u -r1.3.10.42 -r1.3.10.43 --- squid3/src/fs/ufs/store_io_ufs.cc 13 Dec 2002 12:17:22 -0000 1.3.10.42 +++ squid3/src/fs/ufs/store_io_ufs.cc 13 Dec 2002 20:44:03 -0000 1.3.10.43 @@ -1,6 +1,6 @@ /* - * $Id: store_io_ufs.cc,v 1.3.10.42 2002/12/13 12:17:22 rbcollins Exp $ + * $Id: store_io_ufs.cc,v 1.3.10.43 2002/12/13 20:44:03 rbcollins Exp $ * * DEBUG: section 79 Storage Manager UFS Interface * AUTHOR: Duane Wessels @@ -231,15 +231,13 @@ } void -storeUfsClose(SwapDir * SD, storeIOState * sio) +ufsstate_t::close() { - ufsstate_t *ufsstate = dynamic_cast(sio); - debug(79, 3) ("storeUfsClose: dirno %d, fileno %08X\n", - sio->swap_dirn, sio->swap_filen); - ufsstate->closing = true; - if (ufsstate->reading || ufsstate->writing) { - ((UFSFile *)ufsstate->theFile.getRaw())->close(); + swap_dirn, swap_filen); + closing = true; + if (reading || writing) { + ((UFSFile *)theFile.getRaw())->close(); } } Index: squid3/src/fs/ufs/store_ufs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/Attic/store_ufs.h,v retrieving revision 1.1.20.27 retrieving revision 1.1.20.28 diff -u -r1.1.20.27 -r1.1.20.28 --- squid3/src/fs/ufs/store_ufs.h 13 Dec 2002 12:17:22 -0000 1.1.20.27 +++ squid3/src/fs/ufs/store_ufs.h 13 Dec 2002 20:44:05 -0000 1.1.20.28 @@ -42,6 +42,7 @@ void operator delete (void *); ufsstate_t(SwapDir *SD, StoreEntry *e, STIOCB * callback, void *callback_data); ~ufsstate_t(); + void close(); void ioCompletedNotification(); void readCompleted(const char *buf, int len, int errflag); void writeCompleted(int errflag, size_t len); @@ -55,8 +56,6 @@ /* * Store IO stuff */ -extern STOBJCLOSE storeUfsClose; - /* For things that aren't factored well yet */ class UfsSwapDir: public UFSSwapDir { virtual void dump(StoreEntry &)const;