diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 4a2947aa8..46ce9b036 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.78 - =================================== + Add DM_TO_STRING public macro. Always return success on dmeventd -V command call. Fix parsing of 64bit snapshot status in dmeventd snapshot plugin. Add dm_get_status_snapshot() for parsing snapshot status. diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index 1bf580762..dba854801 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -34,6 +34,10 @@ # define __typeof__ typeof #endif +/* Macros to make string defines */ +#define DM_TO_STRING_EXP(A) #A +#define DM_TO_STRING(A) DM_TO_STRING_EXP(A) + #ifdef __cplusplus extern "C" { #endif diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 4b0ba08d2..d18de9ce2 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -1591,10 +1591,6 @@ static void _unmangle_mountinfo_string(const char *src, char *buf) *buf = '\0'; } -/* Macros to make string defines */ -#define TO_STRING_EXP(A) #A -#define TO_STRING(A) TO_STRING_EXP(A) - /* Parse one line of mountinfo and unmangled target line */ static int _mountinfo_parse_line(const char *line, unsigned *maj, unsigned *min, char *buf) { @@ -1602,8 +1598,8 @@ static int _mountinfo_parse_line(const char *line, unsigned *maj, unsigned *min, char target[PATH_MAX + 1]; /* TODO: maybe detect availability of %ms glib support ? */ - if (sscanf(line, "%*u %*u %u:%u %" TO_STRING(PATH_MAX) - "s %" TO_STRING(PATH_MAX) "s", + if (sscanf(line, "%*u %*u %u:%u %" DM_TO_STRING(PATH_MAX) + "s %" DM_TO_STRING(PATH_MAX) "s", maj, min, root, target) < 4) { log_error("Failed to parse mountinfo line."); return 0;