trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [10/12] trafficserver git commit: TS-3533: Revert "TS-3337: remove internal plugin SDK enumeration"
Date Wed, 22 Apr 2015 16:55:29 GMT
TS-3533: Revert "TS-3337: remove internal plugin SDK enumeration"

This reverts commit 7f0f3a47b253d361a16c33413b4501a5ff5d69fe.

Conflicts:
	CHANGES
	proxy/InkAPI.cc
	proxy/Plugin.cc
	proxy/Plugin.h


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a54e8761
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a54e8761
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a54e8761

Branch: refs/heads/5.3.x
Commit: a54e87617dce540e0499b2a9d9870dce7ce016ce
Parents: 37b2819
Author: Phil Sorber <sorber@apache.org>
Authored: Wed Apr 22 10:47:35 2015 -0600
Committer: Phil Sorber <sorber@apache.org>
Committed: Wed Apr 22 10:47:35 2015 -0600

----------------------------------------------------------------------
 CHANGES         |  2 --
 proxy/InkAPI.cc | 20 ++++++++++----------
 proxy/Plugin.cc | 32 +++++++-------------------------
 proxy/Plugin.h  | 14 +++++++++++++-
 4 files changed, 30 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a54e8761/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 0df57b1..4409b70 100644
--- a/CHANGES
+++ b/CHANGES
@@ -211,8 +211,6 @@ Changes with Apache Traffic Server 5.3.0
 
   *) [TS-3338] Update the list of gauges in the epic plugin.
 
-  *) [TS-3337] Remove internal plugin SDK versioning.
-
   *) [TS-3336] Remove unimplemented HTTP metrics.
 
   *) [TS-3333] Enable TOS settings on IPv6 connections.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a54e8761/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 6c73d16..666db4f 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -1779,22 +1779,22 @@ TSPluginDirGet(void)
 TSReturnCode
 TSPluginRegister(TSSDKVersion sdk_version, TSPluginRegistrationInfo *plugin_info)
 {
-  sdk_assert(sdk_sanity_check_null_ptr((void *)plugin_info) == TS_SUCCESS);
+  PluginSDKVersion version = (PluginSDKVersion)sdk_version;
 
-  if (!plugin_reg_current) {
+  if (!plugin_reg_current)
     return TS_ERROR;
-  }
 
-  switch (sdk_version) {
-  case TS_SDK_VERSION_2_0:
-  case TS_SDK_VERSION_3_0:
-    break;
-  default:
-    return TS_ERROR;
-  }
+  sdk_assert(sdk_sanity_check_null_ptr((void*) plugin_info) == TS_SUCCESS);
 
   plugin_reg_current->plugin_registered = true;
 
+  // We're compatible only within the 3.x release
+  if (version >= PLUGIN_SDK_VERSION_3_0 && version < PLUGIN_SDK_VERSION_4_0)
{
+    plugin_reg_current->sdk_version = version;
+  } else {
+    plugin_reg_current->sdk_version = PLUGIN_SDK_VERSION_UNKNOWN;
+  }
+
   if (plugin_info->plugin_name) {
     plugin_reg_current->plugin_name = ats_strdup(plugin_info->plugin_name);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a54e8761/proxy/Plugin.cc
----------------------------------------------------------------------
diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc
index 130cae6..6cfac73 100644
--- a/proxy/Plugin.cc
+++ b/proxy/Plugin.cc
@@ -51,23 +51,9 @@ DLL<PluginRegInfo> plugin_reg_list;
 PluginRegInfo *plugin_reg_current = NULL;
 
 PluginRegInfo::PluginRegInfo()
-  : plugin_registered(false), plugin_path(NULL),
+  : plugin_registered(false), plugin_path(NULL), sdk_version(PLUGIN_SDK_VERSION_UNKNOWN),
     plugin_name(NULL), vendor_name(NULL), support_email(NULL)
-{
-}
-
-PluginRegInfo::~PluginRegInfo()
-{
-  // We don't support unloading plugins once they are successfully loaded, so assert
-  // that we don't accidentally attempt this.
-  ink_release_assert(this->plugin_registered == false);
-  ink_release_assert(this->link.prev == NULL);
-
-  ats_free(this->plugin_path);
-  ats_free(this->plugin_name);
-  ats_free(this->vendor_name);
-  ats_free(this->support_email);
-}
+{ }
 
 static bool
 plugin_load(int argc, char *argv[], bool validateOnly)
@@ -75,6 +61,7 @@ plugin_load(int argc, char *argv[], bool validateOnly)
   char path[PATH_NAME_MAX + 1];
   void *handle;
   init_func_t init;
+  PluginRegInfo *plugin_reg_temp;
 
   if (argc < 1) {
     return true;
@@ -83,14 +70,14 @@ plugin_load(int argc, char *argv[], bool validateOnly)
 
   Note("loading plugin '%s'", path);
 
-  for (PluginRegInfo *plugin_reg_temp = plugin_reg_list.head; plugin_reg_temp != NULL;
-       plugin_reg_temp = (plugin_reg_temp->link).next) {
+  plugin_reg_temp = plugin_reg_list.head;
+  while (plugin_reg_temp) {
     if (strcmp(plugin_reg_temp->plugin_path, path) == 0) {
       Warning("multiple loading of plugin %s", path);
       break;
     }
+    plugin_reg_temp = (plugin_reg_temp->link).next;
   }
-
   // elevate the access to read files as root if compiled with capabilities, if not
   // change the effective user to root
   {
@@ -126,12 +113,7 @@ plugin_load(int argc, char *argv[], bool validateOnly)
     init(argc, argv);
   } // done elevating access
 
-  if (plugin_reg_current->plugin_registered) {
-    plugin_reg_list.push(plugin_reg_current);
-  } else {
-    delete plugin_reg_current;
-  }
-
+  plugin_reg_list.push(plugin_reg_current);
   plugin_reg_current = NULL;
 
   return true;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a54e8761/proxy/Plugin.h
----------------------------------------------------------------------
diff --git a/proxy/Plugin.h b/proxy/Plugin.h
index 44f31f8..9e5098b 100644
--- a/proxy/Plugin.h
+++ b/proxy/Plugin.h
@@ -26,13 +26,25 @@
 
 #include "List.h"
 
-struct PluginRegInfo {
+// need to keep syncronized with TSSDKVersion
+//   in ts/ts.h.in
+typedef enum
+{
+  PLUGIN_SDK_VERSION_UNKNOWN = -1,
+  PLUGIN_SDK_VERSION_2_0,
+  PLUGIN_SDK_VERSION_3_0,
+  PLUGIN_SDK_VERSION_4_0
+} PluginSDKVersion;
+
+struct PluginRegInfo
+{
   PluginRegInfo();
   ~PluginRegInfo();
 
   bool plugin_registered;
   char *plugin_path;
 
+  PluginSDKVersion sdk_version;
   char *plugin_name;
   char *vendor_name;
   char *support_email;


Mime
View raw message