Skip to content

Commit 46e8af8

Browse files
committed
lib: define LIBNVME_LOG_* levels replacing syslog.h LOG_* constants
The library uses only for log levels, thus the rest of the log levels are not used. Furthermore, dropping the dependency on syslog allows porting the project to different OS simpler. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 023d3aa commit 46e8af8

23 files changed

Lines changed: 272 additions & 295 deletions

fabrics.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <stdint.h>
3131
#include <stdio.h>
3232
#include <stdlib.h>
33-
#include <syslog.h>
3433
#include <time.h>
3534
#include <unistd.h>
3635

libnvme/libnvme/nvme.i

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -508,14 +508,10 @@ struct libnvme_ns {
508508
}
509509
void log_level(const char *level) {
510510
int log_level = DEFAULT_LOGLEVEL;
511-
if (!strcmp(level, "debug")) log_level = LOG_DEBUG;
512-
else if (!strcmp(level, "info")) log_level = LOG_INFO;
513-
else if (!strcmp(level, "notice")) log_level = LOG_NOTICE;
514-
else if (!strcmp(level, "warning")) log_level = LOG_WARNING;
515-
else if (!strcmp(level, "err")) log_level = LOG_ERR;
516-
else if (!strcmp(level, "crit")) log_level = LOG_CRIT;
517-
else if (!strcmp(level, "alert")) log_level = LOG_ALERT;
518-
else if (!strcmp(level, "emerg")) log_level = LOG_EMERG;
511+
if (!strcmp(level, "debug")) log_level = LIBNVME_LOG_DEBUG;
512+
else if (!strcmp(level, "info")) log_level = LIBNVME_LOG_INFO;
513+
else if (!strcmp(level, "warning")) log_level = LIBNVME_LOG_WARN;
514+
else if (!strcmp(level, "err")) log_level = LIBNVME_LOG_ERR;
519515
libnvme_set_logging_level($self, log_level, false, false);
520516
}
521517
%pythoncode %{

libnvme/src/nvme/cmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ __public int libnvme_get_uuid_list(struct libnvme_transport_handle *hdl,
296296
nvme_init_identify_ctrl(&cmd, &ctrl);
297297
err = libnvme_submit_admin_passthru(hdl, &cmd);
298298
if (err) {
299-
libnvme_msg(hdl->ctx, LOG_ERR,
299+
libnvme_msg(hdl->ctx, LIBNVME_LOG_ERR,
300300
"ERROR: nvme_identify_ctrl() failed 0x%x\n", err);
301301
return err;
302302
}

0 commit comments

Comments
 (0)