You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by mt...@apache.org on 2010/05/18 20:01:00 UTC
svn commit: r945792 - in /trafficserver/traffic/trunk: configure.ac
iocore/cache/Store.cc proxy/Makefile.am proxy/config/Makefile.am
proxy/config/storage.config proxy/config/storage.config.in
Author: mturk
Date: Tue May 18 18:00:59 2010
New Revision: 945792
URL: http://svn.apache.org/viewvc?rev=945792&view=rev
Log:
Generate storage.config from template instead hard coding the paths
Added:
trafficserver/traffic/trunk/proxy/config/storage.config.in
- copied, changed from r945486, trafficserver/traffic/trunk/proxy/config/storage.config
Removed:
trafficserver/traffic/trunk/proxy/config/storage.config
Modified:
trafficserver/traffic/trunk/configure.ac
trafficserver/traffic/trunk/iocore/cache/Store.cc
trafficserver/traffic/trunk/proxy/Makefile.am
trafficserver/traffic/trunk/proxy/config/Makefile.am
Modified: trafficserver/traffic/trunk/configure.ac
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/configure.ac?rev=945792&r1=945791&r2=945792&view=diff
==============================================================================
--- trafficserver/traffic/trunk/configure.ac (original)
+++ trafficserver/traffic/trunk/configure.ac Tue May 18 18:00:59 2010
@@ -383,6 +383,7 @@ ATS_SUBST([pkgdatadir])
ATS_SUBST([pkglocalstatedir])
ATS_SUBST([pkgruntimedir])
ATS_SUBST([pkglogdir])
+ATS_SUBST([pkgcachedir])
# -----------------------------------------------------------------------------
@@ -903,6 +904,7 @@ AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([proxy/config/body_factory/default/Makefile])
AC_CONFIG_FILES([proxy/config/body_factory/Makefile])
AC_CONFIG_FILES([proxy/config/records.config])
+AC_CONFIG_FILES([proxy/config/storage.config])
AC_CONFIG_FILES([proxy/config/Makefile])
AC_CONFIG_FILES([proxy/congest/Makefile])
AC_CONFIG_FILES([proxy/dns_cache/Makefile])
Modified: trafficserver/traffic/trunk/iocore/cache/Store.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/Store.cc?rev=945792&r1=945791&r2=945792&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/Store.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/Store.cc Tue May 18 18:00:59 2010
@@ -23,6 +23,7 @@
#include "inktomi++.h"
#include "P_Cache.h"
+#include "I_Layout.h"
const char *STORAGE_CONFIG_HEADER = "# \n\
# Storage Configuration file \n\
@@ -311,19 +312,21 @@ Store::read_config(int fd)
// Get pathname if not checking file
if (fd < 0) {
- char p[PATH_NAME_MAX];
-
- ink_strncpy(p, cache_system_config_directory, sizeof(p));
- strncat(p, DIR_SEP, sizeof(p) - (strlen(p) + sizeof(DIR_SEP) + 1));
-
+ char storage_path[PATH_NAME_MAX + 1];
+ char storage_file[PATH_NAME_MAX + 1];
+ // XXX: cache_system_config_directory is initialized
+ // inside ink_cache_init() which is called AFTER
+ // initialize_store().
+ //
+ // ink_strncpy(p, cache_system_config_directory, sizeof(p));
IOCORE_RegisterConfigString(RECT_CONFIG,
"proxy.config.cache.storage_filename",
"storage.config", RECU_RESTART_TS, RECC_NULL, NULL);
- IOCORE_ReadConfigString(p + strlen(p), "proxy.config.cache.storage_filename", PATH_NAME_MAX - strlen(p) - 1);
- if (p[strlen(p) - 1] == DIR_SEP[0])
- strncat(p, "storage.config", sizeof(p) - (strlen(p) + sizeof("storage.config") + 1));
- Debug("cache_init", "Store::read_config, fd = -1, \"%s\"", p);
- fd =::open(p, O_RDONLY);
+ IOCORE_ReadConfigString(storage_file, "proxy.config.cache.storage_filename", PATH_NAME_MAX);
+ Layout::relative_to(storage_path, PATH_NAME_MAX, Layout::get()->sysconfdir,
+ storage_file);
+ Debug("cache_init", "Store::read_config, fd = -1, \"%s\"", storage_path);
+ fd =::open(storage_path, O_RDONLY);
if (fd < 0) {
err = "error on open";
goto Lfail;
@@ -364,18 +367,19 @@ Store::read_config(int fd)
}
n[len] = 0;
-
+ char *pp = Layout::get()->relative(n);
ns = NEW(new Span);
- Debug("cache_init", "Store::read_config - ns = NEW (new Span); ns->init(\"%s\",%lld)", n, size);
- if ((err = ns->init(n, size))) {
+ Debug("cache_init", "Store::read_config - ns = NEW (new Span); ns->init(\"%s\",%lld)", pp, size);
+ if ((err = ns->init(pp, size))) {
char buf[4096];
- snprintf(buf, sizeof(buf), "could not initialize storage \"%s\" [%s]", n, err);
+ snprintf(buf, sizeof(buf), "could not initialize storage \"%s\" [%s]", pp, err);
IOCORE_SignalWarning(REC_SIGNAL_SYSTEM_ERROR, buf);
Debug("cache_init", "Store::read_config - %s", buf);
delete ns;
+ xfree(pp);
continue;
}
-
+ xfree(pp);
n_dsstore++;
// new Span
Modified: trafficserver/traffic/trunk/proxy/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Makefile.am?rev=945792&r1=945791&r2=945792&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Makefile.am (original)
+++ trafficserver/traffic/trunk/proxy/Makefile.am Tue May 18 18:00:59 2010
@@ -399,7 +399,7 @@ test_xml_parser_SOURCES = test_xml_parse
versiondir = $(pkgsysconfdir)
install-data-local:
- $(INSTALL) -d -o $(pkgsysuser) -g $(pkgsysgroup) $(DESTDIR)$(pkglocalstatedir) $(DESTDIR)$(pkglogdir) $(DESTDIR)$(pkgruntimedir) $(DESTDIR)$(pkgsysconfdir) $(DESTDIR)$(pkgsysconfdir)/internal $(DESTDIR)$(pkgdatadir)
+ $(INSTALL) -d -o $(pkgsysuser) -g $(pkgsysgroup) $(DESTDIR)$(pkglocalstatedir) $(DESTDIR)$(pkglogdir) $(DESTDIR)$(pkgruntimedir) $(DESTDIR)$(pkgsysconfdir) $(DESTDIR)$(pkgsysconfdir)/internal $(DESTDIR)$(pkgdatadir) $(DESTDIR)$(pkgcachedir)
install-data-hook:
-chown -R $(pkgsysuser):$(pkgsysgroup) $(DESTDIR)$(pkgsysconfdir) $(DESTDIR)$(pkgdatadir)
@@ -413,7 +413,7 @@ install-exec-hook:
-chown -R $(pkgsysuser):$(pkgsysgroup) $(DESTDIR)$(pkglibexecdir)
uninstall-hook:
- -rm -rf $(DESTDIR)$(pkglocalstatedir) $(DESTDIR)$(pkglogdir) $(DESTDIR)$(pkgruntimedir) $(DESTDIR)$(pkgsysconfdir) $(DESTDIR)$(pkglibexecdir)
+ -rm -rf $(DESTDIR)$(pkglocalstatedir) $(DESTDIR)$(pkglogdir) $(DESTDIR)$(pkgruntimedir) $(DESTDIR)$(pkgsysconfdir) $(DESTDIR)$(pkglibexecdir) $(DESTDIR)$(pkgcachedir)
-rm -f $(DESTDIR)$(sysconfdir)/trafficserver-root
Modified: trafficserver/traffic/trunk/proxy/config/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/config/Makefile.am?rev=945792&r1=945791&r2=945792&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/config/Makefile.am (original)
+++ trafficserver/traffic/trunk/proxy/config/Makefile.am Tue May 18 18:00:59 2010
@@ -17,9 +17,15 @@
# limitations under the License.
SUBDIRS = body_factory
-EXTRA_DIST = records.config.in
+EXTRA_DIST = \
+ records.config.in \
+ storage.config.in
+
sysconfdir = $(pkgsysconfdir)
-nodist_sysconf_DATA = records.config
+nodist_sysconf_DATA = \
+ records.config \
+ storage.config
+
dist_sysconf_DATA = \
admin_access.config \
ae_ua.config \
@@ -45,7 +51,6 @@ dist_sysconf_DATA = \
splitdns.config \
ssl_multicert.config \
stats.config.xml \
- storage.config \
update.config \
vaddrs.config
Copied: trafficserver/traffic/trunk/proxy/config/storage.config.in (from r945486, trafficserver/traffic/trunk/proxy/config/storage.config)
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/config/storage.config.in?p2=trafficserver/traffic/trunk/proxy/config/storage.config.in&p1=trafficserver/traffic/trunk/proxy/config/storage.config&r1=945486&r2=945792&rev=945792&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/config/storage.config (original)
+++ trafficserver/traffic/trunk/proxy/config/storage.config.in Tue May 18 18:00:59 2010
@@ -1,4 +1,4 @@
-#
+#
# Storage Configuration file
#
#
@@ -11,19 +11,19 @@
#
# <pathname> <size>
#
-# Where 'pathname' is full path to the directory where you want
+# Where 'pathname' is full path to the directory where you want
# the cache-file to live and 'size' is size in bytes
#
-# Example: 128MB cache file(/usr/local/trafficserver/cache/cache.db)
-#/usr/local/trafficserver/cache 134217728
+# Example: 128MB cache file(@exp_cachedir@/cache.db)
+# @exp_cachedir@ 134217728
#
-# Example: 144MB cache file(/usr/local/var/trafficserver/cache.db)
-# assuming prefix of '/usr/local'
-./var/trafficserver 150994944
-#
-# Example: 512MB cache file(/usr/local/var/trafficserver/cache.db)
-# assuming prefix of '/usr/local'
-#./var/trafficserver 536870912
+# Example: 144MB cache file(@exp_cachedir@/cache.db)
+# assuming prefix of '@prefix@'
+@rel_cachedir@ 150994944
+#
+# Example: 512MB cache file(@exp_cachedir@/cache.db)
+# assuming prefix of '@prefix@'
+# @rel_cachedir@ 536870912
#
#
#############################################################
@@ -34,7 +34,7 @@
# kernel 2.6.3. http://lkml.org/lkml/2007/2/16/431
# in favor of 'O_DIRECT' flag (Jira TS-13)
#
-# Example: Using O_DIRECT on disks (kernel >= 2.6.3)
+# Example: Using O_DIRECT on disks (kernel >= 2.6.3)
# or cooked disks (kernel < 2.6.3)
#
# /dev/sdb # 250GB drive
@@ -48,10 +48,10 @@
# to bind a raw device to a an existing block device.
#
# e.g. Binding the above 3 block devices to raw devices
-#
+#
# You can set up a few raw devices to start with via mknod:
#
-# mkdir /dev/raw
+# mkdir /dev/raw
# mknod /dev/rawctl c 162 0
# chmod 600 /dev/rawctl # This is important!
#
@@ -69,7 +69,7 @@
#
# /usr/bin/raw -q /dev/raw/rawN
#
-# or
+# or
#
# /usr/bin/raw -a
#
@@ -77,7 +77,7 @@
#
# Example: raw disk entries for the above must include the *SIZE*
#
-# /dev/raw_sdb 9105018880
-# /dev/raw_sdc 18210037760
-# /dev/raw_sdd 18210037760
+# /dev/raw_sdb 9105018880
+# /dev/raw_sdc 18210037760
+# /dev/raw_sdd 18210037760