Commit Graph

1560 Commits

Author SHA1 Message Date
imp
fb0a393e99 /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 18:10:42 +00:00
imp
7be6bff985 Start each of the license/copyright comments with /*- 2005-01-05 23:35:00 +00:00
phk
9799def1bc 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
phk
c13e70487f 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
phk
4e6a1d00d2 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
phk
0faeb292ed 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
phk
4483c94662 Add a couple of KASSERTS to try to diagnose a problem reported. 2004-12-20 21:12:11 +00:00
phk
ccf97ed87f Be a bit more assertive about vnode bypass. 2004-12-14 09:32:18 +00:00
ssouhlal
dce62f3086 Exporting of NTFS filesystem broke in rev 1.70. Fix it.
Approved by:	phk, grehan (mentor)
2004-12-13 16:21:48 +00:00
phk
7bb3e163dd 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
phk
4e2d779c7a 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
phk
381851ecfe Use O_NONBLOCK instead of FNONBLOCK alias. 2004-12-13 07:37:29 +00:00
phk
f4810ece42 Explicit panic in vop_read/vop_write for devices 2004-12-13 07:13:21 +00:00
phk
eda2bd825d Explicitly panic vop_read/vop_write on fifos. 2004-12-13 07:07:50 +00:00
phk
60aefa9310 Don't deref NULL if no charset-conversion is specified.
Return correct vnode in vop_bmap()
2004-12-12 12:02:34 +00:00
phk
40fb82789b 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
phk
93f6fd0d01 typo 2004-12-11 12:45:24 +00:00
phk
13dc81a40f First save from editor, *then* commit. 2004-12-07 15:25:36 +00:00
phk
a103d64da5 Fix exports. 2004-12-07 15:13:35 +00:00
phk
4a639d6164 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
phk
2b5157cd0d 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
phk
5d8af49b77 Trust vfs_mount to call VFS_STATFS() on all mounts. 2004-12-06 20:31:36 +00:00
phk
0e7aaf24f7 Convert to nmount. Add omount compat.
Unpropagate the sm_args function into the runtime part.
2004-12-06 20:31:08 +00:00
phk
b71fe4fc33 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
phk
43fffbad59 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
phk
3d2dc8aba5 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
phk
68b4df69d0 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
kan
17bd3d9149 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
phk
5d1a13a0c9 ufs vfs_mountedon(), rely on vfs_mount.c calling VFS_STATFS() 2004-12-06 20:03:58 +00:00
phk
1eff61ea7f Use vfs_mountedfrom(), rely on vfs_mount.c calling VFS_STATFS(). 2004-12-06 20:02:13 +00:00
phk
463e576c38 Use vfs_mountedfrom() and rely on vfs_mount.c to call VFS_STATFS() 2004-12-06 19:54:31 +00:00
phk
39311fe2e6 Convert coda to nmount. 2004-12-06 19:46:02 +00:00
phk
b894547e6f 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
phk
28a46c9c9c Fix warning 2004-12-06 12:34:28 +00:00
phk
6c14f71ef7 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
phk
3bb4ccf412 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
phk
de7e56a8ab Remove the de_devvp and stop VREF'ing it for every vnode we create. 2004-12-02 10:09:33 +00:00
phk
59f305606c 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
cperciva
ebbf4e4bde Fix unvalidated pointer dereference. This is FreeBSD-SA-04:17.procfs. 2004-12-01 21:33:02 +00:00
phk
24f769137d hpfs_lookup() should have a vop_cachedlookup_t prototype an corresponding
argument.
2004-12-01 20:24:01 +00:00
phk
d0b2552098 Correctly prototype union_write with vop_write_t, not vop_read_t. 2004-12-01 19:15:00 +00:00
phk
05b9cb2a46 Mechanically change prototypes for vnode operations to use the new typedefs. 2004-12-01 12:24:41 +00:00
phk
820a982ffa Ignore MNT_NODEV, it is implicit in choice of filesystem these days. 2004-11-26 07:37:42 +00:00
phk
60f0e34a8a 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
phk
5525bf4639 Use system wide no-op vfs_start function. 2004-11-25 09:11:27 +00:00
phk
a1fa5f3147 Add dropped implementation of ioctl for fifos. 2004-11-18 17:18:11 +00:00
phk
a94fe69bb7 Make vnode bypass for fifos (read, write, poll) mandatory. 2004-11-17 07:30:02 +00:00
phk
07ea2b1e7d Make vnode bypass for devices mandatory. 2004-11-17 07:18:49 +00:00
phk
1329297d10 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
phk
0e1bc6bd7d 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