From patchwork Wed Nov 18 06:45:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Panu Matilainen X-Patchwork-Id: 8967 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 516C55A71; Wed, 18 Nov 2015 07:45:33 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id ABADD5A6C for ; Wed, 18 Nov 2015 07:45:32 +0100 (CET) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id ED0A98EFEB for ; Wed, 18 Nov 2015 06:45:31 +0000 (UTC) Received: from sopuli.koti.laiskiainen.org.com (vpn1-7-206.ams2.redhat.com [10.36.7.206]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAI6jUce001626 for ; Wed, 18 Nov 2015 01:45:31 -0500 From: Panu Matilainen To: dev@dpdk.org Date: Wed, 18 Nov 2015 08:45:23 +0200 Message-Id: <923ebe527219fa16ca91e74b416b978803056d70.1447829123.git.pmatilai@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Subject: [dpdk-dev] [PATCH] eal: fix plugindir processing to be filesystem agnostic X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Not all filesystems supply struct dirent d_type field, in which case everything in the specified directory would go ignored. One such filesystem being XFS which RHEL 7 defaults to... stat() the entries instead. Fixes: 9f8eb1d9ca0f ("eal: support driver loading from directory") Signed-off-by: Panu Matilainen --- lib/librte_eal/common/eal_common_options.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index bed7385..e51fa12 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -191,12 +191,14 @@ eal_plugindir_init(const char *path) } while ((dent = readdir(d)) != NULL) { - if (dent->d_type != DT_REG && dent->d_type != DT_LNK) - continue; + struct stat sb; snprintf(sopath, PATH_MAX-1, "%s/%s", path, dent->d_name); sopath[PATH_MAX-1] = 0; + if (!(stat(sopath, &sb) == 0 && S_ISREG(sb.st_mode))) + continue; + if (eal_plugin_add(sopath) == -1) break; }