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/19 15:19:04 UTC
svn commit: r946176 - in /trafficserver/traffic/trunk/proxy: InkAPI.cc
InkAPITest.cc
Author: mturk
Date: Wed May 19 13:19:03 2010
New Revision: 946176
URL: http://svn.apache.org/viewvc?rev=946176&view=rev
Log:
TS-345 Use layout engine. Plugin directory can be outside the install root
Modified:
trafficserver/traffic/trunk/proxy/InkAPI.cc
trafficserver/traffic/trunk/proxy/InkAPITest.cc
Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=946176&r1=946175&r2=946176&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Wed May 19 13:19:03 2010
@@ -24,6 +24,7 @@
#ifndef INK_NO_API
#include "inktomi++.h"
+#include "I_Layout.h"
#include "InkAPIInternal.h"
#include <stdio.h>
@@ -1045,14 +1046,14 @@ INKContInternal::handle_event_count(int
void INKContInternal::setName(const char *name) {
cont_name = name;
-
+
cont_time_stats.resize((int)(INK_HTTP_LAST_HOOK + 1));
cont_calls.resize((int)(INK_HTTP_LAST_HOOK + 1));
-
+
for(INKHttpHookID cur_hook_id = INK_HTTP_READ_REQUEST_HDR_HOOK; cur_hook_id <= INK_HTTP_LAST_HOOK; cur_hook_id = INKHttpHookID(cur_hook_id+1)) {
std::string stat_base = "cont." + cont_name + "." + HttpDebugNames::get_api_hook_name(cur_hook_id);
cont_time_stats[cur_hook_id].init(stat_base + ".time_spent", 64000);
-
+
StatSystemV2::registerStat((stat_base + ".calls").c_str(), &cont_calls[cur_hook_id]);
}
stats_enabled = true;
@@ -1867,13 +1868,10 @@ INKPluginDirGet(void)
Error("Unable to read %s", CFG_NM);
return NULL;
}
-
- if (*plugin_dir == '/') {
- ink_strncpy(path, plugin_dir, sizeof(path));
- } else {
- snprintf(path, sizeof(path), "%s%s%s", system_root_dir, DIR_SEP, plugin_dir);
- }
-
+ // TODO: We could check for the path itself and in
+ // case of failure use the Layout::get()->libexecdir
+ //
+ Layout::get()->relative(path, sizeof(path), plugin_dir);
}
return path;
Modified: trafficserver/traffic/trunk/proxy/InkAPITest.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPITest.cc?rev=946176&r1=946175&r2=946176&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPITest.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPITest.cc Wed May 19 13:19:03 2010
@@ -35,6 +35,7 @@ extern int errno;
#include "Regression.h"
#include "api/ts/ts_private.h"
#include "I_RecCore.h"
+#include "I_Layout.h"
#include "InkAPITestTool.cc"
#include "http2/HttpSM.h"
@@ -152,6 +153,9 @@ REGRESSION_TEST(SDK_API_INKPluginDirGet)
return;
}
+ // XXX: This doesn't have to be true
+ // since the location can be anywhere
+ //
if (strstr(plugin_dir, "libexec/trafficserver") == NULL) {
SDK_RPRINT(test, "INKPluginDirGet", "TestCase2", TC_FAIL, "plugin dir(%s) is incorrect, expected (%s) in path",plugin_dir,"libexec/trafficserver");
*pstatus = REGRESSION_TEST_FAILED;
@@ -822,15 +826,18 @@ REGRESSION_TEST(SDK_API_INKfopen) (Regre
// Set full path to file at run time.
+ // TODO: This can never fail since we are
+ // returning the char[]
+ // Better check the dir itself.
+ //
if ((install_dir = INKInstallDirGet()) == NULL) {
error_counter++;
*pstatus = REGRESSION_TEST_FAILED;
return;
}
// Add "etc/trafficserver" to point to config directory
- snprintf(input_file_full_path, sizeof(input_file_full_path), "%s%s%s%s", install_dir, DIR_SEP, "etc/trafficserver", DIR_SEP);
-
- strncat(input_file_full_path, INPUT_TEXT_FILE, sizeof(INPUT_TEXT_FILE));
+ snprintf(input_file_full_path, sizeof(input_file_full_path),
+ "%s/%s", Layout::get()->sysconfdir, INPUT_TEXT_FILE);
// open existing file for reading
if (!(source_read_file = INKfopen(input_file_full_path, "r"))) {