Commit Graph

1757 Commits

Author SHA1 Message Date
Poul-Henning Kamp
c049546e16 Also remember to set the fsid here. 2005-03-17 15:15:29 +00:00
Poul-Henning Kamp
e3b803b148 Forgot to replace code to set fsid in vop_getattr. 2005-03-17 14:43:40 +00:00
Poul-Henning Kamp
800b42bde0 Prepare for the final onslaught on devices:
Move uid/gid/mode from cdev to cdevsw.

Add kind field to use for devd(8) later.

Bump both D_VERSION and __FreeBSD_version
2005-03-17 12:07:00 +00:00
Jeff Roberson
ba73105324 - Lock the clearing of v_data so it is safe to inspect it with the
interlock.

Sponsored by:	Isilon Systems, Inc.
2005-03-17 12:00:05 +00:00
Poul-Henning Kamp
51f5ce0c8c Add two arguments to the vfs_hash() KPI so that filesystems which do
not have unique hashes (NFS) can also use it.
2005-03-16 11:20:51 +00:00
Poul-Henning Kamp
9ed94841d9 Remove unused file 2005-03-16 11:10:38 +00:00
Poul-Henning Kamp
fd475cc19d Remove inode fields previously used for private inode hash tables. 2005-03-16 08:09:52 +00:00
Poul-Henning Kamp
beddd41467 XXX: unnecessary pointer in inode. 2005-03-16 07:21:38 +00:00
Poul-Henning Kamp
7e1dd21ccf Don't store the disk cdev in all inodes. 2005-03-16 07:17:39 +00:00
Poul-Henning Kamp
e0251bbbe7 Don't hold a reference to the disk vnode for each inode.
Eliminate cdev and vnode pointer to the disk from the inodes,
the mount holds everything we need.
2005-03-15 21:09:52 +00:00
Poul-Henning Kamp
3b97f388d8 Eliminate cdev pointer in inodes, they're not used or needed.
The cdev could have been pulled out of the mountpoint cheaper back
when it was used anyway.
2005-03-15 20:57:25 +00:00
Poul-Henning Kamp
de68347b1b Don't hold a reference on the disk vnode for each inode. 2005-03-15 20:50:58 +00:00
Poul-Henning Kamp
45c26fa2b6 Improve the vfs_hash() API: vput() the unneeded vnode centrally to
avoid replicating the vput in all the filesystems.
2005-03-15 20:00:03 +00:00
Jeff Roberson
bc855512c8 - Assume that all lower filesystems now support proper locking. Assert
that they set v->v_vnlock.  This is true for all filesystems in the
   tree.
 - Remove all uses of LK_THISLAYER.  If the lower layer is locked, the
   null layer is locked.  We only use vget() to get a reference now.
   null essentially does no locking.  This fixes LOOKUP_SHARED with
   nullfs.
 - Remove the special LK_DRAIN considerations, I do not believe this is
   needed now as LK_DRAIN doesn't destroy the lower vnode's lock, and
   it's hardly used anymore.
 - Add one well commented hack to prevent the lowervp from going away
   while we're in it's VOP_LOCK routine.  This can only happen if we're
   forcibly unmounted while some callers are waiting in the lock.  In
   this case the lowervp could be recycled after we drop our last ref
   in null_reclaim().  Prevent this with a vhold().
2005-03-15 13:49:33 +00:00
Poul-Henning Kamp
7649bbb0b0 Disable two users of findcdev. They do the wrong thing now and will
need to be fixed.  In both cases the API should be reengineered to do
something (more) sensible.
2005-03-15 12:39:30 +00:00
Jeff Roberson
9feb7408f8 - We have to transfer lockers after reseting our vnlock pointer.
Sponsored by:	Isilon Systems, Inc.
2005-03-15 11:28:45 +00:00
Poul-Henning Kamp
46d7d4a332 Don't export major,minor, instead export tty name. 2005-03-15 11:05:11 +00:00
Poul-Henning Kamp
6bc6a87cc9 Print devtoname() instead of minor(). 2005-03-15 10:01:31 +00:00
Poul-Henning Kamp
40d04a26a0 Fix typo: pointers are not boolean in style(9). 2005-03-15 10:01:14 +00:00
Poul-Henning Kamp
e82ef95c11 Simplify the vfs_hash calling convention. 2005-03-15 08:07:07 +00:00
Dag-Erling Smørgrav
0e3b5c73b2 Hook pfs_lookup() up to vfs_cachedlookup_desc instead of vfs_lookup_desc,
as suggested by Matt's comment.  Also fix some style and paranoia issues.

The entire function could benefit from review by a VFS guru.

MFC after:	6 weeks
2005-03-14 16:24:50 +00:00
Dag-Erling Smørgrav
bc593ccd83 Fix two long-standing bugs in pfs_readdir():
Since we used an sbuf of size resid to accumulate dirents, we would end
up returning one byte short when we had enough dirents to fill or exceed
the size of the sbuf (the last byte being lost to bogus NUL termination)
causing the next call to return EINVAL due to an unaligned offset.  This
went undetected for a long time because I did most of my testing in
single-user mode, where there are rarely enough processes to fill the
4096-byte buffer ls(1) uses.  The most common symptom of this bug is that
tab completion of /proc or /compat/linux/proc does not work properly when
many processes are running.

Also, a check near the top would return EINVAL if resid was smaller than
PFS_DELEN, even if it was 0, which is frequently the case and perfectly
allowable.  Change the test so that it returns 0 if resid is 0.

MFC after:	2 weeks
2005-03-14 16:21:32 +00:00
Dag-Erling Smørgrav
cb5abc7d2d If PSEUDOFS_TRACE is defined, create a sysctl knob to enable / disable
pseudofs call tracing.
2005-03-14 16:06:47 +00:00
Dag-Erling Smørgrav
de52d21a02 fbsdidize. 2005-03-14 15:54:11 +00:00
Poul-Henning Kamp
2f00593534 Use vfs_hash instead of home-rolled. 2005-03-14 14:41:37 +00:00
Poul-Henning Kamp
dfb9f846e9 Use vfs_hash instead of home-rolled. 2005-03-14 13:22:41 +00:00
Poul-Henning Kamp
4e94fafc4f Use vfs_hash instead of home-rolled.
Correct locking around g_vfs_close()
2005-03-14 12:29:39 +00:00
Poul-Henning Kamp
a30fc63b19 Use vfs_hash instead of home-rolling. 2005-03-14 12:24:35 +00:00
Jeff Roberson
c1e7e9ba9b - VOP_INACTIVE should no longer drop the vnode lock.
Sponsored by:   Isilon Systems, Inc.
2005-03-13 12:18:47 +00:00
Jeff Roberson
8da0046596 - The VI_DOOMED flag now signals the end of a vnode's relationship with
the filesystem.  Check that rather than VI_XLOCK.
 - VOP_INACTIVE should no longer drop the vnode lock.
 - The vnode lock is required around calls to vrecycle() and vgone().

Sponsored by:	Isilon Systems, Inc.
2005-03-13 12:18:25 +00:00
Jeff Roberson
c0f681c21d - The VI_DOOMED flag now signals the end of a vnode's relationship with
the filesystem.  Check that rather than VI_XLOCK.

Sponsored by:	Isilon Systems, Inc.
2005-03-13 12:14:56 +00:00
Jeff Roberson
172ffe319a - The c_lock in the coda node does not offer any features over the standard
vnode lock.  Remove the c_lock and use the vn lock in its place.
 - Keep the coda lock functions so that the debugging information is
   preserved, but call directly to the vop_std*lock routines for the real
   functionality.

Sponsored by:	Isilon Systems, Inc.
2005-03-13 12:09:34 +00:00
Jeff Roberson
3100b70037 - Deadfs may now use the standard vop lock, get rid of dead_lock().
- We no longer have to take the XLOCK state into consideration in any
   routines.

Sponsored by:	Isilon Systems, Inc.
2005-03-13 12:06:20 +00:00
David E. O'Brien
bdc172ab8f Used unsigned version.
Submitted by:	jmallett
2005-03-12 06:06:04 +00:00
David E. O'Brien
fb2eece6d2 Fix kernel build on 64-bit machines. 2005-03-12 03:50:39 +00:00
Nate Lawson
d81812be67 Correct a last-minute thinko. Instead of copying the nul with the string,
nul-terminate the dp->d_name directly and only copy the string.
2005-03-11 23:35:23 +00:00
Nate Lawson
4cdb148352 The mbnambuf routines combine multiple substrings into a single
long filename.  Each substring is indexed by the windows ID, a
sequential one-based value.  The previous code was extremely slow,
doing a malloc/strcpy/free for each substring.

This code optimizes these routines with this in mind, using the ID
to index into a single array and concatenating each WIN_CHARS chunk
at once.  (The last chunk is variable-length.)

This code has been tested as working on an FS with difficult filename
sizes (255, 13, 26, etc.)  It gives a 77.1% decrease in profiled
time (total across all functions) and a 73.7% decrease in wall time.
Test was "ls -laR > /dev/null".

Per-function time savings:
mbnambuf_init:  -90.7%
mbnambuf_write: -18.7%
mbnambuf_flush: -67.1%

MFC after:	1 month
2005-03-11 23:27:45 +00:00
Poul-Henning Kamp
2647407860 One more bit of the major/minor patch to make ttyname happy as well. 2005-03-10 18:49:17 +00:00
Poul-Henning Kamp
b43ab0e378 Try to fix the mess I made of devname, with the minimal subset of the
larger minor/major patch which was posted for testing.
2005-03-10 18:21:34 +00:00
Poul-Henning Kamp
f5af7353c0 Remove kernelside support for devfs rules filtering on major numbers. 2005-03-08 19:51:27 +00:00
Poul-Henning Kamp
a24042b727 Avoid a couple of mutex operations in the process exit path for the
common case where procfs have never been mounted.

OK'ed by:	des
2005-03-01 12:20:49 +00:00
Poul-Henning Kamp
7ce296cf04 Remove debug printout of major/minor numbers, print name instead. 2005-02-27 21:16:26 +00:00
Sam Leffler
3cdbd5fb04 remove dead code
Submitted by:	Coverity Prevent analysis tool
2005-02-22 19:02:24 +00:00
Poul-Henning Kamp
0454a53d65 We may not have an actual cdev at this point. 2005-02-22 18:17:31 +00:00
Poul-Henning Kamp
aa2f6ddc3f Reap more benefits from DEVFS:
List devfs_dirents rather than vnodes off their shared struct cdev, this
saves a pointer field in the vnode at the expense of a field in the
devfs_dirent.  There are often 100 times more vnodes so this is bargain.
In addition it makes it harder for people to try to do stypid things like
"finding the vnode from cdev".

Since DEVFS handles all VCHR nodes now, we can do the vnode related
cleanup in devfs_reclaim() instead of in dev_rel() and vgonel().
Similarly, we can do the struct cdev related cleanup in dev_rel()
instead of devfs_reclaim().

	rename idestroy_dev() to destroy_devl() for consistency.

	Add LIST_ENTRY de_alias to struct devfs_dirent.
	Remove v_specnext from struct vnode.
	Change si_hlist to si_alist in struct cdev.
	String new devfs vnodes' devfs_dirent on si_alist when
	we create them and take them off in devfs_reclaim().

	Fix devfs_revoke() accordingly.  Also don't clear fields
	devfs_reclaim() will clear when called from vgone();

	Let devfs_reclaim() call dev_rel() instead of vgonel().

	Move the usecount tracking from dev_rel() to devfs_reclaim(),
	and let dev_rel() take a struct cdev argument instead of vnode.

	Destroy SI_CHEAPCLONE devices in dev_rel() (instead of
	devfs_reclaim()) when they are no longer used.   (This
	should maybe happen in devfs_close() instead.)
2005-02-22 15:51:07 +00:00
Poul-Henning Kamp
5a98dd4df5 vp->v_id is a private field for the vfs namecache and it is a big mistake
that NFS ever started using it and an even bigger that it got copied&pasted
to nwfs and smbfs.

Replace with use of vhold()/vdrop().
2005-02-22 15:06:30 +00:00
Poul-Henning Kamp
f69d42a1d2 Use vn_printf() instead of home-rolling. 2005-02-22 14:58:59 +00:00
Poul-Henning Kamp
1a1457d427 Make dev_ref() require the dev_lock() to be held and use it from
devfs instead of directly frobbing the si_refcount.
2005-02-22 14:41:04 +00:00
David Schultz
0e2b18143f Replace the workaround for a deadlock bug in Coda with a different
workaround that does not rely on vfs_start().
2005-02-20 23:01:57 +00:00
Robert Watson
1bfca411a6 Remove basically unused root_vp pointer in udfmount.
MFC after:	1 week
Discussed with:	scottl
2005-02-18 11:47:51 +00:00
Robert Watson
5d0c377bfe Conditionalize cd9660 chattiness regarding the nature of the file system
mounted (is it Joliet, RockRidge, High Sierra) based on bootverbose.
Most file systems don't generate log messages based on details of the
file system superblock, and these log messages disrupt sysinstall output
during a new install from CD.  We may want to explore exposing this
status information using nmount() at some point.

MFC after:	3 days
2005-02-18 10:49:55 +00:00
Poul-Henning Kamp
4d8ac58b05 Introduce vx_wait{l}() and use it instead of home-rolled versions. 2005-02-17 10:49:51 +00:00
Poul-Henning Kamp
5ece08f57a Make a SYSCTL_NODE static 2005-02-10 12:23:29 +00:00
Poul-Henning Kamp
66ae53f804 make M_NTFSMNT and ntfs_calccfree() static 2005-02-10 12:09:49 +00:00
Poul-Henning Kamp
9def42f333 Make fdesc_root static 2005-02-10 12:09:15 +00:00
Poul-Henning Kamp
f70f851c60 Make smbfs_debuglevel private. 2005-02-10 12:07:02 +00:00
Poul-Henning Kamp
271c679c17 don't call vprint with NULL. 2005-02-10 12:06:34 +00:00
Poul-Henning Kamp
87c045d5a2 Statize malloc types.
Don't call vprint with NULL.
2005-02-10 12:05:06 +00:00
Poul-Henning Kamp
df32e67c73 Statize devfs_ops_f 2005-02-10 12:04:26 +00:00
Poul-Henning Kamp
c711aea6ca Make a bunch of malloc types static.
Found by:	src/tools/tools/kernxref
2005-02-10 12:02:37 +00:00
Nate Lawson
2a05fbb949 Unroll the loop for calculating the 8.3 filename checksum. In testing
on my P3, microbenchmarks show the unrolled version is 78x faster.  In
actual use (recursive ls), this gives an average of 9% improvement in
system time and 2% improvement in wall time.
2005-02-08 07:51:14 +00:00
Poul-Henning Kamp
61f9cf813f Remove vop_destroyvobject() 2005-02-07 09:23:34 +00:00
Poul-Henning Kamp
7bf4b73d6c Deimplement vop_destroyvobject() 2005-02-07 08:23:36 +00:00
Poul-Henning Kamp
49829f2ec5 Remove vop_destroyvobject() initialization. 2005-02-07 08:04:24 +00:00
Peter Edwards
72b3e305af Unbreak a few filesystems for which vnode_create_vobject() wasn't being
called in "open", causing mmap() to fail.

Where possible, pass size of file to vnode_create_vobject() rather
than having it find it out the hard way via VOP_LOOKUP

Reviewed by: phk
2005-01-29 16:23:39 +00:00
Poul-Henning Kamp
a369f34d76 Make filesystems get rid of their own vnodes vnode_pager object in
VOP_RECLAIM().
2005-01-28 14:42:17 +00:00
Poul-Henning Kamp
d4eb29ba71 Remove unused argument to vrecycle() 2005-01-28 13:08:21 +00:00
Peter Edwards
174d6a9f73 Make NTFS at least minimally usable after bufobj and GEOM fallout.
mmap() on NTFS files was hosed, returning pages offset from the
start of the disk rather than the start of the file. (ie, "cp" of
a 1-block file would get you a copy of the boot sector, not the
data in the file.) The solution isn't ideal, but gives a functioning
filesystem.

Cached vnode lookup was also broken, resulting in vnode haemorrhage.
A lookup on the same file twice would give you two vnodes, and the
resulting cached pages.

Just recently, mmap() was broken due to a lack of a call to
vnode_create_vobject() in ntfs_open().

Discussed with: phk@
2005-01-27 13:50:27 +00:00
Poul-Henning Kamp
84a6975215 Introduce and use g_vfs_close(). 2005-01-25 15:52:04 +00:00
Poul-Henning Kamp
729fcf7efb Take VOP_GETVOBJECT() out to pasture. We use the direct pointer now. 2005-01-25 00:42:16 +00:00
Poul-Henning Kamp
69816ea35e Kill VOP_CREATEVOBJECT(), it is now the responsibility of the filesystem
for a given vnode to create a vnode_pager object if one is needed.
2005-01-25 00:12:24 +00:00
Poul-Henning Kamp
2a967a99c3 Don't implement vop_createvobject(), vop_open() and vop_close() manages
this for nullfs now.
2005-01-24 23:54:45 +00:00
Poul-Henning Kamp
dcff5b1440 Don't call VOP_CREATEVOBJECT(), it's the responsibility of the
filesystem which owns the vnode.
2005-01-24 23:53:54 +00:00
Poul-Henning Kamp
c683c4ee04 Add null_open() and null_close() which calls null_bypass() and managed
the v_object pointer.
2005-01-24 22:56:24 +00:00
Poul-Henning Kamp
625d4bc03a Create a vp->v_object in VFS_FHTOVP() if we want to be exportable
with NFS.

We are moving responsibility for creating the vnode_pager object into
the filesystems which own the vnode, and this is one of the places
we have to cover.

We call vnode_create_vobject() directly because we own the vnode.

If we can get the size easily, pass it as an argument to save the
call to VOP_GETATTR() in vnode_create_vobject()
2005-01-24 21:51:19 +00:00
Poul-Henning Kamp
35764be39e Kill the VV_OBJBUF and test the v_object for NULL instead. 2005-01-24 13:13:57 +00:00
Poul-Henning Kamp
d34dd851b8 Remove "register" keywords. 2005-01-24 12:37:51 +00:00
Poul-Henning Kamp
a515233f47 Style: Remove the commented out vop_foo_args replicas. 2005-01-24 11:49:41 +00:00
Poul-Henning Kamp
303793b564 whitespace nit 2005-01-19 09:07:56 +00:00
Poul-Henning Kamp
5873f57b29 Remove unused coda_fbsd_getpages() 2005-01-19 08:24:53 +00:00
Scott Long
a4d629e32d Fix an incorrect cast.
Submitted by: Andriy Gapon
MFC-after: 3 days.
2005-01-18 10:15:23 +00:00
Scott Long
444acc1655 NULL-terminate the . and .. directory entries. Apparently some tools ignore
d_namlen and assume that d_name is null-terminated.

Submitted by: Andriy Gapon
2005-01-14 16:35:34 +00:00
Scott Long
43bc24bf5a Replace the min() macro with a test that doesn't truncate the 64-bit values
that are used.  Thanks to Bruce Evans for pointing this out.
2005-01-14 16:24:31 +00:00
Poul-Henning Kamp
e50508df66 Eliminate unused and constant arguments to smbfs_vinvalbuf() 2005-01-14 08:52:55 +00:00
Poul-Henning Kamp
bf0063b87d Eliminate constant and unused arguments to nwfs_vinvalbuf() 2005-01-14 08:09:42 +00:00
Poul-Henning Kamp
7c0745eeae Eliminate unused and unnecessary "cred" argument from vinvalbuf() 2005-01-14 07:33:51 +00:00
Poul-Henning Kamp
83c6439714 Whitespace in vop_vector{} initializations. 2005-01-13 18:59:48 +00:00
Poul-Henning Kamp
e39db32ab0 Ditch vfs_object_create() and make the callers call VOP_CREATEVOBJECT()
directly.
2005-01-13 12:25:19 +00:00
Poul-Henning Kamp
63f89abf4a Change the generated VOP_ macro implementations to improve type checking
and KASSERT coverage.

After this check there is only one "nasty" cast in this code but there
is a KASSERT to protect against the wrong argument structure behind
that cast.

Un-inlining the meat of VOP_FOO() saves 35kB of text segment on a typical
kernel with no change in performance.

We also now run the checking and tracing on VOP's which have been layered
by nullfs, umapfs, deadfs or unionfs.

    Add new (non-inline) VOP_FOO_AP() functions which take a "struct
    foo_args" argument and does everything the VOP_FOO() macros
    used to do with checks and debugging code.

    Add KASSERT to VOP_FOO_AP() check for argument type being
    correct.

    Slim down VOP_FOO() inline functions to just stuff arguments
    into the struct foo_args and call VOP_FOO_AP().

    Put function pointer to VOP_FOO_AP() into vop_foo_desc structure
    and make VCALL() use it instead of the current offsetoff() hack.

    Retire vcall() which implemented the offsetoff()

    Make deadfs and unionfs use VOP_FOO_AP() calls instead of
    VCALL(), we know which specific call we want already.

    Remove unneeded arguments to VCALL() in nullfs and umapfs bypass
    functions.

    Remove unused vdesc_offset and VOFFSET().

    Generally improve style/readability of the generated code.
2005-01-13 07:53:01 +00:00
Scott Long
9d32fde894 Use off_t when passing and calculating file offsets. While a single
extent in UDF is only 32 bits, multiple extents can exist in a file.
Also clean up some minor whitespace problems.

Submitted by: John Wehle
2005-01-12 06:42:13 +00:00
Scott Long
d1022c068e Don't allow reads past the end of a file.
Submitted by: John Wehle, Andriy Gapon
MFC After: 3 days
2005-01-12 06:17:01 +00:00
Poul-Henning Kamp
7164e8f291 Silently ignore forced argument to unmount. 2005-01-11 12:02:26 +00:00
Poul-Henning Kamp
0391e5a151 Wrap the bufobj operations in macros: BO_STRATEGY() and BO_WRITE() 2005-01-11 09:10:46 +00:00
Poul-Henning Kamp
8df6bac4c7 Remove the unused credential argument from VOP_FSYNC() and VFS_SYNC().
I'm not sure why a credential was added to these in the first place, it is
not used anywhere and it doesn't make much sense:

	The credentials for syncing a file (ability to write to the
	file) should be checked at the system call level.

	Credentials for syncing one or more filesystems ("none")
	should be checked at the system call level as well.

	If the filesystem implementation needs a particular credential
	to carry out the syncing it would logically have to the
	cached mount credential, or a credential cached along with
	any delayed write data.

Discussed with:	rwatson
2005-01-11 07:36:22 +00:00
Poul-Henning Kamp
b630d6f15a whitespace 2005-01-10 13:09:33 +00:00
Robert Watson
f644bbc45c Annotate that pfs_exit() always acquires and releases two mutexes for
every process exist, even if procfs isn't mounted.  And one of those
mutexes is Giant.  No immediate thoughts on fixing this.
2005-01-08 04:56:38 +00:00
Warner Losh
86cb007f9f /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
Warner Losh
d167cf6f3a /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 18:10:42 +00:00
Warner Losh
5de2b5750c Start each of the license/copyright comments with /*- 2005-01-05 23:35:00 +00:00
Poul-Henning Kamp
59f69ba49f Unsupport forceful unmounts of DEVFS.
After disscussing things I have decided to take the easy and
consistent 90% solution instead of aiming for the very involved 99%
solution.

If we allow forceful unmounts of DEVFS we need to decide how to handle
the devices which are in use through this filesystem at the time.

We cannot just readopt the open devices in the main /dev instance since
that would open us to security issues.

For the majority of the devices, this is relatively straightforward
as we can just pretend they got revoke(2)'ed.

Some devices get tricky:  /dev/console and /dev/tty for instance
does a sort of recursive open of the real console device.   Other devices
may be mmap'ed (kill the processes ?).

And then there are disk devices which are mounted.

The correct thing here would be to recursively unmount the filesystems
mounte from devices from our DEVFS instance (forcefully) and if
this succeeds, complete the forcefully unmount of DEVFS.  But if
one of the forceful unmounts fail we cannot complete the forceful
unmount of DEVFS, but we are likely to already have severed a lot
of stuff in the process of trying.

Event attempting this would be a lot of code for a very far out
corner-case which most people would never see or get in touch with.

It's just not worth it.
2005-01-04 07:52:26 +00:00
Poul-Henning Kamp
50a36c111f Be consistent about flag values passed to device drivers read/write
methods:

Read can see O_NONBLOCK and O_DIRECT.

Write can see O_NONBLOCK, O_DIRECT and O_FSYNC.

In addition O_DIRECT is shadowed as IO_DIRECT for now for backwards
compatibility.
2004-12-22 17:05:44 +00:00
Poul-Henning Kamp
10eee285f7 Shuffle numeric values of the IO_* flags to match the O_* flags from
fcntl.h.

This is in preparation for making the flags passed to device drivers be
consistently from fcntl.h for all entrypoints.

Today open, close and ioctl uses fcntl.h flags, while read and write
uses vnode.h flags.
2004-12-22 16:25:50 +00:00
Poul-Henning Kamp
e87047b437 We can only ever get to vgonechrl() from a devfs vnode, so we do not
need to reassign the vp->v_op to devfs_specops, we know that is the
value already.

Make devfs_specops private to devfs.
2004-12-20 21:34:29 +00:00
Poul-Henning Kamp
2c0220129d Add a couple of KASSERTS to try to diagnose a problem reported. 2004-12-20 21:12:11 +00:00
Poul-Henning Kamp
2a9e0c3216 Be a bit more assertive about vnode bypass. 2004-12-14 09:32:18 +00:00
Suleiman Souhlal
3d96167a54 Exporting of NTFS filesystem broke in rev 1.70. Fix it.
Approved by:	phk, grehan (mentor)
2004-12-13 16:21:48 +00:00
Poul-Henning Kamp
5cb471d04d Don't forget to bypass vnodes in corner cases.
Found by:	kkenn and ports/shell/zsh
Thanks to:	jeffr
2004-12-13 10:07:57 +00:00
Poul-Henning Kamp
1dc4727ea3 Another FNONBLOCK -> O_NONBLOCK.
Don't unconditionally set IO_UNIT to device drivers in write:  nobody
checks it, and since it was always set it did not carry information anyway.
2004-12-13 07:41:19 +00:00
Poul-Henning Kamp
ab9caf9d67 Use O_NONBLOCK instead of FNONBLOCK alias. 2004-12-13 07:37:29 +00:00
Poul-Henning Kamp
f0d5cba935 Explicit panic in vop_read/vop_write for devices 2004-12-13 07:13:21 +00:00
Poul-Henning Kamp
dce357b112 Explicitly panic vop_read/vop_write on fifos. 2004-12-13 07:07:50 +00:00
Poul-Henning Kamp
e98fdc0d03 Don't deref NULL if no charset-conversion is specified.
Return correct vnode in vop_bmap()
2004-12-12 12:02:34 +00:00
Poul-Henning Kamp
269c902f17 Handle MNT_UPDATE export requests first and return so we do not
interpret the rest of the msdosfs_args structure.

Detected by:	marcel
2004-12-11 20:37:48 +00:00
Poul-Henning Kamp
708394ec72 typo 2004-12-11 12:45:24 +00:00
Poul-Henning Kamp
6366900a0f First save from editor, *then* commit. 2004-12-07 15:25:36 +00:00
Poul-Henning Kamp
5c83b5551c Fix exports. 2004-12-07 15:13:35 +00:00
Poul-Henning Kamp
20a92a18f1 The remaining part of nmount/omount/rootfs mount changes. I cannot sensibly
split the conversion of the remaining three filesystems out from the root
mounting changes, so in one go:

cd9660:
	Convert to nmount.
	Add omount compat shims.
	Remove dedicated rootfs mounting code.
	Use vfs_mountedfrom()
	Rely on vfs_mount.c calling VFS_STATFS()

nfs(client):
	Convert to nmount (the simple way, mount_nfs(8) is still necessary).
	Add omount compat shims.
	Drop COMPAT_PRELITE2 mount arg compatibility.

ffs:
	Convert to nmount.
	Add omount compat shims.
	Remove dedicated rootfs mounting code.
	Use vfs_mountedfrom()
	Rely on vfs_mount.c calling VFS_STATFS()

Remove vfs_omount() method, all filesystems are now converted.

Remove MNTK_WANTRDWR, handling RO/RW conversions is a filesystem
task, and they all do it now.

Change rootmounting to use DEVFS trampoline:

vfs_mount.c:
	Mount devfs on /.  Devfs needs no 'from' so this is clean.
	symlink /dev to /.  This makes it possible to lookup /dev/foo.
	Mount "real" root filesystem on /.
	Surgically move the devfs mountpoint from under the real root
	filesystem onto /dev in the real root filesystem.

Remove now unnecessary getdiskbyname().

kern_init.c:
	Don't do devfs mounting and rootvnode assignment here, it was
	already handled by vfs_mount.c.

Remove now unused bdevvp(), addaliasu() and addalias().  Put the
few necessary lines in devfs where they belong.  This eliminates the
second-last source of bogo vnodes, leaving only the lemming-syncer.

Remove rootdev variable, it doesn't give meaning in a global context and
was not trustworth anyway.  Correct information is provided by
statfs(/).
2004-12-07 08:15:41 +00:00
Poul-Henning Kamp
def91cf267 Use vfs_mountedfrom().
Since VFS_STATFS() always calls the filesystem with mp->mnt_stat now, the
vfs_statfs method is now a no-op.  Explain this in a comment.
2004-12-06 20:52:46 +00:00
Poul-Henning Kamp
1a6cf6a3ad Trust vfs_mount to call VFS_STATFS() on all mounts. 2004-12-06 20:31:36 +00:00
Poul-Henning Kamp
d14c8441e9 Convert to nmount. Add omount compat.
Unpropagate the sm_args function into the runtime part.
2004-12-06 20:31:08 +00:00
Poul-Henning Kamp
bd50907c91 Convert to nmount. Add omount compat.
Use vfs_mountedon().  Rely on vfs_mount.c calling VFS_STATFS().
2004-12-06 20:23:51 +00:00
Poul-Henning Kamp
c4048cf07f Convert to nmount. Add omount compat.
Same comment about charset conversions apply.

Use vfs_mountedfrom().  Rely on vfs_mount.c calling VFS_STATFS().
2004-12-06 20:22:16 +00:00
Poul-Henning Kamp
55dca57ef2 Convert to nmount. Add backwards compat cmount method.
Same comment as msdosfs applies: It would be nice if we had generic option
names for charset conversions.

Use vfs_mountefrom().  Rely on vfs_mount.c calling VFS_STATFS().
2004-12-06 20:14:20 +00:00
Poul-Henning Kamp
526463736e Convert nwfs to nmount, but take the low road: There is no way this is
ever going to work without a dedicated mount_nwfs(8) program so simply
stick struct nwfs_args into a nmount argument and leave it at that.
2004-12-06 20:11:56 +00:00
Alexander Kabaev
f6968c4a99 Fix a typo in PFS_TRACE.
PR:		kern/74461
Submitted by:	Craig Rodrigues <rodrigc at crodrigues.org>
2004-12-06 20:07:17 +00:00
Poul-Henning Kamp
935ab476fa ufs vfs_mountedon(), rely on vfs_mount.c calling VFS_STATFS() 2004-12-06 20:03:58 +00:00
Poul-Henning Kamp
7ab8c8c03c Use vfs_mountedfrom(), rely on vfs_mount.c calling VFS_STATFS(). 2004-12-06 20:02:13 +00:00
Poul-Henning Kamp
a1f5fe1538 Use vfs_mountedfrom() and rely on vfs_mount.c to call VFS_STATFS() 2004-12-06 19:54:31 +00:00
Poul-Henning Kamp
7df2fc80f8 Convert coda to nmount. 2004-12-06 19:46:02 +00:00
Poul-Henning Kamp
6a4b48f488 Convert msdosfs to nmount.
Add a vfs_cmount() function which converts omount argument stucture
to nmount arguments.

Convert vfs_omount() to vfs_mount() and parse nmount arguments.

This is 100% compatible with existing userland.

Later on, but before userland gets converted to nmount we may want
to revisit the names of the mountoptions, for instance it may make
sense to use consistent options for charset conversion etc.
2004-12-06 19:05:48 +00:00
Poul-Henning Kamp
bed8b887ea Fix warning 2004-12-06 12:34:28 +00:00
Poul-Henning Kamp
743312367a VFS_STATFS(mp, ...) is mostly called with &mp->mnt_stat, but a few cases
doesn't.  Most of the implementations have grown weeds for this so they
copy some fields from mnt_stat if the passed argument isn't that.

Fix this the cleaner way:  Always call the implementation on mnt_stat
and copy that in toto to the VFS_STATFS argument if different.
2004-12-05 22:41:02 +00:00
Poul-Henning Kamp
91e691c2d5 Remove embryonic rootfs mounting facility.
In the near future rootfs mounting will not require special handling
in the filesystems.
2004-12-04 09:57:38 +00:00
Poul-Henning Kamp
4b44037433 Remove the de_devvp and stop VREF'ing it for every vnode we create. 2004-12-02 10:09:33 +00:00
Poul-Henning Kamp
aec0fb7b40 Back when VOP_* was introduced, we did not have new-style struct
initializations but we did have lofty goals and big ideals.

Adjust to more contemporary circumstances and gain type checking.

	Replace the entire vop_t frobbing thing with properly typed
	structures.  The only casualty is that we can not add a new
	VOP_ method with a loadable module.  History has not given
	us reason to belive this would ever be feasible in the the
	first place.

	Eliminate in toto VOCALL(), vop_t, VNODEOP_SET() etc.

	Give coda correct prototypes and function definitions for
	all vop_()s.

	Generate a bit more data from the vnode_if.src file:  a
	struct vop_vector and protype typedefs for all vop methods.

	Add a new vop_bypass() and make vop_default be a pointer
	to another struct vop_vector.

	Remove a lot of vfs_init since vop_vector is ready to use
	from the compiler.

	Cast various vop_mumble() to void * with uppercase name,
	for instance VOP_PANIC, VOP_NULL etc.

	Implement VCALL() by making vdesc_offset the offsetof() the
	relevant function pointer in vop_vector.  This is disgusting
	but since the code is generated by a script comparatively
	safe.  The alternative for nullfs etc. would be much worse.

	Fix up all vnode method vectors to remove casts so they
	become typesafe.  (The bulk of this is generated by scripts)
2004-12-01 23:16:38 +00:00
Colin Percival
691b3b0df9 Fix unvalidated pointer dereference. This is FreeBSD-SA-04:17.procfs. 2004-12-01 21:33:02 +00:00
Poul-Henning Kamp
22408f729e hpfs_lookup() should have a vop_cachedlookup_t prototype an corresponding
argument.
2004-12-01 20:24:01 +00:00
Poul-Henning Kamp
0731e6dfb7 Correctly prototype union_write with vop_write_t, not vop_read_t. 2004-12-01 19:15:00 +00:00
Poul-Henning Kamp
6fde64c778 Mechanically change prototypes for vnode operations to use the new typedefs. 2004-12-01 12:24:41 +00:00
Poul-Henning Kamp
ce59d2149d Ignore MNT_NODEV, it is implicit in choice of filesystem these days. 2004-11-26 07:37:42 +00:00
Poul-Henning Kamp
c96c1bebe3 Eliminate null_open() and use instead null_bypass().
Null_open() was only here to handle MNT_NODEV, but since that does
not affect any filesystems anymore, it could only have any effect
if you nullfs mounted a devfs but didn't want devices to show up.

If you need that, there are easier ways.
2004-11-26 07:18:28 +00:00
Poul-Henning Kamp
964ebefd8d Use system wide no-op vfs_start function. 2004-11-25 09:11:27 +00:00
Poul-Henning Kamp
75ad04b4f6 Add dropped implementation of ioctl for fifos. 2004-11-18 17:18:11 +00:00
Poul-Henning Kamp
003e18aef4 Make vnode bypass for fifos (read, write, poll) mandatory. 2004-11-17 07:30:02 +00:00
Poul-Henning Kamp
ea566ae2a5 Make vnode bypass for devices mandatory. 2004-11-17 07:18:49 +00:00
Poul-Henning Kamp
8352b1925d Make vnode bypass the default for devices.
Can be disabled in case of problems with
	vfs.devfs.fops=0
in loader.conf
2004-11-15 22:11:09 +00:00
Poul-Henning Kamp
d6d64f0f2c Add file ops to fifofs so that we can bypass vnodes (and Giant) for the
heavy-duty operations (read, write, poll/select, kqueue).

Disabled for now, enable with "vfs.fifofs.fops=1" in loader.conf.
2004-11-15 14:51:44 +00:00
Poul-Henning Kamp
9c83534dd8 Make VOP_BMAP return a struct bufobj for the underlying storage device
instead of a vnode for it.

The vnode_pager does not and should not have any interest in what
the filesystem uses for backend.

(vfs_cluster doesn't use the backing store argument.)
2004-11-15 09:18:27 +00:00
Poul-Henning Kamp
49b7607eba Integrate most of vop_revoke() into devfs_revoke() where it belongs. 2004-11-13 23:37:29 +00:00
Poul-Henning Kamp
aac5167c38 Add the devfs_fp_check() function which helps us get from a struct file
to a cdev and a devsw, doing all the relevant checks along the way.

Add the check to see if fp->f_vnode->v_rdev differs from our cached
fp->f_data copy of our cdev.  If it does the device was revoked and
we return ENXIO.
2004-11-13 23:21:54 +00:00