From: Christos Tsantilas Date: Tue, 31 Mar 2009 20:33:48 +0000 (+0300) Subject: Currently the fs related subsystem is broken in trunk, because of X-Git-Tag: SQUID_3_2_0_1~1083 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b5b7ba854acb119d1b602bbacb205319310feb5;p=thirdparty%2Fsquid.git Currently the fs related subsystem is broken in trunk, because of 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. --- diff --git a/configure.in b/configure.in index fdee3f5457..e45aee1e81 100644 --- a/configure.in +++ b/configure.in @@ -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) diff --git a/src/Makefile.am b/src/Makefile.am index c9420755d6..050e57d0b7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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@ diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 858fd60140..47d98a8f9d 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -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 index 0000000000..69e40c197d --- /dev/null +++ b/src/fs/Module.cc @@ -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 *UfsInstance; +#endif + +#ifdef HAVE_FS_AUFS +static StoreFSufs *AufsInstance; +#endif + + +#ifdef HAVE_FS_DISKD +static StoreFSufs *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("Blocking", "ufs"); +#endif + +#ifdef HAVE_FS_AUFS + AufsInstance = new StoreFSufs("DiskThreads", "aufs");; +#endif + + +#ifdef HAVE_FS_DISKD + DiskdInstance = new StoreFSufs("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 index 0000000000..b9d2fc83de --- /dev/null +++ b/src/fs/Module.h @@ -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 */ diff --git a/src/fs/aufs/StoreFSaufs.cc b/src/fs/aufs/StoreFSaufs.cc index 9e7f35f8b7..500f48faad 100644 --- a/src/fs/aufs/StoreFSaufs.cc +++ b/src/fs/aufs/StoreFSaufs.cc @@ -32,6 +32,9 @@ * * Copyright (c) 2003, Robert Collins */ + +/* TODO: remove this file as unused */ + #include "config.h" #if 0 @@ -50,5 +53,5 @@ \ingroup UFS, FileSystems */ -/// \ingroup AUFS -static StoreFSufs AufsInstance("DiskThreads", "aufs"); +/* Unused variable: */ +StoreFSufs *AufsInstance_foo = NULL; diff --git a/src/fs/diskd/StoreFSdiskd.cc b/src/fs/diskd/StoreFSdiskd.cc index 6b6e599c85..67e109a80d 100644 --- a/src/fs/diskd/StoreFSdiskd.cc +++ b/src/fs/diskd/StoreFSdiskd.cc @@ -33,6 +33,8 @@ * Copyright (c) 2003, Robert Collins */ +/* 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 DiskdInstance("DiskDaemon", "diskd"); +/* Unused variable: */ +StoreFSufs *DiskdInstance_foo = NULL; diff --git a/src/fs/ufs/StoreFSufs.cc b/src/fs/ufs/StoreFSufs.cc index f85c80d809..72bee8e4ed 100644 --- a/src/fs/ufs/StoreFSufs.cc +++ b/src/fs/ufs/StoreFSufs.cc @@ -33,6 +33,8 @@ * Copyright (c) 2003, Robert Collins */ +/*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 UfsInstance("Blocking", "ufs"); - +/* Unused variable: */ +StoreFSufs *UfsInstance_foo = NULL; diff --git a/src/main.cc b/src/main.cc index db9def2148..e9f1bfa197 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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();