Commit graph

356 commits

Author SHA1 Message Date
John Dyson 2be70f79f6 Lots of improvements, including restructring the caching and management
of vnodes and objects.  There are some metadata performance improvements
that come along with this.  There are also a few prototypes added when
the need is noticed.  Changes include:

1) Cleaning up vref, vget.
2) Removal of the object cache.
3) Nuke vnode_pager_uncache and friends, because they aren't needed anymore.
4) Correct some missing LK_RETRY's in vn_lock.
5) Correct the page range in the code for msync.

Be gentle, and please give me feedback asap.
1997-12-29 00:25:11 +00:00
Bruce Evans 675ea6f083 Unspammed nested include of <vm/vm_zone.h>. 1997-12-27 02:56:39 +00:00
John Dyson 4854f102a0 I added vfs_ioopt prematurely, disabled. 1997-12-21 10:41:19 +00:00
John Dyson 1efb74fbcc Some performance improvements, and code cleanups (including changing our
expensive OFF_TO_IDX to btoc whenever possible.)
1997-12-19 09:03:37 +00:00
Eivind Eklund 16a4e2f328 Make LINT compile again after wollman introduced poll() here.
Overlooked by:	wollman
1997-12-16 22:28:26 +00:00
Eivind Eklund 8c13c35718 Convert SUIDDIR fully to a new-style option.
Forgotten by: julian
1997-12-15 21:51:45 +00:00
Garrett Wollman 1cbbd625cc Add support for poll(2) on files. vop_nopoll() now returns POLLNVAL
if one of the new poll types is requested; hopefully this will not break
any existing code.  (This is done so that programs have a dependable
way of determining whether a filesystem supports the extended poll types
or not.)

The new poll types added are:

	POLLWRITE - file contents may have been modified
	POLLNLINK - file was linked, unlinked, or renamed
	POLLATTRIB - file's attributes may have been changed
	POLLEXTEND - file was extended

Note that the internal operation of poll() means that it is impossible
for two processes to reliably poll for the same event (this could
be fixed but may not be worth it), so it is not possible to rewrite
`tail -f' to use poll at this time.
1997-12-15 03:09:59 +00:00
Bruce Evans 2573d99c75 Restored ufs_pathconf() from rev.1.61. vop_stdpathconf() is too
general to be of much use.  Using it here broke the _PC_NAME_MAX,
_PC_NO_TRUNC and _PC_PATH_MAX cases, and weakened the _PC_MAX_CANON,
_PC_MAX_INPUT and _PC_VDISABLE cases.
1997-12-13 12:30:34 +00:00
Peter Wemm 32935219ba Fix(?) some style consistancy breakage and do some other nit-picking on
the SUIDDIR changes.
1997-12-12 14:14:44 +00:00
Bruce Evans 1cd52ec333 Don't include <sys/lock.h> in headers when only `struct simplelock' is
required.  Fixed everything that depended on the pollution.
1997-12-05 19:55:52 +00:00
Jordan K. Hubbard 8cf27db018 Needs to include <sys/lock.h> if we're using struct lock. 1997-12-05 13:43:47 +00:00
Poul-Henning Kamp ab3f746966 In all such uses of struct buf: 's/b_un.b_addr/b_data/g' 1997-12-02 21:07:20 +00:00
Bruce Evans eb2d1c01ef `nextgennumber' can go away now that is no longer (ab)used by foreign
fs's.
1997-12-02 11:43:45 +00:00
Bruce Evans 1dd78fb7ef Use the same algorithm as ffs for generation numbers. 1997-12-02 11:42:28 +00:00
Bruce Evans 23906a782b Fix a small style bug in the generation number change (rev.1.33) before
copying the change to other fs's.
1997-12-02 11:21:16 +00:00
Bruce Evans 5b76055a53 Fixed overflow in ufs_getblns(). For ufs on systems with 32-bit ints,
triple indirect blocks only worked for block sizes of 4K, since
MNINDIR(ump)**3 overflows for larger block sizes (e.g.,
(8192/4)**3 = 2**33 > INT_MAX).  This fix is not the obvious one of
changing some types to 64 bits.  It rearranges the code to avoid some
unnecessary 64-bit calculations.

Reviewed by:	Kirk McKusick <mckusick@McKusick.COM>
1997-11-24 16:33:03 +00:00
Bruce Evans cb451ebdbd Staticized. 1997-11-22 08:35:46 +00:00
Bruce Evans 2ea354c3bb Unremoved prtrealloc and the declaration of ffs_clusteralloc(). These
are used in the `#ifdef notyet' case :-).  This case is used except in
the `#if !defined (not_yes)' case :-|.  This has something to do with
the `#ifdef notyet_block_reallocation_enabled' case in vfs_cluster.c :-(.
1997-11-22 07:00:40 +00:00
Bruce Evans 3e8b388271 Fixed marking of access time for special files and fifos (don't do
it if the file system is mounted noatime).  Not fixed: the access
time is marked at the start of a read() and not marked on successful
completion.  I think this should be handled at the vfs level.

Print a better panic message for missing vops.  Don't use printf()
before panic(), since the printf()ed part isn't shown by gdb.
This actually loses a little with the current gdb, since gdb just
prints the fmt arg to panic, so %'s aren't expanded.  gdb should
fetch the full message from the message buffer if possible.

Fixed default vop function for vop_getpages_desc.  It needs to
just return EOPNOTSUPP so that the vnode pager can get the pages
in using a general method.  Panicing broke exec'ing of files on
ext2fs file systems.  ffs works because it doesn't use the default.

Fixed nearby style bugs.
1997-11-20 16:08:56 +00:00
Bruce Evans c5697b1f22 Removed an unused #include in the `#ifdef KERNEL' case.
Fixed a comment to match the code.  The code is still wrong
(ffs_checkoverlap() should be staticized and called from a
ddb command).
1997-11-18 15:10:38 +00:00
Poul-Henning Kamp 2c31072227 unifdef -UEXT2FS 1997-11-18 14:20:09 +00:00
Julian Elischer 65d748cf46 oops, fix left out semicolon in code I patched by hand. 1997-11-13 01:48:30 +00:00
Julian Elischer 52bf64c787 Reviewed by: hackers@freebsd.org in general
Obtained from: Whistle Communications tree

Add an option to the way UFS works dependent on the SUID bit of directories
This changes makes things a whole lot simpler on systems running as
fileservers for PCs and MACS. to enable the new code you must
1/ enable option SUIDDIR on the kernel.
2/ mount the filesystem with option suiddir.
hopefully this makes it difficult enough for people to
do this accidentally.
see the new chmod(2) man page for detailed info.
1997-11-13 00:28:51 +00:00
Julian Elischer b1f4a44b03 Reviewed by: various.
Ever since I first say the way the mount flags were used I've hated the
fact that modes, and events, internal and exported, and short-term
and long term flags are all thrown together. Finally it's annoyed me enough..
This patch to the entire FreeBSD tree adds a second mount flag word
to the mount struct. it is not exported to userspace. I have moved
some of the non exported flags over to this word. this means that we now
have 8 free bits in the mount flags. There are another two that might
well move over, but which I'm not sure about.
The only user visible change would have been in pstat -v, except
that davidg has disabled it anyhow.
I'd still like to move the state flags and the 'command' flags
apart from each other.. e.g. MNT_FORCE really doesn't have the
same semantics as MNT_RDONLY, but that's left  for another day.
1997-11-12 05:42:33 +00:00
Poul-Henning Kamp 4a11ca4e29 Remove a bunch of variables which were unused both in GENERIC and LINT.
Found by:	-Wunused
1997-11-07 08:53:44 +00:00
Poul-Henning Kamp cb226aaa62 Move the "retval" (3rd) parameter from all syscall functions and put
it in struct proc instead.

This fixes a boatload of compiler warning, and removes a lot of cruft
from the sources.

I have not removed the /*ARGSUSED*/, they will require some looking at.

libkvm, ps and other userland struct proc frobbing programs will need
recompiled.
1997-11-06 19:29:57 +00:00
Tor Egge 5f8dd62adf Move declaration of M_MFSNODE from mfs_vnops.c to mfsnode.h. 1997-11-01 20:40:14 +00:00
Tor Egge f97c4150dd Bring back mfs_reclaim(), which is used to reclaim the master vnode in MFS. 1997-11-01 20:19:44 +00:00
Bruce Evans ef91bd5734 Removed unused #includes. The need for most of them went away with
recent changes (docluster* and vfs improvements).
1997-10-27 13:33:47 +00:00
Bruce Evans 9405e2ed0c Forward declare precisely the structs that are actually used in this header. 1997-10-27 12:50:57 +00:00
Poul-Henning Kamp dba3870c10 VFS interior redecoration.
Rename vn_default_error to vop_defaultop all over the place.
Move vn_bwrite from vfs_bio.c to vfs_default.c and call it vop_stdbwrite.
Use vop_null instead of nullop.
Move vop_nopoll from vfs_subr.c to vfs_default.c
Move vop_sharedlock from vfs_subr.c to vfs_default.c
Move vop_nolock from vfs_subr.c to vfs_default.c
Move vop_nounlock from vfs_subr.c to vfs_default.c
Move vop_noislocked from vfs_subr.c to vfs_default.c
Use vop_ebadf instead of *_ebadf.
Add vop_defaultop for getpages on master vnode in MFS.
1997-10-26 20:55:39 +00:00
Poul-Henning Kamp 04754a5a13 I belive this fixes MFS after I broke it. 1997-10-20 19:53:26 +00:00
John Dyson 933880dd6e This might fix the mfs_badop problem left over with the cool VFS fixes.
PHK should check this.
1997-10-19 01:36:49 +00:00
Poul-Henning Kamp d54d34b533 Make a set of VOP standard lock, unlock & islocked VOP operators, which
depend on the lock being located at vp->v_data.  Saves 3x3 identical
vop procs, more as the other filesystems becomes lock aware.
1997-10-17 12:36:19 +00:00
Poul-Henning Kamp e9565321ea VFS clean up "hekto commit"
1.  Add defaults for more VOPs
        VOP_LOCK        vop_nolock
        VOP_ISLOCKED    vop_noislocked
        VOP_UNLOCK      vop_nounlock
    and remove direct reference in filesystems.

2.  Rename the nfsv2 vnop tables to improve sorting order.
1997-10-16 22:01:05 +00:00
Poul-Henning Kamp 987f569678 Another VFS cleanup "kilo commit"
1.  Remove VOP_UPDATE, it is (also) an UFS/{FFS,LFS,EXT2FS,MFS}
    intereface function, and now lives in the ufsmount structure.

2.  Remove VOP_SEEK, it was unused.

3.  Add mode default vops:

    VOP_ADVLOCK          vop_einval
    VOP_CLOSE            vop_null
    VOP_FSYNC            vop_null
    VOP_IOCTL            vop_enotty
    VOP_MMAP             vop_einval
    VOP_OPEN             vop_null
    VOP_PATHCONF         vop_einval
    VOP_READLINK         vop_einval
    VOP_REALLOCBLKS      vop_eopnotsupp

    And remove identical functionality from filesystems

4.   Add vop_stdpathconf, which returns the canonical stuff.  Use
     it in the filesystems.  (XXX: It's probably wrong that specfs
     and fifofs sets this vop, shouldn't it come from the "host"
     filesystem, for instance ufs or cd9660 ?)

5.   Try to make system wide VOP functions have vop_* names.

6.   Initialize the um_* vectors in LFS.

(Recompile your LKMS!!!)
1997-10-16 20:32:40 +00:00
Poul-Henning Kamp 8a32f8a5d5 Staticize the ufs vnops member functions. 1997-10-16 11:59:09 +00:00
Poul-Henning Kamp 1ccb82ef21 Remove an overlapping variable I created in last round.
Don't do pointer subtraction on void *

Use VOP_STRATEGY instead of homegrown stuff.

Add an XXX warning for LFS freaks to ponder.
1997-10-16 11:58:30 +00:00
Poul-Henning Kamp cec0f20ce7 VFS mega cleanup commit (x/N)
1.  Add new file "sys/kern/vfs_default.c" where default actions for
    VOPs go. Implement proper defaults for ABORTOP, BWRITE, LEASE,
    POLL, REVOKE and STRATEGY.  Various stuff spread over the entire
    tree belongs here.

2.  Change VOP_BLKATOFF to a normal function in cd9660.

3.  Kill VOP_BLKATOFF, VOP_TRUNCATE, VOP_VFREE, VOP_VALLOC.  These
    are private interface functions between UFS and the underlying
    storage manager layer (FFS/LFS/MFS/EXT2FS).  The functions now
    live in struct ufsmount instead.

4.  Remove a kludge of VOP_ functions in all filesystems, that did
    nothing but obscure the simplicity and break the expandability.
    If a filesystem doesn't implement VOP_FOO, it shouldn't have an
    entry for it in its vnops table.  The system will try to DTRT
    if it is not implemented.  There are still some cruft left, but
    the bulk of it is done.

5.  Fix another VCALL in vfs_cache.c (thanks Bruce!)
1997-10-16 10:50:27 +00:00
Julian Elischer 7d1f0a2825 Two more places where root filesystems were mounted, put them at the head of
the mount list  in case there is already  DEVFS present.
1997-10-16 08:16:34 +00:00
Poul-Henning Kamp 138ec1f71a vnops megacommit
1.  Use the default function to access all the specfs operations.
2.  Use the default function to access all the fifofs operations.
3.  Use the default function to access all the ufs operations.
4.  Fix VCALL usage in vfs_cache.c
5.  Use VOCALL to access specfs functions in devfs_vnops.c
6.  Staticize most of the spec and fifofs vnops functions.
7.  Make UFS panic if it lacks bits of the underlying storage handling.
1997-10-15 13:24:07 +00:00
Poul-Henning Kamp 6a525123aa Hmm, realign the vnops into two columns. 1997-10-15 10:05:29 +00:00
Poul-Henning Kamp 539ef70c2d Stylistic overhaul of vnops tables.
1. Remove comment stating the blatantly obvious.
        2. Align in two columns.
        3. Sort all but the default element alphabetically.
        4. Remove XXX comments pointing out entries not needed.
1997-10-15 09:22:02 +00:00
Bruce Evans ee57d34583 IN_HASHED goes in the in-core flags ip->i_flag, not in the on-disk flags
ip->i_flags.

Rev.1.18 completely broke ufs.  My root directory went away about 10
seconds after booting.  I think file system damage was null, since
IN_HASHED = 0x80 is not used in the disk flags (it would probably
be UF_SOMETHING if it were used).
1997-10-15 07:32:45 +00:00
Poul-Henning Kamp 072199cd57 Reset the flag right away, could catch a bogon someday. 1997-10-14 18:51:07 +00:00
Poul-Henning Kamp 40715905a7 I think my previous change may have opened a race conditio.
This patch does the same thing, with no change in semantics.
1997-10-14 18:46:48 +00:00
Poul-Henning Kamp 34a6a33036 ufs_ihashrem() should not be called from the UFS layer, but from the
lower layer (LFS/FFS/?) like the rest of the ihash functions.
Otherwise it is impossible to make a lower layer that doesn't use the
ihash facility.
1997-10-14 14:22:31 +00:00
Poul-Henning Kamp a1c995b626 Last major round (Unless Bruce thinks of somthing :-) of malloc changes.
Distribute all but the most fundamental malloc types.  This time I also
remembered the trick to making things static:  Put "static" in front of
them.

A couple of finer points by:	bde
1997-10-12 20:26:33 +00:00
Poul-Henning Kamp 55166637cd Distribute and statizice a lot of the malloc M_* types.
Substantial input from:	bde
1997-10-11 18:31:40 +00:00
Poul-Henning Kamp 2cfc47fbc8 Make ufs_reclaim free the underlying inode. 1997-10-10 18:18:13 +00:00
Poul-Henning Kamp 56b5da1c5e Use generic ufs_reclaim(). 1997-10-10 18:17:42 +00:00
Poul-Henning Kamp 0be6b890f9 Add type arg to ffs_mountfs and avoid examining v_tag to find out
if MFS is getting a free ride.

Use generic ufs_reclaim().
1997-10-10 18:17:00 +00:00
KATO Takenori 81bca6ddae Clustered read and write are switched at mount-option level.
1. Clustered I/O is switched by the MNT_NOCLUSTERR and MNT_NOCLUSTERW
   bits of the mnt_flag.  The sysctl variables, vfs.foo.doclusterread
   and vfs.foo.doclusterwrite are deleted.  Only mount option can
   control clustered I/O from userland.
2. When foofs_mount mounts block device, foofs_mount checks D_CLUSTERR
   and D_CLUSTERW bits of the d_flags member in the block device switch
   table.  If D_NOCLUSTERR / D_NOCLUSTERW are set, MNT_NOCLUSTERR /
   MNT_NOCLUSTERW bits will be set.  In this case, MNT_NOCLUSTERR and
   MNT_NOCLUSTERW cannot be cleared from userland.
3. Vnode driver disables both clustered read and write.
4. Union filesystem disables clutered write.

Reviewed by:	bde
1997-09-27 13:40:20 +00:00
Joerg Wunsch 6cce995019 Make MFS a supported option, finally. 1997-09-22 21:24:03 +00:00
Justin T. Gibbs 14d9217731 Convert tqdisksort to bufqdisksort. Honor the B_ORDERED buffer flag
so that meta-data writes go out to the device in the right order.
1997-09-21 22:10:49 +00:00
Justin T. Gibbs b686da5d68 Update for new buffer queue data structure. 1997-09-21 22:10:02 +00:00
John Dyson 99448ed11d Change the M_NAMEI allocations to use the zone allocator. This change
plus the previous changes to use the zone allocator decrease the useage
of malloc by half.  The Zone allocator will be upgradeable to be able
to use per CPU-pools, and has more intelligent usage of SPLs.  Additionally,
it has reasonable stats gathering capabilities, while making most calls
inline.
1997-09-21 04:24:27 +00:00
Poul-Henning Kamp ec1d10e413 [Regarding the previous patch] This is completely wrong.
1. ffs_alloc() actually allowed writing one block less one frag (normally
   7 frags or 7/8 blocks) beyond the limit.
2. freebufspace() gives the free space in frags, but `size' is in bytes,
   so the change results in approximately `size' fragments too many being
   reserved.
3. ffs_realloccg() has the same bug but wasn't changed.

PR:		3398
Submitted by:	bde
Eyeballed by:	phk
1997-09-19 11:13:16 +00:00
Poul-Henning Kamp 6772045776 Ffs_alloc allow users to write one block beyond the limit.
PR:		3398
Reviewed by:	phk
Submitted by:	Wolfram Schneider <wosch@apfel.de>
1997-09-18 18:07:45 +00:00
Peter Wemm a6aeade2c4 Convert select -> poll.
Delete 'always succeed' select/poll handlers, replaced with generic call.
Flag missing vnode op table entries.
1997-09-14 02:58:12 +00:00
Poul-Henning Kamp 375bbf8b88 Update the comment and remove checks now done centrally. 1997-09-10 19:47:37 +00:00
Bruce Evans 41fadeeb28 Removed yet more vestiges of config-time swap configuration and/or
cleaned up nearby cruft.
1997-09-07 16:21:11 +00:00
Bruce Evans e4ba6a82b0 Removed unused #includes. 1997-09-02 20:06:59 +00:00
Poul-Henning Kamp a051452ae2 Change the 0xdeadb hack to a flag called VDOOMED.
Introduce VFREE which indicates that vnode is on freelist.
Rename vholdrele() to vdrop().
Create vfree() and vbusy() to add/delete vnode from freelist.
Add vfree()/vbusy() to keep (v_holdcnt != 0 || v_usecount != 0)
  vnodes off the freelist.
Generalize vhold()/v_holdcnt to mean "do not recycle".
Fix reassignbuf()s lack of use of vhold().
Use vhold() instead of checking v_cache_src list.
Remove vtouch(), the vnodes are always vget'ed soon enough
  after for it to have any measuable effect.
Add sysctl debug.freevnodes to keep track of things.
Move cache_purge() up in getnewvnodes to avoid race.
Decrement v_usecount after VOP_INACTIVE(), put a vhold() on
  it during VOP_INACTIVE()
Unmacroize vhold()/vdrop()
Print out VDOOMED and VFREE flags (XXX: should use %b)

Reviewed by:		dyson
1997-08-31 07:32:39 +00:00
Poul-Henning Kamp 0fa2443f0e Uncut&paste cache_lookup().
This unifies several times in theory indentical 50 lines of code.

The filesystems have a new method: vop_cachedlookup, which is the
meat of the lookup, and use vfs_cache_lookup() for their vop_lookup
method.  vfs_cache_lookup() will check the namecache and pass on
to the vop_cachedlookup method in case of a miss.

It's still the task of the individual filesystems to populate the
namecache with cache_enter().

Filesystems that do not use the namecache will just provide the
vop_lookup method as usual.
1997-08-26 07:32:51 +00:00
John Dyson a5db4bf475 Back out some incorrect changes that was worse than the original bug. 1997-08-26 04:36:27 +00:00
KATO Takenori 804f67f778 Renamed doclusterread/write to unique names (ffs_doclusterread/write),
and staticize them.  Move the #include of <sys/sysctl.h> to the top of
the file.

Pointed out by:	Bruce Evans <bde@zeta.org.au>
1997-08-25 08:18:39 +00:00
John Dyson e5953c0e16 Fix the "remove optimization" by removing it. Sorry for the trouble. 1997-08-22 15:37:23 +00:00
John Dyson 89721f6f1a This is a trial improvement for the vnode reference count while on the vnode
free list problem.  Also, the vnode age flag is no longer used by the
vnode pager.  (It is actually incorrect to use then.)  Constructive
feedback welcome -- just be kind.
1997-08-22 03:56:37 +00:00
John Dyson 656b256cd5 Performance improvment to minimize delayed write output of files
that have been deleted.
Submitted by:	Peter M. Chen <pmchen@eecs.umich.edu>
1997-08-21 01:42:47 +00:00
Garrett Wollman 57bf258e3d Fix all areas of the system (or at least all those in LINT) to avoid storing
socket addresses in mbufs.  (Socket buffers are the one exception.)  A number
of kernel APIs needed to get fixed in order to make this happen.  Also,
fix three protocol families which kept PCBs in mbufs to not malloc them
instead.  Delete some old compatibility cruft while we're at it, and add
some new routines in the in_cksum family.
1997-08-16 19:16:27 +00:00
Poul-Henning Kamp 3758b280f2 We got a couple of "map mismatch" panics from the following
code.  According to the crash dump, bpref is set to 445
and cgp->cg_nclusterblks is 444.  Hence in the for loop,
the test fails immediately but the following failure check
(got == cgp->cg_nclusterblks) doesn't trigger because got >
cgp->cg_nclusterblks.  This wreaks havoc in the code after that.

Fix: Move one source bit to the left  :-)

Noticed by:	Mike Hibler <mike@fast.cs.utah.edu>
Submitted by:	Kirk McKusick <mckusick@McKusick.COM>
1997-08-04 07:30:43 +00:00
Bruce Evans 1fd0b0588f Removed unused #includes. 1997-08-02 14:33:27 +00:00
Bruce Evans ed1ab0dea2 Always mark st_ctime for update upon successful completion of
chown().  Previously, it wasn't marked for null chown()'s.  We
permit null chown()s as a special case of "appropriate privilege"
- everyone has enough priviilege to not change ids (this is a better
argument than the one I gave for rev.1.13, that null changes aren't
really changes).  However, POSIX.1 requires the update independently
of whether anything has changed.

Clear both the setuid and the setgid bits upon successful completion
of non-null chown()s by non-root.  Previously, the setuid bit was
only changed for non-null changes of the uid, etc.  POSIX.1 requires
clearing both unless the call was made by a process with "appropriate
privilege", in which case altering the bits is implementation-defined.
We define appropriate privilege as `process is root, or the change
is null', and the implementation-defined behaviour as not altering
the bits.   There is no interpretation that permits clearing only
one of the bits.

Reviewed by:	jdp
1997-07-13 16:26:40 +00:00
Bruce Evans 7e88aafca7 Use the correct size for a sector in the search for a label in
readdisklabel().  Sectors may be larger than DEV_BSIZE.
1997-07-13 15:53:20 +00:00
Bruce Evans 0dd8d85b1c Removed semicolon from the end of a #define. 1997-07-13 15:43:54 +00:00
Bruce Evans 3f9d0d120a Fixed comment about i_spare. 1997-07-13 15:40:31 +00:00
John Dyson 6b195d32a1 Fix a problem with the VN device. Specifically, the VN device can
cause a problem of spiraling death due to buffer resource limitations.
The vfs_bio code in general had little ability to handle buffer resource
management, and now it does.  Also, there are a lot more knobs for tuning the
vfs_bio code now.  The knobs came free because of the need that there
always be some immediately available buffers (non-delayed or locked) for
use.  Note that the buffer cache code is much less likely to get bogged
down with lots of delayed writes, even more so than before.
1997-06-15 17:56:53 +00:00
Julian Elischer 50dab48a5b Submitted by: Whistle Communications (archie Cobbs)
These changes add the ability to specify that a UFS file/directory
cannot be unlinked. This is basically a scaled back version
of the IMMUTABLE flag. The reason is to allow an administrator
to create a directory hierarchy that a group of users
can arbitrarily add/delete files from, but that the hierarchy
itself is safe from removal by them.
If the NOUNLINK definition is set to 0
then this results in no change to what happens normally.
(and results in identical binary (in the kernel)).
It can be proven that if this bit is never set by the admin,
no new behaviour is introduced..
Several "good idea" comments from reviewers plus one grumble
about creeping featurism.

This code is in production in 2.2 based systems
1997-06-02 06:24:52 +00:00
Peter Wemm 8413abe4c7 Fix warnings (from LINT). Missing static prototype, missing vm includes
for vnode_pager_setsize().
1997-05-25 04:57:11 +00:00
Poul-Henning Kamp f10c6b8f35 Shrink struct inode by 20 bytes, so that malloc wastes less space.
Pointed out by:	bde
1997-05-22 07:30:55 +00:00
Poul-Henning Kamp 8a40593f4d Remove redundant check for vp == dvp (done in VFS before calling). 1997-05-17 18:32:53 +00:00
Jordan K. Hubbard 0f10d94d32 Mount MFS read/write as in days of yore. 1997-04-28 09:15:18 +00:00
Bruce Evans 401116d519 Use smalllblktosize() instead of multiplying small block numbers
by fs->fs_bsize.  The macro is usually faster and makes it clearer
that the multiplication can't overflow.
1997-04-10 13:17:09 +00:00
Bruce Evans 95e7aeb4e1 Removed nested include of <ufs/ufs/dir.h>. Use the pre-Lite2 hack of
defining doff_t both here and in <ufs/ufs/dir.h> so that this file
is independent of <ufs/ufs/dir.h>.  It still has old prerequisites
<sys/param.h> and <ufs/ufs/quota.h>, and a new Lite2 prerequisite of
<sys/lock.h>, sigh.

This might fix lsof, which was broken by namespace pollution giving
conflicting definitions of DIRBLKSIZ.
1997-04-01 08:02:00 +00:00
Peter Wemm 6c14d95d0d Treat symlinks as first class citizens with their own uid/gid rather than
as shadows of their containing directory.  This should solve the problem
of users not being able to delete their symlinks from /tmp once and for
all.

Symlinks do not have modes though, they are accessable to everything that
can read the directory (as before).  They are made to show this fact at
lstat time (they appear as mode 0777 always, since that's how the the
lookup routines in the kernel treat them).

More commits will follow, eg: add a real lchown() syscall and man pages.
1997-03-31 12:02:53 +00:00
Bruce Evans fce002fdef Don't include <sys/ioctl.h> in the kernel. Stage 1: don't include
it when it is not used.  In most cases, the reasons for including it
went away when the special ioctl headers became self-sufficient.
1997-03-24 11:25:10 +00:00
Bruce Evans 90b42d7e40 Fixed corrupted newline and corrupted tab in previous commit. 1997-03-24 03:19:37 +00:00
Guido van Rooij 8f89943eda Add generation number randomization. Newly created filesystems wil now
automatically have random generation numbers. The kenel way of handling those
also changed. Further it is advised to run fsirand on all your nfs exported
filesystems. the code is mostly copied from OpenBSD, with the randomization
chanegd to use /dev/urandom
Reviewed by:	Garrett
Obtained from: OpenBSD
1997-03-23 20:08:22 +00:00
Bruce Evans 3ac4d1ef0c Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.
Fixed everything that depended on getting fcntl.h stuff from the wrong
place.  Most things don't depend on file.h stuff at all.
1997-03-23 03:37:54 +00:00
Bruce Evans 84232bd337 Merged the rest of lfs from Lite2. It compiles (uncleanly) but is as
unlikely to work as before.
1997-03-23 00:45:27 +00:00
Bruce Evans 20cb3c714b Merged enough of lfs from Lite2 for mkdep of LINT to work again. 1997-03-22 09:33:55 +00:00
Bruce Evans 774fce94c0 Removed volatile' from declaration of time', and removed the resulting
null casts.  `time' is nonvolatile for accesses within a region locked
by splclock()/splx().  Accesses outside such a region are invalid, and
splx() must have the side effect of potentially changing all global
variables (since there are hundreds of sort of volatile variables like
`time'), so declaring `time' as volatile didn't have any real benefits.
1997-03-22 08:03:51 +00:00
Bruce Evans 3c81694426 Fixed some invalid (non-atomic) accesses to `time', mostly ones of the
form `tv = time'.  Use a new function gettime().  The current version
just forces atomicicity without fixing precision or efficiency bugs.
Simplified some related valid accesses by using the central function.
1997-03-22 06:53:45 +00:00
Bruce Evans c16cb2c78b Backed out rev.1.27, which broke unmounting of mfs and caused panics
on shutdown.

Should not have been in 2.2 (the buggy last minute change, that is).
1997-03-22 03:59:46 +00:00
Peter Wemm c5d5416c2d MAXDIRSIZE is (or would be) used in fsck. It's a sanity check. 1997-03-18 19:52:17 +00:00
Peter Wemm cc9d89901f Restore the lost MNT_LOCAL flag twiddle. Lite2 has a different mechanism
of setting it (compiled into vfs_conf.c), but we have a dynamic system
in place.  This could probably be better done via a runtime configure
flag in the VFS_SET() VFS declaration, perhaps VFCF_LOCAL, and have the
VFS code propagate this down into MNT_LOCAL at mount time.  The other FS's
would need to be updated, havinf UFS and MSDOSFS filesystems without
MNT_LOCAL breaks a few things..  the man page rebuild scans for local
filesystems and currently fails, I suspect that other tools like find
and tar with their "local filesystem only" modes might be affected.
1997-03-18 19:50:12 +00:00
Søren Schmidt 6ae8358759 Fix support for != 512 byte sector devices.
Restores the use of SBLOCK instead of the BSOFF/sectorsize calculation.
Using SBLOCK is bogus however in that it uses DEV_BSIZE instead of
the actual sector size, but that is taken care of in other places.
Changing the SBLOCK would be better, but it affects the system
in other places, and doing it this way makes it possible to
use filesystems that was made before the lite2 merge.
1997-03-15 18:58:10 +00:00
Mike Pritchard d0ad3d988a Update a number of routines to reflect the actual name
of the routine that caused the panic.
1997-03-09 06:10:36 +00:00
Mike Pritchard 5ace3b260a Update a number of panic messages to reflect the actual name
of the routine that caused the panic.
1997-03-09 06:00:44 +00:00