virlog: Rename virLogParse* to virLogParseAndDefine*

Right now virLogParse* functions are doing both parsing and defining of filters
and outputs which should be two separate operations. Since the naming is
apparently a bit poor this patch renames these functions to
virLogParseAndDefine* which eventually will be replaced by virLogSet*.
Additionally, virLogParse{Filter,Output} will be later (after the split) reused,
so that these functions do exactly what the their name suggests.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Erik Skultety 2016-07-15 12:37:05 +02:00
parent 6aa3a6a48f
commit b8c370a96e
7 changed files with 28 additions and 28 deletions

View File

@ -691,10 +691,10 @@ daemonSetupLogging(struct daemonConfig *config,
virLogSetFromEnv();
if (virLogGetNbFilters() == 0)
virLogParseFilters(config->log_filters);
virLogParseAndDefineFilters(config->log_filters);
if (virLogGetNbOutputs() == 0)
virLogParseOutputs(config->log_outputs);
virLogParseAndDefineOutputs(config->log_outputs);
/*
* Command line override for --verbose
@ -721,7 +721,7 @@ daemonSetupLogging(struct daemonConfig *config,
if (virAsprintf(&tmp, "%d:journald", priority) < 0)
goto error;
virLogParseOutputs(tmp);
virLogParseAndDefineOutputs(tmp);
VIR_FREE(tmp);
}
}
@ -764,7 +764,7 @@ daemonSetupLogging(struct daemonConfig *config,
if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
goto error;
}
virLogParseOutputs(tmp);
virLogParseAndDefineOutputs(tmp);
VIR_FREE(tmp);
}

View File

@ -1882,9 +1882,9 @@ virLogLock;
virLogMessage;
virLogOutputFree;
virLogOutputListFree;
virLogParseAndDefineFilters;
virLogParseAndDefineOutputs;
virLogParseDefaultPriority;
virLogParseFilters;
virLogParseOutputs;
virLogPriorityFromSyslog;
virLogProbablyLogMessage;
virLogReset;

View File

@ -476,10 +476,10 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config,
virLogSetFromEnv();
if (virLogGetNbFilters() == 0)
virLogParseFilters(config->log_filters);
virLogParseAndDefineFilters(config->log_filters);
if (virLogGetNbOutputs() == 0)
virLogParseOutputs(config->log_outputs);
virLogParseAndDefineOutputs(config->log_outputs);
/*
* Command line override for --verbose
@ -499,7 +499,7 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config,
if (access("/run/systemd/journal/socket", W_OK) >= 0) {
if (virAsprintf(&tmp, "%d:journald", virLogGetDefaultPriority()) < 0)
goto error;
virLogParseOutputs(tmp);
virLogParseAndDefineOutputs(tmp);
VIR_FREE(tmp);
}
}
@ -543,7 +543,7 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config,
if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
goto error;
}
virLogParseOutputs(tmp);
virLogParseAndDefineOutputs(tmp);
VIR_FREE(tmp);
}

View File

@ -404,10 +404,10 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config,
virLogSetFromEnv();
if (virLogGetNbFilters() == 0)
virLogParseFilters(config->log_filters);
virLogParseAndDefineFilters(config->log_filters);
if (virLogGetNbOutputs() == 0)
virLogParseOutputs(config->log_outputs);
virLogParseAndDefineOutputs(config->log_outputs);
/*
* Command line override for --verbose
@ -427,7 +427,7 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config,
if (access("/run/systemd/journal/socket", W_OK) >= 0) {
if (virAsprintf(&tmp, "%d:journald", virLogGetDefaultPriority()) < 0)
goto error;
virLogParseOutputs(tmp);
virLogParseAndDefineOutputs(tmp);
VIR_FREE(tmp);
}
}
@ -471,7 +471,7 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config,
if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
goto error;
}
virLogParseOutputs(tmp);
virLogParseAndDefineOutputs(tmp);
VIR_FREE(tmp);
}

View File

@ -1134,7 +1134,7 @@ int virLogPriorityFromSyslog(int priority ATTRIBUTE_UNUSED)
static int
virLogParseOutput(const char *src)
virLogParseAndDefineOutput(const char *src)
{
int ret = -1;
char **tokens = NULL;
@ -1206,7 +1206,7 @@ virLogParseOutput(const char *src)
/**
* virLogParseOutputs:
* virLogParseAndDefineOutputs:
* @outputs: string defining a (set of) output(s)
*
* The format for an output can be:
@ -1231,7 +1231,7 @@ virLogParseOutput(const char *src)
* Returns the number of output parsed or -1 in case of error.
*/
int
virLogParseOutputs(const char *src)
virLogParseAndDefineOutputs(const char *src)
{
int ret = -1;
int count = 0;
@ -1251,7 +1251,7 @@ virLogParseOutputs(const char *src)
if (STREQ(strings[i], ""))
continue;
if (virLogParseOutput(strings[i]) < 0)
if (virLogParseAndDefineOutput(strings[i]) < 0)
goto cleanup;
count++;
@ -1265,7 +1265,7 @@ virLogParseOutputs(const char *src)
static int
virLogParseFilter(const char *filter)
virLogParseAndDefineFilter(const char *filter)
{
int ret = -1;
size_t count = 0;
@ -1311,7 +1311,7 @@ virLogParseFilter(const char *filter)
}
/**
* virLogParseFilters:
* virLogParseAndDefineFilters:
* @filters: string defining a (set of) filter(s)
*
* The format for a filter is:
@ -1329,7 +1329,7 @@ virLogParseFilter(const char *filter)
* Returns the number of filter parsed or -1 in case of error.
*/
int
virLogParseFilters(const char *filters)
virLogParseAndDefineFilters(const char *filters)
{
int ret = -1;
int count = 0;
@ -1349,7 +1349,7 @@ virLogParseFilters(const char *filters)
if (STREQ(strings[i], ""))
continue;
if (virLogParseFilter(strings[i]) < 0)
if (virLogParseAndDefineFilter(strings[i]) < 0)
goto cleanup;
count++;
@ -1527,10 +1527,10 @@ virLogSetFromEnv(void)
virLogParseDefaultPriority(debugEnv);
debugEnv = virGetEnvAllowSUID("LIBVIRT_LOG_FILTERS");
if (debugEnv && *debugEnv)
virLogParseFilters(debugEnv);
virLogParseAndDefineFilters(debugEnv);
debugEnv = virGetEnvAllowSUID("LIBVIRT_LOG_OUTPUTS");
if (debugEnv && *debugEnv)
virLogParseOutputs(debugEnv);
virLogParseAndDefineOutputs(debugEnv);
}

View File

@ -206,8 +206,8 @@ void virLogLock(void);
void virLogUnlock(void);
int virLogReset(void);
int virLogParseDefaultPriority(const char *priority);
int virLogParseFilters(const char *filters);
int virLogParseOutputs(const char *output);
int virLogParseAndDefineFilters(const char *filters);
int virLogParseAndDefineOutputs(const char *output);
int virLogPriorityFromSyslog(int priority);
void virLogMessage(virLogSourcePtr source,
virLogPriority priority,

View File

@ -50,7 +50,7 @@ testLogParseOutputs(const void *opaque)
int noutputs;
const struct testLogData *data = opaque;
noutputs = virLogParseOutputs(data->str);
noutputs = virLogParseAndDefineOutputs(data->str);
if (noutputs < 0) {
if (!data->pass) {
VIR_TEST_DEBUG("Got expected error: %s\n",
@ -81,7 +81,7 @@ testLogParseFilters(const void *opaque)
int nfilters;
const struct testLogData *data = opaque;
nfilters = virLogParseFilters(data->str);
nfilters = virLogParseAndDefineFilters(data->str);
if (nfilters < 0) {
if (!data->pass) {
VIR_TEST_DEBUG("Got expected error: %s\n",