From patchwork Sun Mar 26 13:49:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 9645011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C0586601E9 for ; Sun, 26 Mar 2017 13:57:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2BF920144 for ; Sun, 26 Mar 2017 13:57:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8533520265; Sun, 26 Mar 2017 13:57:16 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1334320144 for ; Sun, 26 Mar 2017 13:57:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84AE8437F45; Sun, 26 Mar 2017 13:57:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 84AE8437F45 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 84AE8437F45 Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E662BA889; Sun, 26 Mar 2017 13:57:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C21774E9BC; Sun, 26 Mar 2017 13:57:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2QDo3sr000831 for ; Sun, 26 Mar 2017 09:50:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 27D7984418; Sun, 26 Mar 2017 13:50:03 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F84484417 for ; Sun, 26 Mar 2017 13:50:00 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D76D8553F for ; Sun, 26 Mar 2017 13:49:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9D76D8553F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mwilck@suse.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9D76D8553F X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 311C2AAB9; Sun, 26 Mar 2017 13:49:57 +0000 (UTC) From: Martin Wilck To: dm-devel@redhat.com Date: Sun, 26 Mar 2017 15:49:47 +0200 Message-Id: <20170326134947.24993-1-mwilck@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sun, 26 Mar 2017 13:50:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sun, 26 Mar 2017 13:50:00 +0000 (UTC) for IP:'195.135.220.15' DOMAIN:'mx2.suse.de' HELO:'mx2.suse.de' FROM:'mwilck@suse.com' RCPT:'' X-RedHat-Spam-Score: -1.901 (BAYES_50, DCC_REPUT_00_12, RCVD_IN_DNSWL_MED, SPF_PASS) 195.135.220.15 mx2.suse.de 195.135.220.15 mx2.suse.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH] libmpathpersist: use extern struct udev from main program X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 26 Mar 2017 13:57:16 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Use the global variable "udev" - the internal one is not initialized, causing current libudev calls to fail. In the main program "mpathpersist", use a globally visible variable "udev" rather than a local variable in main(). This imitates the way the global variable "udev" is used in multipath and multipathd. Removed the "udev" parameter from mpath_lib_init() to clarify that it isn't used. Fixes: b87454988 "libmultipath: separate out 'udev' config entry" Signed-off-by: Martin Wilck --- libmpathpersist/mpath_persist.c | 4 ++-- libmpathpersist/mpath_persist.h | 2 +- mpathpersist/main.c | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c index 982c7954..9bca7764 100644 --- a/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c @@ -34,10 +34,10 @@ #define __STDC_FORMAT_MACROS 1 -struct udev *udev; +extern struct udev *udev; struct config * -mpath_lib_init (struct udev *udev) +mpath_lib_init (void) { struct config *conf; diff --git a/libmpathpersist/mpath_persist.h b/libmpathpersist/mpath_persist.h index 79de5b5b..7422322d 100644 --- a/libmpathpersist/mpath_persist.h +++ b/libmpathpersist/mpath_persist.h @@ -174,7 +174,7 @@ struct prout_param_descriptor { /* PROUT parameter descriptor */ * * RETURNS: struct config ->Success, NULL->Failed. */ -extern struct config * mpath_lib_init (struct udev *udev); +extern struct config * mpath_lib_init (void); /* diff --git a/mpathpersist/main.c b/mpathpersist/main.c index 2e0aba3c..e1aac8fa 100644 --- a/mpathpersist/main.c +++ b/mpathpersist/main.c @@ -57,6 +57,8 @@ void rcu_register_thread_memb(void) {} void rcu_unregister_thread_memb(void) {} +struct udev *udev; + int main (int argc, char * argv[]) { int fd, c, res; @@ -86,7 +88,6 @@ int main (int argc, char * argv[]) int num_transport =0; void *resp = NULL; struct transportid * tmp; - struct udev *udev = NULL; struct config *conf; if (optind == argc) @@ -104,7 +105,7 @@ int main (int argc, char * argv[]) } udev = udev_new(); - conf = mpath_lib_init(udev); + conf = mpath_lib_init(); if(!conf) { udev_unref(udev); exit(1);