minix/lib
Thomas Veerman eea9343411 stat.h: replace big_ with native types
This patch will make mode_t 16-bits->32-bits, off_t 32-bits->64-bits,
ino_t 32-bits->64-bits, and nlink_t 16-bits->32-bits. As uid_t and
gid_t were already 32-bits we can drop the big_{mode,off,ino,uid,
gid,nlink}_t types from struct stat. This has huge consequences:
. lseek now has to accept a 64-bit argument and returns a 64-bit
  result. Therefore we need a new lseek and return proper results
  based on the used version (i.e., translate).
. some fcntl functions take and return a struct flock which holds 2
  off_t fields. Like lseek, we need to distinguish between old and
  new versions.
. getdents uses struct dirent which has among other fields an ino_t
  and off_t field. Consequently we need a new getdents system call
  and have to translate when we encounter an old call.
. truncate and ftruncate also take off_t arguments and therefore
  require a new version.

To add insult to injury VFS itself uses getdents. This has as
consequence that we have 2^3 combinations of version for getdents; old
and new version of libc (new system calls), new and old version of VFS
(when booting an old image), old and new version of an FS. We can
distinguish between these cases as follows; libc will use new system
call numbers that have not yet been in use. When using a new number,
VFS knows libc is new, otherwise it's an old libc. Vice versa, libc
first tries the new number and if that fails due to ENOSYS (unknown
system call number) it knows it's dealing with an old VFS. Finally,
since we now have VFS-FS protocol versioning and by bumping the version
to 1, VFS knows an FS is old when it reports version 0 and an FS knows
VFS is old when VFS reports it's using version 0.

0 = old version, 1 = new version
libc | VFS | FS | approach
----------------------------
  0   |  0  | 0  | Nothing to do
----------------------------
  0   |  0  | 1  | VFS reports protocol version 0, FS falls back
                 | to using the old getdents function
----------------------------
  0   |  1  | 0  | VFS reports protocol version 1, FS version 0.
                 | libc requires old getdents so there is nothing
                 | to do. VFS itself needs new getdents and will
                 | translate.
----------------------------
  0   |  1  | 1  | VFS reports protocol version 1, FS version 1.
                 | VFS intercepts getdents results and translates
                 | them on the fly before returning results to libc
----------------------------
  1   |  0  | 0  | libc first tries new system call number and
                 | then fall back to the old number. libc first
                 | translates the results to the new getdents before
                 | returning.
----------------------------
  1   |  0  | 1  | VFS reports protocol version 0, so FS uses fall
                 | back. libc translates.
----------------------------
  1   |  1  | 0  | VFS reports protocol version 1, FS version 0. VFS
                 | will intercept all results and translate on the
                 | fly.
----------------------------
  1   |  1  | 1  | Nothing to do.

As VFS can distinguish between old and new system calls of (f)truncate,
lseek, and fcntl, it will translate the arguments and results if
necessary. Likewise libc falls back to using the old calls and
translating the results to the new version if necessary.

Change-Id: Id5bc819e6ef90f317dbddb21020e0a65028225ce
2013-03-28 21:09:31 +00:00
..
csu libcsu: store argc and argv on the stack 2013-01-25 17:07:02 +00:00
libasyn No more intel/minix segments. 2012-07-15 22:30:15 +02:00
libaudiodriver libaudiodriver: properly deallocate memory 2012-08-24 09:17:27 +00:00
libbdev libbdev: resolve Coverity warnings 2012-07-30 12:10:12 +00:00
libblockdriver Rename "struct partition" to "struct part_geom" 2013-03-20 16:14:21 +00:00
libbz2 Upgrading bzip2 2012-11-21 18:32:06 +01:00
libc stat.h: replace big_ with native types 2013-03-28 21:09:31 +00:00
libchardriver libchardriver: resolve Coverity warnings 2012-07-30 12:10:13 +00:00
libcompat_minix Removing obsolete _MINIX_COMPAT define 2013-02-26 09:44:23 +00:00
libcrypt Updating lib/libcrypt 2013-01-14 11:36:27 +01:00
libcurses Removing useless __NBSD_LIBC define in libcurses 2013-01-17 10:03:58 +01:00
libddekit Removing obsolete _MINIX define 2013-02-26 09:44:20 +00:00
libdevman retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
libedit Fix command line history in ash 2013-02-01 11:41:47 +01:00
libelf Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00
libexec Removing obsolete _MINIX define 2013-02-26 09:44:20 +00:00
libfetch Removing obsolete _MINIX define 2013-02-26 09:44:20 +00:00
libgpio Let the build system manage compilation flags 2013-03-08 09:41:49 +01:00
libhgfs Create SFFS library out of HGFS 2012-04-09 18:08:26 +02:00
liblwip LIBLWIP - ARP fix 2013-03-25 16:51:25 +01:00
libm Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00
libminc ldivmod, uldivmod: fix qdivrem calls 2013-02-08 14:09:45 +01:00
libminixfs Spring cleanup 2013-03-06 09:56:08 +00:00
libminlib ARM updates 2013-01-17 10:03:58 +01:00
libmthread Let the build system manage compilation flags 2013-03-08 09:41:49 +01:00
libnetdriver retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
libnetsock LWIP - fixed makefiles 2013-03-25 16:51:25 +01:00
libpadconf Let the build system manage compilation flags 2013-03-08 09:41:49 +01:00
libprop Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00
libpuffs Define protocol version of {mode,ino,uid,gid}_t 2013-03-28 19:39:21 +00:00
librefuse Let the build system manage compilation flags 2013-03-08 09:41:49 +01:00
librmt Fix warnings trivial warnings. 2013-01-14 11:44:31 +01:00
libsffs Define protocol version of {mode,ino,uid,gid}_t 2013-03-28 19:39:21 +00:00
libsys Removing obsolete _MINIX define 2013-02-26 09:44:20 +00:00
libterminfo Re-adding extended keys in minix termcap entry 2013-01-23 21:28:17 +01:00
libtimers Replace NULL macro defs with null.h include 2010-07-22 10:03:31 +00:00
libusb retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
libutil Fixing cross build i386 on minix 2013-01-23 21:03:38 +01:00
libvassert No more intel/minix segments. 2012-07-15 22:30:15 +02:00
libvboxfs libvboxfs: fix setting file mtimes 2012-10-17 23:01:24 +02:00
libvirtio virtio: generic virtio library 2013-01-23 09:03:03 +00:00
libvtreefs stat.h: replace big_ with native types 2013-03-28 21:09:31 +00:00
libz Removing obsolete _MINIX define 2013-02-26 09:44:20 +00:00
Makefile lwip (inet's alternative) is compiled by default 2013-03-25 16:51:25 +01:00
Makefile.inc Removing obsolete _MINIX define 2013-02-26 09:44:20 +00:00