master - libdm: use dm_log_with_errno always
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ee13f265f043b47a1b023321fb9e8470fb5703c1 Commit: ee13f265f043b47a1b023321fb9e8470fb5703c1 Parent: 221d8ff2a420a4104826907de9d71100dc208834 Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu Nov 3 17:15:07 2016 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Thu Nov 3 17:49:07 2016 +0100
libdm: use dm_log_with_errno always
Instead of compiling 2 log call for 2 different logging functions, and runtime decide which version to use - use only 'newer' function and when user sets his own OLD dm_log logging translate it runtime for old arg list set.
The positive part is - we get shorter generated library, on the negative part this translation means, we always have evaluate all args and print the message into local on stack buffer, before we can pass this buffer to the users' logging function with proper expected parameters (and such function may later decide to discard logging based on message level so whole printing was unnecessary).
--- WHATS_NEW_DM | 1 + libdm/libdm-common.c | 62 ++++++++++++++++++++++++++++++++++++++++------ libdm/misc/dm-logging.h | 10 +------ 3 files changed, 57 insertions(+), 16 deletions(-)
WHATS_NEW_DM +1 -0
@@ -1,5 +1,6 @@ Version 1.02.136 - ====================================== + Use dm_log_with_errno and translate runtime to dm_log only when needed. Make log messages from dm and lvm library differnt from dmeventd. Notice and Info messages are again logged from dmeventd and its plugins. Dmeventd now also respects DM_ABORT_ON_INTERNAL_ERRORS as libdm based tool.
libdm/libdm-common.c +54 -8
80 lines not on this page · raw message
libdm/misc/dm-logging.h +2 -8
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2016 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -18,16 +18,10 @@#include "libdevmapper.h" -extern dm_log_fn dm_log;extern dm_log_with_errno_fn dm_log_with_errno; #define LOG_MESG(l, f, ln, e, x...) \ - do { \ - if (dm_log_is_non_default()) \ - dm_log(l, f, ln, ## x); \ - else \ - dm_log_with_errno(l, f, ln, e, ## x); \ - } while (0) + dm_log_with_errno(l, f, ln, e, ## x) #define LOG_LINE(l, x...) LOG_MESG(l, __FILE__, __LINE__, 0, ## x) #define LOG_LINE_WITH_ERRNO(l, e, x...) LOG_MESG(l, __FILE__, __LINE__, e, ## x)