--------------------- PatchSet 408 Date: 2002/12/15 19:50:38 Author: rbcollins Branch: unify-io Tag: (none) Log: make doing the callback a method Members: src/fs/diskd/store_diskd.h:1.1.20.45->1.1.20.46 src/fs/diskd/store_io_diskd.cc:1.1.20.44->1.1.20.45 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.45 retrieving revision 1.1.20.46 diff -u -r1.1.20.45 -r1.1.20.46 --- squid3/src/fs/diskd/store_diskd.h 15 Dec 2002 12:19:50 -0000 1.1.20.45 +++ squid3/src/fs/diskd/store_diskd.h 15 Dec 2002 19:50:38 -0000 1.1.20.46 @@ -81,6 +81,7 @@ void closeCompleted(); private: CBDATA_CLASS(diskdstate_t); + void doCallback(int); }; enum { 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.44 retrieving revision 1.1.20.45 diff -u -r1.1.20.44 -r1.1.20.45 --- squid3/src/fs/diskd/store_io_diskd.cc 15 Dec 2002 12:19:50 -0000 1.1.20.44 +++ squid3/src/fs/diskd/store_io_diskd.cc 15 Dec 2002 19:50:38 -0000 1.1.20.45 @@ -1,6 +1,6 @@ /* - * $Id: store_io_diskd.cc,v 1.1.20.44 2002/12/15 12:19:50 rbcollins Exp $ + * $Id: store_io_diskd.cc,v 1.1.20.45 2002/12/15 19:50:38 rbcollins Exp $ * * DEBUG: section 79 Squid-side DISKD I/O functions. * AUTHOR: Duane Wessels @@ -46,7 +46,6 @@ static int storeDiskdSend(int, DiskdIO *, int, StoreIOState::Pointer, int, int, off_t); static int storeDiskdSend(int, DiskdIO *, int, DiskdFile *, int, int, off_t); -static void storeDiskdIOCallback(void *siocb, int errflag); /* === PUBLIC =========================================================== */ DiskdIO::DiskdIO() : away (0), magic1(64), magic2(72) @@ -441,7 +440,7 @@ swap_dirn, swap_filen, theFile->error()); assert (FILE_MODE(mode) == O_RDONLY); if (theFile->error()) { - storeDiskdIOCallback(this, DISK_ERROR); + doCallback(DISK_ERROR); } return; } @@ -450,7 +449,7 @@ debug(79, 3) ("storeDiskdCreateDone: dirno %d, fileno %08x status %d\n", swap_dirn, swap_filen, theFile->error()); if (theFile->error()) { - storeDiskdIOCallback(this, DISK_ERROR); + doCallback(DISK_ERROR); } return; } @@ -458,7 +457,7 @@ debug(79, 3) ("diskd::ioCompleted: dirno %d, fileno %08x status %d\n", swap_dirn, swap_filen, theFile->error()); /* Ok, notification past open means an error has occured */ assert (theFile->error()); - storeDiskdIOCallback(this, DISK_ERROR); + doCallback(DISK_ERROR); } void @@ -468,9 +467,9 @@ debug(79, 3) ("storeDiskdCloseDone: dirno %d, fileno %08x status %d\n", swap_dirn, swap_filen, theFile->error()); if (theFile->error()) { - storeDiskdIOCallback(this, DISK_ERROR); + doCallback(DISK_ERROR); } else { - storeDiskdIOCallback(this, DISK_OK); + doCallback(DISK_OK); } } @@ -615,7 +614,7 @@ swap_dirn, swap_filen, len); offset_ += len; if (errflag) - storeDiskdIOCallback(this, DISK_ERROR); + doCallback(DISK_ERROR); } void @@ -678,20 +677,19 @@ cbdataReferenceDone (M->callback_data); } -static void -storeDiskdIOCallback(void *siocb, int errflag) +void +diskdstate_t::doCallback(int errflag) { - if (!cbdataReferenceValid(siocb)) { - debug (79, 0) ("storeDiskdIOCallback: invalid siocb %p\n",siocb); + if (!this || !cbdataReferenceValid(this)) { + debug (79, 0) ("storeDiskdIOCallback: invalid siocb %p\n",this); return; } - StoreIOState::Pointer sio = (storeIOState *)siocb; void *cbdata; - STIOCB *callback = sio->callback; + STIOCB *theCallback = callback; debug(79, 3) ("storeUfsIOCallback: errflag=%d\n", errflag); - sio->callback = NULL; - if (cbdataReferenceValidDone(sio->callback_data, &cbdata) && callback) - callback(cbdata, errflag, sio.getRaw()); + callback = NULL; + if (cbdataReferenceValidDone(callback_data, &cbdata) && theCallback) + theCallback(cbdata, errflag, this); } int