1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

const: daemon server logging backend struct

This commit is contained in:
Zdenek Kabelac 2024-05-07 20:41:40 +02:00
parent 495ea0f058
commit 75a03c2c26

View File

@ -57,7 +57,7 @@ static void _log_stderr(log_state *s, void **state, int type, const char *messag
fprintf(stderr, "%s%s\n", prefix, message); fprintf(stderr, "%s%s\n", prefix, message);
} }
struct backend backend[] = { static const struct backend _backend[] = {
{ DAEMON_LOG_OUTLET_SYSLOG, _log_syslog }, { DAEMON_LOG_OUTLET_SYSLOG, _log_syslog },
{ DAEMON_LOG_OUTLET_STDERR, _log_stderr }, { DAEMON_LOG_OUTLET_STDERR, _log_stderr },
{ 0, 0 } { 0, 0 }
@ -65,17 +65,17 @@ struct backend backend[] = {
void daemon_log(log_state *s, int type, const char *message) { void daemon_log(log_state *s, int type, const char *message) {
int i = 0; int i = 0;
while ( backend[i].id ) { while ( _backend[i].id ) {
if ((int)(s->log_config[type] & backend[i].id) == backend[i].id ) if ((int)(s->log_config[type] & _backend[i].id) == _backend[i].id )
backend[i].log( s, &s->backend_state[i], type, message ); _backend[i].log( s, &s->backend_state[i], type, message );
++ i; ++ i;
} }
} }
static int _type_interesting(log_state *s, int type) { static int _type_interesting(log_state *s, int type) {
int i = 0; int i = 0;
while ( backend[i].id ) { while ( _backend[i].id ) {
if ((int)(s->log_config[type] & backend[i].id) == backend[i].id ) if ((int)(s->log_config[type] & _backend[i].id) == _backend[i].id )
return 1; return 1;
++ i; ++ i;
} }