]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Moved unlinkd-related prototypes to own header.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 30 Aug 2012 21:01:30 +0000 (23:01 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 30 Aug 2012 21:01:30 +0000 (23:01 +0200)
Removed preprocessor conditionals from calling code.

src/DiskIO/Blocking/BlockingIOStrategy.cc
src/DiskIO/DiskDaemon/DiskdIOStrategy.cc
src/DiskIO/IpcIo/IpcIoIOStrategy.cc
src/DiskIO/Mmapped/MmappedIOStrategy.cc
src/Makefile.am
src/main.cc
src/protos.h
src/unlinkd.cc
src/unlinkd.h [new file with mode: 0644]

index de5d52fd130708ecc14907336a1b0d03d6e65da8..d9329ce61556e15bc1d935563b1a5d66570766a6 100644 (file)
@@ -1,7 +1,4 @@
-
 /*
- * $Id$
- *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Robert Collins
  *
@@ -38,6 +35,7 @@
 #include "BlockingIOStrategy.h"
 #include "BlockingFile.h"
 #include "protos.h"
+#include "unlinkd.h"
 
 bool
 BlockingIOStrategy::shedLoad()
@@ -67,9 +65,5 @@ BlockingIOStrategy::unlinkdUseful() const
 void
 BlockingIOStrategy::unlinkFile(char const *path)
 {
-#if USE_UNLINKD
     unlinkdUnlink(path);
-#else
-    ::unlink(path);
-#endif
 }
index 10b71cb41cb3c9c72c7091e34b1bb6d367005fed..3ee7d0744d8f6e795bb3a52a78e6e377eccebc38 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * DEBUG: section 79    Squid-side DISKD I/O functions.
  * AUTHOR: Duane Wessels
  *
@@ -45,6 +43,7 @@
 #include "Store.h"
 #include "StatCounters.h"
 #include "SquidTime.h"
+#include "unlinkd.h"
 
 #include <sys/ipc.h>
 #include <sys/msg.h>
@@ -120,14 +119,7 @@ DiskdIOStrategy::unlinkFile(char const *path)
     if (shedLoad()) {
         /* Damn, we need to issue a sync unlink here :( */
         debugs(79, 2, "storeDiskUnlink: Out of queue space, sync unlink");
-#if USE_UNLINKD
-
         unlinkdUnlink(path);
-#else
-
-        unlink(path);
-#endif
-
         return;
     }
 
index 9fded819dc04791c8925e424bf5f15e5cb512dcb..277fd52b841caddfebeffb9a745175ca1117612a 100644 (file)
@@ -1,7 +1,4 @@
-
 /*
- * $Id$
- *
  * DEBUG: section 47    Store Directory Routines
  */
 
@@ -9,6 +6,7 @@
 #include "IpcIoFile.h"
 #include "IpcIoIOStrategy.h"
 #include "protos.h"
+#include "unlinkd.h"
 
 bool
 IpcIoIOStrategy::shedLoad()
@@ -38,9 +36,5 @@ IpcIoIOStrategy::unlinkdUseful() const
 void
 IpcIoIOStrategy::unlinkFile(char const *path)
 {
-#if USE_UNLINKD
     unlinkdUnlink(path);
-#else
-    ::unlink(path);
-#endif
 }
index 41d4f679c3686fa8820b82251c1aa309ef5d06ea..66dfcb7d0214a1f7ddc20b10ed9949d2a6e2d58f 100644 (file)
@@ -1,7 +1,4 @@
-
 /*
- * $Id$
- *
  * DEBUG: section 47    Store Directory Routines
  */
 
@@ -9,6 +6,7 @@
 #include "MmappedFile.h"
 #include "MmappedIOStrategy.h"
 #include "protos.h"
+#include "unlinkd.h"
 
 bool
 MmappedIOStrategy::shedLoad()
@@ -38,9 +36,5 @@ MmappedIOStrategy::unlinkdUseful() const
 void
 MmappedIOStrategy::unlinkFile(char const *path)
 {
-#if USE_UNLINKD
     unlinkdUnlink(path);
-#else
-    ::unlink(path);
-#endif
 }
index 52de8c328326f980bb04f02977948d23df01801f..97d0690926fb54e1fc9f4e1232092f5c74ee8503 100644 (file)
@@ -137,10 +137,10 @@ LEAKFINDERSOURCE =
 endif
 
 if ENABLE_UNLINKD
-UNLINKDSOURCE = unlinkd.cc
+UNLINKDSOURCE = unlinkd.h unlinkd.cc
 UNLINKD = unlinkd
 else
-UNLINKDSOURCE = 
+UNLINKDSOURCE = unlinkd.h
 UNLINKD = 
 endif
 
index 5c11a4d7e901c6c714f88f64b0b04a4a3cde3fab..20a16fdc9db2e76738ac09c7a64f0003ce019a01 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * DEBUG: section 01    Startup and Main Loop
  * AUTHOR: Harvest Derived
  *
@@ -91,6 +89,7 @@
 #include "StoreFileSystem.h"
 #include "Store.h"
 #include "SwapDir.h"
+#include "unlinkd.h"
 #include "URL.h"
 #include "wccp.h"
 #include "wccp2.h"
@@ -871,10 +870,8 @@ mainReconfigureFinish(void *)
 
     mimeInit(Config.mimeTablePathname);
 
-#if USE_UNLINKD
     if (unlinkdNeeded())
         unlinkdInit();
-#endif
 
 #if USE_DELAY_POOLS
     Config.ClientDelay.finalize();
@@ -1078,10 +1075,8 @@ mainInitialize(void)
 #endif
 
     if (!configured_once) {
-#if USE_UNLINKD
         if (unlinkdNeeded())
             unlinkdInit();
-#endif
 
         urlInitialize();
         statInit();
@@ -1889,10 +1884,8 @@ SquidShutdown()
 #endif
 
     Store::Root().sync(); /* Flush pending object writes/unlinks */
-#if USE_UNLINKD
 
-    unlinkdClose();      /* after sync/flush */
-#endif
+    unlinkdClose();      /* after sync/flush. NOP if !USE_UNLINKD */
 
     storeDirWriteCleanLogs(0);
     PrintRusage();
index 4774015032a5ef339b2a02401fff50726519df4b..6b7f6e9c01d80b9f631ad6ea0ae62c31f7cfd0d9 100644 (file)
@@ -86,17 +86,9 @@ extern void shut_down(int);
 extern void rotate_logs(int);
 extern void reconfigure(int);
 
-class store_client;
-
 #include "fatal.h"
 
 
-#if USE_UNLINKD
-SQUIDCEXTERN bool unlinkdNeeded(void);
-SQUIDCEXTERN void unlinkdInit(void);
-SQUIDCEXTERN void unlinkdClose(void);
-SQUIDCEXTERN void unlinkdUnlink(const char *);
-#endif
 
 SQUIDCEXTERN peer_t parseNeighborType(const char *s);
 
index 022831150d006a025f787c7a9cfeac9369739774..b2e687a17d09de1071dba7609be84b5bfdeb5f27 100644 (file)
@@ -1,7 +1,4 @@
-
 /*
- * $Id$
- *
  * DEBUG: section 02    Unlink Daemon
  * AUTHOR: Duane Wessels
  *
@@ -34,6 +31,8 @@
  */
 
 #include "squid.h"
+
+#if USE_UNLINKD
 #include "disk.h"
 #include "fd.h"
 #include "fde.h"
@@ -273,3 +272,4 @@ unlinkdInit(void)
 #endif
 
 }
+#endif /* USE_UNLINKD */
diff --git a/src/unlinkd.h b/src/unlinkd.h
new file mode 100644 (file)
index 0000000..e417a7a
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef SQUID_UNLINKD_H_
+#define SQUID_UNLINKD_H_
+/*
+ * DEBUG: section 02    Unlink Daemon
+ * AUTHOR: Duane Wessels
+ *
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#if USE_UNLINKD
+extern bool unlinkdNeeded(void);
+extern void unlinkdInit(void);
+extern void unlinkdClose(void);
+extern void unlinkdUnlink(const char *);
+#else /* USE_UNLINKD */
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+inline bool unlinkdNeeded(void) { return false; }
+inline void unlinkdInit(void) { return; }
+inline void unlinkdClose(void) { return; }
+inline void unlinkdUnlink(const char * path) { ::unlink(path); }
+#endif /* USE_UNLINKD */
+
+#endif /* SQUID_UNLINKD_H_ */