From: "Michael Kerrisk" <mtk.manpages@googlemail.com>
To: "Adrian Bunk" <bunk@stusta.de>
Cc: "Daniel Gollub" <dgollub@suse.de>,
viro@zeniv.linux.org.uk, ltp-list@lists.sourceforge.net,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
"Petr Gajdos" <pgajdos@suse.cz>
Subject: Re: ltp getdents syscalls testcases and 2.6.27-rcX
Date: Thu, 2 Oct 2008 13:37:04 +0200 [thread overview]
Message-ID: <cfd18e0f0810020437o6562ea70pfa96a171b97d530a@mail.gmail.com> (raw)
In-Reply-To: <20080924155015.GA27090@cs181140183.pp.htv.fi>
On Wed, Sep 24, 2008 at 5:50 PM, Adrian Bunk <bunk@stusta.de> wrote:
> [ kernel people added to Cc ]
>
> On Tue, Sep 16, 2008 at 02:27:36PM +0200, Daniel Gollub wrote:
>> Hi,
>>
>> with 2.6.27-rc1(?) linux/dirent.h got removed Kbuild headers_install targe and
>> dirent struct got removed:
>>
>>
>> commit cf6ae8b50e0ee3f764392dadd1970e3f03c40773
>> Author: Adrian Bunk <bunk@kernel.org>
>> Date: Fri Jul 25 01:46:46 2008 -0700
>>
>> remove the in-kernel struct dirent{,64}
>>
>> The kernel struct dirent{,64} were different from the ones in
>> userspace.
>>
>> Even worse, we exported the kernel ones to userspace.
>>
>> But after the fat usages are fixed we can remove the conflicting
>> kernel versions.
>>
>>
>> This broke the build of some LTP syscalls testcases for "getdents", since the
>> <linux/dirent.h> include is missing and the "internal" dirent struct get/got
>> used in:
>>
>> testcases/kernel/syscalls/getdents/getdents01.c
>> testcases/kernel/syscalls/getdents/getdents03.c
>> testcases/kernel/syscalls/getdents/getdents02.c
>> testcases/kernel/syscalls/getdents/getdents04.c
>>
>> http://ltp.cvs.sourceforge.net/ltp/ltp/testcases/kernel/syscalls/getdents/
>>
>> Is it safe to use the userspace dirent struct from <dirent.h> to fix the build
>> of this? Or what should be used for testing the getdents interface instead?
>
> Thanks for your report.
>
> I missed this since the kernel sys_getdents() did not use the
> "struct dirent" from the header but an own "struct linux_dirent".
>
> It might be safe since the LTP tests don't seem to care whether
> getdents() returns nonsense.
>
> But it is not correct since the reason why I removed this struct from
> the userspace headers was that the kernel and libc structs are
> *different*.
>
> E.g. when I enable the commented out code in getdents01.c I get the
> expected result that using <dirent.h> instead of <linux/dirent.h>
> changes a PASS into a FAIL. [1]
>
> IMHO the solution is something like:
> - move "struct linux_dirent" from fs/readdir.c to include/linux/dirent.h
> - re-export linux/dirent.h to userspace
> - change getdents(2) to consistently use "struct linux_dirent"
>
> Questions to fsdevel:
> - Do we need to preserve API compatibility with compatibility #define's
> for struct dirent{,64} here?
> - LTP does malloc(sizeof(struct dirent)).
> Is this considered a valid API usage that must continue to work?
>
>> best regards,
>> Daniel
I've made some changes to the readdir(2) and getdents(2) man pages to
make it clearer that the "dirent" structures used by these to syscalls
are different from one another (old_linux_dirent vs linux_dirent), and
also different from that used by glibc's readdir(3). (dirent) The
changes are already pushed out to man-pages git.
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html
prev parent reply other threads:[~2008-10-02 11:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200809161427.36373.dgollub@suse.de>
2008-09-24 15:50 ` Adrian Bunk
2008-10-02 11:37 ` Michael Kerrisk [this message]
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=cfd18e0f0810020437o6562ea70pfa96a171b97d530a@mail.gmail.com \
--to=mtk.manpages@googlemail.com \
--cc=bunk@stusta.de \
--cc=dgollub@suse.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ltp-list@lists.sourceforge.net \
--cc=mtk.manpages@gmail.com \
--cc=pgajdos@suse.cz \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®