From: Panu Matilainen <pmatilai@redhat.com>
To: David Marchand <david.marchand@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH] eal: fix plugindir processing to be filesystem agnostic
Date: Mon, 23 Nov 2015 08:04:10 +0200 [thread overview]
Message-ID: <5652AC5A.4080005@redhat.com> (raw)
In-Reply-To: <CALwxeUt5-hD+Y0KWVhBJNY0nWq-ZRVx_F06gaaAphxsW_+1LBg@mail.gmail.com>
On 11/20/2015 06:38 PM, David Marchand wrote:
> Hello Panu,
>
> On Wed, Nov 18, 2015 at 7:45 AM, Panu Matilainen <pmatilai@redhat.com>
> 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 <pmatilai@redhat.com>
>> ---
>> 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 -
next prev parent reply other threads:[~2015-11-23 6:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-18 6:45 [PATCH] eal: fix plugindir processing to be filesystem agnostic Panu Matilainen
2015-11-20 16:38 ` David Marchand
2015-11-23 6:04 ` Panu Matilainen [this message]
2015-11-23 10:41 ` Thomas Monjalon
2015-11-23 11:42 ` Panu Matilainen
2015-11-23 13:54 ` Thomas Monjalon
2015-11-23 15:39 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5652AC5A.4080005@redhat.com \
--to=pmatilai@redhat.com \
--cc=david.marchand@6wind.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.