RFC: patch to make d_fileno 64bits

Konstantin Belousov kostikbel at gmail.com
Sat Nov 22 17:55:37 UTC 2014

On Sat, Nov 22, 2014 at 09:23:41AM -0800, Kirk McKusick wrote:
> > Date: Sat, 22 Nov 2014 17:34:27 +0200
> > From: Konstantin Belousov <kostikbel at gmail.com>
> > To: Rick Macklem <rmacklem at uoguelph.ca>
> > Subject: Re: RFC: patch to make d_fileno 64bits
> > Cc: FreeBSD Filesystems <freebsd-fs at freebsd.org>
> > 
> > On Fri, Nov 21, 2014 at 06:45:52PM -0500, Rick Macklem wrote:
> >> Kostik wrote:
> >> What about old binaries that do getdirentries(2) and expect the old
> >> structure with 32bit d_fileno or the linux compatibility stuff?
> >> I suspect that there are some old staticly linked binaries out there
> >> that does/expects the old getdirentries.
> > 
> > No, let me restate my position.  There are two places for backward
> > compatibility, one is in-kernel binary interface, and another is
> > applications ,i.e. KBI and ABI.
> > 
> > My opinion is that we must provide strict backward ABI compatibility
> > to have even right to be called useful OS.  In particular, the syscalls
> > like current getdirentries (156 and 196) providing 32-bit inonums, must
> > be kept with their current binary contract.  The userspace issues do
> > not end there, but this is not the currently discussed item.
> > 
> > On the other hand, providing KBI compat for filesystems which work
> > right now with 32bit inode numbers, should not be done. I.e., no
> > VOP_READDIR_32INO(), all filesystems must be converted once.
> > 
> > For syscalls 156 and 196 (and some more), the converter must be written
> > in the vfs_syscalls.c which translates the new dirents into old dirents,
> > at the level of best efforts.
> I believe that we are all in agreement with you on the kernel approach
> at this point.
Well, I think this was the Rick patch and proposal to have compat ino32
in kernel.

> Do we have a way of versioning libc so that we can have the old version
> that provides the 32-bit version of the syscalls (156 and 196) along
> with 32-bit higher-level functions like fts and friends and then a new
> libc version that has the 64-bit version of the syscalls and other
> higher-level functions?

We do not need several versions of libc. We support symbol versioning,
i.e. we can have old getdirents symbol which resolves to syscall stub
for 196, and new getdirents for new syscall.

It is somewhat convoluted feature, you could look at example in
sys/kern/sysv_*.c, for instance, freebsd7_shmctl and shmctl. Also
look at libc/include/compat.h.  For pure usermode compat shims,
lib/libc/gen/fts-compat.c was already handled one time.

I promise to write neccessary magic for libc versioning when needed.
As I explained before, unfortunately the libc is not the final point
for the userspace compat.

More information about the freebsd-fs mailing list