Skip to contentSkip to conversation

LVM2 ./WHATS_NEW_DM lib/log/log.h lib/log/lvm- ...

PATCH [email protected] 1 participant 1 message Jul 10, 2009

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2009-07-10 09:59:38

Modified files:

	.              : WHATS_NEW_DM 
	lib/log        : log.h lvm-logging.h 
	libdm          : .exported_symbols libdevmapper.h libdm-common.c 
	libdm/misc     : dm-logging.h 
	libdm/mm       : dbg_malloc.c 
	po             : pogen.h 

Log message:
Add dm_log_with_errno and dm_log_with_errno_init, deprecating the old Change plog to use dm_log_with_errno unless deprecated dm_log_init was used. Rename plog macro to LOG_LINE and use in dm_dump_memory_debug.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.284&r2=1.285
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.h.diff?cvsroot=lvm2&r1=1.43&r2=1.44
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/lvm-logging.h.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/.exported_symbols.diff?cvsroot=lvm2&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.90&r2=1.91
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/misc/dm-logging.h.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/mm/dbg_malloc.c.diff?cvsroot=lvm2&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/po/pogen.h.diff?cvsroot=lvm2&r1=1.3&r2=1.4

WHATS_NEW_DM +3 -0
@@ -1,5 +1,8 @@
 Version 1.02.34 - 
 ================================
+  Rename plog macro to LOG_LINE and use in dm_dump_memory_debug.
+  Change plog to use dm_log_with_errno unless deprecated dm_log_init was used.
+  Add dm_log_with_errno and dm_log_with_errno_init, deprecating the old fns.
   Fix whitespace in linear target line to fix identical table line detection.
   Add device number to more log messages during activation.
 
lib/log/log.h +7 -7
@@ -50,17 +50,17 @@
 #define _LOG_ERR 3
 #define _LOG_FATAL 2
 
-#define log_debug(x...) plog(_LOG_DEBUG, x)
-#define log_info(x...) plog(_LOG_INFO, x)
-#define log_notice(x...) plog(_LOG_NOTICE, x)
-#define log_warn(x...) plog(_LOG_WARN | _LOG_STDERR, x)
-#define log_err(x...) plog(_LOG_ERR, x)
-#define log_fatal(x...) plog(_LOG_FATAL, x)
+#define log_debug(x...) LOG_LINE(_LOG_DEBUG, x)
+#define log_info(x...) LOG_LINE(_LOG_INFO, x)
+#define log_notice(x...) LOG_LINE(_LOG_NOTICE, x)
+#define log_warn(x...) LOG_LINE(_LOG_WARN | _LOG_STDERR, x)
+#define log_err(x...) LOG_LINE(_LOG_ERR, x)
+#define log_fatal(x...) LOG_LINE(_LOG_FATAL, x)
 
 #define stack log_debug("<backtrace>")	/* Backtrace on error */
 #define log_very_verbose(args...) log_info(args)
 #define log_verbose(args...) log_notice(args)
-#define log_print(args...) plog(_LOG_WARN, args)
+#define log_print(args...) LOG_LINE(_LOG_WARN, args)
 #define log_error(args...) log_err(args)
 
 /* System call equivalents */
lib/log/lvm-logging.h +1 -1
@@ -19,7 +19,7 @@
 void print_log(int level, const char *file, int line, const char *format, ...)
     __attribute__ ((format(printf, 4, 5)));
 
-#define plog(l, x...) print_log(l, __FILE__, __LINE__ , ## x)
+#define LOG_LINE(l, x...) print_log(l, __FILE__, __LINE__ , ## x)
 
 #include "log.h"
 
libdm/.exported_symbols +3 -0
@@ -6,6 +6,9 @@
 dm_get_library_version
 dm_log
 dm_log_init
+dm_log_is_non_default
+dm_log_with_errno
+dm_log_with_errno_init
 dm_log_init_verbose
 dm_task_create
 dm_task_destroy
libdm/libdevmapper.h +29 -14

65 lines not on this page · raw message

libdm/libdm-common.c +45 -7

83 lines not on this page · raw message

libdm/misc/dm-logging.h +8 -1
@@ -19,8 +19,15 @@
 #include "libdevmapper.h"
 
 extern dm_log_fn dm_log;
+extern dm_log_with_errno_fn dm_log_with_errno;
 
-#define plog(l, x...) dm_log(l, __FILE__, __LINE__, ## x)
+#define LOG_LINE(l, x...) \
+	do { \
+		if (dm_log_is_non_default()) \
+			dm_log(l, __FILE__, __LINE__, ## x); \
+		else \
+			dm_log_with_errno(l, __FILE__, __LINE__, 0, ## x); \
+	} while (0)
 
 #include "log.h"
 
libdm/mm/dbg_malloc.c +3 -3
@@ -205,9 +205,9 @@
 		}
 		str[sizeof(str) - 1] = '\0';
 
-		dm_log(_LOG_INFO, mb->file, mb->line,
-		       "block %d at %p, size %" PRIsize_t "\t [%s]",
-		       mb->id, mb->magic, mb->length, str);
+		LOG_LINE(_LOG_INFO, mb->file, mb->line,
+			 "block %d at %p, size %" PRIsize_t "\t [%s]",
+			 mb->id, mb->magic, mb->length, str);
 		tot += mb->length;
 	}
 
po/pogen.h +3 -0
@@ -21,3 +21,6 @@
 
 #define print_log(level, file, line, format, args...) print_log(format, args)
 #define dm_log(level, file, line, format, args...) dm_log(format, args)
+#define dm_log_with_errno(level, file, line, format, dm_errno, args...) \
+    dm_log(format, args)
+