summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-09-05 17:45:31 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-09-19 15:25:36 +0200
commitc41158288f76b4809d01f3ec5028d8be609bb613 (patch)
tree405f435a7bb377b3f0b3719f87424ac9f30a4846
parent7c0c4ba7a28fad979e602312959203dfefdfaef1 (diff)
wgtpkg-unit: improve naming (minor)
Change-Id: I5dae72c8dd925646b18c30ab4ef60382e43c744b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/tests/test-unit/test-unit.c2
-rw-r--r--src/wgtpkg-unit.c10
-rw-r--r--src/wgtpkg-unit.h4
3 files changed, 8 insertions, 8 deletions
diff --git a/src/tests/test-unit/test-unit.c b/src/tests/test-unit/test-unit.c
index 9a205fc..7c63a08 100644
--- a/src/tests/test-unit/test-unit.c
+++ b/src/tests/test-unit/test-unit.c
@@ -74,7 +74,7 @@ int main(int ac, char **av)
conf.installdir = "INSTALL-DIR";
conf.icondir = "ICONS-DIR";
conf.port = 666;
- rc = unit_generator_on(*++av);
+ rc = unit_generator_open_template(*++av);
if (rc < 0)
error("can't read template %s: %m",*av);
while(*++av) {
diff --git a/src/wgtpkg-unit.c b/src/wgtpkg-unit.c
index 123a950..856be46 100644
--- a/src/wgtpkg-unit.c
+++ b/src/wgtpkg-unit.c
@@ -344,7 +344,7 @@ static int process_all_units(char *corpus, const struct unitconf *conf, int (*pr
/*
* Clear the unit generator
*/
-void unit_generator_off()
+void unit_generator_close_template()
{
free(template);
template = NULL;
@@ -354,13 +354,13 @@ void unit_generator_off()
* Initialises the unit generator with the content of the file of path 'filename'.
* Returns 0 in case of success or a negative number in case of error.
*/
-int unit_generator_on(const char *filename)
+int unit_generator_open_template(const char *filename)
{
size_t size;
char *tmp;
int rc;
- unit_generator_off();
+ unit_generator_close_template();
rc = getfile(filename ? : FWK_UNIT_CONF, &template, NULL);
if (!rc) {
size = pack(template, ';');
@@ -388,7 +388,7 @@ static int add_metadata(struct json_object *jdesc, const struct unitconf *conf)
* Applies the object 'jdesc' augmented of meta data coming
* from 'conf' to the current unit generator.
* The current unit generator will be set to the default one if not unit
- * was previously set using the function 'unit_generator_on'.
+ * was previously set using the function 'unit_generator_open_template'.
* The callback function 'process' is then called with the
* unit descriptors array and the expected closure.
* Return what returned process in case of success or a negative
@@ -404,7 +404,7 @@ int unit_generator_process(struct json_object *jdesc, const struct unitconf *con
if (rc)
ERROR("can't set the metadata. %m");
else {
- rc = template ? 0 : unit_generator_on(NULL);
+ rc = template ? 0 : unit_generator_open_template(NULL);
if (!rc) {
instance = NULL;
rc = apply_mustach(template, jdesc, &instance, &size);
diff --git a/src/wgtpkg-unit.h b/src/wgtpkg-unit.h
index 10751a6..dc011e1 100644
--- a/src/wgtpkg-unit.h
+++ b/src/wgtpkg-unit.h
@@ -57,8 +57,8 @@ struct generatedesc {
int nunits;
};
-extern int unit_generator_on(const char *filename);
-extern void unit_generator_off();
+extern int unit_generator_open_template(const char *filename);
+extern void unit_generator_close_template();
extern int unit_generator_process(struct json_object *jdesc, const struct unitconf *conf, int (*process)(void *closure, const struct generatedesc *desc), void *closure);
extern int unit_install(struct wgt_info *ifo, const struct unitconf *conf);
extern int unit_uninstall(struct wgt_info *ifo, const struct unitconf *conf);