replace SNDMSG,SYSMSG,SNDERR,SYSERR with new log macros

... with interface identifiers

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-06 15:57:13 +01:00
parent 492df4bb94
commit 62c8e635dc
82 changed files with 1292 additions and 1201 deletions

View file

@ -89,30 +89,30 @@ static int snd_timer_open_conf(snd_timer_t **timer,
void *h = NULL;
if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
SNDERR("Invalid type for TIMER %s definition", name);
snd_error(TIMER, "Invalid type for TIMER %s definition", name);
else
SNDERR("Invalid type for TIMER definition");
snd_error(TIMER, "Invalid type for TIMER definition");
return -EINVAL;
}
err = snd_config_search(timer_conf, "type", &conf);
if (err < 0) {
SNDERR("type is not defined");
snd_error(TIMER, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
SNDERR("unable to get id");
snd_error(TIMER, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(TIMER, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(timer_root, "timer_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for TIMER type %s definition", str);
snd_error(TIMER, "Invalid type for TIMER type %s definition", str);
goto _err;
}
snd_config_for_each(i, next, type_conf) {
@ -125,7 +125,7 @@ static int snd_timer_open_conf(snd_timer_t **timer,
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(TIMER, "Invalid type for %s", id);
goto _err;
}
continue;
@ -133,12 +133,12 @@ static int snd_timer_open_conf(snd_timer_t **timer,
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(TIMER, "Invalid type for %s", id);
goto _err;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(TIMER, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
@ -155,10 +155,10 @@ static int snd_timer_open_conf(snd_timer_t **timer,
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_DLSYM_VERSION));
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
snd_error(TIMER, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
snd_error(TIMER, "symbol %s is not defined inside %s", open_name, lib);
snd_dlclose(h);
err = -ENXIO;
}
@ -181,7 +181,7 @@ static int snd_timer_open_noupdate(snd_timer_t **timer, snd_config_t *root, cons
snd_config_t *timer_conf;
err = snd_config_search_definition(root, "timer", name, &timer_conf);
if (err < 0) {
SNDERR("Unknown timer %s", name);
snd_error(TIMER, "Unknown timer %s", name);
return err;
}
err = snd_timer_open_conf(timer, name, root, timer_conf, mode);
@ -331,7 +331,7 @@ int snd_async_add_timer_handler(snd_async_handler_t **handler, snd_timer_t *time
snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler)
{
if (handler->type != SND_ASYNC_HANDLER_TIMER) {
SNDMSG("invalid handler type %d", handler->type);
snd_check(TIMER, "invalid handler type %d", handler->type);
return NULL;
}
return handler->u.timer;

View file

@ -72,7 +72,7 @@ static int snd_timer_hw_async(snd_timer_t *timer, int sig, pid_t pid)
assert(timer);
fd = timer->poll_fd;
if ((flags = fcntl(fd, F_GETFL)) < 0) {
SYSERR("F_GETFL failed");
snd_errornum(TIMER, "F_GETFL failed");
return -errno;
}
if (sig >= 0)
@ -80,19 +80,19 @@ static int snd_timer_hw_async(snd_timer_t *timer, int sig, pid_t pid)
else
flags &= ~O_ASYNC;
if (fcntl(fd, F_SETFL, flags) < 0) {
SYSERR("F_SETFL for O_ASYNC failed");
snd_errornum(TIMER, "F_SETFL for O_ASYNC failed");
return -errno;
}
if (sig < 0)
return 0;
#ifdef F_SETSIG
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
SYSERR("F_SETSIG failed");
snd_errornum(TIMER, "F_SETSIG failed");
return -errno;
}
#endif
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
SYSERR("F_SETOWN failed");
snd_errornum(TIMER, "F_SETOWN failed");
return -errno;
}
return 0;
@ -250,7 +250,7 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int
ret = -errno;
__no_tread:
close(fd);
SNDMSG("extended read is not supported (SNDRV_TIMER_IOCTL_TREAD)");
snd_check(TIMER, "extended read is not supported (SNDRV_TIMER_IOCTL_TREAD)");
return ret;
}
}
@ -327,7 +327,7 @@ int _snd_timer_hw_open(snd_timer_t **timer, char *name,
return err;
continue;
}
SNDERR("Unexpected field %s", id);
snd_error(TIMER, "Unexpected field %s", id);
return -EINVAL;
}
return snd_timer_hw_open(timer, name, dev_class, dev_sclass, card, device, subdevice, mode);

View file

@ -46,30 +46,30 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer,
void *h = NULL;
if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
SNDERR("Invalid type for TIMER %s definition", name);
snd_error(TIMER, "Invalid type for TIMER %s definition", name);
else
SNDERR("Invalid type for TIMER definition");
snd_error(TIMER, "Invalid type for TIMER definition");
return -EINVAL;
}
err = snd_config_search(timer_conf, "type", &conf);
if (err < 0) {
SNDERR("type is not defined");
snd_error(TIMER, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
SNDERR("unable to get id");
snd_error(TIMER, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(TIMER, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(timer_root, "timer_query_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("Invalid type for TIMER type %s definition", str);
snd_error(TIMER, "Invalid type for TIMER type %s definition", str);
err = -EINVAL;
goto _err;
}
@ -83,7 +83,7 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer,
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(TIMER, "Invalid type for %s", id);
goto _err;
}
continue;
@ -91,12 +91,12 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer,
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(TIMER, "Invalid type for %s", id);
goto _err;
}
continue;
}
SNDERR("Unknown field %s", id);
snd_error(TIMER, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
@ -113,10 +113,10 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer,
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_QUERY_DLSYM_VERSION));
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
snd_error(TIMER, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!open_func) {
SNDERR("symbol %s is not defined inside %s", open_name, lib);
snd_error(TIMER, "symbol %s is not defined inside %s", open_name, lib);
snd_dlclose(h);
err = -ENXIO;
}
@ -139,7 +139,7 @@ static int snd_timer_query_open_noupdate(snd_timer_query_t **timer, snd_config_t
snd_config_t *timer_conf;
err = snd_config_search_definition(root, "timer_query", name, &timer_conf);
if (err < 0) {
SNDERR("Unknown timer %s", name);
snd_error(TIMER, "Unknown timer %s", name);
return err;
}
err = snd_timer_query_open_conf(timer, name, root, timer_conf, mode);

View file

@ -130,7 +130,7 @@ int _snd_timer_query_hw_open(snd_timer_query_t **timer, char *name,
continue;
if (_snd_conf_generic_id(id))
continue;
SNDERR("Unexpected field %s", id);
snd_error(TIMER, "Unexpected field %s", id);
return -EINVAL;
}
return snd_timer_query_hw_open(timer, name, mode);