Browse Source

scheme.plugin: Remove 'global' field

Serj Kalichev 3 years ago
parent
commit
5dd269ae6b
7 changed files with 1 additions and 34 deletions
  1. 0 2
      bin/klishd/sch.c
  2. 0 3
      klish.xsd
  3. 0 1
      klish/iplugin.h
  4. 0 11
      klish/ischeme/iplugin.c
  5. 0 2
      klish/kdb/xml-common/load.c
  6. 0 2
      klish/kplugin.h
  7. 1 13
      klish/kscheme/kplugin.c

+ 0 - 2
bin/klishd/sch.c

@@ -6,14 +6,12 @@ ischeme_t sch = {
    .name = "plugin1",
    .id = "id1",
    .file = "file1",
-   .global = "true",
   },
 
   PLUGIN {
    .name = "plugin2",
    .id = "id2",
    .file = "file2",
-   .global = "false",
   },
 
  END_PLUGIN_LIST,

+ 0 - 3
klish.xsd

@@ -483,8 +483,6 @@
 * [id] - Internal plugin name. Can be the same as "name".
 * [file] - File name if standard autogenerated filename (using "name" field)
 *	is not appropriate.
-* [global] - A boolean RTLD_GLOBAL flag for dlopen()
-*	while plugin loading. Default is "false".
 ********************************************************
 -->
 	<xs:complexType name="plugin_t">
@@ -493,7 +491,6 @@
 				<xs:attribute name="name" type="xs:string" use="required"/>
 				<xs:attribute name="id" type="xs:string" use="optional"/>
 				<xs:attribute name="file" type="xs:string" use="optional"/>
-				<xs:attribute name="global" type="xs:boolean" use="optional" default="false"/>
 			</xs:extension>
 		</xs:simpleContent>
 	</xs:complexType>

+ 0 - 1
klish/iplugin.h

@@ -10,7 +10,6 @@ typedef struct iplugin_s {
 	char *name;
 	char *id;
 	char *file;
-	char *global;
 	char *conf;
 } iplugin_t;
 

+ 0 - 11
klish/ischeme/iplugin.c

@@ -43,16 +43,6 @@ bool_t iplugin_parse(const iplugin_t *info, kplugin_t *plugin,
 		}
 	}
 
-	// Global
-	if (!faux_str_is_empty(info->global)) {
-		bool_t b = BOOL_FALSE;
-		if (!faux_conv_str2bool(info->global, &b) ||
-			!kplugin_set_global(plugin, b)) {
-			faux_error_add(error, TAG": Illegal 'global' attribute");
-			retcode = BOOL_FALSE;
-		}
-	}
-
 	// Conf
 	if (!faux_str_is_empty(info->conf)) {
 		if (!kplugin_set_conf(plugin, info->conf)) {
@@ -107,7 +97,6 @@ char *iplugin_deploy(const kplugin_t *kplugin, int level)
 	attr2ctext(&str, "name", kplugin_name(kplugin), level + 1);
 	attr2ctext(&str, "id", kplugin_id(kplugin), level + 1);
 	attr2ctext(&str, "file", kplugin_file(kplugin), level + 1);
-	attr2ctext(&str, "global", faux_conv_bool2str(kplugin_global(kplugin)), level + 1);
 	attr2ctext(&str, "conf", kplugin_conf(kplugin), level + 1);
 
 	tmp = faux_str_sprintf("%*c},\n\n", level, ' ');

+ 0 - 2
klish/kdb/xml-common/load.c

@@ -334,7 +334,6 @@ static bool_t process_plugin(const kxml_node_t *element, void *parent,
 	iplugin.name = kxml_node_attr(element, "name");
 	iplugin.id = kxml_node_attr(element, "id");
 	iplugin.file = kxml_node_attr(element, "file");
-	iplugin.global = kxml_node_attr(element, "global");
 	iplugin.conf = kxml_node_content(element);
 
 	plugin = iplugin_load(&iplugin, error);
@@ -361,7 +360,6 @@ err:
 	kxml_node_attr_free(iplugin.name);
 	kxml_node_attr_free(iplugin.id);
 	kxml_node_attr_free(iplugin.file);
-	kxml_node_attr_free(iplugin.global);
 	kxml_node_content_free(iplugin.conf);
 
 	return res;

+ 0 - 2
klish/kplugin.h

@@ -45,8 +45,6 @@ const char *kplugin_id(const kplugin_t *plugin);
 bool_t kplugin_set_id(kplugin_t *plugin, const char *id);
 const char *kplugin_file(const kplugin_t *plugin);
 bool_t kplugin_set_file(kplugin_t *plugin, const char *file);
-bool_t kplugin_global(const kplugin_t *plugin);
-bool_t kplugin_set_global(kplugin_t *plugin, bool_t global);
 const char *kplugin_conf(const kplugin_t *plugin);
 bool_t kplugin_set_conf(kplugin_t *plugin, const char *conf);
 uint8_t kplugin_major(const kplugin_t *plugin);

+ 1 - 13
klish/kscheme/kplugin.c

@@ -18,7 +18,6 @@ struct kplugin_s {
 	char *name;
 	char *id;
 	char *file;
-	bool_t global;
 	char *conf;
 	uint8_t major;
 	uint8_t minor;
@@ -43,10 +42,6 @@ KSET_STR(plugin, id);
 KGET_STR(plugin, file);
 KSET_STR(plugin, file);
 
-// Global
-KGET_BOOL(plugin, global);
-KSET_BOOL(plugin, global);
-
 // Conf
 KGET_STR(plugin, conf);
 KSET_STR(plugin, conf);
@@ -89,7 +84,6 @@ kplugin_t *kplugin_new(const char *name)
 	plugin->name = faux_str_dup(name);
 	plugin->id = NULL;
 	plugin->file = NULL;
-	plugin->global = BOOL_FALSE;
 	plugin->conf = NULL;
 	plugin->major = 0;
 	plugin->minor = 0;
@@ -133,7 +127,7 @@ bool_t kplugin_load(kplugin_t *plugin)
 	char *fini_name = NULL;
 	char *major_name = NULL;
 	char *minor_name = NULL;
-	int flag = RTLD_NOW;
+	int flag = RTLD_NOW | RTLD_LOCAL;
 	const char *id = NULL;
 	bool_t retcode = BOOL_FALSE;
 	uint8_t *ver = NULL;
@@ -159,12 +153,6 @@ bool_t kplugin_load(kplugin_t *plugin)
 	init_name = faux_str_sprintf(KPLUGIN_INIT_FMT, id);
 	fini_name = faux_str_sprintf(KPLUGIN_FINI_FMT, id);
 
-	// SO flags
-	if (kplugin_global(plugin))
-		flag |= RTLD_GLOBAL;
-	else
-		flag |= RTLD_LOCAL;
-
 	// Open shared object
 	plugin->dlhan = dlopen(file_name, flag);
 	if (!plugin->dlhan) {