1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2013-05-29 12:46:21 +02:00
parent 2f1a571c97
commit c5c452a137
3 changed files with 7 additions and 6 deletions

View File

@ -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.

View File

@ -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

View File

@ -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;