---------------------
PatchSet 363 
Date: 2002/12/13 23:23:31
Author: rbcollins
Branch: unify-io
Tag: (none) 
Log:
make sync a method

Members: 
	src/SwapDir.cc:1.1.2.15->1.1.2.16 
	src/SwapDir.h:1.1.2.20->1.1.2.21 
	src/store_dir.cc:1.4.10.7->1.4.10.8 
	src/fs/aufs/async_io.cc:1.3.12.1->1.3.12.2 
	src/fs/aufs/store_asyncufs.h:1.2.12.39->1.2.12.40 
	src/fs/aufs/store_dir_aufs.cc:1.2.12.22->1.2.12.23 
	src/fs/coss/store_coss.h:1.3.10.18->1.3.10.19 
	src/fs/coss/store_dir_coss.cc:1.4.10.19->1.4.10.20 
	src/fs/coss/store_io_coss.cc:1.3.10.11->1.3.10.12 
	src/fs/diskd/store_dir_diskd.cc:1.2.16.30->1.2.16.31 
	src/fs/diskd/store_diskd.h:1.1.20.40->1.1.20.41 
	src/fs/ufs/store_dir_ufs.cc:1.1.20.25->1.1.20.26 

Index: squid3/src/SwapDir.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -u -r1.1.2.15 -r1.1.2.16
--- squid3/src/SwapDir.cc	13 Dec 2002 22:59:36 -0000	1.1.2.15
+++ squid3/src/SwapDir.cc	13 Dec 2002 23:23:31 -0000	1.1.2.16
@@ -1,6 +1,6 @@
 
 /*
- * $Id: SwapDir.cc,v 1.1.2.15 2002/12/13 22:59:36 rbcollins Exp $
+ * $Id: SwapDir.cc,v 1.1.2.16 2002/12/13 23:23:31 rbcollins Exp $
  *
  * DEBUG: section ??    Swap Dir base object
  * AUTHOR: Robert Collins
@@ -83,3 +83,6 @@
 {
     return 0;
 }
+
+void
+SwapDir::sync(){}
Index: squid3/src/SwapDir.h
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v
retrieving revision 1.1.2.20
retrieving revision 1.1.2.21
diff -u -r1.1.2.20 -r1.1.2.21
--- squid3/src/SwapDir.h	13 Dec 2002 22:59:36 -0000	1.1.2.20
+++ squid3/src/SwapDir.h	13 Dec 2002 23:23:31 -0000	1.1.2.21
@@ -1,6 +1,6 @@
 
 /*
- * $Id: SwapDir.h,v 1.1.2.20 2002/12/13 22:59:36 rbcollins Exp $
+ * $Id: SwapDir.h,v 1.1.2.21 2002/12/13 23:23:31 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 STSYNC(SwapDir *);
-
 #include "StoreIOState.h"
 
 typedef StoreIOState::Pointer STOBJCREATE(SwapDir *, StoreEntry *, STFNCB *, STIOCB *, void *);
@@ -77,7 +75,7 @@
     virtual void reference(StoreEntry &);	/* Reference this object */
     virtual void dereference(StoreEntry &);	/* Unreference this object */
     virtual int callback();	/* Handle pending callbacks */
-    STSYNC *sync;		/* Sync the directory */
+    virtual void sync();	/* Sync the store prior to shutdown */
     struct {
 	STOBJCREATE *create;
 	STOBJOPEN *open;
Index: squid3/src/store_dir.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/store_dir.cc,v
retrieving revision 1.4.10.7
retrieving revision 1.4.10.8
diff -u -r1.4.10.7 -r1.4.10.8
--- squid3/src/store_dir.cc	13 Dec 2002 22:59:36 -0000	1.4.10.7
+++ squid3/src/store_dir.cc	13 Dec 2002 23:23:31 -0000	1.4.10.8
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir.cc,v 1.4.10.7 2002/12/13 22:59:36 rbcollins Exp $
+ * $Id: store_dir.cc,v 1.4.10.8 2002/12/13 23:23:31 rbcollins Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -450,14 +450,8 @@
 void
 storeDirSync(void)
 {
-    int i;
-    SwapDir *SD;
-
-    for (i = 0; i < Config.cacheSwap.n_configured; i++) {
-	SD = INDEXSD(i);
-	if (SD->sync != NULL)
-	    SD->sync(SD);
-    }
+    for (int i = 0; i < Config.cacheSwap.n_configured; ++i)
+	INDEXSD(i)->sync();
 }
 
 /*
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.12.1
retrieving revision 1.3.12.2
diff -u -r1.3.12.1 -r1.3.12.2
--- squid3/src/fs/aufs/async_io.cc	13 Dec 2002 22:59:38 -0000	1.3.12.1
+++ squid3/src/fs/aufs/async_io.cc	13 Dec 2002 23:23:31 -0000	1.3.12.2
@@ -1,6 +1,6 @@
 
 /*
- * $Id: async_io.cc,v 1.3.12.1 2002/12/13 22:59:38 rbcollins Exp $
+ * $Id: async_io.cc,v 1.3.12.2 2002/12/13 23:23:31 rbcollins Exp $
  *
  * DEBUG: section 32    Asynchronous Disk I/O
  * AUTHOR: Pete Bentley <pete@demon.net>
@@ -380,14 +380,14 @@
 
 /* Flush all pending I/O */
 void
-aioSync(SwapDir * SD)
+AUFSSwapDir::sync()
 {
     if (!initialised)
 	return;			/* nothing to do then */
     /* Flush all pending operations */
     debug(32, 1) ("aioSync: flushing pending I/O operations\n");
     do {
-	SD->callback();
+	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.39
retrieving revision 1.2.12.40
diff -u -r1.2.12.39 -r1.2.12.40
--- squid3/src/fs/aufs/store_asyncufs.h	13 Dec 2002 22:59:38 -0000	1.2.12.39
+++ squid3/src/fs/aufs/store_asyncufs.h	13 Dec 2002 23:23:31 -0000	1.2.12.40
@@ -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 *);
-void aioSync(SwapDir *);
 int aioQueueSize(void);
 
 #include "ufscommon.h"
@@ -159,6 +158,7 @@
   virtual void unlink(StoreEntry &);
   virtual int canStore(StoreEntry const &)const;
   virtual int callback();
+  virtual void sync();
 };
 
 #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.22
retrieving revision 1.2.12.23
diff -u -r1.2.12.22 -r1.2.12.23
--- squid3/src/fs/aufs/store_dir_aufs.cc	13 Dec 2002 22:59:38 -0000	1.2.12.22
+++ squid3/src/fs/aufs/store_dir_aufs.cc	13 Dec 2002 23:23:31 -0000	1.2.12.23
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_aufs.cc,v 1.2.12.22 2002/12/13 22:59:38 rbcollins Exp $
+ * $Id: store_dir_aufs.cc,v 1.2.12.23 2002/12/13 23:23:31 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->sync = aioSync;
     sd->obj.create = commonUFSCreate;
     sd->obj.open = commonUFSOpen;
     sd->log.open = commonUfsDirOpenSwapLog;
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.18
retrieving revision 1.3.10.19
diff -u -r1.3.10.18 -r1.3.10.19
--- squid3/src/fs/coss/store_coss.h	13 Dec 2002 22:59:38 -0000	1.3.10.18
+++ squid3/src/fs/coss/store_coss.h	13 Dec 2002 23:23:31 -0000	1.3.10.19
@@ -101,7 +101,6 @@
  */
 extern STOBJCREATE storeCossCreate;
 extern STOBJOPEN storeCossOpen;
-extern STSYNC storeCossSync;
 
 class CossSwapDir : public SwapDir 
 {
@@ -114,6 +113,7 @@
     virtual void statfs (StoreEntry &)const;
     virtual int canStore(StoreEntry const &)const;
     virtual int callback();
+    virtual void sync();
 };
 
 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.19
retrieving revision 1.4.10.20
diff -u -r1.4.10.19 -r1.4.10.20
--- squid3/src/fs/coss/store_dir_coss.cc	13 Dec 2002 22:59:39 -0000	1.4.10.19
+++ squid3/src/fs/coss/store_dir_coss.cc	13 Dec 2002 23:23:31 -0000	1.4.10.20
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_coss.cc,v 1.4.10.19 2002/12/13 22:59:39 rbcollins Exp $
+ * $Id: store_dir_coss.cc,v 1.4.10.20 2002/12/13 23:23:31 rbcollins Exp $
  *
  * DEBUG: section 47    Store COSS Directory Routines
  * AUTHOR: Eric Stern
@@ -657,7 +657,7 @@
 {
     CossInfo *cs = (CossInfo *) fsdata;
 
-    storeCossSync(this);		/* This'll call a_file_syncqueue() */
+    sync();				/* This'll call a_file_syncqueue() */
     a_file_closequeue(&cs->aq);
     file_close(cs->fd);
     cs->fd = -1;
@@ -756,8 +756,6 @@
     cs->fd = -1;
     cs->swaplog_fd = -1;
 
-    sd->sync = storeCossSync;
-
     sd->obj.create = storeCossCreate;
     sd->obj.open = storeCossOpen;
 
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.11
retrieving revision 1.3.10.12
diff -u -r1.3.10.11 -r1.3.10.12
--- squid3/src/fs/coss/store_io_coss.cc	13 Dec 2002 20:43:55 -0000	1.3.10.11
+++ squid3/src/fs/coss/store_io_coss.cc	13 Dec 2002 23:23:31 -0000	1.3.10.12
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_io_coss.cc,v 1.3.10.11 2002/12/13 20:43:55 rbcollins Exp $
+ * $Id: store_io_coss.cc,v 1.3.10.12 2002/12/13 23:23:31 rbcollins Exp $
  *
  * DEBUG: section 79    Storage Manager COSS Interface
  * AUTHOR: Eric Stern
@@ -483,9 +483,9 @@
 }
 
 void
-storeCossSync(SwapDir * SD)
+CossSwapDir::sync()
 {
-    CossInfo *cs = (CossInfo *) SD->fsdata;
+    CossInfo *cs = (CossInfo *) fsdata;
     CossMemBuf *t;
     dlink_node *m;
     int end;
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.30
retrieving revision 1.2.16.31
diff -u -r1.2.16.30 -r1.2.16.31
--- squid3/src/fs/diskd/store_dir_diskd.cc	13 Dec 2002 22:59:39 -0000	1.2.16.30
+++ squid3/src/fs/diskd/store_dir_diskd.cc	13 Dec 2002 23:23:32 -0000	1.2.16.31
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_diskd.cc,v 1.2.16.30 2002/12/13 22:59:39 rbcollins Exp $
+ * $Id: store_dir_diskd.cc,v 1.2.16.31 2002/12/13 23:23:32 rbcollins Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -51,7 +51,6 @@
 static int diskd_initialised = 0;
 
 static void storeDiskdStats(StoreEntry * sentry);
-static void storeDiskdDirSync(SwapDir *);
 static void storeDiskdDirIOUnlinkFile(char *path);
 
 /* The only externally visible interface */
@@ -143,18 +142,18 @@
  * Sync any pending data. We just sit around and read the queue
  * until the data has finished writing.
  */
-static void
-storeDiskdDirSync(SwapDir * SD)
+void
+DiskdSwapDir::sync()
 {
     static time_t lastmsg = 0;
-    DiskdIO *IO = dynamic_cast<DiskdIO *>(SD->IO);
-    while (IO->away > 0) {
+    DiskdIO *DIO = dynamic_cast<DiskdIO *>(IO);
+    while (DIO->away > 0) {
 	if (squid_curtime > lastmsg) {
 	    debug(47, 1) ("storeDiskdDirSync: %d messages away\n",
-		IO->away);
+		DIO->away);
 	    lastmsg = squid_curtime;
 	}
-	SD->callback();
+	callback();
     }
 }
 
@@ -394,7 +393,6 @@
     ufsinfo->map = NULL;	/* Debugging purposes */
     ufsinfo->suggest = 0;
     ufsinfo->io.storeDirUnlinkFile = storeDiskdDirIOUnlinkFile;
-    sd->sync = storeDiskdDirSync;
     sd->obj.create = commonUFSCreate;
     sd->obj.open = commonUFSOpen;
     sd->log.open = commonUfsDirOpenSwapLog;
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.40
retrieving revision 1.1.20.41
diff -u -r1.1.20.40 -r1.1.20.41
--- squid3/src/fs/diskd/store_diskd.h	13 Dec 2002 22:59:40 -0000	1.1.20.40
+++ squid3/src/fs/diskd/store_diskd.h	13 Dec 2002 23:23:32 -0000	1.1.20.41
@@ -145,6 +145,7 @@
     virtual void statfs (StoreEntry &) const;
     virtual int canStore(StoreEntry const &) const;
     virtual int callback();
+    virtual void sync();
 };
 
 #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.25
retrieving revision 1.1.20.26
diff -u -r1.1.20.25 -r1.1.20.26
--- squid3/src/fs/ufs/store_dir_ufs.cc	13 Dec 2002 22:59:41 -0000	1.1.20.25
+++ squid3/src/fs/ufs/store_dir_ufs.cc	13 Dec 2002 23:23:32 -0000	1.1.20.26
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir_ufs.cc,v 1.1.20.25 2002/12/13 22:59:41 rbcollins Exp $
+ * $Id: store_dir_ufs.cc,v 1.1.20.26 2002/12/13 23:23:32 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->sync = NULL;
     sd->obj.create = commonUFSCreate;
     sd->obj.open = commonUFSOpen;
     sd->log.open = commonUfsDirOpenSwapLog;
