From: hno <> Date: Thu, 27 Dec 2007 22:48:53 +0000 (+0000) Subject: Remove the default cache_dir location and the null store type X-Git-Tag: BASIC_TPROXY4~220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bebc043b8df7953e06b2a66ad7b88b362fbc59b5;p=thirdparty%2Fsquid.git Remove the default cache_dir location and the null store type Many people gets confused by the builtin cache_dir location, thinking that if there is no cache_dir in squid.conf then there is no on-disk cache. This removes the builtin default. By removing the builtin default we can also remove the "null" cache_dir type whos purpose is only to override the builtin default. --- diff --git a/configure.in b/configure.in index 032e3eb33c..b0248288b0 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Configuration input file for Squid dnl -dnl $Id: configure.in,v 1.492 2007/12/19 02:36:26 amosjeffries Exp $ +dnl $Id: configure.in,v 1.493 2007/12/27 15:48:53 hno Exp $ dnl dnl dnl @@ -11,7 +11,7 @@ AM_CONFIG_HEADER(include/autoconf.h) AC_CONFIG_AUX_DIR(cfgaux) AC_CONFIG_SRCDIR([src/main.cc]) AM_INIT_AUTOMAKE([tar-ustar]) -AC_REVISION($Revision: 1.492 $)dnl +AC_REVISION($Revision: 1.493 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -448,9 +448,6 @@ for fs in $STORE_MODULES none; do dnl STORE_TESTS="$STORE_TESTS tests/testCoss$EXEEXT" ;; - null) - STORE_TESTS="$STORE_TESTS tests/testNull$EXEEXT" - ;; ufs) UFS_FOUND="true" STORE_TESTS="$STORE_TESTS tests/testUfs$EXEEXT" diff --git a/src/Makefile.am b/src/Makefile.am index 56f610f364..97d55de34b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.196 2007/12/27 14:55:47 hno Exp $ +# $Id: Makefile.am,v 1.197 2007/12/27 15:48:53 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -243,7 +243,6 @@ all_FSMODULES = \ fs/aufs/StoreFSaufs.cc \ fs/coss/StoreFScoss.cc \ fs/diskd/StoreFSdiskd.cc \ - fs/null/StoreFSnull.cc \ fs/ufs/StoreFSufs.cc all_DISKIOMODULES = \ diff --git a/src/cache_cf.cc b/src/cache_cf.cc index ea504cfa15..2a23779a43 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.530 2007/12/18 23:24:25 amosjeffries Exp $ + * $Id: cache_cf.cc,v 1.531 2007/12/27 15:48:53 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -359,9 +359,6 @@ configDoConfigure(void) memConfigure(); /* Sanity checks */ - if (Config.cacheSwap.swapDirs == NULL) - fatal("No cache_dir's specified in config file"); - #if SIZEOF_OFF_T <= 4 if (Config.Store.maxObjectSize > 0x7FFF0000) { debugs(3, 0, "WARNING: This Squid binary can not handle files larger than 2GB. Limiting maximum_object_size to just below 2GB"); @@ -1327,12 +1324,6 @@ dump_cachedir(StoreEntry * entry, const char *name, _SquidConfig::_cacheSwap swa } } -static int -check_null_cachedir(_SquidConfig::_cacheSwap swap) -{ - return swap.swapDirs == NULL; -} - static int check_null_string(char *s) { diff --git a/src/cf.data.pre b/src/cf.data.pre index 7d7f4d7d9a..f9e15f2f1f 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.490 2007/12/27 14:55:47 hno Exp $ +# $Id: cf.data.pre,v 1.491 2007/12/27 15:48:53 hno Exp $ # # SQUID Web Proxy Cache http://www.squid-cache.org/ # ---------------------------------------------------------- @@ -1744,7 +1744,6 @@ DOC_END NAME: cache_dir TYPE: cachedir DEFAULT: none -DEFAULT_IF_NONE: ufs @DEFAULT_SWAP_DIR@ 100 16 256 LOC: Config.cacheSwap DOC_START Usage: @@ -1832,10 +1831,6 @@ DOC_START called 'stripe' in the directory names in the config - and this will be created by squid -z. - The null store type: - - no options are allowed or required - Common options: no-store, no new objects should be stored to this cache_dir @@ -1849,6 +1844,9 @@ DOC_START Note for coss, max-size must be less than COSS_MEMBUF_SZ, which can be changed with the --with-coss-membuf-size=N configure option. +NOCOMMENT_START +DEFAULT_IF_NONE: ufs @DEFAULT_SWAP_DIR@ 100 16 256 +NOCOMMENT_END DOC_END NAME: store_dir_select_algorithm diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 8e189d3ad0..144f4cb400 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -1,6 +1,6 @@ # Makefile for storage modules in the Squid Object Cache server # -# $Id: Makefile.am,v 1.13 2005/08/20 21:08:38 serassio Exp $ +# $Id: Makefile.am,v 1.14 2007/12/27 15:48:55 hno Exp $ # AUTOMAKE_OPTIONS = subdir-objects @@ -9,7 +9,7 @@ AM_CXXFLAGS = @SQUID_CXXFLAGS@ ##DIST_SUBDIRS = coss null ufs -EXTRA_LIBRARIES = libcoss.a libnull.a libufs.a +EXTRA_LIBRARIES = libcoss.a libufs.a noinst_LIBRARIES = @STORE_LIBS@ libcoss_a_SOURCES = \ @@ -18,7 +18,6 @@ libcoss_a_SOURCES = \ coss/store_dir_coss.cc \ coss/CossSwapDir.h -libnull_a_SOURCES = null/store_null.cc null/store_null.h libufs_a_SOURCES = ufs/store_dir_ufs.cc ufs/store_io_ufs.cc \ ufs/ufscommon.cci \ ufs/ufscommon.cc \ @@ -28,8 +27,7 @@ libufs_a_SOURCES = ufs/store_dir_ufs.cc ufs/store_io_ufs.cc \ EXTRA_DIST = \ coss/coss-notes.txt \ coss/StoreFScoss.h \ - ufs/StoreFSufs.h \ - null/StoreFSnull.h + ufs/StoreFSufs.h INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/src @@ -37,7 +35,5 @@ INCLUDES = -I. -I$(top_builddir)/include -I$(top_srcdir)/include \ ## targets below to emulate distributed makefiles coss/all: libcoss.a coss/clean: clean -null/all: libnull.a -null/clean: clean ufs/all: libufs.a ufs/clean: clean diff --git a/src/fs/null/StoreFSnull.cc b/src/fs/null/StoreFSnull.cc deleted file mode 100644 index 6f172b98f7..0000000000 --- a/src/fs/null/StoreFSnull.cc +++ /dev/null @@ -1,79 +0,0 @@ - - -/* - * $Id: StoreFSnull.cc,v 1.1 2003/07/22 15:23:14 robertc Exp $ - * - * DEBUG: section 47 Store Directory Routines - * AUTHOR: Robert Collins - * - * 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. - * - * Copyright (c) 2003, Robert Collins - */ - - -#include "StoreFileSystem.h" -#include "fs/null/StoreFSnull.h" -#include "fs/null/store_null.h" - -StoreFSnull StoreFSnull::_instance; - -StoreFileSystem & -StoreFSnull::GetInstance() -{ - return _instance; -} - -StoreFSnull::StoreFSnull() -{ - FsAdd(*this); -} - -char const * -StoreFSnull::type() const -{ - return "null"; -} - -void -StoreFSnull::done() -{ - initialised = false; -} - -SwapDir * -StoreFSnull::createSwapDir() -{ - return new NullSwapDir; -} - -void -StoreFSnull::setup() -{ - assert(!initialised); - initialised = true; -} diff --git a/src/fs/null/StoreFSnull.h b/src/fs/null/StoreFSnull.h deleted file mode 100644 index d53d9ba8de..0000000000 --- a/src/fs/null/StoreFSnull.h +++ /dev/null @@ -1,59 +0,0 @@ - -/* - * $Id: StoreFSnull.h,v 1.1 2003/07/22 15:23:14 robertc Exp $ - * - * 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. - * - * Copyright (c) 2003, Robert Collins - */ - -#ifndef SQUID_STOREFSNULL_H -#define SQUID_STOREFSNULL_H - -#include "squid.h" - -class StoreFSnull : public StoreFileSystem -{ - -public: - static StoreFileSystem &GetInstance(); - StoreFSnull(); - virtual ~StoreFSnull() {} - - virtual char const *type() const; - virtual SwapDir *createSwapDir(); - virtual void done(); - virtual void setup(); - /* Not implemented */ - StoreFSnull (StoreFSnull const &); - StoreFSnull &operator=(StoreFSnull const &); - -private: - static StoreFSnull _instance; -}; - -#endif /* SQUID_STOREFSNULL_H */ diff --git a/src/fs/null/store_null.cc b/src/fs/null/store_null.cc deleted file mode 100644 index 80f1a4c76f..0000000000 --- a/src/fs/null/store_null.cc +++ /dev/null @@ -1,154 +0,0 @@ - -/* - * $Id: store_null.cc,v 1.14 2007/05/29 13:31:47 amosjeffries Exp $ - * - * DEBUG: section 47 Store Directory Routines - * 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. - * - */ - -#include "squid.h" -#include "event.h" -#if HAVE_STATVFS -#if HAVE_SYS_STATVFS_H -#include -#endif -#endif -#include "Store.h" -#include "fs/null/store_null.h" - -static EVH storeNullDirRebuildComplete; -NullSwapDir::NullSwapDir() : SwapDir ("null") -{ - repl = NULL; -} - -void -NullSwapDir::reconfigure(int index, char *path) -{ - (void) 0; -} - - -void -NullSwapDir::init() -{ - StoreController::store_dirs_rebuilding++; - eventAdd("storeNullDirRebuildComplete", storeNullDirRebuildComplete, - NULL, 0.0, 1); -} - -StoreIOState::Pointer -NullSwapDir::createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) -{ - fatal ("Attempt to get a StoreIO from the NULL store!\n"); - return NULL; -} - -StoreIOState::Pointer -NullSwapDir::openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) -{ - fatal ("Attempt to get a StoreIO from the NULL store!\n"); - return NULL; -} - -static void -storeNullDirRebuildComplete(void *unused) -{ - - struct _store_rebuild_data counts; - memset(&counts, '\0', sizeof(counts)); - StoreController::store_dirs_rebuilding--; - storeRebuildComplete(&counts); -} - -int -NullSwapDir::canStore(StoreEntry const &)const -{ - return -1; -} - -void -NullSwapDir::parse(int anIndex, char *aPath) -{ - index = anIndex; - path = xstrdup(aPath); - parseOptions(0); -} - -StoreSearch * -NullSwapDir::search(String const url, HttpRequest *) -{ - if (url.size()) - fatal ("Cannot search by url yet\n"); - - return new StoreSearchNull (); -} - - -CBDATA_CLASS_INIT(StoreSearchNull); -StoreSearchNull::StoreSearchNull() -{} - -/* do not link -StoreSearchNull::StoreSearchNull(StoreSearchNull const &); -*/ - -StoreSearchNull::~StoreSearchNull() -{} - -void -StoreSearchNull::next(void (callback)(void *cbdata), void *cbdata) -{ - callback (cbdata); -} - -bool -StoreSearchNull::next() -{ - return false; -} - -bool -StoreSearchNull::error() const -{ - return false; -} - -bool -StoreSearchNull::isDone() const -{ - return true; -} - -StoreEntry * -StoreSearchNull::currentItem() -{ - return NULL; -} diff --git a/src/fs/null/store_null.h b/src/fs/null/store_null.h deleted file mode 100644 index ea0c90b0b1..0000000000 --- a/src/fs/null/store_null.h +++ /dev/null @@ -1,77 +0,0 @@ - -/* - * $Id: store_null.h,v 1.5 2007/05/29 13:31:47 amosjeffries Exp $ - * - * 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. - * - * Copyright (c) 2003, Robert Collins - */ - -#ifndef SQUID_STORE_NULL_H -#define SQUID_STORE_NULL_H - -#include "squid.h" -#include "SwapDir.h" -#include "StoreSearch.h" - -class NullSwapDir : public SwapDir -{ - -public: - NullSwapDir(); - virtual void init(); - virtual int canStore(StoreEntry const &)const; - virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *); - virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *); - virtual void parse(int, char*); - virtual void reconfigure (int, char *); - virtual StoreSearch *search(String const url, HttpRequest *); -}; - -class StoreSearchNull : public StoreSearch -{ - -public: - StoreSearchNull(); - StoreSearchNull(StoreSearchNull const &); - ~StoreSearchNull(); - /* Iterator API - garh, wrong place */ - /* callback the client when a new StoreEntry is available - * or an error occurs - */ - virtual void next(void (callback)(void *cbdata), void *cbdata); - /* return true if a new StoreEntry is immediately available */ - virtual bool next(); - virtual bool error() const; - virtual bool isDone() const; - virtual StoreEntry *currentItem(); - -private: - CBDATA_CLASS2(StoreSearchNull); -}; - -#endif /* SQUID_STORE_NULL_H */