[RFC,5/8] discover/device-handler: Read command files if present

Message ID 20181218041953.8960-6-sam@mendozajonas.com
State New
Headers show
Series
  • Introduce pb-plugin 'commands' & Rust PoC
Related show

Commit Message

Samuel Mendoza-Jonas Dec. 18, 2018, 4:19 a.m.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 discover/device-handler.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch

diff --git a/discover/device-handler.c b/discover/device-handler.c
index e75f4123..05d8df11 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -20,6 +20,7 @@ 
 #include <url/url.h>
 #include <i18n/i18n.h>
 #include <pb-config/pb-config.h>
+#include <rust/rustlibs.h>
 
 #include <sys/sysmacros.h>
 #include <sys/types.h>
@@ -1845,6 +1846,13 @@  void device_handler_add_plugin_option(struct device_handler *handler,
 		}
 	}
 
+	if (opt->command_file) {
+		opt->n_commands = parse_command_file(opt, opt->command_file,
+				&opt->commands);
+		pb_log("Plugin %s included %d command definitions\n",
+				opt->name, opt->n_commands);
+	}
+
 	handler->plugins = talloc_realloc(handler, handler->plugins,
 			struct plugin_option *, handler->n_plugins + 1);
 	if (!handler->plugins) {