Commit Graph

261 Commits

Author SHA1 Message Date
pooka 21913eabe5 Rototill.
Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?).  Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it.  This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
2007-11-30 19:02:28 +00:00
pooka 6a3d9a187d Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces.  puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
2007-11-27 11:31:17 +00:00
dogcow 1e02f40f0f fallout from the not-quite-complete curlwp removal.
I'm not sure why I had to monkey about with the includes to get VFS_SYNC to
reappear.
2007-11-27 09:14:21 +00:00
pooka 61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
pooka 5251a48396 support cv_broadcast() 2007-11-19 14:17:22 +00:00
pooka 2632ba6df4 Implement cv_timedwait(), requested by Reinoud. 2007-11-17 20:50:18 +00:00
pooka 8f1126a23d Shield against returning EJUSTRETURN from relookup() 2007-11-14 15:01:46 +00:00
pooka f48aa71ad4 fix build (hi rmind!) 2007-11-11 17:18:47 +00:00
pooka 655af89222 Fix more uninitialized uses of variables.
noticed by lukasz.siemiradzki
2007-11-10 18:03:15 +00:00
pooka f94895de17 Cast void * to intptr_t before casting to int and vice versa.
Fixes 64bit compilation warnings.  reported by moof & wiz
2007-11-08 10:57:19 +00:00
pooka 7e0d71a369 Execute I/O in a separate thread for async I/O where previously
everything was written/read in caller context.

Also, make the "kernel" lock recursive.  It works better that way ...
2007-11-07 18:59:18 +00:00
pooka b1a1a009b6 final splash of ketchup after source update: init/fini mountspecific 2007-11-07 16:31:21 +00:00
pooka 6fd64d7496 implement _kernel_lock{,_unlock}() 2007-11-07 16:24:22 +00:00
pooka a4fdbff490 fix pool cache line alignment code (hi ad) 2007-11-07 16:22:22 +00:00
pooka 55a3e632c4 remove accidentally committed debugging code 2007-11-07 15:51:07 +00:00
pooka eabd71f058 Emulate spls by using pthread rwlocks: splfoo() takes a read lock
and when doing processing in an interrupt (effectively when calling
biodone()), we take the write lock.
2007-11-07 15:41:18 +00:00
pooka ae80a527f0 oops, backout part which wasn't supposed to go in 2007-11-07 12:11:30 +00:00
pooka 0a587be2cb Call buf_syncwait() after releasing a file system. 2007-11-07 12:08:45 +00:00
ad d18c6ca4de Merge from vmlocking:
- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
2007-11-07 00:23:13 +00:00
ad 4f48f4962d Define ipl_cookie_t, ipl_t. 2007-11-07 00:20:22 +00:00
pooka 773d31b14b yank out extra debug printf 2007-11-06 15:25:40 +00:00
pooka 210515ea9c Fix locking issues with the anonymous pager too so that tmpfs can work. 2007-11-06 12:57:50 +00:00
pooka 7331777bf0 default to rootnode mode 0777 2007-11-06 12:26:12 +00:00
pooka 78821d0076 initialize vnode interlock when creating one 2007-11-06 12:14:37 +00:00
pooka 895e09b8c5 Sprinkle some more locking, especially to the vm. Due to some
additional fixes, it's now possible to run file systems with
spinlocks actually enabled.  The genfs_putpages() locking is still
working only due to greater powers, but I'll eventually get around to
fixing it.
2007-11-06 11:35:04 +00:00
pooka ef11b00de6 Update to new puffs_mainloop() signature. Forgot to do this yesterday.
noticed by Kurt Schreiner on current-users
2007-11-06 10:57:35 +00:00
pooka 2525a332ae * sprinkle some locking into the vm code
* avoid extra insert+search+remove step in file systems using
  ubc_uiomove() instead of standard uiomove()
2007-11-04 19:52:14 +00:00
pooka 85efd8ec20 set mask and dirmask to 0777 by default 2007-11-04 19:42:56 +00:00
pooka 0be31eefc7 Allocate buf using getiobuf() instead of abusing the stack. 2007-11-04 19:37:29 +00:00
pooka 08ac8063af Fix some comments: thinking of it more closely, it is actually safe
to release the sleep interlock before calling cv_wait() because we
are protected by the list mutex which prevents a wakeup race.
2007-11-04 18:46:29 +00:00
pooka 18ae49a27c Make the strategy routine get the results through biowait() and
the "disk driver" (rumpuser) call biodone() to indicate the completion
of I/O.  Support for B_ASYNC is coming at some point, but I need
more locking support in the emulated vm for that.
2007-11-04 18:43:55 +00:00
pooka 2567179467 Remember to save errno before restoring it.
noticed by Lukasz on current-users
2007-11-04 17:21:08 +00:00
pooka 55ace5d0d5 Include bufq priority implementations also and link librump with
--whole-archive since the bufq priorities use link sets.
2007-10-31 17:53:38 +00:00
pooka 6cc957f067 "Support" splhigh(), requested by reinoud. But the spl emulation
code needs to be actually written soon ...
2007-10-31 16:00:26 +00:00
pooka 87f9ee4c42 Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads.  It also makes rump file system behaviour better match
file system behaviour in the kernel.
2007-10-31 15:57:19 +00:00
pooka cb11cd8fde In uvm_estimatepageable() "estimate" pageable. 2007-10-28 18:54:17 +00:00
pooka eff8fdc9d1 Prevent recursion in INACTIVE -> vrecycle -> inactive -> ... 2007-10-27 19:36:34 +00:00
pooka 87ffdd1649 RUMUSEROBJDIR -> RUMPUSEROBJDIR (those cold-blooded old times ...) 2007-10-26 18:03:26 +00:00
pooka 6640f4d32a It's non-trivial to say that "no, we don't have cpu counter on this
arch (rump)", so emulate it.  But this is suboptimal.  The crux of
the problem seems to be that types.h contains both information on
the machine architecture (which we want) as well as other defines
such as __HAVE_CPU_COUNTER (which we don't want).
2007-10-26 17:59:38 +00:00
pooka ff9a260335 few stubs 2007-10-26 17:56:24 +00:00
pooka bf494d7f8d more carefully emulate vget() and vrecycle() 2007-10-26 17:55:43 +00:00
pooka 90f8810031 In threading where available. 2007-10-26 17:36:23 +00:00
pooka 4f8627af5f define _RUMPKERNEL 2007-10-26 10:44:27 +00:00
pooka f608ef6f7b Don't unmount file system when releasing ukfs - it's always already
unmounted at that point (or never was mounted in the first place).
2007-10-25 16:56:41 +00:00
pooka 50591a9595 "flags * (M_CANFAIL | M_NOWAIT)" is probably not correct. Use & instead.
And while committing, add other random cruft I've needed recently.
2007-10-24 15:00:37 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
pooka b16ab0b2da Compile most genfs routines directly out of the kernel sources.
Move special I/O routines to genfs_io.c to mirror kernel naming.
2007-10-17 16:48:16 +00:00
ad 11dc639958 Merge from vmlocking:
- G/C spinlockmgr() and simple_lock debugging.
- Always include the kernel_lock functions, for LKMs.
- Slightly improved subr_lockdebug code.
- Keep sizeof(struct lock) the same if LOCKDEBUG.
2007-10-11 19:45:24 +00:00
ad 7dad9f7391 Merge from vmlocking:
- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
2007-10-10 20:42:20 +00:00
ad 067cf977c9 transferlockers() is gone. 2007-10-10 18:51:43 +00:00
hannken 3856acafe2 Update the file system copy-on-write handler.
- Instead of hooking the handler on the specdev of a mounted file system
  hook directly on the `struct mount'.

- Rename from `vn_cow_*' to `fscow_*' and move to `kern/vfs_trans.c'.  Use
  `mount_*specific' instead of clobbering `struct mount' or `struct specinfo'.

- Replace the hand-made reader/writer lock with a krwlock.

- Keep `vn_cow_*' functions and mark as obsolete.

- Welcome to NetBSD 4.99.32 - `struct specinfo' changed size.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
2007-10-07 13:38:53 +00:00
pooka eb069641c1 call biooops sync from sync 2007-09-26 21:23:24 +00:00
pooka 38cdad643b check puffs_init() return value to squelch coverity CID 4568 2007-09-26 21:21:28 +00:00
pooka 268bb1001b print 0x before hex, print proper types 2007-09-24 01:40:38 +00:00
pooka 84387d0fd3 Don't whine about wakeup() not being implemented every time it's
called.  Nobody cares unless ltsleep() is called (and it panics).
2007-09-24 01:34:27 +00:00
pooka 1d4d5500dc -DFFS_EI 2007-09-24 01:31:07 +00:00
pooka 310b3e7254 add rw_tryenter() and rw_lock_held(), inspired by Adam Hamsik 2007-09-22 11:26:42 +00:00
pooka b795ecbe79 fsync() device fd if doing a non-B_ASYNC write. This makes the
file system safe, but less performant as the kernel, as it syncs
*all* outstanding dirty buffers.  However, we don't have much choice
in userspace currently.
2007-09-20 23:43:44 +00:00
pooka c777421532 Expose namei. Some applications might want to call VOPs directly for
whatever reason and no need to make them implement their own copy of
namei, fun though it might be.
2007-09-18 19:59:21 +00:00
pooka 0ae64860f6 don't allocate variable-sized arrays from the stack 2007-09-12 10:24:23 +00:00
briggs 06c4139448 If !_HAVE_TIMECOUNTER, initialize 'time' instead of 'time_second.' 2007-09-11 16:33:19 +00:00
briggs bf243579ed Define splclock() so that this will at least compile on architectures
without _HAVE_TIMECOUNTER.
2007-09-11 16:31:01 +00:00
pooka dffee5c423 fix ukfs_readlink() to be of type ssize_t 2007-09-11 00:42:16 +00:00
pooka 850349a3c2 create generated files before running makedepend 2007-09-11 00:41:46 +00:00
pooka 99dbf2bb34 manadatory TODO-list.
Makes project appear less dead when there's something TODO.
2007-09-10 21:18:55 +00:00
pooka ccd777c8fa Provide errno from rumpuser_{gettimeofday,close}() to be consistent. 2007-09-10 19:11:44 +00:00
pooka cc370e5dc5 no need to include param.c twice in the source list 2007-09-10 16:11:43 +00:00
pooka 88f28c1eed honor LOCKLEAF in namei 2007-09-08 15:40:51 +00:00
pooka 2c096f9eae "proper" return value handling 2007-09-02 13:55:27 +00:00
pooka e61b08e4b2 fix assert 2007-09-02 13:54:21 +00:00
pooka a1c82d9717 * Give rump_vfs_root() the option of returning the vnode unlocked.
* initialize syncdelay
* implement io_sync handler
2007-09-02 13:29:50 +00:00
pooka 420d610664 include bsd.own.mk for NETBSDSRCDIR
this time noticed by mjf
2007-09-02 12:00:12 +00:00
pooka 3f3cac88a3 Make bioops a pointer and point it to the softdeps struct in softdep
init.  Decouples "options SOFTDEP" from the main kernel and ffs code.
2007-09-01 23:40:21 +00:00
pooka eb606989ed avoid uninitialized warning from impossible enum 2007-09-01 22:10:10 +00:00
pooka 292192fe0a * fill struct buf a little better
* hop, skip & jump to make uvm_pageratop work
2007-09-01 21:45:19 +00:00
pooka 34ab6399f3 * add a very crude version of uvm_pageatop()
* add biodone/aiodone
2007-09-01 21:40:58 +00:00
pooka ebf393b89f vinvalbuf in vrecycle 2007-09-01 21:39:46 +00:00
pooka 396d174477 allow to set ffs options with command-line -o
XXX: can't mix puffs and ffs options in one -o foo,bar
2007-08-27 23:15:26 +00:00
pooka 59a7b3704a define FFS 2007-08-26 23:53:24 +00:00
pooka dbce9b9f2c few panicky functions 2007-08-26 23:51:08 +00:00
pooka 9157302845 split implemented lock stuff out of lock_stub.c into lock.c 2007-08-26 23:49:42 +00:00
pooka c869e534dd very rudimentary recursive lock support 2007-08-26 23:46:47 +00:00
pooka 1cf445da3e Don't play rename & typecast games with kauth_cred_t, but rather
declare the type in rump.h only if necessary with the help of ifdef
magic.
2007-08-25 10:22:31 +00:00
pooka 8b0f2e2191 Support nfs exporting file systems. 2007-08-23 14:37:40 +00:00
pooka faafe7834a Implement credentials. Access control is now similar to if the file
system were run in the kernel.
2007-08-21 13:57:17 +00:00
pooka a86741016f add rump private parts I forgot to commit earlier today 2007-08-20 23:05:46 +00:00
pooka d6b288093a g/c bit about r/w && bsize < PAGE_SIZE, not a concern any more 2007-08-20 23:01:51 +00:00
pooka b49c4f6b0b g/c comment invalidated by previous 2007-08-20 22:59:17 +00:00
pooka 4224c1d885 * in getpages, make sure we always align our buffer size to the page size
* in putpages, make sure we don't try attempt to push data in a page
  after eof.  also, skip blocks which bmap can't locate (see comment
  in code).

the effect: file systems with fs_bsize < PAGE_SIZE now work r/w
2007-08-20 22:58:03 +00:00
pooka 3c2765f1a3 Hide NetBSD kernel headers completely from ukfs. This includes creating
accessors for:
  * struct mount & VFS ops
  * struct uio
  * struct vnode
  * struct vattr

and some namespace games for:
  * namei flags
  * VOPs
  * enum vtype

Also, split rump services into two categories: library private and public
(rump_private.h and rump.h, respectively).

As a result, it is now possible to compile and use the NetBSD kernel
file systems on Linux (and probably other systems too with very
little work), although the makefiles need a bit of work to make it
a pleasureable experience.
2007-08-20 15:58:13 +00:00
pooka 34980d5637 Namespace management: do not call VOP_FOO directly from ukfs or
p2k, but rather make the calls go through librump.  This avoids
having to include NetBSD kernel headers in userspace programs.
Stay tuned for some more mods of the same sort ...
2007-08-19 21:24:21 +00:00
pooka 29e91e1a8c * fix build if using obj dirs
* this shouldn't use rump directly
2007-08-19 20:06:58 +00:00
pooka 8e851258d0 * support symlink & readlink
* some reorg & bugfixage
2007-08-19 15:57:38 +00:00
pooka 8d4ab68505 always define __NetBSD__ 2007-08-19 14:47:24 +00:00
pooka 8657b11ebd jump through rename hoops (hi ad!) 2007-08-16 21:26:21 +00:00
pooka 73dcfa3099 missed a bit 2007-08-16 19:56:22 +00:00
pooka fb60c8abcc describe libukfs 2007-08-16 19:53:48 +00:00
pooka aecd6d8924 tweaks 2007-08-16 19:50:19 +00:00
pooka 6c71c22a44 Add "file system console", which is meant eventually to become a
"console" to a file system, i.e. a tool for mounting any file system
image supported by rump and executing various commands on it.
Currently it's just a linear set of calls to ukfs routines and
serves mainly as a simple test program and ukfs usage example.
2007-08-16 19:48:31 +00:00
pooka 71d88cd835 use UKFS_UIOINIT 2007-08-16 19:43:09 +00:00
pooka 55a47971a5 Actually using passed parameters instead of hardcoded ones makes
a macro work better ...
2007-08-16 19:42:50 +00:00
pooka b926b490ec Add routines for pure userspace file system operation
(i.e. no kernel involvement), namely:
* create, mknod, remove, mknod, rmdir, getdents, read, write, and link

Still obviously missing a few, but this is a start (I'm also searching
for the blessed orb of code quality, maybe someone has seen it?).
2007-08-16 19:37:18 +00:00
pooka 85a8716f91 locking fixes 2007-08-16 16:17:42 +00:00
pooka 56accd1ffe enable UFS_DIRHASH 2007-08-15 22:22:14 +00:00
pooka cfd4dc8f38 Wrap malloc() so that we catch the kernel arguments (namely M_ZERO)
properly.  It's fairly amusing that this wasn't noticed until now.
2007-08-15 22:13:15 +00:00
pooka ba8f4f0ea5 support VOP_LINK 2007-08-15 16:56:44 +00:00
pooka c360a79960 * split userspace file system access into two separate libraries:
+ libp2k: the interface between libpuffs and vfs/vop
  + libukfs: generic user kernel file system library, usable
	     independent of libp2k and/or puffs
* use file system name (MOUNT_XYZ) instead of vfsops pointer to
  mount file system
2007-08-14 15:56:15 +00:00
pooka b0ae85df19 interrupt headers necessary for vfs_bio 2007-08-14 14:06:12 +00:00
pooka ea312e5c20 udf support 2007-08-14 13:56:58 +00:00
pooka 243a4686b8 Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
2007-08-14 13:54:14 +00:00
pooka 790f3adcf7 compile in clock_subr.c 2007-08-14 13:24:34 +00:00
pooka f89f2dc0be Add some barely staggering code to get more disklabel support. 2007-08-14 13:24:07 +00:00
pooka 0322f263f2 nuke no longer used vm macros 2007-08-13 15:59:47 +00:00
pooka 5e1193986e opts necessary for vfs_vnops.c missed in previous commit 2007-08-13 13:57:21 +00:00
pooka 7ed98ea083 Add locking assertions to check that file systems comply with the
vnode locking protocol.
2007-08-13 13:52:45 +00:00
pooka 787d952790 Use supermarket variety vfs_vnops.c instead of homecooked routines
(that's actually a good thing here).
2007-08-13 13:51:39 +00:00
pooka e09047007b lock and unlock vnodes according to locking protocol 2007-08-13 12:20:55 +00:00
pooka 66cdfd6744 compile in libkern __assert.c, argument order differs from libc model 2007-08-13 10:52:15 +00:00
pooka 74e8607136 track lockmgr lock status. makes lfs work again 2007-08-12 13:34:11 +00:00
pooka 643e56125f * move rump_vopwrite_fault() into history - we now support the file
system faulting in pages if it does e.g. fragment reallocation
* get rid of rumpvm_findpage() and always use uvm_pagelookup()
* determine a vnode's cleanness by flagging it as being on the work
  list if we "take" a write fault and removing it from the worklist
  once pages are flushed.  There is no work list here, but at least
  there is symmetry with the kernel.
2007-08-11 17:52:12 +00:00
pooka c3bc94628d Play catchup with ufs/ffs changes: compile subr_specificdata.c
and emulate kmem_foo() to support the prior.
2007-08-09 20:57:22 +00:00
pooka 36c0b176cc Fix it a bit & wait for the dust to settle. Also, enable UBC by default.
ffs in userspace on top of puffs/p2k/rump is now stable enough to
host a make -j4 kernel build (well, at least my kernel build ...
but, yes, I am currently running that kernel on my desktop)
2007-08-09 13:53:36 +00:00
pooka c1649dbc9e * fix symlink
* actually call a couple of VOPs
2007-08-09 11:59:16 +00:00
pooka 0a371e70c2 deal with holes in getpages() 2007-08-09 11:18:13 +00:00
pooka 58b908ae12 Flush file's pages in inactive (they'll still be kept in the kernel
page page if it's enabled).  This very easily takes care of memory
management problems except for large files.
2007-08-09 09:54:36 +00:00
pooka 37698f56d6 Enable lfs in r/o mode, i.e. does not start lfs_clean-nerd and do
any real trickery.  Unfortunately this was the easy part; r/w
support is going to make ascending naked, blind, illiterate, without
food and as an atheist look trivial.
2007-08-09 09:19:30 +00:00
pooka cb6989bfcf fool some KASSERTs 2007-08-09 09:11:57 +00:00
pooka c36b0d0bc4 whoops, committed old signature of vrele2() 2007-08-09 09:06:44 +00:00
pooka 2c3d0e9d16 Add some stubs for lfs. 2007-08-09 08:56:44 +00:00
pooka dfeea3487b Don't need to use MNT_FORCE here (my original test image was a bit
b0rked), but do stuff MNT_RDONLY down the file system's throat.
2007-08-09 08:33:25 +00:00
pooka 39afc34cc7 * compile subr_time.c from kern/
* some pmap stubs
2007-08-09 07:42:07 +00:00
pooka 1f47971378 pass mntflags to puffs_mount() 2007-08-08 22:45:51 +00:00
pooka 24c0b6d0d0 Provide rump_getvninfo() and use that in libp2k_lookup() to avoid an
extra getattr for stuff the file system already cached in the vnode.
2007-08-08 14:09:07 +00:00
pooka 804db68101 Make genfs_islocked return always 1 instead of 0. But these should
really get tracked ...
2007-08-08 14:07:35 +00:00
pooka 427705465b Provide rumpmachine bswap.h, which makes bswapxx() call rumpuser
directly instead of relying on a symbol in rumpkern.  I would like
to make it call the libc symbol directly, but I don't currently know
how to make it do that MI.

Makes hfs work (on i386), as it avoids endless recursion in bswap64().
Thanks to dillo for the image!
2007-08-08 13:12:08 +00:00
pooka bbae7f4e94 Add hfs. Untested, as I couldn't find a hfs+ image for testing,
so one would be appreciated.  At least it works enough to tell me
this:

hfs: Plain HFS volumes not currently supported
2007-08-08 09:28:53 +00:00
pooka 7772c7295b * compile param.c
* move opts to a separate directory
2007-08-08 09:06:11 +00:00
pooka 258ed3740b microfrost strikes back 2007-08-08 07:53:54 +00:00
pooka 034104770f add microtime 2007-08-08 07:50:33 +00:00
pooka 22ca3a326a Compile kernel stuff with DIAGNOSTIC. 2007-08-07 21:33:13 +00:00
pooka 3ac2af6a15 support ext2fs 2007-08-07 21:26:35 +00:00
pooka 33e8054a43 refuse (not *that* refuse) to mount a r/w file system with
bs < PAGE_SIZE, it simply won't work yet.
2007-08-07 21:24:40 +00:00
pooka f815ddfdf3 flush pages in vflushbuf() 2007-08-07 21:23:19 +00:00
pooka d70a2a3a9d realpath() can also fail, take that into account 2007-08-07 20:40:53 +00:00
pooka 711e2ec866 always compile with -g for now 2007-08-07 20:39:54 +00:00
pooka 3c4d6d00f7 * adjust device block number based on if we're putting pages to a
fs block boudary or not
* round writes to DEV_BSIZE, just to be kosher
2007-08-07 19:43:56 +00:00
pooka 44eee227b6 remove the allocstorage param from makepage - not needed 2007-08-07 19:40:17 +00:00
pooka 7d41c1505d track dirty vm objects 2007-08-07 19:37:05 +00:00
pooka 34c0850533 When doing "ubc faults", truncate offsets to page boundary to get
the last page also if it's accessed from the middle of the page.
2007-08-07 19:14:51 +00:00
pooka 09afbbeda4 mutex_pwned - needed for kassert 2007-08-07 17:55:49 +00:00