Commit Graph

922 Commits

Author SHA1 Message Date
Lionel Sambuc
3e89221bf0 Replacing timer_t by netbsd's timer_t
* Renamed struct timer to struct minix_timer
 * Renamed timer_t to minix_timer_t
 * Ensured all the code uses the minix_timer_t typedef
 * Removed ifdef around _BSD_TIMER_T
 * Removed include/timers.h and merged it into include/minix/timers.h
 * Resolved prototype conflict by renaming kernel's (re)set_timer
   to (re)set_kernel_timer.

Change-Id: I56f0f30dfed96e1a0575d92492294cf9a06468a5
2013-09-28 00:10:59 +02:00
David van Moolenbroek
dd0813b30e Import NetBSD vndconfig(8)
The tool has been changed heavily to match our VND driver model.

NetBSD is in the process of renaming it from vnconfig(8) to
vndconfig(8). To keep things in sync, we have to play along.

Change-Id: Ie86df184f03ab00573ea76b43c9caa0412e8321d
2013-09-28 00:10:58 +02:00
David van Moolenbroek
ee7e478f18 Add VND driver, providing loopback devices
Change-Id: I40fa695e28c67477a75383e6f1550e451afcab41
2013-09-28 00:10:58 +02:00
David van Moolenbroek
f83da990c0 VFS: add dupfrom(2) call
This call copies a file descriptor from a remote process into the
calling process. The call is for the VND driver only, and in the
future, ACLs will prevent any other process from using this call.

Change-Id: Ib16fdd1f1a12cb38a70d7e441dad91bc86898f6d
2013-09-28 00:10:58 +02:00
David van Moolenbroek
0d38512be1 Enable devname(3)
There is no support for a device name database yet, so this call is
expected to be fairly slow.

Change-Id: I73aa5f267e2b6921b7d3bbdcc4beac463931132c
2013-09-28 00:10:57 +02:00
David van Moolenbroek
86899c9307 Straighten ioctl.h
- include all ioctl subheaders, properly listing all letters;
- change FBD's ioctl calls to use 'B' instead of 'F', in
  preparation of the VND driver.
Change-Id: Ia718979568cc057f47cf505a89238d5b3b6695d4
2013-09-28 00:10:57 +02:00
David van Moolenbroek
6f9af35e8b VM: readd support for forgetting cached FS blocks
Not all services involved in block I/O go through VM to access the
blocks they need.  As a result, the blocks in VM may become stale,
possibly causing corruption when the stale copy is restored by a
service that does go through VM later on.  This patch restores support
for forgetting cached blocks that belong to a particular device, and
makes the relevant file systems use this functionality 1) when
requested by VFS through REQ_FLUSH, and 2) upon unmount.

Change-Id: I0758c5ed8fe4b5ba81d432595d2113175776aff8
2013-09-28 00:10:57 +02:00
David van Moolenbroek
570c9c8436 Rewrite character driver protocol
As a side effect, remove the clone style, as the normal device style
supports device cloning now.

Change-Id: Ie82d1ef0385514a04a8faa139129a617895780b5
2013-09-28 00:10:56 +02:00
David van Moolenbroek
3835235193 Remove support for reopening character devices
Previously, VFS would reopen a character device after a driver crash
if the associated file descriptor was opened with the O_REOPEN flag.
This patch removes support for this feature. The code was complex,
full of uncovered corner cases, and hard to test. Moreover, it did not
actually hide the crash from user applications: they would get an
error code to indicate that something went wrong, and have to decide
based on the nature of the underlying device how to continue.

- remove support for O_REOPEN, and make playwave(1) reopen its device;
- remove support for the DEV_REOPEN protocol message;
- remove all code in VFS related to reopening character devices;
- no longer change VFS filp reference count and FD bitmap upon filp
  invalidation; instead, make get_filp* fail all calls on invalidated
  FDs except when obtained with the locktype VNODE_OPCL which is used
  by close_fd only;
- remove the VFS fproc file descriptor bitmap entirely, returning to
  the situation that a FD is in use if its slot points to a filp; use
  FILP_CLOSED as single means of marking a filp as invalidated.

Change-Id: I34f6bc69a036b3a8fc667c1f80435ff3af56558f
2013-09-28 00:10:56 +02:00
David van Moolenbroek
106aa54545 Make PFS backcalls regular VFS calls
- prefix them with VFS_ as they are going to VFS;
- give these calls normal call numbers;
- give them their own set of message field aliases;
- also make do_mapdriver a regular call.

Change-Id: I2140439f288b06d699a1f65438bd8306509b259e
2013-09-28 00:10:56 +02:00
David van Moolenbroek
748aa2ffeb TTY: use libchardriver; clean up
- writing to a PTY master side blocks if there is not already a
  blocked reader on the slave side, and select now reflects this;
- internally, TTY now uses a test based on "caller != NONE" rather
  than "grant != GRANT_INVALID" to identify whether a call is
  currently ongoing;
- "offset" fields have been removed as they equal the corresponding
  "cum" fields;
- improved variable typing and function naming here and there;
- various other small fixes.

Change-Id: I6b51452888942e864b4e034e8c8490576184a23e
2013-09-28 00:10:55 +02:00
David van Moolenbroek
9cb14b4a32 libnetsock: use libchardriver
Change-Id: Ia5b780cad0b0c636db9bd866c7223da0d38ef6ea
2013-09-28 00:10:55 +02:00
David van Moolenbroek
9030f602d9 LWIP: move chardev message parsing into libnetsock
Change-Id: Ie23fd003c9fa35811548f388c8e9b55e8d9de8d7
2013-09-28 00:10:54 +02:00
David van Moolenbroek
7e6fb473b5 libaudiodriver: use libchardriver
Change-Id: I299d58d110ad14b69076276ba46c4325875c34ca
2013-09-28 00:10:54 +02:00
David van Moolenbroek
c9152e5207 libchardriver: full API rewrite
The new API now covers the entire character driver protocol, while
hiding all the message details. It should therefore be used by all
new character drivers. All existing drivers that already made use of
libchardriver have been changed to use the new API.

As one of the most important API changes, support for scatter and
gather transfers has been removed, as several key drivers already
did not support this, and it could be supported at the safecopy
level instead (for a future readv/writev).

Additional changes include:

- respond to block device open requests to avoid hanging VFS threads;
- add support for sef_cancel.

Change-Id: I1bab6c1cb66916c71b87aeb1db54a9bdf171fe6b
2013-09-28 00:10:53 +02:00
David van Moolenbroek
fd5b12ab74 Block drivers: make IOCTL request unsigned long
The block driver protocol and libblockdriver's bdr_ioctl hook are
changed, as well as the users of this hook. Other parts of the system
are expected to change accordingly eventually, since the ioctl(2)
prototype has been aligned with NetBSD's.

Change-Id: Ide46245b22cfa89ed267a38088fb0ab7696eba92
2013-09-28 00:10:53 +02:00
David van Moolenbroek
9999124fe3 Block protocol: add user endpoint to IOCTL request
I/O control requests now come with the endpoint of the user process
that initiated the ioctl(2) call. It is stored in a new BDEV_USER
field, which is an alias for BDEV_FLAGS. The contents of this field
are to be used only in highly specific situations. It should be
preserved (not replaced!) by services that forward IOCTL requests,
and may be set to NONE for service-initiated IOCTL requests.

Change-Id: I68a01b9ce43eca00e61b985a9cf87f55ba683de4
2013-09-28 00:10:53 +02:00
David van Moolenbroek
ed01b5f8e2 Block protocol: use own [RW]_BIT definitions
The original R_BIT and W_BIT definitions have nothing to do with the
way these bits are used. Their distinct usage is more apparent when
they have different names.

Change-Id: Ia984457f900078b2e3502ceed565fead4e5bb965
2013-09-28 00:10:52 +02:00
David van Moolenbroek
701a6c359a libblockdriver: expose BLOCKDRIVER_MAX_DEVICES
This constant determines the range of valid device_id_t values that
a block driver can return from the bdr_device hook: a value between
0 and (BLOCKDRIVER_MAX_DEVICES - 1) inclusive.

Change-Id: I80fac469e88ac13d4b869007e6f2c2f7569da433
2013-09-28 00:10:52 +02:00
David van Moolenbroek
06d589c2fa libblockdriver: various updates
- internal structure rearrangement;
- respond to char device open requests to avoid hanging VFS threads;
- make drivers use designated initializers;
- use devminor_t for all minor device numbers;
- change bdr_other hook to take ipc_status and return nothing;
- fix default geometry computation;
- add support for sef_cancel.

Change-Id: Ia063a136a3ddb2b78de36180feda870605753d70
2013-09-28 00:10:52 +02:00
David van Moolenbroek
e8dbca661b Move SUB_PER_DRIVE definition into minix/drvlib.h 2013-09-28 00:10:51 +02:00
David van Moolenbroek
1cea00a2fe I2C: change BUSC_I2C_xxx to use own protocol
Previously it would use bits of the character driver protocol, which
will change heavily.  In the new situation, the BUSC_I2C_xxx requests
use a protocol more in line with the PCI protocol, with the reply code
in m_type.

Change-Id: I51597b3f191078c8178ce17372de123031f7a4c4
2013-09-28 00:10:51 +02:00
David van Moolenbroek
ecf94d5705 Retire ptrace(T_DUMPCORE), dumpcore(1), gcore(1)
The T_DUMPCORE implementation was not only broken - it would currently
produce a coredump of the tracer process rather than the traced
process - but also deeply flawed, and fixing it would require serious
alteration of PM's internal state machine. It should be possible to
implement the same functionality in userland, and that is now the
suggested way forward. For now, also remove the (identical) utilities
using T_DUMPCORE: dumpcore(1) and gcore(1).

Change-Id: I1d51be19c739362b8a5833de949b76382a1edbcc
2013-09-28 00:10:49 +02:00
David van Moolenbroek
ee15ec95e3 VFS: remove FP_BLOCKED_ON_DOPEN
These days, DEV_OPEN calls to character drivers block the calling
thread until completion or failure, and thus never return SUSPEND to
the caller. The same already applied to BDEV_OPEN calls to block
drivers. It has thus become impossible for a process to enter a state
of being blocked on a device open call.

There is currently no support for restarting device open calls to
restarted character drivers. This support was present in the _DOPEN
logic, but was already no longer triggering. In the future, this case
should be handled by the thread performing the open request.

Change-Id: I6cc1e7b4c9ed116c6ce160b315e6e060124dce00
2013-09-28 00:10:48 +02:00
David van Moolenbroek
9e2b5c667b Retire the synchronous character driver protocol
- change all sync char drivers into async drivers;
- retire support for the sync protocol in libchardev;
- remove async dev style, as this is now the default;
- remove dev_status from VFS;
- clean up now-unused protocol messages.

Change-Id: I6aacff712292f6b29f2ccd51bc1e7d7003723e87
2013-09-28 00:10:48 +02:00
Lionel Sambuc
77db0c5766 Removing CSU patches
* Removed startup code patches in lib/csu regarding kernel to userland
   ABI.

 * Aligned stack layout on NetBSD stack layout.

 * Generate valid stack pointers instead of offsets by taking into account
   _minix_kerninfo->kinfo->user_sp.

 * Refactored stack generation, by moving part of execve in two
   functions {minix_stack_params(), minix_stack_fill()} and using them
   in execve(), rs and vm.

 * Changed load offset of rtld (ld.so) to:
      execi.args.stack_high - execi.args.stack_size - 0xa00000
   which is 10MB below the main executable stack.

Change-Id: I839daf3de43321cded44105634102d419cb36cec
2013-09-28 00:10:47 +02:00
David van Moolenbroek
eb836677a8 Set M3_STRING to M3_LONG_STRING (ABI break)
Change-Id: Id48bbd4ba3000acf8a891445b4c890b1b42bd72f
2013-09-28 00:10:47 +02:00
David van Moolenbroek
390c4df3cd Remove support for obsolete 3.2.1 ABI
Change-Id: I76b4960bda41f55d9c42f8c99c5beae3424ca851
2013-09-28 00:10:47 +02:00
David van Moolenbroek
cb32cbb218 VFS/FS: replace protocol version with flag field
The main motivation for this change is that only Loris supports
multithreading, and Loris supports dynamic thread allocation, so the
number of supported threads can be implemented as a bit flag (i.e.,
either 1 or "at least as many as VFS has"). The ABI break obviates the
need to support file system versioning at this time, and several
other aspects are better implemented as flags as well. Other changes:

- replace peek/bpeek test upon mount with FS flag as well;
- mark libsffs as 64-bit file size capable;
- remove old (3.2.1) getdents support.

Change-Id: I313eace9c50ed816656c31cd47d969033d952a03
2013-09-28 00:10:46 +02:00
David van Moolenbroek
ab703fdfdf Implement support for [f]statvfs1(2)
The [f]statvfs(3) calls now use [f]statvfs1(2).

Change-Id: I949c177fc14abf976e45165c342f897f4ec988ee
2013-09-28 00:09:54 +02:00
David van Moolenbroek
cdcbf659a1 Implement support for getvfsstat(2)
Change-Id: I99b697919d411c57105de561105beefc7d1d309a
2013-09-28 00:09:43 +02:00
David van Moolenbroek
098ec7e415 Redo mount(2)/umount(2) ABI
- pass in file system type through mount(2), and return this type in
  statvfs structures as generated by [f]statvfs(2);
- align mount flags field with NetBSD's, splitting out service flags
  which are not to be passed to VFS;
- remove limitation of mount ABI to 16-byte labels, so that labels
  can be made larger in the future;
- introduce new m11 message union type for mount(2) as side effect.

Change-Id: I88b7710e297e00a5e4582ada5243d3d5c2801fd9
2013-09-28 00:09:33 +02:00
David van Moolenbroek
92f858105b VFS/FS: remove fstatfs(2) and REQ_FSTATFS
The fstatfs(3) call now uses fstatvfs(2).

Change-Id: I3fa5d31f078457b4d80418c23060bb2c148cb460
2013-09-28 00:06:01 +02:00
Lionel Sambuc
6112cea1e2 almost aligned ioctl prototype
Change-Id: I7f3eaa99d2a9767f71e8387cea5c7f56dcb28f99
2013-09-28 00:03:44 +02:00
Lionel Sambuc
2cf2960340 ABI Break: aligning struct termios
Change-Id: I0109188fffbb166a5036e324a4a75b2491c39fb3
2013-09-28 00:03:43 +02:00
Lionel Sambuc
29d530957e 32 to 64 bits fsblkcnt_t and fsfilcnt_t.
Change-Id: I432229143c85cd178262b802a76ac606801ac59a
2013-09-28 00:03:43 +02:00
Lionel Sambuc
730d1ea6d6 moving prototypes to lib.h
Change-Id: If53d3f5ee761b10e0f3d4346a0c5b39ba7901c65
2013-09-28 00:03:43 +02:00
Lionel Sambuc
43490dfc1d struct uucred
Change-Id: Ia97cb6c38bb566be30d568a252ae7b76142a21dd
2013-09-28 00:03:43 +02:00
Lionel Sambuc
54065af023 Alignement on netbsd types, part 1
The following types are modified (old -> new):
 * _BSD_USECONDS_T_ int       -> unsigned int
 * __socklen_t      __int32_t -> __uint32_t
 * blksize_t        uint32_t  -> int32_t
 * rlim_t           uint32_t  -> uint64_t
On ARM:
 * _BSD_CLOCK_T_    int       -> unsigned int
On Intel:
 * _BSD_CLOCK_T_    int       -> unsigned long

bin/cat is also updated in order to fix warnings.

_BSD_TIMER_T_ has still to be aligned.

Change-Id: I2b4fda024125a19901120546c4e22e443ba5e9d7
2013-09-28 00:03:42 +02:00
Lionel Sambuc
0d76bdef63 Bumping version to 3.3.0
Change-Id: I4c88bdd449daf6ad3fe4e93ee8fc35d4f38becc4
2013-09-28 00:03:25 +02:00
Thomas Veerman
1fb2d93acc VFS: use 64-bit file offsets in all requests
Change-Id: I735c4068135474aff2c397f4bc9fb147a618b453
2013-09-28 00:03:14 +02:00
Thomas Veerman
72b91ca301 stat.h: remove some big_ types
Change-Id: I84017db3d54edfb823cc52e02d0b07fccb003988
2013-09-28 00:02:52 +02:00
Thomas Veerman
62b10087fc Define protocol version of {mode,ino,uid,gid}_t
Change-Id: Ia2027749f2ce55a561d19eb895a5618505e9a2ac
2013-09-28 00:02:32 +02:00
Thomas Veerman
334c19a7f8 VFS-FS protocol: add versioning
Change-Id: Ice6fbfd4b535b7435653fa08b27a3378d1cfdbf8
2013-09-28 00:02:15 +02:00
Kees Jongenburger
0d02dc9d54 arm:make the MMU fetch pagetable data through the caches.
Change-Id: Ibd7b66558c369d0c0792c02801562580d255fa1f
2013-09-26 11:54:36 +02:00
Kees Jongenburger
c4ffaa0afb arm:caching define a new caching combination and use that.
This combo was taken from the startware examples.

Change-Id: I9ef8d4f4706124a6aaec72f5da65b5301c5c2301
2013-09-26 11:54:36 +02:00
Kees Jongenburger
0f23130180 arm:caching introduce _CACHED defines
Introduce ARM_VM_SECTION_CACHED and ARM_VM_PTE_CACHED to ensure we
are using the correct caching flags everywhere.
2013-09-26 11:54:36 +02:00
Kees Jongenburger
b08490a35b arm:document arm vm.h 2013-09-26 11:45:43 +02:00
Kees Jongenburger
a17691a98f arm:define the physical memory range for the omap.
Change-Id: I256dbeb58fec5b95b48d521054810fe478fce67f
2013-09-26 11:45:43 +02:00
Ben Gras
a9db0ea184 x86 hd image creator
A script that creates a HD image ready to be booted by an x86
emulator, ready to work in a crossbuild environment.

It's really just for qemu/kvm as there's no boot code in
the MBR and no bootloader installed so we rely on the in-kvm
multiboot implementation for now. This is very convenient for
passing args too.

To minimize reliance on external tools, we use the Minix
'partition' utility to write the partition table of the HD
image, which therefore has to be compiled natively.

	. new script releasetools/x86_hdimage.sh
	. natively compile minix 'partition' utility
	. make <machine/partition.h> 64-bit safe for it

Change-Id: If645b4691536752271e0b8a8ed59a34f248dace4
2013-09-25 19:30:22 +02:00