From patchwork Mon Mar 16 12:36:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 6017901 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9E8EEBF90F for ; Mon, 16 Mar 2015 12:41:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF588204D8 for ; Mon, 16 Mar 2015 12:41:35 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 55AE2204D9 for ; Mon, 16 Mar 2015 12:41:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t2GCcFCi027908; Mon, 16 Mar 2015 08:38:15 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t2GCbHaw028815 for ; Mon, 16 Mar 2015 08:37:17 -0400 Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.16]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2GCbHRF004181; Mon, 16 Mar 2015 08:37:17 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2GCbFTF024073 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=FAIL); Mon, 16 Mar 2015 08:37:16 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8D261ADE0; Mon, 16 Mar 2015 12:37:09 +0000 (UTC) From: Hannes Reinecke To: Christophe Varoqui Date: Mon, 16 Mar 2015 13:36:27 +0100 Message-Id: <1426509425-15978-41-git-send-email-hare@suse.de> In-Reply-To: <1426509425-15978-1-git-send-email-hare@suse.de> References: <1426509425-15978-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.309 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, URIBL_BLOCKED) 195.135.220.15 cantor2.suse.de 195.135.220.15 cantor2.suse.de X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.16 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 40/78] Remove sysfs_get_dev X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development 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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pointless, and can be replaced by udev_device_get_devnum(). Signed-off-by: Hannes Reinecke --- libmultipath/discovery.c | 9 ++++----- libmultipath/discovery.h | 1 - libmultipath/structs_vec.c | 4 +++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 899cbd5..7d3ff49 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -172,7 +172,6 @@ declare_sysfs_get_str(devtype); declare_sysfs_get_str(vendor); declare_sysfs_get_str(model); declare_sysfs_get_str(rev); -declare_sysfs_get_str(dev); int sysfs_get_timeout(struct path *pp, unsigned int *timeout) @@ -900,6 +899,8 @@ cciss_sysfs_pathinfo (struct path * pp) static int common_sysfs_pathinfo (struct path * pp) { + dev_t devt; + if (!pp) return 1; @@ -907,10 +908,8 @@ common_sysfs_pathinfo (struct path * pp) condlog(4, "%s: udev not initialised", pp->dev); return 1; } - if (sysfs_get_dev(pp->udev, pp->dev_t, BLK_DEV_SIZE) <= 0) { - condlog(3, "%s: no 'dev' attribute in sysfs", pp->dev); - return 1; - } + devt = udev_device_get_devnum(pp->udev); + snprintf(pp->dev_t, BLK_DEV_SIZE, "%d:%d", major(devt), minor(devt)); condlog(3, "%s: dev_t = %s", pp->dev, pp->dev_t); diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h index f14fcee..7e5680e 100644 --- a/libmultipath/discovery.h +++ b/libmultipath/discovery.h @@ -30,7 +30,6 @@ struct config; -ssize_t sysfs_get_dev (struct udev_device *udev, char * buff, size_t len); int path_discovery (vector pathvec, struct config * conf, int flag); int do_tur (char *); diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index a1f2212..79f31b1 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -8,6 +8,7 @@ #include "debug.h" #include "structs.h" #include "structs_vec.h" +#include "sysfs.h" #include "waiter.h" #include "devmapper.h" #include "dmparser.h" @@ -501,7 +502,8 @@ verify_paths(struct multipath * mpp, struct vectors * vecs, vector rpvec) /* * see if path is in sysfs */ - if (sysfs_get_dev(pp->udev, pp->dev_t, BLK_DEV_SIZE) <= 0) { + if (sysfs_attr_get_value(pp->udev, "dev", + pp->dev_t, BLK_DEV_SIZE) < 0) { if (pp->state != PATH_DOWN) { condlog(1, "%s: removing valid path %s in state %d", mpp->alias, pp->dev, pp->state);