From: Ralph Sennhauser <ralph.sennhauser@gmail.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs_io: fix building with musl
Date: Fri, 9 Sep 2016 19:07:51 +0200 [thread overview]
Message-ID: <20160909190751.40fb7e75@gmail.com> (raw)
In-Reply-To: <106faf8f-3b68-56b9-6188-af01601cc870@sandeen.net>
On Fri, 9 Sep 2016 08:59:16 -0500
Eric Sandeen <sandeen@sandeen.net> wrote:
> On 9/9/16 8:32 AM, Ralph Sennhauser wrote:
> > The fallback in case the libc doesn't have or doesn't advertise the
> > existence of d_reclen in struct dirent uses d_namlen. Musl neither
> > advertises d_reclen nor does it have a d_namlen member.
> >
> > Calculate the value for d_namlen from d_name in the fallback path.
> >
> > Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
> > ---
> >
> > With ustat.h issue resolved in 4.8.0-rc1 this is the only musl
> > related one left.
> >
> > An alternative could be some autoconf magic [1] or waiting for a
> > long time for musl to add _DIRENT_HAVE_D_RECLEN [2] and for it to
> > propagate to distributions.
> >
> > [1] http://oss.sgi.com/archives/xfs/2016-01/msg00388.html
> > [2] http://www.openwall.com/lists/musl/2016/01/15/9
>
> eh, this is fine by me. Even Linus has hated d_namlen for over
> a decade ;) http://lkml.iu.edu/hypermail/linux/kernel/9506/0033.html
>
> Last question, have you tested it beyond the build, i.e.
> with xfs_io -c "readdir -v" /some/dir ? Works here but it'd be nice
> to know that it's working properly on musl as well.
>
Kernel is 4.8-rc5, xfsprogs 4-8.0-rc1 plus fixups mentioned. An xfs
filesystem is mounted at /mnt/xfs.
# xfs_io -c "readdir -v" /mnt/xfs/test/
00000000: d_ino: 0x00000063 d_name: .
00000000: d_ino: 0x00000060 d_name: ..
00000000: d_ino: 0x00000064 d_name: file
read 847 bytes from offset 0
847.000000 bytes, 3 ops, 0.0000 sec (20 MiB/sec and 75000.0000 ops/sec)
> the d_reclen field doesn't exist in any xfstests output, so looks
> like its loss on some platforms won't affect any existing tests.
>
> If you can verify that you did a runtime test as well, that'd
> be great, but in any case:
>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
>
Thanks for the review
Ralph
> Thanks,
> -Eric
>
> > ---
> > io/readdir.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/io/readdir.c b/io/readdir.c
> > index 151b72e..2b56dc8 100644
> > --- a/io/readdir.c
> > +++ b/io/readdir.c
> > @@ -24,6 +24,10 @@
> > #include <sys/types.h>
> > #include <dirent.h>
> >
> > +#ifndef _DIRENT_HAVE_D_RECLEN
> > +#include <string.h>
> > +#endif
> > +
> > static struct cmdinfo readdir_cmd;
> >
> > const char *d_type_str(unsigned int type)
> > @@ -106,7 +110,7 @@ read_directory(
> > #ifdef _DIRENT_HAVE_D_RECLEN
> > *total += dirent->d_reclen;
> > #else
> > - *total += dirent->d_namlen + sizeof(*dirent);
> > + *total += strlen(dirent->d_name) + sizeof(*dirent);
> > #endif
> > count++;
> >
> >
next prev parent reply other threads:[~2016-09-09 17:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1473241376-10922-1-git-send-email-ralph.sennhauser@gmail.com>
2016-09-07 22:27 ` [BUG] xfsprogs-4.7.0: issues cross-compiling for musl Dave Chinner
2016-09-07 22:40 ` Eric Sandeen
2016-09-08 8:41 ` Ralph Sennhauser
2016-09-08 12:13 ` Eric Sandeen
2016-09-08 13:22 ` Ralph Sennhauser
2016-09-08 8:35 ` Ralph Sennhauser
2016-09-09 13:32 ` [PATCH] xfs_io: fix building with musl Ralph Sennhauser
2016-09-09 13:59 ` Eric Sandeen
2016-09-09 17:07 ` Ralph Sennhauser [this message]
2016-09-10 7:37 ` [RFC] libxfs: cross-compile fixes Ralph Sennhauser
2016-09-19 5:50 ` Dave Chinner
2016-09-19 7:32 ` Ralph Sennhauser
2017-01-15 20:32 ` Eric Sandeen
2017-01-16 13:45 ` Ralph Sennhauser
2017-01-16 14:42 ` Eric Sandeen
2017-01-16 14:50 ` Ralph Sennhauser
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=20160909190751.40fb7e75@gmail.com \
--to=ralph.sennhauser@gmail.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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.