Skip to content
Snippets Groups Projects
Commit 3666c117 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

remove use of service_is function

parent 4002936a
No related branches found
No related tags found
No related merge requests found
......@@ -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) ;
......
......@@ -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) ;
......
......@@ -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 ;
......
......@@ -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 ;
......
......@@ -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) ;
......
......@@ -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) {
......
......@@ -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) ;
}
......@@ -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 ;
}
......
......@@ -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) {
......
......@@ -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) ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment