From patchwork Thu Jun 25 14:12:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Schmidt X-Patchwork-Id: 6675381 X-Patchwork-Delegate: ira.weiny@intel.com Return-Path: X-Original-To: patchwork-linux-rdma@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 14035C05AD for ; Thu, 25 Jun 2015 14:12:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A14D206E6 for ; Thu, 25 Jun 2015 14:12:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBC2D206D4 for ; Thu, 25 Jun 2015 14:12:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751378AbbFYOMG (ORCPT ); Thu, 25 Jun 2015 10:12:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33038 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751337AbbFYOMF (ORCPT ); Thu, 25 Jun 2015 10:12:05 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id ABE1EB8BD4; Thu, 25 Jun 2015 14:12:05 +0000 (UTC) Received: from hp.brq.redhat.com (dhcp-26-164.brq.redhat.com [10.34.26.164]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5PEC2Eb022944; Thu, 25 Jun 2015 10:12:05 -0400 From: Michal Schmidt To: Ira Weiny Cc: linux-rdma@vger.kernel.org Subject: [infiniband-diags PATCH 1/2] rdma-ndd: never use udev_get_sys_path() Date: Thu, 25 Jun 2015 16:12:01 +0200 Message-Id: <1435241522-7721-2-git-send-email-mschmidt@redhat.com> In-Reply-To: <1435241522-7721-1-git-send-email-mschmidt@redhat.com> References: <1435241522-7721-1-git-send-email-mschmidt@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The function was deprecated and later dropped by udev entirely because it was pointless. Quoting kernel's Documentation/sysfs-rules.txt: sysfs is always at /sys Parsing /proc/mounts is a waste of time. Other mount points are a system configuration bug you should not try to solve. [...] Signed-off-by: Michal Schmidt --- configure.ac | 1 - src/rdma-ndd.c | 19 +++++-------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index b9b7ad84ee..ece1d530a7 100644 --- a/configure.ac +++ b/configure.ac @@ -214,7 +214,6 @@ if test x$rdmandd = xyes; then AC_CHECK_HEADER(libudev.h, with_udev="yes", with_udev="no") AC_CHECK_LIB(udev, udev_monitor_ref, [], AC_MSG_ERROR(libudev is required for rdma-ndd...)) AC_CONFIG_FILES([doc/man/rdma-ndd.8 etc/rdma-ndd.init]) - AC_CHECK_FUNCS_ONCE(udev_get_sys_path) fi dnl Generate doc/man/*.in files if possible diff --git a/src/rdma-ndd.c b/src/rdma-ndd.c index 194c2cd865..d40e7567db 100644 --- a/src/rdma-ndd.c +++ b/src/rdma-ndd.c @@ -58,9 +58,7 @@ struct udev_monitor *mon; #include "ibdiag_common.h" #define SYS_HOSTNAME "/proc/sys/kernel/hostname" -#define DEF_SYS_DIR "/sys" -char *sys_dir = DEF_SYS_DIR; -#define SYS_INFINIBAND "class/infiniband" +#define SYS_INFINIBAND "/sys/class/infiniband" #define DEFAULT_RETRY_RATE 60 #define DEFAULT_RETRY_COUNT 0 #define DEFAULT_ND_FORMAT "%h %d" @@ -122,8 +120,8 @@ static int update_node_desc(const char *device, const char *hostname, int force) char nd_file[PATH_MAX]; FILE *f; - snprintf(nd_file, sizeof(nd_file), "%s/%s/%s/node_desc", - sys_dir, SYS_INFINIBAND, device); + snprintf(nd_file, sizeof(nd_file), SYS_INFINIBAND "/%s/node_desc", + device); nd_file[sizeof(nd_file)-1] = '\0'; f = fopen(nd_file, "r+"); @@ -160,14 +158,10 @@ static int set_rdma_node_desc(const char *hostname, int force) { DIR *class_dir; struct dirent *dent; - char dev_dir[PATH_MAX]; - snprintf(dev_dir, sizeof(dev_dir), "%s/%s", sys_dir, SYS_INFINIBAND); - dev_dir[sizeof(dev_dir)-1] = '\0'; - - class_dir = opendir(dev_dir); + class_dir = opendir(SYS_INFINIBAND); if (!class_dir) { - syslog(LOG_INFO, "Failed to open %s", dev_dir); + syslog(LOG_INFO, "Failed to open " SYS_INFINIBAND); return -ENOSYS; } @@ -261,9 +255,6 @@ static void setup_udev(void) udev_set_log_fn(udev, udev_log_fn); udev_set_log_priority(udev, LOG_INFO); -#if HAVE_UDEV_GET_SYS_PATH - sys_dir = (char *)udev_get_sys_path(udev); -#endif } static int get_udev_fd(void)