Home | History | Annotate | Download | only in msdosfs
History log of /src/sys/fs/msdosfs/msdosfs_vnops.c
RevisionDateAuthorComments
 1.113  11-Sep-2024  perseant Move the comment intended to introduce msdosfs_fsync back above
msdosfs_fsync (it has been above the wrong function since 1996).
No functional change.
 1.112  18-Aug-2023  mrg fix the previous to not fail to include the extension in lookups.

copy deExtension into the final 3 bytes. previously, this was found
by having them next to each other in the containing structure, but as
separate strings.

thanks to miod for pointing this out.
 1.111  14-Aug-2023  mrg when calling a function that needs more bytes than we have, create a
stack variable long enough and use that instead.

found by GCC 12.
 1.110  23-Oct-2021  thorpej Sanitize the symbol namespace. NFC.
 1.109  23-Oct-2021  hannken Move msdosfs_rename() and doscheckpath() to new file msdosfs_rename.c.

No functional change.
 1.108  23-Oct-2021  hannken Factor out the lookup results from struct denode.

No functional change.
 1.107  20-Oct-2021  thorpej Overhaul of the EVFILT_VNODE kevent(2) filter:

- Centralize vnode kevent handling in the VOP_*() wrappers, rather than
forcing each individual file system to deal with it (except VOP_RENAME(),
because VOP_RENAME() is a mess and we currently have 2 different ways
of handling it; at least it's reasonably well-centralized in the "new"
way).
- Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ,
compatible with the same events in FreeBSD.
- Track which kevent notifications clients are interested in receiving
to avoid doing work for events no one cares about (avoiding, e.g.
taking locks and traversing the klist to send a NOTE_WRITE when
someone is merely watching for a file to be deleted, for example).

In support of the above:

- Add support in vnode_if.sh for specifying PRE- and POST-op handlers,
to be invoked before and after vop_pre() and vop_post(), respectively.
Basic idea from FreeBSD, but implemented differently.
- Add support in vnode_if.sh for specifying CONTEXT fields in the
vop_*_args structures. These context fields are used to convey information
between the file system VOP function and the VOP wrapper, but do not
occupy an argument slot in the VOP_*() call itself. These context fields
are initialized and subsequently interpreted by PRE- and POST-op handlers.
- Version VOP_REMOVE(), uses the a context field for the file system to report
back the resulting link count of the target vnode. Return this in tmpfs,
udf, nfs, chfs, ext2fs, lfs, and ufs.

NetBSD 9.99.92.
 1.106  18-Jul-2021  dholland Abolish all the silly indirection macros for initializing vnode ops tables.

These are things of the form #define foofs_op genfs_op, or #define
foofs_op genfs_eopnotsupp, or similar. They serve no purpose besides
obfuscation, and have gotten cutpasted all over everywhere.
 1.105  29-Jun-2021  dholland - Add a new vnode op: VOP_PARSEPATH.
- Move namei_getcomponent to genfs_vnops.c and call it genfs_parsepath.
- Add a parsepath entry to every vnode ops table.

VOP_PARSEPATH takes a directory vnode to be searched and a complete
following path and chooses how much of that path to consume. To begin
with, all parsepath calls are genfs_parsepath, which locates the first
'/' as always.

Note that the call doesn't take the whole struct componentname, only
the string. The other bits of struct componentname should not be
needed and there's no reason to cause potential complications by
exposing them.
 1.104  27-Jun-2020  christos branches: 1.104.6;
Introduce genfs_pathconf() and use it for the default case in all filesystems.
 1.103  16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.102  23-Apr-2020  ad PR kern/54759 (vm.ubc_direct deadlock when read()/write() into mapping of itself)

- Add new flag UBC_ISMAPPED which tells ubc_uiomove() the object is mmap()ed
somewhere. Use it to decide whether to do direct-mapped copy, rather than
poking around directly in the vnode in ubc_uiomove(), which is ugly and
doesn't work for tmpfs. It would be nicer to contain all this in UVM but
the filesystem provides the needed locking here (VV_MAPPED) and to
reinvent that would suck more.

- Rename UBC_UNMAP_FLAG() to UBC_VNODE_FLAGS(). Pass in UBC_ISMAPPED where
appropriate.
 1.101  13-Apr-2020  ad Replace most uses of vp->v_usecount with a call to vrefcnt(vp), a function
that hides the details and does atomic_load_relaxed(). Signature matches
FreeBSD.
 1.100  23-Feb-2020  ad branches: 1.100.4;
UVM locking changes, proposed on tech-kern:

- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart. v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap. Others to follow later.
 1.99  18-Sep-2019  christos branches: 1.99.2;
Add newly created vnodes to the namei cache. The rest of the filesystems
already did that (or they don't support writing). Discussed in tech-kern.
 1.98  26-Apr-2017  riastradh branches: 1.98.12;
Change VOP_REMOVE and VOP_RMDIR to preserve lock/ref on dvp.

No change to vp -- the plan is to replace the node by the
componentname in the vop parameters, and let all directory vops do
lookups internally.

Proposed on tech-kern with no objections:
https://mail-index.netbsd.org/tech-kern/2017/04/17/msg021825.html
 1.97  01-Mar-2017  hannken Remove now redundant calls to fstrans_start()/fstrans_done().
 1.96  01-Feb-2016  christos branches: 1.96.2; 1.96.4;
- split a long line.
- remove extra test.
- move d_namlen setting to msdosfs_vnops.c to avoid the ifdef.
 1.95  01-Feb-2016  christos We can't depend on dp->d_namlen existing for the parts that are used in
makefs(8).
 1.94  30-Jan-2016  mlelstv Add support to msdosfs and makefs to generate correct Unicode (UCS-2) directory
entries from UTF8 encoded file names.
 1.93  04-Apr-2015  riastradh Fix remaining read(fd, NULL, 1) cases.
 1.92  28-Mar-2015  maxv Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
 1.91  25-Jul-2014  dholland branches: 1.91.4;
Add VOP_FALLOCATE and VOP_FDISCARD to every vnode ops table I can
find.

The filesystem ones all call genfs_eopnotsupp - right now I am only
implementing the plumbing and we can implement fallocate and/or
fdiscard for files later.

The device ones call spec_fallocate (which is also genfs_eopnotsupp)
and spec_fdiscard, which dispatches to the device-level op.

The fifo ones all call vn_fifo_bypass, which also ends up being
EOPNOTSUPP.
 1.90  08-Jul-2014  hannken Change msdosfs from hashlist to vcache:
- Use (dir_cluster, dir_offset, dir_generation) as key, where
dir_generation is non-zero and unique for unlinked but open nodes.
- Change deget() to return a vnode as it is unsafe to return a
referenced but unlocked denode.
 1.89  23-Jan-2014  hannken branches: 1.89.2;
Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30
 1.88  17-Jan-2014  hannken Change vnode operations create, mknod, mkdir and symlink to keep the
directory node dvp locked on return.

Discussed on tech-kern@

Welcome to 6.99.29
 1.87  02-Nov-2013  hannken Stop using v_mount of an unreferenced vnode -- save the mount while
the vnode has a reference.
 1.86  18-Mar-2013  plunky branches: 1.86.6;
C99 section 6.7.2.3 (Tags) Note 3 states that:

A type specifier of the form

enum identifier

without an enumerator list shall only appear after the type it
specifies is complete.

which means that we cannot pass an "enum vtype" argument to
kauth_access_action() without fully specifying the type first.
Unfortunately there is a complicated include file loop which
makes that difficult, so convert this minimal function into a
macro (and capitalize it).

(ok elad@)
 1.85  28-Dec-2012  hannken Move the initialization of n to after the error branch.

From Taylor R Campbell <riastradh@netbsd.org>
 1.84  20-Dec-2012  hannken Change bread() and breadn() to never return a buffer on
error and modify all callers to not brelse() on error.

Welcome to 6.99.16

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
 1.83  29-Apr-2012  chs branches: 1.83.2;
change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
 1.82  03-Apr-2012  njoly Add missing braces in previous commit.
 1.81  02-Apr-2012  njoly Report the SF_ARCHIVED file flag if set.
 1.80  13-Mar-2012  elad Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
 1.79  21-Nov-2011  hannken branches: 1.79.2; 1.79.4;
Add missing fstrans_done().

Should fix PR #45635 (KASSERT "fli->fli_trans_cnt == 0" failed)
 1.78  20-Jul-2011  hannken branches: 1.78.2;
Even though msdosfs never truncates file names it advertises _PC_NO_TRUNC
as zero. Make it advertise one (no_trunc == true).

Names longer than NAME_MAX (255) will never pass namei() btw.

Fixes PR #43670 (msdosfs claims support for filenames longer than {NAME_MAX},
but fails)
 1.77  16-Jun-2011  hannken Rename uvm_vnp_zerorange(struct vnode *, off_t, size_t) to
ubc_zerorange(struct uvm_object *, off_t, size_t, int) changing
the first argument to an uvm_object and adding a flags argument.

Modify tmpfs_reg_resize() to zero the backing store (aobj) instead
of the vnode. Ubc_purge() no longer panics when unmounting tmpfs.

Keep uvm_vnp_zerorange() until the next kernel version bump.
 1.76  12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.75  26-Apr-2011  hannken branches: 1.75.2;
Change vflushbuf() to return an error if a synchronous write fails.

Welcome to 5.99.51.
 1.74  20-Mar-2011  hannken When extending a file, either by truncating or by writing past EOF make
sure the unallocated remainder of the last page gets zeroed.

Detected by fsx.
 1.73  19-Mar-2011  hannken Remove a vnode reference leak from msdosfs_rename. Release tdvp if either
doscheckpath() or relookup() fails.

Adjust test fs/vfs/t_vnops.c and remove the link count test for msdos.

Fixes PR #44661
 1.72  03-Mar-2011  pooka In rename, use char[12]�for new names instead of [11]. At least
one routine called from here (unix2dosfn) expects and uses all of
a [12].

This may fix the "stack size exceeded" problem which has been
triggering in gson's test runs. (i'm not entirely sure why it
doesn't trigger in anyone else's env)
 1.71  02-Jan-2011  dholland branches: 1.71.2; 1.71.4;
Remove the special refcount behavior (adding an extra reference to the
parent dir) associated with SAVESTART in relookup().

Check all call sites to make sure that SAVESTART wasn't set while
calling relookup(); if it was, adjust the refcount behavior. Remove
related references to SAVESTART.

The only code that was reaching the extra ref was msdosfs_rename,
where the refcount behavior was already fairly broken and/or gross;
repair it.

Add a dummy 4th argument to relookup to make sure code that hasn't
been inspected won't compile. (This will go away next time the
relookup semantics change, which they will.)
 1.70  30-Nov-2010  dholland Abolish the SAVENAME and HASBUF flags. There is now always a buffer,
so the path in a struct componentname is now always valid during VOP
calls.
 1.69  30-Nov-2010  dholland Abolish struct componentname's cn_pnbuf. Use the path buffer in the
pathbuf object passed to namei as work space instead. (For now a pnbuf
pointer appears in struct nameidata, to support certain unclean things
that haven't been fixed yet, but it will be going away in the future.)

This removes the need for the SAVENAME and HASBUF namei flags.
 1.68  22-Jul-2010  njoly Remove bad cast, fix compilation with MSDOSFS_DEBUG.
 1.67  24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.66  25-May-2010  pooka Don't double unlock fvp if source file disappears during rename.
Problem found by njoly's awesome stresstester.
 1.65  23-Apr-2010  pooka Enforce RLIMIT_FSIZE before VOP_WRITE. This adds support to file
system drivers where it was missing from and fixes one buggy
implementation. The arguably weird semantics of the check are
maintained (v_size vs. va_bytes, overwrite).
 1.64  09-Apr-2010  hannken Add file system suspension support (vfs_suspend(9)) to msdosfs.

Reviewed by: Antti Kantee <pooka@netbsd.org>
 1.63  08-Apr-2010  pooka In genfs where available.

The only functional change is mknod now returning EOPNOTSUPP instead
of EINVAL. I make this sacrifice willingly and with a clean conscience.
 1.62  08-Apr-2010  pooka Use genfs instead of homegrown stuff where possible.
 1.61  03-Jul-2009  elad branches: 1.61.2; 1.61.4;
Where possible, extract the file-system's access() routine to two internal
functions: the first checking if the operation is possible (regardless of
permissions), the second checking file-system permissions, ACLs, etc.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005311.html
 1.60  23-Jun-2009  elad Move the implementation of vaccess() to genfs_can_access(), in line with
the other routines of the same spirit.

Adjust file-system code to use it.

Keep vaccess() for KPI compatibility and to keep element of least
surprise. A "diagnostic" message warning that vaccess() is deprecated will
be printed when it's used (obviously, only in DIAGNOSTIC kernels).

No objections on tech-kern@:

http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005310.html
 1.59  07-May-2009  elad Extract the open-coded authorization logic for chtimes() from various
file-systems and put it in a single function, genfs_can_chtimes().

This also makes UDF follow the same policy as all other file-systems.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/27/msg004951.html
 1.58  14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.57  11-Jan-2009  cegger branches: 1.57.2;
make this compile
 1.56  11-Jan-2009  christos merge christos-time_t
 1.55  28-Nov-2008  pooka Tyop: v -> vp. Spotted by Tom's ARM builds.
 1.54  26-Nov-2008  pooka Rototill all remaining file systems to use ubc_uiomove() instead
of the ubc_alloc() - uiomove() - ubc_release() dance.
 1.53  14-Nov-2008  pooka In case writing past EOF, fail if extending the file fails (most
likely due to the file system being full).

Otherwise we'd fail in VOP_PUTPAGES(), which might not happen during
VOP_WRITE(), thus giving the caller the wrong impression that
writing was succesful.
 1.52  16-May-2008  hannken branches: 1.52.4; 1.52.6; 1.52.10;
Make sure all cached buffers with valid, not yet written data have been
run through copy-on-write. Call fscow_run() with valid data where possible.

The LP_UFSCOW hack is no longer needed to protect ffs_copyonwrite() against
endless recursion.

- Add a flag B_MODIFY to bread(), breada() and breadn(). If set the caller
intends to modify the buffer returned.

- Always run copy-on-write on buffers returned from ffs_balloc().

- Add new function ffs_getblk() that gets a buffer, assigns a new blkno,
may clear the buffer and runs copy-on-write. Process possible errors
from getblk() or fscow_run(). Part of PR kern/38664.

Welcome to 4.99.63

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
 1.51  30-Apr-2008  ad branches: 1.51.2;
Make various bits of debug code compile again.
 1.50  24-Apr-2008  ad branches: 1.50.2;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.49  30-Jan-2008  ad branches: 1.49.6; 1.49.8;
Replace struct lock on vnodes with a simpler lock object built on
krwlock_t. This is a step towards removing lockmgr and simplifying
vnode locking. Discussed on tech-kern.
 1.48  25-Jan-2008  ad Remove VOP_LEASE. Discussed on tech-kern.
 1.47  05-Jan-2008  christos PR/37696: Paul Ripke: add large read / readahead support (Introduce run-length
detection to msdosfs_bmap(), from FreeBSD)
 1.46  02-Jan-2008  ad Merge vmlocking2 to head.
 1.45  28-Dec-2007  reinoud Use uvm_vnp_setwritesize() on file extending to instruct UVM to NOT read-in
the newly added space first. This significantly speeds up write speed for
msdosfs and making it at par with ffs wich already had this patched.

Speed increase measured on my IDE disc from 2Mb/sec to 32 Mb/sec
 1.44  26-Nov-2007  pooka branches: 1.44.2; 1.44.6;
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
 1.43  14-Nov-2007  pooka Fix a problem noticed by Reinoud: the fs would try to release an
unlocked vnode when trying to rename a directory. The fix was to
shuffle some bits around and #pray.

The rename routine actually needs a very very major wide-angle whopping:
* it takes locks out-of-order
* it deals with references from SAVESTART lookups in interesting ways
* I doubt there is any guarantee for correct operation if there
are multiple concurrent accesses
* the error branches might just as well call panic() directly
 1.42  08-Oct-2007  ad branches: 1.42.2; 1.42.4;
Merge brelse() changes from the vmlocking branch.
 1.41  24-Sep-2007  rumble Avoid stack allocation of large dirent structures in foo_readdir().
 1.40  29-Jul-2007  rumble branches: 1.40.4; 1.40.6; 1.40.8; 1.40.10;
Use _DIRENT_MINSIZE when determining the number of NFS cookies to allocate,
rather than hard-coding 16.
 1.39  19-Apr-2007  yamt branches: 1.39.2;
hold proclist_mutex when calling psignal().
 1.38  04-Mar-2007  christos branches: 1.38.2; 1.38.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.37  21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.36  04-Jan-2007  elad branches: 1.36.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.35  09-Dec-2006  chs a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
these now always return the parent vnode locked. namei() works as before.
lookup() and various other paths no longer acquire vnode locks in the
wrong order via vrele(). fixes PR 32535.
as a nice side effect, path lookup is also up to 25% faster.
- the above allows us to get rid of PDIRUNLOCK.
- also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
- remove an assumption in layer_node_find() that all file systems implement
a recursive VOP_LOCK() (unionfs doesn't).
- require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
fill in eopnotsupp() for file systems that don't support being exported
and remove the checks for NULL. (layerfs calls these without checking.)
- in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
adjust which vnode is locked. fixes PR 33374.
- apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
 1.34  25-Nov-2006  scw branches: 1.34.2;
Support FAT filesystems on non-DEV_BSIZE media.

Based on the patches provided in PR kern/17398 by Trevin Beattie.
 1.33  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.32  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.31  22-Sep-2006  xtraeme Apply patch from PR kern/34583 sent by Rhialto, quoting him:

"Add a 3rd entry in the cache, which keeps the end position
from just before extending a file.
This has the desired effect of keeping the write speed constant."

And yes, that helps a lot copying large files... always at full speed
now. This closes my PR kern/30868 "Poor performance copying large files
on msdosfs".

Also remove a 2 if-statements testing the same condition, combine them.

All that from Rhialto, thank you very much.
 1.30  23-Jul-2006  ad branches: 1.30.2; 1.30.4; 1.30.6;
Use the LWP cached credentials where sane.
 1.29  07-Jun-2006  kardel merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.28  14-May-2006  elad branches: 1.28.2;
integrate kauth.
 1.27  14-Apr-2006  christos Coveriry CID 733: Remove dead code.
 1.26  01-Mar-2006  yamt branches: 1.26.2; 1.26.4; 1.26.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.25  14-Jan-2006  christos branches: 1.25.2; 1.25.4;
Protect against uio_lwp being NULL from Pavel Cahyna
 1.24  11-Dec-2005  christos branches: 1.24.2;
merge ktrace-lwp.
 1.23  29-Nov-2005  yamt merge yamt-readahead branch.
 1.22  04-Nov-2005  christos branches: 1.22.2;
PR/32003: Brian Buhrow: msdosfs doesn't properly zero out high cluster data
on non-FAT32 msdos filesystems.
 1.21  02-Nov-2005  yamt merge yamt-vop branch. remove following VOPs.

VOP_BLKATOFF
VOP_VALLOC
VOP_BALLOC
VOP_REALLOCBLKS
VOP_VFREE
VOP_TRUNCATE
VOP_UPDATE
 1.20  12-Sep-2005  christos branches: 1.20.2;
Use nanotime() to update the time fields in filesystems. Convert the code
from macros to real functions. Original patch and review from chuq.
Note: ext2fs only keeps seconds in the on-disk inode, and msdosfs does not
have enough precision for all fields, so this is not very useful for those
two.
 1.19  10-Sep-2005  christos Make fileno calculations use ino_t variables.
 1.18  29-Aug-2005  xtraeme Remove __P()
 1.17  29-Aug-2005  xtraeme The maximum file size on MS-DOS filesystems is 4 GB - 1 byte, so
don't bother trying to write files bigger than this. Just return
EFBIG to caller, rather than panic()ing later.

From OpenBSD.

This closes my PR kern/30864: "panic when copying files of >4GB on msdosfs"
 1.16  19-Aug-2005  christos fileid is now a quad.
 1.15  19-Aug-2005  christos 64 bit inode changes.
 1.14  26-Feb-2005  perry branches: 1.14.2; 1.14.4;
nuke trailing whitespace
 1.13  09-Jan-2005  chs branches: 1.13.2; 1.13.4;
adjust the UBC mapping code to support non-vnode uvm_objects.
this means we can no longer look at the vnode size to determine how many
pages to request in a fault, which is good since for NFS the size can change
out from under us on the server anyway. there's also a new flag UBC_UNMAP
for ubc_release(), so that the file system code can make the decision about
whether to cache mappings for files being used as executables.
 1.12  13-Sep-2004  jdolecek set mp->mnt_stat.f_namemax on filesystem mount for use by statvfs, and use
the value for also pathconf(_PC_NAME_MAX) to keep the two in sync
 1.11  12-May-2004  jrf caddr_t -> void * and removal of some more casts.
 1.10  04-May-2004  jrf Remove caddr_t inlines. Approved by christos@NetBSD.org.
 1.9  26-Jan-2004  hannken branches: 1.9.2; 1.9.4;
Fix xxx_strategy() to use the vnode arg instead of bp->b_vp.
 1.8  25-Jan-2004  hannken Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.

VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp) Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp) Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
 1.7  07-Sep-2003  itojun add -t option for gmt time offset (normally MS-DOS filesystem has timestamp
in localtime, not GMT). PR kern/22717
 1.6  02-Aug-2003  jdolecek Allow separate masks for files and directories. Useful e.g. to turn
the execute bit off for files, but keep search permission for directories.
Change contributed in PR kern/21538 by Pavel Arnost, based on some FreeBSD
patches.
Further manpage changes, and backward-compatibility adjustments done by me.

Also fixes PR kern/16778 by Johan Danielsson, and PR kern/3400 by Rick Byers
 1.5  29-Jun-2003  fvdl branches: 1.5.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.4  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.3  26-Jun-2003  itojun strlcpy
 1.2  25-Feb-2003  jdolecek make 'dosdirtemplate' static const
 1.1  26-Dec-2002  jdolecek branches: 1.1.2;
move msdosfs code from sys/msdosfs to sys/fs/msdosfs
 1.1.2.2  29-Dec-2002  thorpej With with HEAD.
 1.1.2.1  26-Dec-2002  thorpej file msdosfs_vnops.c was added on branch nathanw_sa on 2002-12-29 19:56:06 +0000
 1.5.2.8  11-Dec-2005  christos Sync with head.
 1.5.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.2.5  17-Jan-2005  skrll Sync with HEAD.
 1.5.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.5.2.2  03-Aug-2004  skrll Sync with HEAD
 1.5.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.9.4.2  06-Nov-2005  riz Pull up following revision(s) (requested by christos in ticket #5972):
sys/fs/msdosfs/denode.h: revision 1.10
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.22
PR/32003: Brian Buhrow: msdosfs doesn't properly zero out high cluster data
on non-FAT32 msdos filesystems.
 1.9.4.1  06-Sep-2005  riz Pull up following revision(s) (requested by xtraeme in ticket #5627):
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.17
sys/fs/msdosfs/denode.h: revision 1.6
The maximum file size on MS-DOS filesystems is 4 GB - 1 byte, so
don't bother trying to write files bigger than this. Just return
EFBIG to caller, rather than panic()ing later.
From OpenBSD.
This closes my PR kern/30864: "panic when copying files of >4GB on
msdosfs"
 1.9.2.1  06-Sep-2005  riz Pull up following revision(s) (requested by xtraeme in ticket #5627):
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.17
sys/fs/msdosfs/denode.h: revision 1.6
The maximum file size on MS-DOS filesystems is 4 GB - 1 byte, so
don't bother trying to write files bigger than this. Just return
EFBIG to caller, rather than panic()ing later.
From OpenBSD.
This closes my PR kern/30864: "panic when copying files of >4GB on
msdosfs"
 1.13.4.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.2.1  29-Apr-2005  kent sync with -current
 1.14.4.9  04-Feb-2008  yamt sync with head.
 1.14.4.8  21-Jan-2008  yamt sync with head
 1.14.4.7  07-Dec-2007  yamt sync with head
 1.14.4.6  15-Nov-2007  yamt sync with head.
 1.14.4.5  27-Oct-2007  yamt sync with head.
 1.14.4.4  03-Sep-2007  yamt sync with head.
 1.14.4.3  26-Feb-2007  yamt sync with head.
 1.14.4.2  30-Dec-2006  yamt sync with head.
 1.14.4.1  21-Jun-2006  yamt sync with head.
 1.14.2.3  06-Oct-2006  ghen Pull up following revision(s) (requested by xtraeme in ticket #1525):
sys/fs/msdosfs/denode.h: revision 1.14
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.31
sys/fs/msdosfs/msdosfs_fat.c: revision 1.11
Apply patch from PR kern/34583 sent by Rhialto, quoting him:
"Add a 3rd entry in the cache, which keeps the end position
from just before extending a file.
This has the desired effect of keeping the write speed constant."
And yes, that helps a lot copying large files... always at full speed
now. This closes my PR kern/30868 "Poor performance copying large files
on msdosfs".
Also remove a 2 if-statements testing the same condition, combine them.
All that from Rhialto, thank you very much.
 1.14.2.2  06-Nov-2005  tron Pull up following revision(s) (requested by christos in ticket #937):
sys/fs/msdosfs/denode.h: revision 1.10
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.22
PR/32003: Brian Buhrow: msdosfs doesn't properly zero out high cluster data
on non-FAT32 msdos filesystems.
 1.14.2.1  02-Sep-2005  riz Pull up following revision(s) (requested by xtraeme in ticket #722):
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.17
sys/fs/msdosfs/denode.h: revision 1.6
The maximum file size on MS-DOS filesystems is 4 GB - 1 byte, so
don't bother trying to write files bigger than this. Just return
EFBIG to caller, rather than panic()ing later.
From OpenBSD.
This closes my PR kern/30864: "panic when copying files of >4GB on
msdosfs"
 1.20.2.1  20-Oct-2005  yamt adapt msdosfs.
 1.22.2.3  19-Nov-2005  yamt - as read-ahead context is per-vnode now,
there are less reasons to make VOP_READ call uvm_ra_request explicitly.
move it to pager (uvn_get) so that it can handle accesses via mmap as well.
- pass advice to pager via ubc.
- tweak DPRINTF.

XXX can be disturbed by PGO_LOCKED.

XXX it's controversial where it should be done.
(uvm_fault, uvn_get or genfs_getpages.)
 1.22.2.2  18-Nov-2005  yamt - associate read-ahead context to vnode, rather than file.
- revert VOP_READ prototype.
 1.22.2.1  15-Nov-2005  yamt adapt the rest of filesystems which use genfs_getpages.
 1.24.2.2  18-Feb-2006  yamt adapt the rest of MI code.
 1.24.2.1  15-Jan-2006  yamt sync with head.
 1.25.4.3  01-Jun-2006  kardel Sync with head.
 1.25.4.2  22-Apr-2006  simonb Sync with head.
 1.25.4.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.25.2.1  09-Sep-2006  rpaulo sync with head
 1.26.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.26.4.4  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.26.4.3  19-Apr-2006  elad sync with head.
 1.26.4.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.26.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.26.2.3  11-Aug-2006  yamt sync with head
 1.26.2.2  26-Jun-2006  yamt sync with head.
 1.26.2.1  24-May-2006  yamt sync with head.
 1.28.2.1  19-Jun-2006  chap Sync with head.
 1.30.6.2  10-Dec-2006  yamt sync with head.
 1.30.6.1  22-Oct-2006  yamt sync with head
 1.30.4.2  12-Jan-2007  ad Sync with head.
 1.30.4.1  18-Nov-2006  ad Sync with head.
 1.30.2.1  23-Sep-2006  ghen Pull up following revision(s) (requested by xtraeme in ticket #206):
sys/fs/msdosfs/denode.h: revision 1.14
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.31
sys/fs/msdosfs/msdosfs_fat.c: revision 1.11
Apply patch from PR kern/34583 sent by Rhialto, quoting him:
"Add a 3rd entry in the cache, which keeps the end position
from just before extending a file.
This has the desired effect of keeping the write speed constant."
And yes, that helps a lot copying large files... always at full speed
now. This closes my PR kern/30868 "Poor performance copying large files
on msdosfs".
Also remove a 2 if-statements testing the same condition, combine them.
All that from Rhialto, thank you very much.
 1.34.2.2  01-Feb-2008  riz Pull up following revision(s) (requested by pooka in ticket #1007):
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.43
Fix a problem noticed by Reinoud: the fs would try to release an
unlocked vnode when trying to rename a directory. The fix was to
shuffle some bits around and #pray.
The rename routine actually needs a very very major wide-angle whopping:
* it takes locks out-of-order
* it deals with references from SAVESTART lookups in interesting ways
* I doubt there is any guarantee for correct operation if there
are multiple concurrent accesses
* the error branches might just as well call panic() directly
 1.34.2.1  17-Feb-2007  tron branches: 1.34.2.1.2;
Apply patch (requested by chs in ticket #422):
- Fix various deadlock problems with nullfs and unionfs.
- Speed up path lookups by upto 25%.
 1.34.2.1.2.1  03-Jun-2008  skrll Sync with netbsd-4.
 1.36.2.3  07-May-2007  yamt sync with head.
 1.36.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.36.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.38.4.1  11-Jul-2007  mjf Sync with head.
 1.38.2.6  09-Oct-2007  ad Sync with head.
 1.38.2.5  20-Aug-2007  ad Sync with HEAD.
 1.38.2.4  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.38.2.3  08-Jun-2007  ad Sync with head.
 1.38.2.2  13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.38.2.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.39.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.40.10.2  29-Jul-2007  rumble Use _DIRENT_MINSIZE when determining the number of NFS cookies to allocate,
rather than hard-coding 16.
 1.40.10.1  29-Jul-2007  rumble file msdosfs_vnops.c was added on branch matt-mips64 on 2007-07-29 21:17:42 +0000
 1.40.8.2  14-Oct-2007  yamt sync with head.
 1.40.8.1  06-Oct-2007  yamt sync with head.
 1.40.6.3  23-Mar-2008  matt sync with HEAD
 1.40.6.2  09-Jan-2008  matt sync with HEAD
 1.40.6.1  06-Nov-2007  matt sync with HEAD
 1.40.4.4  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.40.4.3  21-Nov-2007  joerg Sync with HEAD.
 1.40.4.2  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.40.4.1  02-Oct-2007  joerg Sync with HEAD.
 1.42.4.3  18-Feb-2008  mjf Sync with HEAD.
 1.42.4.2  08-Dec-2007  mjf Sync with HEAD.
 1.42.4.1  19-Nov-2007  mjf Sync with HEAD.
 1.42.2.1  18-Nov-2007  bouyer Sync with HEAD
 1.44.6.2  08-Jan-2008  bouyer Sync with HEAD
 1.44.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.44.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.49.8.1  18-May-2008  yamt sync with head.
 1.49.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.49.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.50.2.5  11-Aug-2010  yamt sync with head.
 1.50.2.4  18-Jul-2009  yamt sync with head.
 1.50.2.3  16-May-2009  yamt sync with head
 1.50.2.2  04-May-2009  yamt sync with head.
 1.50.2.1  16-May-2008  yamt sync with head.
 1.51.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.52.10.4  27-Dec-2008  christos merge with head.
 1.52.10.3  20-Nov-2008  christos merge with head.
 1.52.10.2  09-Nov-2008  christos account for major and minor being unsigned long long
 1.52.10.1  16-May-2008  christos file msdosfs_vnops.c was added on branch christos-time_t on 2008-11-09 02:05:20 +0000
 1.52.6.2  28-Apr-2009  skrll Sync with HEAD.
 1.52.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.52.4.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.57.2.2  23-Jul-2009  jym Sync with HEAD.
 1.57.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.61.4.6  31-May-2011  rmind sync with head
 1.61.4.5  21-Apr-2011  rmind sync with head
 1.61.4.4  05-Mar-2011  rmind sync with head
 1.61.4.3  03-Jul-2010  rmind sync with head
 1.61.4.2  30-May-2010  rmind sync with head
 1.61.4.1  16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.61.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.61.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.71.4.1  05-Mar-2011  bouyer Sync with HEAD
 1.71.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.75.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.78.2.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.78.2.3  23-Jan-2013  yamt sync with head
 1.78.2.2  23-May-2012  yamt sync with head.
 1.78.2.1  17-Apr-2012  yamt sync with head
 1.79.4.2  07-May-2012  riz Pull up following revision(s) (requested by chs in ticket #204):
sys/fs/sysvbfs/sysvbfs_vnops.c: revision 1.44
sys/ufs/ffs/ffs_vfsops.c: revision 1.277
sys/fs/v7fs/v7fs_vnops.c: revision 1.11
sys/ufs/chfs/chfs_vnops.c: revision 1.7
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.61
sys/miscfs/genfs/genfs_io.c: revision 1.54
sys/kern/vfs_wapbl.c: revision 1.52
sys/uvm/uvm_pager.h: revision 1.43
sys/ufs/ffs/ffs_vnops.c: revision 1.121
sys/kern/vfs_subr.c: revision 1.434
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.83
sys/fs/ntfs/ntfs_vnops.c: revision 1.51
sys/fs/udf/udf_subr.c: revision 1.119
sys/miscfs/specfs/spec_vnops.c: revision 1.135
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.103
sys/fs/udf/udf_vnops.c: revision 1.71
sys/ufs/ufs/ufs_readwrite.c: revision 1.104
change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
mark all wapbl I/O as BPRIO_TIMECRITICAL.
this is the second part of addressing PR 46325.
 1.79.4.1  06-Apr-2012  riz Pull up following revision(s) (requested by njoly in ticket #161):
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.81
sys/fs/msdosfs/msdosfs_vnops.c: revision 1.82
Report the SF_ARCHIVED file flag if set.
Add missing braces in previous commit.
 1.79.2.2  02-Jun-2012  mrg sync to latest -current.
 1.79.2.1  05-Apr-2012  mrg sync to latest -current.
 1.83.2.4  03-Dec-2017  jdolecek update from HEAD
 1.83.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.83.2.2  23-Jun-2013  tls resync from head
 1.83.2.1  25-Feb-2013  tls resync with head
 1.86.6.1  18-May-2014  rmind sync with head
 1.89.2.1  10-Aug-2014  tls Rebase.
 1.91.4.3  28-Aug-2017  skrll Sync with HEAD
 1.91.4.2  19-Mar-2016  skrll Sync with HEAD
 1.91.4.1  06-Apr-2015  skrll Sync with HEAD
 1.96.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.96.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.98.12.3  21-Apr-2020  martin Sync with HEAD
 1.98.12.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.98.12.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.99.2.1  29-Feb-2020  ad Sync with head.
 1.100.4.2  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.100.4.1  20-Apr-2020  bouyer Sync with HEAD
 1.104.6.1  01-Aug-2021  thorpej Sync with HEAD.

RSS XML Feed