minix/usr.bin
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
..
apropos update/fix manpage support 2011-09-28 15:24:15 +00:00
banner Importing NetBSD banner 2013-03-22 10:15:11 +01:00
bzip2 Upgrading bzip2 2012-11-21 18:32:06 +01:00
bzip2recover Upgrading bzip2 2012-11-21 18:32:06 +01:00
cal Importing usr.bin/cal 2013-03-18 11:27:44 +01:00
chpass Toolchain upgrade and portability improvements. 2012-11-15 16:07:29 +01:00
cksum Importing cksum (needed by NetBSD build system) 2012-10-23 12:02:51 +02:00
col Importing usr.bin/col 2013-03-05 16:44:54 +01:00
ctags Termcap update, replacing elvis by nvi. 2013-01-24 07:44:38 +01:00
du Import NetBSD du(1) 2012-03-05 22:32:33 +01:00
from Importing usr.bin/from 2013-03-23 16:11:11 +01:00
genassym genassym.sh update 2012-12-07 13:58:06 +01:00
getopt Importing usr.bin/getopt 2013-03-11 11:31:55 +01:00
gzip stat.h: replace big_ with native types 2013-03-28 21:09:31 +00:00
head Importing usr.bin/head 2013-03-23 14:37:39 +01:00
indent Toolchain upgrade and portability improvements. 2012-11-15 16:07:29 +01:00
infocmp Import infocmp from NetBSD 2013-01-25 20:11:01 +01:00
join Replacing join with NetBSD join 2012-12-07 13:58:07 +01:00
ldd Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00
login Toolchain upgrade and portability improvements. 2012-11-15 16:07:29 +01:00
lorder Importing lorder 2012-12-07 13:58:07 +01:00
m4 Updating usr.bin/m4 2013-01-14 11:36:26 +01:00
make make: correct a typo of NetBSD source 2013-01-25 18:44:17 +01:00
man update/fix manpage support 2011-09-28 15:24:15 +00:00
ministat worldstone benchmark script 2011-09-24 14:49:55 +00:00
mkdep mkdep: restore NetBSD behaviour 2013-01-25 18:42:58 +01:00
mktemp Import NetBSD mktemp 2012-06-18 10:54:48 +00:00
nbperf Importing nbperf 2012-12-07 13:58:07 +01:00
newgrp Toolchain upgrade and portability improvements. 2012-11-15 16:07:29 +01:00
nvi Termcap update, replacing elvis by nvi. 2013-01-24 07:44:38 +01:00
passwd Updating usr.bin/passwd 2013-01-14 11:36:27 +01:00
printf Upgrading printf 2013-02-01 11:41:47 +01:00
sed Cross compile on minix support 2012-11-15 16:07:30 +01:00
seq Toolchain upgrade and portability improvements. 2012-11-15 16:07:29 +01:00
sort sort: add -x hex sort feature back 2012-12-11 11:59:44 +01:00
stat Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00
su Toolchain upgrade and portability improvements. 2012-11-15 16:07:29 +01:00
tic Cross compile on minix support 2012-11-15 16:07:30 +01:00
top Fix warnings trivial warnings. 2013-01-14 11:44:31 +01:00
tput Fix file permissions in usr.bin/tput 2013-02-01 11:41:47 +01:00
tsort Importing NetBSD tsort 2012-12-07 13:58:07 +01:00
uniq Replace uniq with NetBSD version 2011-07-24 21:40:02 +02:00
whatis Importing usr.bin/whatis 2013-03-23 16:10:23 +01:00
who Importing usr.bin/who 2013-03-18 11:23:59 +01:00
xinstall Fix warnings trivial warnings. 2013-01-14 11:44:31 +01:00
yes Importing usr.bin/yes 2013-03-18 11:27:25 +01:00
Makefile Importing usr.bin/from 2013-03-23 16:11:11 +01:00
Makefile.inc Upgrading build system to new NetBSD revision 2012-11-15 16:07:29 +01:00