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

@ -239,8 +239,9 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
/* clearing */
pipe = popen(file->final_fname + 1, "w");
if (!pipe) {
SYSERR("running %s for writing failed",
file->final_fname);
snd_errornum(PCM, "running %s for writing failed",
file->final_fname);
return -errno;
}
fd = fileno(pipe);
@ -274,8 +275,9 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
}
}
if (fd < 0) {
SYSERR("open %s for writing failed",
file->final_fname);
snd_errornum(PCM, "open %s for writing failed",
file->final_fname);
free(tmpfname);
return -errno;
}
@ -303,7 +305,7 @@ static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm,
return -ENOMEM;
if (file->rbuf_size < frames) {
SYSERR("requested more frames than pcm buffer");
snd_errornum(PCM, "requested more frames than pcm buffer");
return -ENOMEM;
}
@ -312,7 +314,7 @@ static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm,
return bytes;
bytes = read(file->ifd, file->rbuf, bytes);
if (bytes < 0) {
SYSERR("read from file failed, error: %d", bytes);
snd_errornum(PCM, "read from file failed, error: %d", bytes);
return bytes;
}
@ -376,9 +378,9 @@ write_error:
* be used to signal XRUN on playback device
*/
if (res < 0)
SYSERR("%s write header failed, file data may be corrupt", file->fname);
snd_errornum(PCM, "%s write header failed, file data may be corrupt", file->fname);
else
SNDERR("%s write header incomplete, file data may be corrupt", file->fname);
snd_error(PCM, "%s write header incomplete, file data may be corrupt", file->fname);
memset(&file->wav_header, 0, sizeof(struct wav_fmt));
@ -440,7 +442,7 @@ static int snd_pcm_file_write_bytes(snd_pcm_t *pcm, size_t bytes)
if (err < 0) {
file->wbuf_used_bytes = 0;
file->file_ptr_bytes = 0;
SYSERR("%s write failed, file data may be corrupt", file->fname);
snd_errornum(PCM, "%s write failed, file data may be corrupt", file->fname);
return err;
}
bytes -= err;
@ -791,7 +793,7 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
if (file->fd < 0) {
err = snd_pcm_file_open_output_file(file);
if (err < 0) {
SYSERR("failed opening output file %s", file->fname);
snd_errornum(PCM, "failed opening output file %s", file->fname);
return err;
}
}
@ -914,7 +916,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
else if (!strcmp(fmt, "wav"))
format = SND_PCM_FILE_FORMAT_WAV;
else {
SNDERR("file format %s is unknown", fmt);
snd_error(PCM, "file format %s is unknown", fmt);
return -EINVAL;
}
file = calloc(1, sizeof(snd_pcm_file_t));
@ -932,7 +934,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (ifname && (stream == SND_PCM_STREAM_CAPTURE)) {
ifd = open(ifname, O_RDONLY); /* TODO: mind blocking mode */
if (ifd < 0) {
SYSERR("open %s for reading failed", ifname);
snd_errornum(PCM, "open %s for reading failed", ifname);
free(file->fname);
free(file);
return -errno;
@ -1057,7 +1059,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "format") == 0) {
err = snd_config_get_string(n, &format);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
@ -1067,7 +1069,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (err < 0) {
err = snd_config_get_integer(n, &fd);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
}
@ -1078,7 +1080,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (err < 0) {
err = snd_config_get_integer(n, &ifd);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
}
@ -1087,11 +1089,11 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (strcmp(id, "perm") == 0) {
err = snd_config_get_integer(n, &perm);
if (err < 0) {
SNDERR("Invalid type for %s", id);
snd_error(PCM, "Invalid type for %s", id);
return err;
}
if ((perm & ~0777) != 0) {
SNDERR("The field perm must be a valid file permission");
snd_error(PCM, "The field perm must be a valid file permission");
return -EINVAL;
}
continue;
@ -1103,7 +1105,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
trunc = err;
continue;
}
SNDERR("Unknown field %s", id);
snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!format) {
@ -1112,13 +1114,13 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
if (snd_config_search(root, "defaults.pcm.file_format", &n) >= 0) {
err = snd_config_get_string(n, &format);
if (err < 0) {
SNDERR("Invalid file format");
snd_error(PCM, "Invalid file format");
return -EINVAL;
}
}
}
if (!slave) {
SNDERR("slave is not defined");
snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
@ -1126,7 +1128,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
return err;
if ((!fname || strlen(fname) == 0) && fd < 0) {
snd_config_delete(sconf);
SNDERR("file is not defined");
snd_error(PCM, "file is not defined");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);