From: Jamie Lokier <jamie@shareable.org>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
Jakub Jelinek <jakub@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Add getdents32t syscall
Date: Sat, 28 Feb 2004 23:21:36 +0000 [thread overview]
Message-ID: <20040228232136.GA1048@mail.shareable.org> (raw)
In-Reply-To: <403E9E4D.6090301@redhat.com>
Ulrich Drepper wrote:
> > In other words, why doesn't glibc ever just make a new major number and
> > make its "struct dirent" be the 64-bit version?
>
> You can't be serious. Can you even imagine the pain this would cause?
Why wouldn't this work?
Change the 32-bit struct dirent to this:
struct direct
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
__ino_t d_ino;
__u32 __padding1;
__off_t d_off;
__u32 __padding2;
#elif __BYTE_ORDER == __BIG_ENDIAN
__u32 __padding1;
__ino_t d_ino;
__u32 __padding2;
__off_t d_off;
#else
#error Help!
#endif
unsigned short int d_reclen;
unsigned char d_type;
char d_name[256];
};
And also change getdirentries() and readdir() to call the kernel's getdents64.
Use symbol versioning, so that old binaries will link to the old
(compatible and slower) functions, and newly compiled code, using the
new definition of struct dirent, uses the fast new versions of those
functions?
I presume that, if ELF symbol versioning doesn't allow you to do this,
then the same trick you do with stat() can be used. From Glibc's
<sys/stat.h>:
/* To allow the `struct stat' structure and the file type `mode_t'
bits to vary without changing shared library major version number,
the `stat' family of functions and `mknod' are in fact inline
wrappers around calls to `xstat', `fxstat', `lxstat', and `xmknod',
which all take a leading version-number argument designating the
data structure and bits used.
-- Jamie
next prev parent reply other threads:[~2004-02-28 23:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-26 19:38 [PATCH] Add getdents32t syscall Jakub Jelinek
2004-02-26 22:03 ` Randy.Dunlap
2004-02-26 22:15 ` Linus Torvalds
2004-02-26 22:25 ` Linus Torvalds
2004-02-26 22:29 ` Ulrich Drepper
2004-02-26 23:00 ` Linus Torvalds
2004-02-26 22:32 ` Jakub Jelinek
2004-02-26 23:15 ` Linus Torvalds
2004-02-27 1:33 ` Ulrich Drepper
2004-02-27 6:16 ` Linus Torvalds
2004-02-27 7:05 ` Ulrich Drepper
2004-02-28 23:21 ` Jamie Lokier [this message]
2004-02-27 1:46 ` Andreas Dilger
2004-02-27 3:36 ` Theodore Ts'o
2004-02-29 0:25 ` Jamie Lokier
2004-02-27 19:28 ` Linus Torvalds
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=20040228232136.GA1048@mail.shareable.org \
--to=jamie@shareable.org \
--cc=drepper@redhat.com \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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.