AC_ARG_ENABLE(disk-io,
AC_HELP_STRING([--enable-disk-io="list of modules"],
[Build support for the list of disk I/O modules.
- The default is only to build the "Blocking" module.
+ If unset only the "Blocking" module will be built.
+ Set without a value all available modules will be built.
See src/DiskIO for a list of available modules, or
- Programmers Guide section <not yet written>
+ Programmers Guide section on DiskIO
for details on how to build your custom disk module]),
[ case $enableval in
yes)
for dir in $srcdir/src/DiskIO/*; do
module="`basename $dir`"
if test -d "$dir" && test "$module" != CVS; then
+ echo "Autodetected $module DiskIO module"
DISK_MODULES="$DISK_MODULES $module"
fi
done
],
[ if test -z "$DISK_MODULES"; then
DISK_MODULES="Blocking"
+ echo "Enabling Blocking DiskIO module (required default)"
AC_DEFINE(USE_DISKIO,1,[DiskIO modules are expected to be available.])
fi
])
DISK_LIBS="lib`echo $DISK_MODULES|sed -e 's% %.a lib%g'`.a"
DISK_LINKOBJS=
for module in $DISK_MODULES; do
+ echo "Enabling $module DiskIO module"
DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/${module}/${module}DiskIOModule.o"
done
fi
;;
esac
done
-
+AC_SUBST(DISK_MODULES)
AC_SUBST(DISK_LIBS)
AC_SUBST(DISK_PROGRAMS)
AC_SUBST(DISK_LINKOBJS)
static BlockingDiskIOModule Instance;
};
-
-
#endif /* SQUID_BLOCKINGDISKIOMODULE_H */
-
/*
- * $Id: DiskIOModule.cc,v 1.3 2006/09/14 00:51:10 robertc Exp $
*
* DEBUG: section 92 Storage File System
* AUTHOR: Robert Collins
Vector<DiskIOModule*> *DiskIOModule::_Modules = NULL;
//DiskIOModule() : initialised (false) {}
+
DiskIOModule::DiskIOModule()
{
- /* We cannot call
- * ModuleAdd(*this);
- * here as the virtual methods are not yet available
+ /** We cannot call ModuleAdd(*this)
+ * here as the virtual methods are not yet available.
+ * We leave that to PokeAllModules() later.
*/
}
void
DiskIOModule::SetupAllModules()
{
+ DiskIOModule::PokeAllModules();
+
for (iterator i = GetModules().begin(); i != GetModules().end(); ++i)
/* Call the FS to set up capabilities and initialize the FS driver */
(*i)->init();
return *_Modules;
}
-/*
- * called when a graceful shutdown is to occur
+/**
+ * Called when a graceful shutdown is to occur
* of each fs module.
*/
void
DiskIOModule *
DiskIOModule::FindDefault()
{
- /* Best IO options are in order: */
+ /** Best IO options are in order: */
DiskIOModule * result;
result = Find("DiskThreads");
if (NULL == result)
result = Find("Blocking");
return result;
}
-
static void SetupAllModules();
static void ModuleAdd(DiskIOModule &);
static void FreeAllModules();
+
+ /** Poke all compiled modules for self-setup */
+ static void PokeAllModules();
+
static DiskIOModule *Find(char const *type);
- /* find *any* usable disk module. This will look for the 'best'
+
+ /** Find *any* usable disk module. This will look for the 'best'
* available module for this system.
*/
static DiskIOModule *FindDefault();
--- /dev/null
+#!/bin/sh
+echo "/* automatically generated by $0 $*"
+echo " * do not edit"
+echo " */"
+echo "#include \"squid.h\""
+echo "#include \"DiskIO/DiskIOModule.h\""
+for module in "$@"; do
+ echo "#include \"DiskIO/${module}/${module}DiskIOModule.h\""
+done
+echo ""
+echo "void DiskIOModule::PokeAllModules(void)"
+echo "{"
+for module in "$@"; do
+ echo " ${module}DiskIOModule::GetInstance();"
+done
+echo "}"
fs/diskd/StoreFSdiskd.cc \
fs/ufs/StoreFSufs.cc
-all_DISKIOMODULES = \
- DiskIO/AIO/AIODiskIOModule.cc \
- DiskIO/Blocking/BlockingDiskIOModule.cc \
- DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc \
- DiskIO/DiskThreads/DiskThreadsDiskIOModule.cc
-
DISKIO_SOURCE = \
DiskIO/DiskIOModule.cc \
DiskIO/ReadRequest.cc \
DiskIO/DiskIOStrategy.h \
DiskIO/IORequestor.h \
DiskIO/DiskIOModule.h \
- DiskIO/ReadRequest.h
+ DiskIO/ReadRequest.h \
+ DiskIO/DiskIOModules_gen.cc
+
+DiskIO/DiskIOModules_gen.cc: Makefile
+ $(SHELL) $(srcdir)/DiskIO/modules.sh $(DISK_MODULES) > DiskIO/DiskIOModules_gen.cc
+
all_AUTHMODULES = \
auth/basic/basicScheme.cc \
EXTRA_squid_SOURCES = \
$(all_FSMODULES) \
- $(all_DISKIOMODULES) \
$(AIO_WIN32_ALL_SOURCES) \
$(all_AUTHMODULES) \
$(ARP_ACL_ALL_SOURCE) \
# fi
DISTCLEANFILES = cf_gen_defines.h cf.data cf_parser.h squid.conf.default squid.conf.documented \
- globals.cc string_arrays.c repl_modules.cc
+ globals.cc string_arrays.c repl_modules.cc DiskIO/DiskIOModules_gen.cc
# stock tools for unit tests - library independent versions of dlink_list
# etc.
@SSLLIB@
tests_testDiskIO_LDFLAGS = $(LIBADD_DL)
tests_testDiskIO_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \
+ $(SWAP_TEST_DS) \
@SQUID_CPPUNIT_LA@
## Tests of the Even module.
memConfigure(void)
{
size_t new_pool_limit;
- /* set to configured value first */
+ /** Set to configured value first */
if (!Config.onoff.mem_pools)
new_pool_limit = 0;
else if (Config.MemPools.limit > 0)
new_pool_limit = mem_unlimited_size;
#if 0
- /*
+ /** \par
* DPW 2007-04-12
* No debugging here please because this method is called before
* the debug log is configured and we'll get the message on
{
int i;
- /*
+ /** \par
* NOTE: Mem::Init() is called before the config file is parsed
* and before the debugging module has been initialized. Any
* debug messages here at level 0 or 1 will always be printed
* on stderr.
*/
- /* set all pointers to null */
+ /** \par
+ * Set all pointers to null. */
memset(MemPools, '\0', sizeof(MemPools));
- /*
- * it does not hurt much to have a lot of pools since sizeof(MemPool) is
+ /**
+ * Then initialize all pools.
+ * \par
+ * Starting with generic 2kB - 64kB buffr pools, then specific object types.
+ * \par
+ * It does not hurt much to have a lot of pools since sizeof(MemPool) is
* small; someday we will figure out what to do with all the entries here
* that are never used or used only once; perhaps we should simply use
* malloc() for those? @?@
memDataInit(MEM_MD5_DIGEST, "MD5 digest", SQUID_MD5_DIGEST_LENGTH, 0);
MemPools[MEM_MD5_DIGEST]->setChunkSize(512 * 1024);
- /* init string pools */
-
+ /** Lastly init the string pools. */
for (i = 0; i < mem_str_pool_count; i++) {
StrPools[i].pool = memPoolCreate(StrPoolsAttrs[i].name, StrPoolsAttrs[i].obj_size);
StrPools[i].pool->zeroOnPush(false);
debugs(13, 1, "Notice: " << StrPoolsAttrs[i].name << " is " << StrPools[i].pool->objectSize() << " bytes instead of requested " << StrPoolsAttrs[i].obj_size << " bytes");
}
+ /** \par
+ * finally register with the cache manager */
RegisterWithCacheManager();
}
{
DiskIOModule * module = DiskIOModule::FindDefault();
#if USE_DISKIO
+ /* enabled. we expect at least ONE */
CPPUNIT_ASSERT(module != NULL);
#else
+ /* disabled. we don't expect ANY */
CPPUNIT_ASSERT(module == NULL);
#endif
}