From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 8C0558E7E for ; Mon, 23 Nov 2015 07:04:12 +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 E34E3C0F1CE3; Mon, 23 Nov 2015 06:04:11 +0000 (UTC) Received: from sopuli.koti.laiskiainen.org (vpn1-4-70.ams2.redhat.com [10.36.4.70]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAN64AM6015004; Mon, 23 Nov 2015 01:04:11 -0500 To: David Marchand References: <923ebe527219fa16ca91e74b416b978803056d70.1447829123.git.pmatilai@redhat.com> From: Panu Matilainen Message-ID: <5652AC5A.4080005@redhat.com> Date: Mon, 23 Nov 2015 08:04:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Cc: "dev@dpdk.org" Subject: Re: [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: , X-List-Received-Date: Mon, 23 Nov 2015 06:04:12 -0000 On 11/20/2015 06:38 PM, David Marchand wrote: > Hello Panu, > > On Wed, Nov 18, 2015 at 7:45 AM, Panu Matilainen > wrote: > >> 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; >> } > > > > It looks like you would skip the symbolic links while you were not before. > Intended ? Intended. We want to accept symlinks in the driver directory, but the actual drivers are always regular files. Since stat() dereferences symbolic links it cannot return a file whose type would be S_IFLNK. - Panu -