diff --git a/src/include/66/service.h b/src/include/66/service.h index 9ac6ffeae385409284daba1af2f9668ffca37258..fd21f44951a6fbffa425510238ccf43c6d6a7b41 100644 --- a/src/include/66/service.h +++ b/src/include/66/service.h @@ -322,7 +322,6 @@ extern void service_db_migrate(resolve_service_t *old, resolve_service_t *new, c /* avoid circular dependencies by prototyping the ss_state_t instead * of calling the state.h header file*/ typedef struct ss_state_s ss_state_t, *ss_state_t_ref ; -extern int service_is(ss_state_t *ste, uint32_t flag) ; /** Graph */ extern void service_graph_g(char const *alist, size_t alen, graph_t *graph, resolve_service_t *ares, unsigned int *areslen, ssexec_t *info, uint32_t flag) ; diff --git a/src/lib66/exec/ssexec_signal.c b/src/lib66/exec/ssexec_signal.c index 3178d4c2b55dc7537ed0622bf0a8d296a2b9ac6c..f7455aeb866fecea64f914481206e58509ed7845 100644 --- a/src/lib66/exec/ssexec_signal.c +++ b/src/lib66/exec/ssexec_signal.c @@ -89,7 +89,7 @@ static void pidservice_init_array(unsigned int *list, unsigned int listlen, pids if (!state_read(&sta, &ares[pids.aresid])) log_dieusys(LOG_EXIT_SYS, "read state file of: ", name) ; - if (service_is(&sta, STATE_FLAGS_ISUP) == STATE_FLAGS_TRUE) + if (sta.isup == STATE_FLAGS_TRUE) FLAGS_SET(pids.state, SVC_FLAGS_UP) ; else FLAGS_SET(pids.state, SVC_FLAGS_DOWN) ; diff --git a/src/lib66/exec/ssexec_status.c b/src/lib66/exec/ssexec_status.c index 2c021f6ed3a7b5b4de306cd8c927ab3bb798f537..7e53a5c9ae5010cc450860ec603b860e1dd3394e 100644 --- a/src/lib66/exec/ssexec_status.c +++ b/src/lib66/exec/ssexec_status.c @@ -223,11 +223,11 @@ static void info_get_status(resolve_service_t *res) if (!state_read(&sta, res)) log_dieusys(LOG_EXIT_SYS,"read state of: ", res->sa.s + res->name) ; - if (service_is(&sta, STATE_FLAGS_ISSUPERVISED) == STATE_FLAGS_FALSE) { + if (sta.issupervised == STATE_FLAGS_FALSE) { status = "unsupervised" ; - } else if (service_is(&sta, STATE_FLAGS_ISUP) == STATE_FLAGS_FALSE) { + } else if (sta.isup == STATE_FLAGS_FALSE) { status = "down" ; warn_color = 1 ; diff --git a/src/lib66/info/info_graph_display_service.c b/src/lib66/info/info_graph_display_service.c index c91e0b90bf5216d06a07915f7c0e414ea09865ce..e7bc8881e5a97b022873237c62e614bfddbef4e5 100644 --- a/src/lib66/info/info_graph_display_service.c +++ b/src/lib66/info/info_graph_display_service.c @@ -69,12 +69,12 @@ int info_graph_display_service(char const *name) } else { - if (service_is(&sta, STATE_FLAGS_ISSUPERVISED) == STATE_FLAGS_FALSE) { + if (sta.issupervised == STATE_FLAGS_FALSE) { ppid = "unitialized" ; goto dis ; - } else if (service_is(&sta, STATE_FLAGS_ISUP) == STATE_FLAGS_FALSE) { + } else if (sta.isup == STATE_FLAGS_FALSE) { ppid = "down" ; pid_color = 1 ; diff --git a/src/lib66/sanitize/sanitize_fdholder.c b/src/lib66/sanitize/sanitize_fdholder.c index 4c7fd7c0d7a048799da0b48c03a8bd45e296b683..faa053b2ac91dcc206ae003a75089ce91ee7769d 100644 --- a/src/lib66/sanitize/sanitize_fdholder.c +++ b/src/lib66/sanitize/sanitize_fdholder.c @@ -123,9 +123,9 @@ void sanitize_fdholder(resolve_service_t *res, uint32_t flag) if (FLAGS_ISSET(flag, STATE_FLAGS_TRUE)) { - if (service_is(&sta, STATE_FLAGS_ISSUPERVISED) == STATE_FLAGS_TRUE || - service_is(&sta, STATE_FLAGS_TORELOAD) == STATE_FLAGS_TRUE || - service_is(&sta, STATE_FLAGS_TORESTART) == STATE_FLAGS_TRUE) { + if (sta->issupervised == STATE_FLAGS_TRUE || + sta->toreload == STATE_FLAGS_TRUE || + sta->torestart == STATE_FLAGS_TRUE) { log_trace("delete fdholder entry: ", name) ; fdholder_delete(&a, name, &deadline) ; diff --git a/src/lib66/sanitize/sanitize_source.c b/src/lib66/sanitize/sanitize_source.c index 1b54882e9129df3560fba6c0902a65e7da54fc97..3ff7b621db6afae9118da912e4caa088eb9a997e 100644 --- a/src/lib66/sanitize/sanitize_source.c +++ b/src/lib66/sanitize/sanitize_source.c @@ -72,7 +72,7 @@ void sanitize_source(char const *name, ssexec_t *info) if (!state_read(&sta, &res)) log_dieu(LOG_EXIT_SYS, "read state file of: ", name) ; - if (service_is(&sta, STATE_FLAGS_TOPARSE) == STATE_FLAGS_TRUE) { + if (sta.toparse == STATE_FLAGS_TRUE) { if (!info->opt_tree) { diff --git a/src/lib66/sanitize/sanitize_write.c b/src/lib66/sanitize/sanitize_write.c index 857851999d230b9242e43489cee8d6debd8de11a..9ff4b2c32ac57064ccde628e84d51ec5bf936cbc 100644 --- a/src/lib66/sanitize/sanitize_write.c +++ b/src/lib66/sanitize/sanitize_write.c @@ -54,7 +54,7 @@ static void resolve_compare(resolve_service_t *res) if (!state_read(&sta, &fres)) log_dieu(LOG_EXIT_SYS, "read state file of: ", name) ; - if (service_is(&sta, STATE_FLAGS_ISSUPERVISED) == STATE_FLAGS_TRUE) { + if (sta.issupervised == STATE_FLAGS_TRUE) { if (fres.type != res->type) log_die(LOG_EXIT_SYS, "Detection of incompatible type format for supervised service: ", name, " -- current: ", get_key_by_enum(ENUM_TYPE, res->type), " previous: ", get_key_by_enum(ENUM_TYPE, fres.type), ". Please unsupervise it with '66 unsupervice ", name,"' before trying the conversion") ; @@ -89,7 +89,7 @@ static int preserve(resolve_service_t *res, uint8_t force) } else /** This info should never be executed as long as the parse_frontend - * check already verifies the service and prevents reaching this point if !force. */ + * verify the service and prevents reaching this point if !force. */ log_info_return(0, "Ignoring: ", res->sa.s + res->name, " -- service already written") ; } @@ -100,10 +100,6 @@ int sanitize_write(resolve_service_t *res, uint8_t force) { log_flow() ; - int r ; - - r = preserve(res, force) ; - - return r ; + return preserve(res, force) ; } diff --git a/src/lib66/service/service_graph_build.c b/src/lib66/service/service_graph_build.c index f2f2c3dae7015d445177051e03e5450b6af8f8e2..83ec07d0e2f13ab59e4714e3f0b14ba5ce7a89a8 100644 --- a/src/lib66/service/service_graph_build.c +++ b/src/lib66/service/service_graph_build.c @@ -51,7 +51,7 @@ static void issupervised(char *store, resolve_service_t *ares, unsigned int ares if (!state_read(&ste, &ares[aresid])) continue ; - if ((&ste, STATE_FLAGS_ISSUPERVISED) == STATE_FLAGS_TRUE) + if (ste.issupervised == STATE_FLAGS_TRUE) auto_strings(store + strlen(store), name, " ") ; else continue ; @@ -81,7 +81,7 @@ void service_graph_build(graph_t *g, resolve_service_t *ares, unsigned int aresl if (!state_read(&ste, &ares[pos])) continue ; - if (service_is(&ste, STATE_FLAGS_ISSUPERVISED) == STATE_FLAGS_FALSE && FLAGS_ISSET(flag, STATE_FLAGS_ISSUPERVISED)) { + if (ste.issupervised == STATE_FLAGS_FALSE && FLAGS_ISSET(flag, STATE_FLAGS_ISSUPERVISED)) { log_warn("service: ", service, " not available -- ignore it") ; continue ; } diff --git a/src/lib66/service/service_is_g.c b/src/lib66/service/service_is_g.c index 16656602bca3fa0674f3d05cccfebd2c493d82d4..632a2bff86faa1e2c00ebd16b575226bf835d693 100644 --- a/src/lib66/service/service_is_g.c +++ b/src/lib66/service/service_is_g.c @@ -30,7 +30,7 @@ #include <66/constants.h> #include <66/utils.h> -int service_is(ss_state_t *ste, uint32_t flag) +static int service_is(ss_state_t *ste, uint32_t flag) { switch (flag) { diff --git a/src/lib66/svc/svc_compute_ns.c b/src/lib66/svc/svc_compute_ns.c index d65032365d5b158bdb67e04baa211975dd6cfae4..67573fb812ef3cfb1d8376ccae57e1d54aa3395b 100644 --- a/src/lib66/svc/svc_compute_ns.c +++ b/src/lib66/svc/svc_compute_ns.c @@ -90,7 +90,7 @@ static void pidservice_init_array(unsigned int *list, unsigned int listlen, pids if (!state_read(&sta, &ares[pids.aresid])) log_dieusys(LOG_EXIT_SYS, "read state file of: ", name) ; - if (service_is(&sta, STATE_FLAGS_ISUP) == STATE_FLAGS_TRUE) + if (sta.isup == STATE_FLAGS_TRUE) FLAGS_SET(pids.state, SVC_FLAGS_UP) ; else FLAGS_SET(pids.state, SVC_FLAGS_DOWN) ;