Commit Graph

13 Commits

Author SHA1 Message Date
Thomas Veerman
3ff8349d7d VFS: use 64-bit file offsets in all requests
As the current File Servers don't yet support file sizes > 2^31-1
(except for ext2 with some work), the VFS-FS protocol negotioting
field now has a field that FSes can use to indicate they do support
64-bit off_t. When they do, VFS will accept 64-bit results. Otherwise
VFS will zero out the upper 32 bits.

The previous commit contained a hack to support truncate for dynamically
linked binaries. This commit removes it as it's no longer necessary.
Change-Id: I07189d410094b193cb7bbd3f2507537bb1e7f96c
2013-03-28 21:12:18 +00:00
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
Thomas Veerman
db8198d99d VFS: use S_IS* macros 2012-04-27 08:49:38 +00:00
Ben Gras
7336a67dfe retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
Thomas Veerman
80c4685324 VFS: replace VFS with AVFS 2012-02-13 16:53:21 +00:00
Arun Thomas
4c10a31440 Remove legacy MM, FS, and FS_PROC_NR macros 2010-06-08 13:58:01 +00:00
Tomas Hruby
6e25ad8b0a Use of all NIL_* defines converted to NULL 2010-05-10 13:26:00 +00:00
Thomas Veerman
f9317dc039 Scan all processes for that might be blocked on a lock 2010-04-28 11:54:22 +00:00
Ben Gras
35a108b911 panic() cleanup.
this change
   - makes panic() variadic, doing full printf() formatting -
     no more NO_NUM, and no more separate printf() statements
     needed to print extra info (or something in hex) before panicing
   - unifies panic() - same panic() name and usage for everyone -
     vm, kernel and rest have different names/syntax currently
     in order to implement their own luxuries, but no longer
   - throws out the 1st argument, to make source less noisy.
     the panic() in syslib retrieves the server name from the kernel
     so it should be clear enough who is panicing; e.g.
         panic("sigaction failed: %d", errno);
     looks like:
         at_wini(73130): panic: sigaction failed: 0
         syslib:panic.c: stacktrace: 0x74dc 0x2025 0x100a
   - throws out report() - printf() is more convenient and powerful
   - harmonizes/fixes the use of panic() - there were a few places
     that used printf-style formatting (didn't work) and newlines
     (messes up the formatting) in panic()
   - throws out a few per-server panic() functions
   - cleans up a tie-in of tty with panic()

merging printf() and panic() statements to be done incrementally.
2010-03-05 15:05:11 +00:00
Thomas Veerman
958b25be50 - Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
  the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
  functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
  the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
  - Several path lookup bugs in MFS.
  - A link can be too big for the path buffer.
  - A mountpoint can become inaccessible when the creation of a new inode
    fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
  suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
  unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
  named pipes. However, named pipes still reside on the (M)FS, as they are part
  of the file system on disk. To make this work VFS now has a concept of
  'mapped' inodes, which causes read, write, truncate and stat requests to be
  redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 20:27:14 +00:00
Tomas Hruby
8590ac260d Removed dependency of vfs on NR_TASKS macro
- all macros in consts.h that depend on NR_TASKS replaced by a FP_BLOCKED_ON_*

- fp_suspended removed and replaced by fp_blocked_on. Testing whether a process
  is supended is qeual to testing whether fp_blocked_on is FP_BLOCKED_ON_NONE or
  not

- fp_task is valid only if fp_blocked_on == FP_BLOCKED_ON_OTHER

- no need of special values that do not colide with valid and special endpoints
  since they are not used as endpoints anymore

- suspend only takes FP_BLOCKED_ON_* values not endpoints anymore

- suspend(task) replaced by wait_for(task) which sets fp_task so we remember who
  are we waiting for and suspend sets fp_blocked_on to FP_BLOCKED_ON_OTHER to
  signal that we are waiting for some other process

- some functions should take endpoint_t instead of int, fixed
2009-09-22 21:48:26 +00:00
Philip Homburg
bafc45a309 First cut at 64-bit file offsets in block devices for mkfs/fsck. 2006-11-27 14:21:43 +00:00
Ben Gras
fa0ba56bc9 Merge of VFS by Balasz Gerofi with Minix trunk. 2006-10-25 13:40:36 +00:00