]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Currently the fs related subsystem is broken in trunk, because of
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Tue, 31 Mar 2009 20:33:48 +0000 (23:33 +0300)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Tue, 31 Mar 2009 20:33:48 +0000 (23:33 +0300)
linking problems. This patch:
 - Add the files fs/Module.cc,h which are similar to esi/Module.* files
 - Build a new library libfs.a
 - The  fs/aufs/StoreFSaufs.cc, fs/diskd/StoreFSdiskd.cc and
   fs/ufs/StoreFSufs.cc now contain just fake pointers
 - The FS::Init() method used to build  ufs, aufs and diskd filesystems.
 - The FS::Init method called in main.cc before the code which reads the
   config files. The FS::clean() currently does not used.
 - The coss file system initiated using the old way.

configure.in
src/Makefile.am
src/fs/Makefile.am
src/fs/Module.cc [new file with mode: 0644]
src/fs/Module.h [new file with mode: 0644]
src/fs/aufs/StoreFSaufs.cc
src/fs/diskd/StoreFSdiskd.cc
src/fs/ufs/StoreFSufs.cc
src/main.cc

index fdee3f5457423f0dfda4036c99f93b4e2d8e691d..e45aee1e81d21ac9230cfd494817b37b552728e9 100644 (file)
@@ -509,6 +509,12 @@ if test -z "$UFS_FOUND" && test -n "$NEED_UFS"; then
     STORE_TESTS="$STORE_TESTS tests/testUfs$EXEEXT"
 fi
 
+AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
+AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
+AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
+AH_TEMPLATE(HAVE_FS_COSS, "Define to 1 if coss filesystem module is build")
+
+
 dnl got final STORE_MODULES, build library lists
 dnl This list will not be needed when each fs library has its own Makefile
 STORE_LIBS_TO_BUILD=
@@ -516,8 +522,10 @@ dnl File system libraries to link executables with.
 dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
 STORE_LIBS_TO_ADD=
 for fs in $STORE_MODULES; do
-    STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.a"
-    STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.a"
+    STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
+    STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
+    HAVE_FS_TYPE=HAVE_FS_`echo $fs | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` 
+    AC_DEFINE_UNQUOTED($HAVE_FS_TYPE, 1)
 done
 
 AC_SUBST(STORE_LIBS_TO_BUILD)
index c9420755d690b3c3bf8fa1f3fb7c8b792396043c..050e57d0b76ab8e4e9712b83396fba3e8832fa97 100644 (file)
@@ -168,7 +168,8 @@ COMMON_LIBS = \
        auth/libauth.la \
        acl/libapi.la \
        base/libbase.la \
-       ip/libip.la
+       ip/libip.la \
+       fs/libfs.la
 
 INCLUDES = \
        -I$(top_srcdir) \
@@ -532,7 +533,6 @@ squid_LDADD = \
        @XTRA_OBJS@ \
        @DISK_LINKOBJS@ \
        @REPL_OBJS@ \
-       @STORE_LIBS_TO_ADD@ \
        @DISK_LIBS@ \
        @CRYPTLIB@ \
        @REGEXLIB@ \
@@ -545,7 +545,6 @@ squid_LDADD = \
        @EPOLL_LIBS@ \
        @MINGW_LIBS@ 
 squid_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \
-       @STORE_LIBS_TO_ADD@ \
        @DISK_LIBS@ \
        @DISK_LINKOBJS@ \
        @REPL_OBJS@ \
@@ -613,7 +612,6 @@ ufsdump_LDADD = \
        $(COMMON_LIBS) \
        @XTRA_OBJS@ \
        @REPL_OBJS@ \
-       @STORE_LIBS_TO_ADD@ \
        @CRYPTLIB@ \
        @REGEXLIB@ \
        @SNMPLIB@ \
@@ -623,7 +621,7 @@ ufsdump_LDADD = \
        @EPOLL_LIBS@ \
        @MINGW_LIBS@ 
 ufsdump_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \
-       @STORE_LIBS_TO_ADD@ \
+       $(COMMON_LIBS) \
        @DISK_LIBS@ \
        @DISK_LINKOBJS@ \
        @REPL_OBJS@
@@ -1595,7 +1593,6 @@ tests_test_http_range_LDADD = \
        $(COMMON_LIBS) \
        icmp/libicmp.la icmp/libicmp-core.la \
        @REPL_OBJS@ \
-       @STORE_LIBS_TO_ADD@ \
        ${ADAPTATION_LIBS} \
        ${ESI_LIBS} \
        @REGEXLIB@ \
@@ -1895,7 +1892,7 @@ SWAP_TEST_GEN_SOURCES = \
 
 SWAP_TEST_LDADD = \
        @REGEXLIB@ \
-       @STORE_LIBS_TO_ADD@ \
+       $(COMMON_LIBS) \
        @REPL_OBJS@ \
        @DISK_LIBS@ \
        -L../lib -lmiscutil \
@@ -1905,7 +1902,7 @@ SWAP_TEST_DS =\
        $(top_builddir)/lib/libmiscutil.a \
        repl_modules.o \
        @DISK_LIBS@ \
-       @STORE_LIBS_TO_ADD@ \
+       $(COMMON_LIBS) \
        @REPL_OBJS@ \
        @SQUID_CPPUNIT_LA@
 
index 858fd60140cc185e7af60851fb3cc19e223a545a..47d98a8f9d3aa97571b84c4668696880df2af6b3 100644 (file)
@@ -1,20 +1,17 @@
 include $(top_srcdir)/src/Common.am
 
-EXTRA_LIBRARIES = libaufs.a libdiskd.a libcoss.a libufs.a
-noinst_LIBRARIES = @STORE_LIBS_TO_BUILD@
-
-## TODO: add libfs -- file system framework; this library is always built
-## TODO: use libtool and add @STORE_LIBS_TO_BUILD@ to libfs.la
+EXTRA_LTLIBRARIES = libaufs.la libdiskd.la libcoss.la libufs.la
+noinst_LTLIBRARIES =  @STORE_LIBS_TO_BUILD@ libfs.la
 
 # aufs is a "fake" legacy store
-libaufs_a_SOURCES = \
+libaufs_la_SOURCES = \
        aufs/StoreFSaufs.cc
 
 # diskd is a "fake" legacy store
-libdiskd_a_SOURCES = \
+libdiskd_la_SOURCES = \
        diskd/StoreFSdiskd.cc
 
-libcoss_a_SOURCES = \
+libcoss_la_SOURCES = \
        coss/StoreFScoss.h \
        coss/StoreFScoss.cc \
        coss/store_coss.h \
@@ -22,7 +19,7 @@ libcoss_a_SOURCES = \
        coss/store_dir_coss.cc \
        coss/CossSwapDir.h
 
-libufs_a_SOURCES = \
+libufs_la_SOURCES = \
        ufs/StoreFSufs.h \
        ufs/StoreFSufs.cc \
        ufs/store_dir_ufs.cc \
@@ -31,6 +28,9 @@ libufs_a_SOURCES = \
        ufs/ufscommon.cc \
        ufs/ufscommon.h 
 
+libfs_la_SOURCES = Module.cc Module.h
+libfs_la_LIBADD =  @STORE_LIBS_TO_BUILD@
+libfs_la_DEPENDENCIES = @STORE_LIBS_TO_BUILD@
 
 EXTRA_DIST = \
        coss/coss-notes.txt
@@ -56,7 +56,7 @@ testHeaders.c:
 CLEANFILES += testHeaders.c
 
 ## targets below to emulate distributed makefiles
-coss/all: libcoss.a
+coss/all: libcoss.la
 coss/clean: clean
-ufs/all: libufs.a
+ufs/all: libufs.la
 ufs/clean: clean
diff --git a/src/fs/Module.cc b/src/fs/Module.cc
new file mode 100644 (file)
index 0000000..69e40c1
--- /dev/null
@@ -0,0 +1,67 @@
+#include "squid.h"
+#include "Module.h"
+#if defined(HAVE_FS_UFS) || defined(HAVE_FS_AUFS) || defined(HAVE_FS_DISKD)
+#include "fs/ufs/StoreFSufs.h"
+#include "fs/ufs/ufscommon.h"
+#endif
+
+#ifdef HAVE_FS_COSS
+#include "fs/coss/StoreFScoss.h"
+#endif
+
+#ifdef HAVE_FS_UFS
+static StoreFSufs<UFSSwapDir> *UfsInstance;
+#endif
+
+#ifdef HAVE_FS_AUFS
+static StoreFSufs<UFSSwapDir> *AufsInstance;
+#endif
+
+
+#ifdef HAVE_FS_DISKD
+static StoreFSufs<UFSSwapDir> *DiskdInstance;
+#endif
+
+/* TODO: Modify coss code to:
+ * (a) remove the StoreFScoss::GetInstance method, 
+ * (b) declare the StoreFScoss::stats  as static and 
+ * (c) merge the StoreFScoss::stat() method with the static 
+ *     StoreFScoss::Stats() */
+#ifdef HAVE_FS_COSS
+    StoreFScoss &CossInstance = StoreFScoss::GetInstance();
+#endif
+
+
+void Fs::Init() {
+
+#ifdef HAVE_FS_UFS
+    UfsInstance = new StoreFSufs<UFSSwapDir>("Blocking", "ufs");
+#endif
+
+#ifdef HAVE_FS_AUFS
+    AufsInstance = new StoreFSufs<UFSSwapDir>("DiskThreads", "aufs");;
+#endif
+
+
+#ifdef HAVE_FS_DISKD
+    DiskdInstance = new StoreFSufs<UFSSwapDir>("DiskDaemon", "diskd");;
+#endif
+
+}
+
+
+void Fs::Clean() {
+#ifdef HAVE_FS_UFS
+    delete UfsInstance;
+#endif
+
+#ifdef HAVE_FS_AUFS
+    delete AufsInstance;
+#endif
+
+
+#ifdef HAVE_FS_DISKD
+    delete DiskdInstance;
+#endif
+
+}
diff --git a/src/fs/Module.h b/src/fs/Module.h
new file mode 100644 (file)
index 0000000..b9d2fc8
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef SQUID_FS_MODULE_H
+#define SQUID_FS_MODULE_H
+
+namespace Fs {
+
+    extern void Init();
+    extern void Clean();
+
+}; // namespace Fs
+
+#endif /* SQUID_FS_MODULE_H */
index 9e7f35f8b7403ab4620432cc91435bf1fb8aaceb..500f48faadbeeb4b912e79926ee53eb3a48b00e1 100644 (file)
@@ -32,6 +32,9 @@
  *
  * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
  */
+
+/* TODO: remove this file as unused */ 
+
 #include "config.h"
 
 #if 0
@@ -50,5 +53,5 @@
  \ingroup UFS, FileSystems
  */
 
-/// \ingroup AUFS
-static StoreFSufs<UFSSwapDir> AufsInstance("DiskThreads", "aufs");
+/* Unused variable: */
+StoreFSufs<UFSSwapDir> *AufsInstance_foo = NULL;
index 6b6e599c850a0a038425c3739bcf517ac0d31371..67e109a80dcd8f5f9f4a6ae5482ddf70d41153f9 100644 (file)
@@ -33,6 +33,8 @@
  * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
  */
 
+/* TODO: remove this file as unused */
+
 #if 0
 #include "StoreFileSystem.h"
 #include "DiskIO/DiskIOModule.h"
@@ -48,5 +50,5 @@
  \ingroup FileSystems, UFS
  */
 
-/// \ingroup diskd
-static StoreFSufs<UFSSwapDir> DiskdInstance("DiskDaemon", "diskd");
+/* Unused variable: */
+StoreFSufs<UFSSwapDir> *DiskdInstance_foo = NULL;
index f85c80d809997ef9123e6086280a9d92ab0b6387..72bee8e4edcef9323ea34a13600034089818a324 100644 (file)
@@ -33,6 +33,8 @@
  * Copyright (c) 2003, Robert Collins <robertc@squid-cache.org>
  */
 
+/*TODO: remove this file as unused*/
+
 #if 0
 #include "StoreFileSystem.h"
 #endif
@@ -46,5 +48,5 @@
 /** \todo FIXME: break UFSSwapDir out so we don't build all the extras */
 #include "fs/ufs/ufscommon.h"
 
-static StoreFSufs<UFSSwapDir> UfsInstance("Blocking", "ufs");
-
+/* Unused variable: */
+StoreFSufs<UFSSwapDir> *UfsInstance_foo = NULL;
index db9def21483a84c6713a8554e85f128e29884b5c..e9f1bfa1971536bd471feba48291e72d6405d58f 100644 (file)
@@ -90,6 +90,8 @@
 #include "esi/Module.h"
 #endif
 
+#include "fs/Module.h"
+
 #if USE_WIN32_SERVICE
 
 #include "squid_windows.h"
@@ -1227,6 +1229,9 @@ SquidMain(int argc, char **argv)
 
         storeFsInit();         /* required for config parsing */
 
+        /* TODO: call the FS::Clean() in shutdown to do Fs cleanups */
+       Fs::Init();
+
         /* May not be needed for parsing, have not audited for such */
         DiskIOModule::SetupAllModules();