dev-mornfall-lvmcache - libdm: add public macro DM_TO_STRING
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c5c452a137ba36840d71f3bde23b1a6b496ede4f Commit: c5c452a137ba36840d71f3bde23b1a6b496ede4f Parent: 2f1a571c9707d596d7716cec9488e54ba4c0c946 Author: Zdenek Kabelac <[email protected]> AuthorDate: Wed May 29 12:46:21 2013 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Thu May 30 16:53:59 2013 +0200
libdm: add public macro DM_TO_STRING
Since this stringifying macro is usable in more places, move it to the public header with DM_ prefix.
--- WHATS_NEW_DM | 1 + libdm/libdevmapper.h | 4 ++++ libdm/libdm-common.c | 8 ++------ 3 files changed, 7 insertions(+), 6 deletions(-)
WHATS_NEW_DM +1 -0
@@ -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.
libdm/libdevmapper.h +4 -0
@@ -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 __cplusplusextern "C" {#endif
libdm/libdm-common.c +2 -6
@@ -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 ;