From patchwork Fri Nov 9 14:29:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Tulak X-Patchwork-Id: 10676073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5E8B13AD for ; Fri, 9 Nov 2018 14:31:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6DB92EC62 for ; Fri, 9 Nov 2018 14:31:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB6952EC5B; Fri, 9 Nov 2018 14:31:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 636D12EC5F for ; Fri, 9 Nov 2018 14:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727800AbeKJAMa (ORCPT ); Fri, 9 Nov 2018 19:12:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37953 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727781AbeKJAMa (ORCPT ); Fri, 9 Nov 2018 19:12:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1EC5E3002E00 for ; Fri, 9 Nov 2018 14:31:40 +0000 (UTC) Received: from honza-mbp.redhat.com (ovpn-204-23.brq.redhat.com [10.40.204.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66C29672DD; Fri, 9 Nov 2018 14:31:38 +0000 (UTC) From: Jan Tulak To: linux-xfs@vger.kernel.org Cc: Jan Tulak Subject: [PATCH 02/24] xfsdump: do not split function call with ifdef Date: Fri, 9 Nov 2018 15:29:42 +0100 Message-Id: <20181109143004.24963-3-jtulak@redhat.com> In-Reply-To: <20181109143004.24963-1-jtulak@redhat.com> References: <20181109143004.24963-1-jtulak@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 09 Nov 2018 14:31:40 +0000 (UTC) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In two files in xfsdump, a function call is split in half by an ifdef macro to conditionally pick an argument at compile time. This causes the code to be a bit less obvious and some analysis tools have trouble with understanding it. So, instead of splitting the function in half, move the whole function call into each of the ifdef macros. Signed-off-by: Jan Tulak --- common/drive_minrmt.c | 3 ++- common/main.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/drive_minrmt.c b/common/drive_minrmt.c index 59a40a7..04fed3e 100644 --- a/common/drive_minrmt.c +++ b/common/drive_minrmt.c @@ -2585,11 +2585,12 @@ read_label( drive_t *drivep ) if (( nread == 0 ) /* takes care of sun */ || /* now handle SGI */ (nread < 0 && saved_errno == ENOSPC )) { - mlog( MLOG_NORMAL | MLOG_DRIVE, #ifdef DUMP + mlog( MLOG_NORMAL | MLOG_DRIVE, _("encountered EOD : assuming blank media\n") ); #endif #ifdef RESTORE + mlog( MLOG_NORMAL | MLOG_DRIVE, _("encountered EOD : end of data\n") ); #endif ( void )rewind_and_verify( drivep ); diff --git a/common/main.c b/common/main.c index b3605d1..0c23eb4 100644 --- a/common/main.c +++ b/common/main.c @@ -581,12 +581,14 @@ main( int argc, char *argv[] ) sigaction( SIGTERM, &sa, NULL ); sigaction( SIGQUIT, &sa, NULL ); +#ifdef DUMP ok = drive_init2( argc, argv, -#ifdef DUMP gwhdrtemplatep ); #endif /* DUMP */ #ifdef RESTORE + ok = drive_init2( argc, + argv, ( global_hdr_t * )0 ); #endif /* RESTORE */ if ( ! ok ) { @@ -629,12 +631,14 @@ main( int argc, char *argv[] ) * time-consuming chore. drive_init3 will synchronize with each slave. */ if ( ! init_error ) { +#ifdef DUMP ok = drive_init2( argc, argv, -#ifdef DUMP gwhdrtemplatep ); #endif /* DUMP */ #ifdef RESTORE + ok = drive_init2( argc, + argv, ( global_hdr_t * )0 ); #endif /* RESTORE */ if ( ! ok ) {