Home | History | Annotate | only in /src/sys/fs/msdosfs
History log of /src/sys/fs/msdosfs
RevisionDateAuthorComments
 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 Makefile was added on branch nathanw_sa on 2002-12-29 19:55:54 +0000
 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 TODO was added on branch nathanw_sa on 2002-12-29 19:55:55 +0000
 1.7 09-Aug-2021  andvar s/fist/first/
 1.6 22-Jan-2016  dholland u_int8_t -> uint8_t
 1.5 04-Nov-2012  jakllsch branches: 1.5.14;
Stylistic changes in comments/strings:
"FAT" and "fat" are different things, use the appropriate case.
"GEMDOS" is all caps.
 1.4 14-Aug-2006  gdt branches: 1.4.92; 1.4.102;
When mounting an MSDOS fileysystem, do not require that bytes 252 and
253 of the superblock be zero. Searching the net failed to find any
justification for checking these bytes; all available references say
that they are part of the boot code and not BOOTSIG2 and BOOTSIG3.

Modify the MSDOS 7.1 bootsector definition to have 420 bytes of boot
code and no BOOTSIG[23], rather than 418 bytes of boot code, to follow
available references and apparent Windows practice. A test build
showed that these defines are not used other than in the check removed
by this commit.

Patch tested on netbsd-3, and enabled mounting of a 4 GB CF formatted
under Windows XP and then in a digital camera. The CF was previously
unmountable.

Concept approved on tech-kern by christos@ and martin@.
 1.3 03-Dec-2005  christos branches: 1.3.4; 1.3.8;
- protect userland exported files against multiple inclusion.
- make sure that kernel only files don't compile in userland using #error
- XXX: some kernel only files still get installed.
- XXX: some files used in userland, don't get installed.
 1.2 06-Oct-2003  lukem branches: 1.2.16;
Consistently use "bsBPB" as the struct member for the BIOS parameter block.
 1.1 26-Dec-2002  jdolecek branches: 1.1.2; 1.1.4;
move msdosfs code from sys/msdosfs to sys/fs/msdosfs
 1.1.4.4 11-Dec-2005  christos Sync with head.
 1.1.4.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 29-Dec-2002  thorpej With with HEAD.
 1.1.2.1 26-Dec-2002  thorpej file bootsect.h was added on branch nathanw_sa on 2002-12-29 19:55:56 +0000
 1.2.16.2 30-Dec-2006  yamt sync with head.
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.3.8.1 03-Sep-2006  yamt sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.102.2 03-Dec-2017  jdolecek update from HEAD
 1.4.102.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.4.92.1 16-Jan-2013  yamt sync with (a bit old) head
 1.5.14.1 19-Mar-2016  skrll Sync with HEAD
 1.8 22-Jan-2016  dholland u_int{8,16,32}_t -> uint{8,16,32}_t, also u_int -> unsigned and
u_char -> unsigned char.
 1.7 04-Nov-2012  jakllsch branches: 1.7.14;
Stylistic changes in comments/strings:
"FAT" and "fat" are different things, use the appropriate case.
"GEMDOS" is all caps.
 1.6 27-Jan-2007  cbiere branches: 1.6.80; 1.6.90;
Use the endian conversion functions from sys/endian.h.
 1.5 30-Nov-2006  christos PR/35151: Christian Groessler: file size reported incorrectly for files > 2GB
on a FAT32 file system on a 64bit host
 1.4 03-Dec-2005  christos branches: 1.4.20; 1.4.22;
- protect userland exported files against multiple inclusion.
- make sure that kernel only files don't compile in userland using #error
- XXX: some kernel only files still get installed.
- XXX: some files used in userland, don't get installed.
 1.3 30-Jun-2004  christos branches: 1.3.12;
cleanup casts in get/set u short/long so that we don't have const castaways.
 1.2 08-Oct-2003  lukem add bpbReserved fields
 1.1 26-Dec-2002  jdolecek branches: 1.1.2; 1.1.4;
move msdosfs code from sys/msdosfs to sys/fs/msdosfs
 1.1.4.4 11-Dec-2005  christos Sync with head.
 1.1.4.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 29-Dec-2002  thorpej With with HEAD.
 1.1.2.1 26-Dec-2002  thorpej file bpb.h was added on branch nathanw_sa on 2002-12-29 19:55:56 +0000
 1.3.12.3 26-Feb-2007  yamt sync with head.
 1.3.12.2 30-Dec-2006  yamt sync with head.
 1.3.12.1 21-Jun-2006  yamt sync with head.
 1.4.22.1 10-Dec-2006  yamt sync with head.
 1.4.20.2 01-Feb-2007  ad Sync with head.
 1.4.20.1 12-Jan-2007  ad Sync with head.
 1.6.90.2 03-Dec-2017  jdolecek update from HEAD
 1.6.90.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.6.80.1 16-Jan-2013  yamt sync with (a bit old) head
 1.7.14.1 19-Mar-2016  skrll Sync with HEAD
 1.29 23-Oct-2021  thorpej Sanitize the symbol namespace. NFC.
 1.28 23-Oct-2021  hannken Convert msdosfs_rename() to use genfs_sane_rename().

Based on work by Taylor R Campbell.
 1.27 23-Oct-2021  hannken Factor out the lookup results from struct denode.

No functional change.
 1.26 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.25 14-Jan-2017  maya branches: 1.25.32;
Be explicit about how we're placing part of the on-disk name into
the extension, so it doesn't appear like we are overrunning an array.
Appeases coverity, NFC.

ok riastradh
 1.24 08-Jul-2014  hannken branches: 1.24.4; 1.24.8;
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.23 26-Jan-2013  christos branches: 1.23.10;
fix fstat build.
 1.22 26-Jan-2013  christos more cross-compile friendly.
 1.21 26-Jan-2013  christos expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
 1.20 04-Nov-2012  jakllsch Stylistic changes in comments/strings:
"FAT" and "fat" are different things, use the appropriate case.
"GEMDOS" is all caps.
 1.19 04-Apr-2011  hannken branches: 1.19.4; 1.19.14;
Msdosfs on-disk meta data is not sufficient to create or validate file handles.

Maintain a tree of file handles, create nodes from msdosfs_vptofh() and keep
them until either the file gets unlinked or the file system gets unmounted.

Fixes the msdosfs part of PR #43745 (fhopen of an unlinked file causes problems
on multiple file systems)
 1.18 08-Apr-2010  pooka branches: 1.18.2;
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.17 08-Apr-2010  pooka Use genfs instead of homegrown stuff where possible.
 1.16 26-Nov-2007  pooka branches: 1.16.18; 1.16.38; 1.16.40;
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.15 09-Apr-2007  pooka branches: 1.15.8; 1.15.10; 1.15.16;
fix comment: struct fid is in fstypes.h now
 1.14 22-Sep-2006  xtraeme branches: 1.14.4; 1.14.8; 1.14.10;
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.13 14-May-2006  elad branches: 1.13.6; 1.13.8; 1.13.10;
integrate kauth.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 03-Dec-2005  christos - protect userland exported files against multiple inclusion.
- make sure that kernel only files don't compile in userland using #error
- XXX: some kernel only files still get installed.
- XXX: some files used in userland, don't get installed.
 1.10 04-Nov-2005  christos PR/32003: Brian Buhrow: msdosfs doesn't properly zero out high cluster data
on non-FAT32 msdos filesystems.
 1.9 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.8 12-Sep-2005  christos branches: 1.8.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.7 29-Aug-2005  xtraeme Remove __P()
 1.6 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.5 23-Jul-2005  yamt update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.
 1.4 07-Sep-2003  itojun branches: 1.4.2; 1.4.6; 1.4.14; 1.4.16;
add -t option for gmt time offset (normally MS-DOS filesystem has timestamp
in localtime, not GMT). PR kern/22717
 1.3 29-Jun-2003  fvdl branches: 1.3.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.2 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.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 denode.h was added on branch nathanw_sa on 2002-12-29 19:55:57 +0000
 1.3.2.6 11-Dec-2005  christos Sync with head.
 1.3.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.2 03-Aug-2004  skrll Sync with HEAD
 1.3.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.4.16.4 07-Dec-2007  yamt sync with head
 1.4.16.3 03-Sep-2007  yamt sync with head.
 1.4.16.2 30-Dec-2006  yamt sync with head.
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.4.14.4 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.4.14.3 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.4.14.2 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.4.14.1 24-Aug-2005  riz Pull up following revision(s) (requested by yamt in ticket #688):
sys/miscfs/genfs/genfs_vnops.c: revision 1.98 via patch
sys/ufs/ffs/ffs_vfsops.c: revision 1.165
sys/ufs/lfs/lfs_extern.h: revision 1.69
sys/fs/filecorefs/filecore_vfsops.c: revision 1.20
sys/nfs/nfs_node.c: revision 1.80
sys/fs/smbfs/smbfs_node.c: revision 1.24
sys/fs/cd9660/cd9660_vfsops.c: revision 1.24
sys/fs/msdosfs/msdosfs_denode.c: revision 1.8
sys/miscfs/genfs/genfs_node.h: revision 1.6
sys/ufs/lfs/lfs_vfsops.c: revision 1.183
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.86
sys/fs/adosfs/advfsops.c: revision 1.23
sys/fs/ntfs/ntfs_vfsops.c: revision 1.31
- constify genfs_ops.
- use member designators.

sys/miscfs/genfs/genfs_vnops.c: revision 1.99 via patch
genfs_getpages: don't forget to put the vnode onto the syncer's work que
ue
even in the case of PGO_LOCKED.

sys/uvm/uvm_bio.c: revision 1.40
sys/uvm/uvm_pager.h: revision 1.29
sys/miscfs/genfs/genfs_vnops.c: revision 1.100 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.50
- introduce PGO_NOBLOCKALLOC and use it for ubc mapping
to prevent unnecessary block allocations in the case that
page size > block size.
- ufs_balloc_range: use VM_PROT_WRITE+PGO_NOBLOCKALLOC rather than
VM_PROT_READ.

sys/uvm/uvm_fault.c: revision 1.96
sys/miscfs/genfs/genfs_vnops.c: revision 1.101 via patch
sys/uvm/uvm_object.h: revision 1.19
sys/miscfs/genfs/genfs_node.h: revision 1.7
ensure that vnodes with dirty pages are always on syncer's queue.
- genfs_putpages: wait for i/o completion of PG_RELEASED/PG_PAGEOUT pages by
setting "wasclean" false when encountering them.
suggested by Stephan Uphoff in PR/24596 (1).
- genfs_putpages: write protect pages when cleaning out, if
we're going to take the vnode off the syncer's queue.
uvm_fault: don't write-map pages unless its vnode is already on
the syncer's queue.
fix PR/24596 (3) but in the different way from the suggested fix.
(to keep our current behaviour, ie. not to require explicit msync.
discussed on tech-kern@.)
- genfs_putpages: don't mistakenly take a vnode off the queue
by introducing a generation number in genfs_node.
genfs_getpages: increment the generation number.
suggested by Stephan Uphoff in PR/24596 (2).
- add some assertions.

sys/miscfs/genfs/genfs_vnops.c: revision 1.102 via patch
genfs_putpages: don't bother to clean the vnode unless VONWORKLST.

sys/ufs/ffs/ffs_vnops.c: revision 1.71
ffs_full_fsync: because VBLK/VCHR can be mmap'ed,
do VOP_PUTPAGES for them as well.

sys/uvm/uvm_fault.c: revision 1.97
uvm_fault: check a correct object in the case of layered filesystems.
fix PR/30811 from Jukka Salmi.

sys/uvm/uvm_object.h: revision 1.20
sys/ufs/ffs/ffs_vfsops.c: revision 1.167
sys/uvm/uvm_bio.c: revision 1.41
sys/ufs/ufs/ufs_vnops.c: revision 1.129
sys/uvm/uvm_mmap.c: revision 1.92
sys/uvm/uvm_fault.c: revision 1.98
sys/kern/vfs_subr.c: revision 1.252
sys/fs/msdosfs/denode.h: revision 1.5
sys/miscfs/genfs/genfs_vnops.c: revision 1.103 via patch
sys/fs/msdosfs/msdosfs_denode.c: revision 1.9
sys/sys/vnode.h: revision 1.141
sys/ufs/ufs/ufs_inode.c: revision 1.51
sys/ufs/ufs/ufs_extern.h: revision 1.45 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.8
sys/ufs/lfs/lfs_vfsops.c: revision 1.184
sys/uvm/uvm_pager.h: revision 1.30
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.87
update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.

sys/miscfs/genfs/genfs_vnops.c: revision 1.104 via patch
don't write-protect wired pages. pointed by Chuck Silvers.
for now, leave a vnode on the syncer's queue, as suggested by him.

sys/ufs/ffs/ffs_vnops.c: revision 1.72
revert VCHR part of ffs_vnops.c 1.71.
as VCHR uses the device pager, no point to call VOP_PUTPAGES here.
pointed by Chuck Silvers.
 1.4.6.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.4.6.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.4.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.8.2.1 20-Oct-2005  yamt adapt msdosfs.
 1.12.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.12.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.12.8.1 24-May-2006  yamt sync with head.
 1.12.6.1 01-Jun-2006  kardel Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.10.1 22-Oct-2006  yamt sync with head
 1.13.8.1 18-Nov-2006  ad Sync with head.
 1.13.6.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.14.10.1 11-Jul-2007  mjf Sync with head.
 1.14.8.1 10-Apr-2007  ad Sync with head.
 1.14.4.1 15-Apr-2007  yamt sync with head.
 1.15.16.1 08-Dec-2007  mjf Sync with HEAD.
 1.15.10.1 09-Jan-2008  matt sync with HEAD
 1.15.8.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.16.40.2 21-Apr-2011  rmind sync with head
 1.16.40.1 30-May-2010  rmind sync with head
 1.16.38.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.16.18.1 11-Aug-2010  yamt sync with head.
 1.18.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.14.4 03-Dec-2017  jdolecek update from HEAD
 1.19.14.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.14.2 25-Feb-2013  tls resync with head
 1.19.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.19.4.2 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.19.4.1 16-Jan-2013  yamt sync with (a bit old) head
 1.23.10.1 10-Aug-2014  tls Rebase.
 1.24.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.24.4.1 05-Feb-2017  skrll Sync with HEAD
 1.25.32.1 01-Aug-2021  thorpej Sync with HEAD.
 1.12 23-Oct-2021  thorpej Sanitize the symbol namespace. NFC.
 1.11 01-Feb-2016  christos We can't depend on dp->d_namlen existing for the parts that are used in
makefs(8).
 1.10 30-Jan-2016  mlelstv Add support to msdosfs and makefs to generate correct Unicode (UCS-2) directory
entries from UTF8 encoded file names.
 1.9 23-Jan-2016  dholland Apparently a recent round of vandalism by the C++ standards committee
includes disallowing the standard and historic type name "unsigned". Add
a gratuitous "int" to recent changes.

C++ is really a blight on the world.
 1.8 22-Jan-2016  dholland u_int{8,16,32}_t -> uint{8,16,32}_t, also u_int -> unsigned and
u_char -> unsigned char.
 1.7 20-Oct-2013  christos branches: 1.7.6;
provide a function to access the name and extension as a single array as
opposed depend on array index overflow.
 1.6 26-Jan-2013  christos branches: 1.6.2;
expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
 1.5 03-Dec-2005  christos branches: 1.5.110; 1.5.120;
- protect userland exported files against multiple inclusion.
- make sure that kernel only files don't compile in userland using #error
- XXX: some kernel only files still get installed.
- XXX: some files used in userland, don't get installed.
 1.4 12-Sep-2005  christos 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.3 29-Aug-2005  xtraeme Remove __P()
 1.2 07-Sep-2003  itojun branches: 1.2.16;
add -t option for gmt time offset (normally MS-DOS filesystem has timestamp
in localtime, not GMT). PR kern/22717
 1.1 26-Dec-2002  jdolecek branches: 1.1.2; 1.1.4;
move msdosfs code from sys/msdosfs to sys/fs/msdosfs
 1.1.4.5 11-Dec-2005  christos Sync with head.
 1.1.4.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 29-Dec-2002  thorpej With with HEAD.
 1.1.2.1 26-Dec-2002  thorpej file direntry.h was added on branch nathanw_sa on 2002-12-29 19:55:58 +0000
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.5.120.3 03-Dec-2017  jdolecek update from HEAD
 1.5.120.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.120.1 25-Feb-2013  tls resync with head
 1.5.110.1 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.6.2.1 18-May-2014  rmind sync with head
 1.7.6.1 19-Mar-2016  skrll Sync with HEAD
 1.10 23-Oct-2021  thorpej Sanitize the symbol namespace. NFC.
 1.9 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.8 26-Jan-2013  christos expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
 1.7 04-Nov-2012  jakllsch Stylistic changes in comments/strings:
"FAT" and "fat" are different things, use the appropriate case.
"GEMDOS" is all caps.
 1.6 04-Nov-2012  jakllsch And correct a typo that wasn't corrected in previous.
 1.5 04-Nov-2012  jakllsch Correct constant in comment to match the expression it is derived from.
 1.4 03-Dec-2005  christos branches: 1.4.110; 1.4.120;
- protect userland exported files against multiple inclusion.
- make sure that kernel only files don't compile in userland using #error
- XXX: some kernel only files still get installed.
- XXX: some files used in userland, don't get installed.
 1.3 29-Aug-2005  xtraeme Remove __P()
 1.2 26-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 26-Dec-2002  jdolecek branches: 1.1.2; 1.1.4; 1.1.12; 1.1.14;
move msdosfs code from sys/msdosfs to sys/fs/msdosfs
 1.1.14.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.12.1 29-Apr-2005  kent sync with -current
 1.1.4.3 11-Dec-2005  christos Sync with head.
 1.1.4.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.2 29-Dec-2002  thorpej With with HEAD.
 1.1.2.1 26-Dec-2002  thorpej file fat.h was added on branch nathanw_sa on 2002-12-29 19:55:59 +0000
 1.2.4.1 21-Jun-2006  yamt sync with head.
 1.4.120.3 03-Dec-2017  jdolecek update from HEAD
 1.4.120.2 25-Feb-2013  tls resync with head
 1.4.120.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.4.110.2 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.4.110.1 16-Jan-2013  yamt sync with (a bit old) head
 1.4 23-Oct-2021  hannken Move msdosfs_rename() and doscheckpath() to new file msdosfs_rename.c.

No functional change.
 1.3 06-Feb-2016  mlelstv Split case folding table into separate source file and add full
copyright and permission notice from http://www.unicode.org/copyright.html
 1.2 11-Oct-2014  uebayasi branches: 1.2.2;
Define filesystem attributes with vfs dependency.
 1.1 26-Dec-2002  jdolecek branches: 1.1.2; 1.1.152;
move msdosfs code from sys/msdosfs to sys/fs/msdosfs
 1.1.152.1 03-Dec-2017  jdolecek update from HEAD
 1.1.2.2 29-Dec-2002  thorpej With with HEAD.
 1.1.2.1 26-Dec-2002  thorpej file files.msdosfs was added on branch nathanw_sa on 2002-12-29 19:55:59 +0000
 1.2.2.1 19-Mar-2016  skrll Sync with HEAD
 1.20 02-Jun-2023  andvar follow the steps of Andrew Doran (ad) commit and fix more s/loose/lose/ typos.
also s/beyound/beyond/ and few others along the way, mainly in comments.
 1.19 13-Feb-2023  andvar s/chacters/characters/ in comments.
 1.18 23-Oct-2021  thorpej Sanitize the symbol namespace. NFC.
 1.17 30-Jun-2016  nonaka Fix false positives when comparing long file names that have the
same first 13 (or some multiple thereof) characters.
 1.16 06-Mar-2016  mlelstv Use KASSERT for conditions that cannot be met with current parameters.
 1.15 06-Feb-2016  mlelstv Split case folding table into separate source file and add full
copyright and permission notice from http://www.unicode.org/copyright.html
 1.14 01-Feb-2016  christos - split a long line.
- remove extra test.
- move d_namlen setting to msdosfs_vnops.c to avoid the ifdef.
 1.13 01-Feb-2016  martin Avoid unsigned/signed comparision warning to fix the build.
 1.12 01-Feb-2016  christos We can't depend on dp->d_namlen existing for the parts that are used in
makefs(8).
 1.11 30-Jan-2016  mlelstv Add support to msdosfs and makefs to generate correct Unicode (UCS-2) directory
entries from UTF8 encoded file names.
 1.10 01-Sep-2014  martin branches: 1.10.2;
Make msdosfs time conversion use the y/m/d/h/m/s conversion functions
from clock_subr.c and compile that into the userland (and tools)
makefs as well.
 1.9 26-Jan-2013  christos branches: 1.9.12;
more cross-compile friendly.
 1.8 26-Jan-2013  christos expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
 1.7 15-Mar-2009  cegger branches: 1.7.12; 1.7.22;
ansify function definitions
 1.6 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 12-Sep-2005  christos 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.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 07-Sep-2003  itojun branches: 1.2.8; 1.2.10;
add -t option for gmt time offset (normally MS-DOS filesystem has timestamp
in localtime, not GMT). PR kern/22717
 1.1 26-Dec-2002  jdolecek branches: 1.1.2; 1.1.4;
move msdosfs code from sys/msdosfs to sys/fs/msdosfs
 1.1.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 29-Dec-2002  thorpej With with HEAD.
 1.1.2.1 26-Dec-2002  thorpej file msdosfs_conv.c was added on branch nathanw_sa on 2002-12-29 19:56:00 +0000
 1.2.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.8.1 29-Apr-2005  kent sync with -current
 1.3.4.1 21-Jun-2006  yamt sync with head.
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.7.22.2 03-Dec-2017  jdolecek update from HEAD
 1.7.22.1 25-Feb-2013  tls resync with head
 1.7.12.1 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.9.12.1 12-Nov-2014  snj Pull up following revision(s) (requested by martin in ticket #216):
share/man/man9/todr.9: revision 1.17
sys/arch/sh3/dev/rtc.c: revision 1.9
sys/dev/clock_subr.c: revision 1.17-1.22
sys/dev/clock_subr.h: revision 1.22
sys/fs/msdosfs/msdosfs_conv.c: revision 1.10
tools/compat/compat_defs.h: revision 1.98
tools/compat/dev/clock_subr.h: revision 1.1-1.2
usr.sbin/makefs/msdos/Makefile.inc: revision 1.6
clock_secs_to_ymdhms(9) takes seconds as a time_t, not int.
--
Make this compile- and usable from userland as well.
--
Add a slightly stripped down version of sys/dev/clock/clock_subr.h to make
this code available for tools.
--
Reformulate an overflow test so it can be used in tool builds (i.e. does
not depend on netbsd specific macros).
--
Make msdosfs time conversion use the y/m/d/h/m/s conversion functions
from clock_subr.c and compile that into the userland (and tools)
makefs as well.
--
Copy definitions of __type_min(t), __type_max(t), and some related macros,
from <sys/cdefs.h>, for use when building tools.
--
Revert previous; test secs > __type_max(time_t) again, now
that __type_max is available in tools/compat/compat_defs.h.
--
If HAVE_NBTOOL_CONFIG_H is set, then include "nbtool_config.h",
because this file is compiled as part of tools/makefs.
--
Counting leap years was fine while we had 32bit time_t - but now it
is not a good idea for dates far away in the future.
For dates in the year 2000 or later, use arithmetic instead (since the
repeating periods are well aligned). Should fix PR 49144.
--
Avoid overflowing the "year" value by making the field uint64_t. Adapt
arguments and local variables accordingly.
This now fixes PR 49144 for real.
--
Adapt formats for debug printfs to clock_subr type changes.
 1.10.2.2 09-Jul-2016  skrll Sync with HEAD
 1.10.2.1 19-Mar-2016  skrll Sync with HEAD
 1.60 23-Oct-2021  thorpej Sanitize the symbol namespace. NFC.
 1.59 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.58 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.57 28-May-2018  chs branches: 1.57.2; 1.57.12;
add a genfs method to allow a file system to limit the range of pages
that are given to a single GOP_WRITE() call. needed by ZFS.
 1.56 26-May-2017  riastradh branches: 1.56.8;
Eliminate crusty debugging sludge.

We have a mostly sane vnode lifecycle now. If this needs debugging,
it should be done once at the call site of VOP_RECLAIM.
 1.55 26-May-2017  riastradh Make VOP_RECLAIM do the last unlock of the vnode.

VOP_RECLAIM naturally has exclusive access to the vnode, so having it
locked on entry is not strictly necessary -- but it means if there
are any final operations that must be done on the vnode, such as
ffs_update, requiring exclusive access to it, we can now kassert that
the vnode is locked in those operations.

We can't just have the caller release the last lock because some file
systems don't use genfs_lock, and require the vnode to remain valid
for VOP_UNLOCK to work, notably unionfs.
 1.54 11-Apr-2017  riastradh Make VOP_INACTIVE preserve vnode lock on return.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html

Ride 7.99.68, a bumpy bus of incremental vfs improvements!
 1.53 01-Mar-2017  hannken Remove now redundant calls to fstrans_start()/fstrans_done().
 1.52 20-Aug-2016  hannken branches: 1.52.2;
Remove now obsolete operation vcache_remove().

Welcome to 7.99.36
 1.51 28-Mar-2015  maxv branches: 1.51.2;
Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
 1.50 08-Jul-2014  hannken branches: 1.50.4;
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.49 30-May-2014  hannken msdosfs_reclaim(): add missing fstrans and protect change
of v_data with v_interlock as msdosfs_sync() now needs it.
 1.48 20-Dec-2012  hannken branches: 1.48.10;
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.47 04-Nov-2012  jakllsch Stylistic changes in comments/strings:
"FAT" and "fat" are different things, use the appropriate case.
"GEMDOS" is all caps.
 1.46 16-Jun-2011  hannken branches: 1.46.2; 1.46.12;
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.45 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.44 19-May-2011  rmind branches: 1.44.2;
Remove cache_purge(9) calls from reclamation routines in the file systems,
as vclean(9) performs it for us since Lite2 merge.
 1.43 04-Apr-2011  hannken Msdosfs on-disk meta data is not sufficient to create or validate file handles.

Maintain a tree of file handles, create nodes from msdosfs_vptofh() and keep
them until either the file gets unlinked or the file system gets unmounted.

Fixes the msdosfs part of PR #43745 (fhopen of an unlinked file causes problems
on multiple file systems)
 1.42 22-Mar-2011  hannken When truncating a file purge the fat cache after setting the new size
and after all io but before actually updating the cluster chain.

Both uvm_vnp_zerorange() and vtruncbuf() call get/putpages -> bmap -> pcbmap
and here the fat cache gets updated with information no longer valid after
truncation.
 1.41 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.40 21-Jul-2010  hannken branches: 1.40.2;
Make holding v_interlock mandatory for callers of vget().

Announced some time ago on tech-kern.
 1.39 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.38 09-Apr-2010  hannken Add file system suspension support (vfs_suspend(9)) to msdosfs.

Reviewed by: Antti Kantee <pooka@netbsd.org>
 1.37 08-Jan-2010  pooka branches: 1.37.2; 1.37.4;
The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase). Plenty of mix'n match upper/lowercase has creeped
into the tree since then. Nuke the macros and convert all callsites
to lowercase.

no functional change
 1.36 15-Mar-2009  cegger ansify function definitions
 1.35 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.34 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.33 16-May-2008  hannken branches: 1.33.6; 1.33.12;
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.32 05-May-2008  ad branches: 1.32.2;
- Convert hashinit() to use kmem_alloc(). The hash tables can be large
and it's better to not have them in kmem_map.
- Convert a couple of minor items along the way to kmem_alloc().
- Fix some memory leaks.
 1.31 17-Jan-2008  ad branches: 1.31.6; 1.31.8; 1.31.10;
Fix dodgy tests of v_usecount.
 1.30 02-Jan-2008  ad Merge vmlocking2 to head.
 1.29 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.28 08-Dec-2007  ad branches: 1.28.4;
Merge ihash locking changes from the vmlocking branch.
 1.27 26-Nov-2007  pooka branches: 1.27.2;
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.26 10-Oct-2007  ad branches: 1.26.4;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.25 08-Oct-2007  ad Merge brelse() changes from the vmlocking branch.
 1.24 28-Sep-2007  pooka Release vnode being created in error branch instead of leaving it
locked. Ideally the function should be rewritten to do things in
a different order, but this tries to keep changes minimal aiming
for a possible netbsd-4 pullup.

fixes PR kern/37034
 1.23 24-Sep-2007  rumble Avoid stack allocation of large dirent structures in foo_readdir().
 1.22 23-Jul-2007  pooka branches: 1.22.4; 1.22.6; 1.22.8; 1.22.10;
Also set writesize when creating node.

noticed by Markus W Kilbinger
 1.21 30-Jun-2007  pooka branches: 1.21.2;
Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.
 1.20 12-Mar-2007  ad branches: 1.20.2; 1.20.4;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.19 04-Mar-2007  christos branches: 1.19.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 20-Feb-2007  ad Call genfs_node_destroy() where appropriate.
 1.17 25-Nov-2006  scw branches: 1.17.2; 1.17.4; 1.17.6;
Support FAT filesystems on non-DEV_BSIZE media.

Based on the patches provided in PR kern/17398 by Trevin Beattie.
 1.16 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.15 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.14 14-May-2006  elad branches: 1.14.8; 1.14.10;
integrate kauth.
 1.13 15-Apr-2006  christos Coverity CID 2508: Initialize variable
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 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.10 29-Aug-2005  xtraeme branches: 1.10.2;
Remove __P()
 1.9 23-Jul-2005  yamt update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.
 1.8 28-Jun-2005  yamt branches: 1.8.2;
- constify genfs_ops.
- use member designators.
 1.7 20-May-2004  atatat branches: 1.7.10;
Explicitly call pool_init() (and pool_destroy()) when being built as
an _LKM.

This adds pools to the list of things that lkms must do manually
because they're set up with link sets. Not that there's anything
wrong with link sets, but that we need to try harder to remember that
lkms are second class citizens. Of a sort.
 1.6 25-Apr-2004  simonb Initialise (most) pools from a link set instead of explicit calls
to pool_init. Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

Convert struct session, ucred and lockf to pools.
 1.5 27-Mar-2004  atatat Manually attach malloc types when being built as an lkm.
 1.4 29-Jun-2003  fvdl branches: 1.4.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.3 29-Jun-2003  thorpej Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.2 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.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_denode.c was added on branch nathanw_sa on 2002-12-29 19:56:01 +0000
 1.4.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.6 31-Oct-2004  skrll Fix comment that describe the argument structures.
 1.4.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.3 24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.4.2.2 03-Aug-2004  skrll Sync with HEAD
 1.4.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.7.10.2 04-Oct-2007  bouyer Pull up following revision(s) (requested by pooka in ticket #1849):
sys/fs/msdosfs/msdosfs_denode.c: revision 1.24
Release vnode being created in error branch instead of leaving it
locked. Ideally the function should be rewritten to do things in
a different order, but this tries to keep changes minimal aiming
for a possible netbsd-4 pullup.
fixes PR kern/37034
 1.7.10.1 24-Aug-2005  riz Pull up following revision(s) (requested by yamt in ticket #688):
sys/miscfs/genfs/genfs_vnops.c: revision 1.98 via patch
sys/ufs/ffs/ffs_vfsops.c: revision 1.165
sys/ufs/lfs/lfs_extern.h: revision 1.69
sys/fs/filecorefs/filecore_vfsops.c: revision 1.20
sys/nfs/nfs_node.c: revision 1.80
sys/fs/smbfs/smbfs_node.c: revision 1.24
sys/fs/cd9660/cd9660_vfsops.c: revision 1.24
sys/fs/msdosfs/msdosfs_denode.c: revision 1.8
sys/miscfs/genfs/genfs_node.h: revision 1.6
sys/ufs/lfs/lfs_vfsops.c: revision 1.183
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.86
sys/fs/adosfs/advfsops.c: revision 1.23
sys/fs/ntfs/ntfs_vfsops.c: revision 1.31
- constify genfs_ops.
- use member designators.

sys/miscfs/genfs/genfs_vnops.c: revision 1.99 via patch
genfs_getpages: don't forget to put the vnode onto the syncer's work que
ue
even in the case of PGO_LOCKED.

sys/uvm/uvm_bio.c: revision 1.40
sys/uvm/uvm_pager.h: revision 1.29
sys/miscfs/genfs/genfs_vnops.c: revision 1.100 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.50
- introduce PGO_NOBLOCKALLOC and use it for ubc mapping
to prevent unnecessary block allocations in the case that
page size > block size.
- ufs_balloc_range: use VM_PROT_WRITE+PGO_NOBLOCKALLOC rather than
VM_PROT_READ.

sys/uvm/uvm_fault.c: revision 1.96
sys/miscfs/genfs/genfs_vnops.c: revision 1.101 via patch
sys/uvm/uvm_object.h: revision 1.19
sys/miscfs/genfs/genfs_node.h: revision 1.7
ensure that vnodes with dirty pages are always on syncer's queue.
- genfs_putpages: wait for i/o completion of PG_RELEASED/PG_PAGEOUT pages by
setting "wasclean" false when encountering them.
suggested by Stephan Uphoff in PR/24596 (1).
- genfs_putpages: write protect pages when cleaning out, if
we're going to take the vnode off the syncer's queue.
uvm_fault: don't write-map pages unless its vnode is already on
the syncer's queue.
fix PR/24596 (3) but in the different way from the suggested fix.
(to keep our current behaviour, ie. not to require explicit msync.
discussed on tech-kern@.)
- genfs_putpages: don't mistakenly take a vnode off the queue
by introducing a generation number in genfs_node.
genfs_getpages: increment the generation number.
suggested by Stephan Uphoff in PR/24596 (2).
- add some assertions.

sys/miscfs/genfs/genfs_vnops.c: revision 1.102 via patch
genfs_putpages: don't bother to clean the vnode unless VONWORKLST.

sys/ufs/ffs/ffs_vnops.c: revision 1.71
ffs_full_fsync: because VBLK/VCHR can be mmap'ed,
do VOP_PUTPAGES for them as well.

sys/uvm/uvm_fault.c: revision 1.97
uvm_fault: check a correct object in the case of layered filesystems.
fix PR/30811 from Jukka Salmi.

sys/uvm/uvm_object.h: revision 1.20
sys/ufs/ffs/ffs_vfsops.c: revision 1.167
sys/uvm/uvm_bio.c: revision 1.41
sys/ufs/ufs/ufs_vnops.c: revision 1.129
sys/uvm/uvm_mmap.c: revision 1.92
sys/uvm/uvm_fault.c: revision 1.98
sys/kern/vfs_subr.c: revision 1.252
sys/fs/msdosfs/denode.h: revision 1.5
sys/miscfs/genfs/genfs_vnops.c: revision 1.103 via patch
sys/fs/msdosfs/msdosfs_denode.c: revision 1.9
sys/sys/vnode.h: revision 1.141
sys/ufs/ufs/ufs_inode.c: revision 1.51
sys/ufs/ufs/ufs_extern.h: revision 1.45 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.8
sys/ufs/lfs/lfs_vfsops.c: revision 1.184
sys/uvm/uvm_pager.h: revision 1.30
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.87
update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.

sys/miscfs/genfs/genfs_vnops.c: revision 1.104 via patch
don't write-protect wired pages. pointed by Chuck Silvers.
for now, leave a vnode on the syncer's queue, as suggested by him.

sys/ufs/ffs/ffs_vnops.c: revision 1.72
revert VCHR part of ffs_vnops.c 1.71.
as VCHR uses the device pager, no point to call VOP_PUTPAGES here.
pointed by Chuck Silvers.
 1.8.2.7 21-Jan-2008  yamt sync with head
 1.8.2.6 07-Dec-2007  yamt sync with head
 1.8.2.5 27-Oct-2007  yamt sync with head.
 1.8.2.4 03-Sep-2007  yamt sync with head.
 1.8.2.3 26-Feb-2007  yamt sync with head.
 1.8.2.2 30-Dec-2006  yamt sync with head.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.10.2.1 20-Oct-2005  yamt adapt msdosfs.
 1.12.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.12.10.3 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.12.10.2 19-Apr-2006  elad sync with head.
 1.12.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.12.8.1 24-May-2006  yamt sync with head.
 1.12.6.2 01-Jun-2006  kardel Sync with head.
 1.12.6.1 22-Apr-2006  simonb Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.14.10.2 10-Dec-2006  yamt sync with head.
 1.14.10.1 22-Oct-2006  yamt sync with head
 1.14.8.2 12-Jan-2007  ad Sync with head.
 1.14.8.1 18-Nov-2006  ad Sync with head.
 1.17.6.1 30-Sep-2007  wrstuden Catch up w/ last night's netbsd-4
 1.17.4.3 24-Mar-2007  yamt sync with head.
 1.17.4.2 12-Mar-2007  rmind Sync with HEAD.
 1.17.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.17.2.1 29-Sep-2007  xtraeme Pull up following revision(s) (requested by pooka in ticket #909):
sys/fs/msdosfs/msdosfs_denode.c: revision 1.24

Release vnode being created in error branch instead of leaving it
locked. Ideally the function should be rewritten to do things in
a different order, but this tries to keep changes minimal aiming
for a possible netbsd-4 pullup.
fixes PR kern/37034
 1.19.2.10 25-Oct-2007  ad Fix up mnt_vnodelist handling.
 1.19.2.9 09-Oct-2007  ad Sync with head.
 1.19.2.8 09-Oct-2007  ad Sync with head.
 1.19.2.7 16-Sep-2007  ad Checkpoint work in progress on the vnode lifecycle and reference counting
stuff. This makes it work properly without kernel_lock and fixes a few
quite old bugs. See vfs_subr.c 1.283.2.17 for details.
 1.19.2.6 20-Aug-2007  ad Sync with HEAD.
 1.19.2.5 15-Jul-2007  ad Sync with head.
 1.19.2.4 17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.19.2.3 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.19.2.2 13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.19.2.1 13-Mar-2007  ad Sync with head.
 1.20.4.1 09-Dec-2007  reinoud Pullup to HEAD
 1.20.2.1 11-Jul-2007  mjf Sync with head.
 1.21.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.22.10.2 23-Jul-2007  pooka Also set writesize when creating node.

noticed by Markus W Kilbinger
 1.22.10.1 23-Jul-2007  pooka file msdosfs_denode.c was added on branch matt-mips64 on 2007-07-23 11:05:48 +0000
 1.22.8.2 14-Oct-2007  yamt sync with head.
 1.22.8.1 06-Oct-2007  yamt sync with head.
 1.22.6.3 23-Mar-2008  matt sync with HEAD
 1.22.6.2 09-Jan-2008  matt sync with HEAD
 1.22.6.1 06-Nov-2007  matt sync with HEAD
 1.22.4.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.22.4.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.22.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.22.4.1 02-Oct-2007  joerg Sync with HEAD.
 1.26.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.26.4.2 27-Dec-2007  mjf Sync with HEAD.
 1.26.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.27.2.2 08-Dec-2007  ad Sync with head.
 1.27.2.1 04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.28.4.2 19-Jan-2008  bouyer Sync with HEAD
 1.28.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.31.10.4 11-Aug-2010  yamt sync with head.
 1.31.10.3 11-Mar-2010  yamt sync with head
 1.31.10.2 04-May-2009  yamt sync with head.
 1.31.10.1 16-May-2008  yamt sync with head.
 1.31.8.1 18-May-2008  yamt sync with head.
 1.31.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.32.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.33.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.33.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.37.4.7 31-May-2011  rmind sync with head
 1.37.4.6 19-May-2011  rmind Implement sharing of vnode_t::v_interlock amongst vnodes:
- Lock is shared amongst UVM objects using uvm_obj_setlock() or getnewvnode().
- Adjust vnode cache to handle unsharing, add VI_LOCKSHARE flag for that.
- Use sharing in tmpfs and layerfs for underlying object.
- Simplify locking in ubc_fault().
- Sprinkle some asserts.

Discussed with ad@.
 1.37.4.5 21-Apr-2011  rmind sync with head
 1.37.4.4 05-Mar-2011  rmind sync with head
 1.37.4.3 03-Jul-2010  rmind sync with head
 1.37.4.2 30-May-2010  rmind sync with head
 1.37.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.37.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.37.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.40.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.44.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.46.12.4 03-Dec-2017  jdolecek update from HEAD
 1.46.12.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.12.2 25-Feb-2013  tls resync with head
 1.46.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.46.2.2 23-Jan-2013  yamt sync with head
 1.46.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.48.10.1 10-Aug-2014  tls Rebase.
 1.50.4.3 28-Aug-2017  skrll Sync with HEAD
 1.50.4.2 05-Oct-2016  skrll Sync with HEAD
 1.50.4.1 06-Apr-2015  skrll Sync with HEAD
 1.51.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.51.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.52.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.56.8.1 25-Jun-2018  pgoyette Sync with HEAD
 1.57.12.2 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.57.12.1 20-Apr-2020  bouyer Sync with HEAD
 1.57.2.1 21-Apr-2020  martin Sync with HEAD
 1.37 13-May-2024  msaitoh s/contigous/contiguous/ in comment.
 1.36 23-Oct-2021  thorpej Sanitize the symbol namespace. NFC.
 1.35 07-Sep-2020  mrg avoid an uninit warning with GCC 9.
 1.34 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.33 25-Jul-2018  kamil Avoid undefined behavior semantics in msdosfs_fat.c

Do not change signedness bit with left shift.
While there avoid signed integer overflow.
Address both issues with using unsigned type.

msdosfs_fat.c:512:42, left shift of 1 by 31 places cannot be represented in type 'int'
msdosfs_fat.c:521:44, left shift of 1 by 31 places cannot be represented in type 'int'
msdosfs_fat.c:744:14, left shift of 1 by 31 places cannot be represented in type 'int'
msdosfs_fat.c:744:24, signed integer overflow: -2147483648 - 1 cannot be represented in type 'int [20]'
msdosfs_fat.c:840:13, left shift of 1 by 31 places cannot be represented in type 'int'
msdosfs_fat.c:840:36, signed integer overflow: -2147483648 - 1 cannot be represented in type 'int [20]'

Detected with micro-UBSan in the user mode.
 1.32 27-Jan-2018  sevan branches: 1.32.2; 1.32.4;
Need strings.h for ffs()
Resolves implict declaration warning of ffs() when building tools via build.sh
 1.31 07-May-2016  mlelstv branches: 1.31.10;
fix DEBUG build
 1.30 03-May-2016  mlelstv Validate FAT entries to avoid some panics caused by a corrupted FAT.

Also print FAT write errors when mount is synchronous (-o sync). This
reveals problems caused by a write protected disklabel on sector 1.
 1.29 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.28 28-Jan-2013  christos branches: 1.28.12; 1.28.14;
A little more debugging.
 1.27 27-Jan-2013  christos don't need sys/mount.h in userland.
 1.26 27-Jan-2013  christos tidy up debugging printfs; no functional change.
 1.25 26-Jan-2013  christos more cross-compile friendly.
 1.24 26-Jan-2013  christos expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
 1.23 20-Dec-2012  hannken Revert rev. 1.20 now that bread() has been fixed.

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
 1.22 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.21 04-Nov-2012  jakllsch Stylistic changes in comments/strings:
"FAT" and "fat" are different things, use the appropriate case.
"GEMDOS" is all caps.
 1.20 09-Apr-2012  hannken branches: 1.20.2;
pcbmap(): We cannot use bread() here as for the pagedaemon getblk()
may fail leading to a panic in bread().
Replace bread() with getblk() / VOP_STRATEGY() and return
an error if getblk() fails.

Fixes PR#46282: 6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread

This is an interim solution for easy pullup. The final solution
is be to change bread() to not return a buffer on error. As
we have to change all callers of bread() this will not qualify
for a pullup.
 1.19 26-Jan-2010  joerg branches: 1.19.12; 1.19.16; 1.19.18;
On broken filesystems the fillinmap inner loop may have never read a
block, so don't try to release it if bp==NULL.
 1.18 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.17 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.16 16-May-2008  hannken branches: 1.16.6; 1.16.12;
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.15 08-Oct-2007  ad branches: 1.15.18; 1.15.20; 1.15.22; 1.15.24;
Merge brelse() changes from the vmlocking branch.
 1.14 29-Apr-2007  msaitoh branches: 1.14.6; 1.14.8; 1.14.10;
fix typos
 1.13 04-Mar-2007  christos branches: 1.13.2; 1.13.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12 25-Nov-2006  scw branches: 1.12.4;
Support FAT filesystems on non-DEV_BSIZE media.

Based on the patches provided in PR kern/17398 by Trevin Beattie.
 1.11 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.10 14-May-2006  elad branches: 1.10.6; 1.10.8; 1.10.10;
integrate kauth.
 1.9 15-Apr-2006  christos Coverity CID 839: Add KASSERT before deref.
 1.8 15-Apr-2006  christos Coverity CID 838: Add KASSERT before deref.
 1.7 24-Dec-2005  perry branches: 1.7.4; 1.7.6; 1.7.8; 1.7.10; 1.7.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 29-Aug-2005  xtraeme Remove __P()
 1.4 26-Feb-2005  perry branches: 1.4.2; 1.4.4;
nuke trailing whitespace
 1.3 21-Apr-2004  christos branches: 1.3.4; 1.3.6;
Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.2 22-Oct-2003  briggs Fix a panic that occurred when trying to traverse a corrupt msdosfs
filesystem. With this particular corruption, the code in pcbmap()
would compute an offset into an array that was way out of bounds,
so check the bounds before trying to access and return an error if
the offset would be out of bounds.
 1.1 26-Dec-2002  jdolecek branches: 1.1.2; 1.1.4;
move msdosfs code from sys/msdosfs to sys/fs/msdosfs
 1.1.4.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 29-Dec-2002  thorpej With with HEAD.
 1.1.2.1 26-Dec-2002  thorpej file msdosfs_fat.c was added on branch nathanw_sa on 2002-12-29 19:56:02 +0000
 1.3.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.4.1 29-Apr-2005  kent sync with -current
 1.4.4.4 27-Oct-2007  yamt sync with head.
 1.4.4.3 03-Sep-2007  yamt sync with head.
 1.4.4.2 30-Dec-2006  yamt sync with head.
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 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.7.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.7.10.2 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.7.10.1 19-Apr-2006  elad sync with head.
 1.7.8.1 24-May-2006  yamt sync with head.
 1.7.6.2 01-Jun-2006  kardel Sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.10.10.2 10-Dec-2006  yamt sync with head.
 1.10.10.1 22-Oct-2006  yamt sync with head
 1.10.8.2 12-Jan-2007  ad Sync with head.
 1.10.8.1 18-Nov-2006  ad Sync with head.
 1.10.6.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.12.4.2 07-May-2007  yamt sync with head.
 1.12.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.4.1 11-Jul-2007  mjf Sync with head.
 1.13.2.2 08-Jun-2007  ad Sync with head.
 1.13.2.1 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.14.10.1 14-Oct-2007  yamt sync with head.
 1.14.8.1 06-Nov-2007  matt sync with HEAD
 1.14.6.1 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.15.24.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.22.2 11-Mar-2010  yamt sync with head
 1.15.22.1 04-May-2009  yamt sync with head.
 1.15.20.1 18-May-2008  yamt sync with head.
 1.15.18.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.18.1 16-Apr-2012  riz Pull up following revision(s) (requested by hannken in ticket #183):
sys/fs/msdosfs/msdosfs_fat.c: revision 1.20
pcbmap(): We cannot use bread() here as for the pagedaemon getblk()
may fail leading to a panic in bread().
Replace bread() with getblk() / VOP_STRATEGY() and return
an error if getblk() fails.

Fixes PR#46282: 6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread ->
bio_doread

This is an interim solution for easy pullup. The final solution
is be to change bread() to not return a buffer on error. As
we have to change all callers of bread() this will not qualify
for a pullup.
 1.19.16.1 29-Apr-2012  mrg sync to latest -current.
 1.19.12.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.19.12.3 23-Jan-2013  yamt sync with head
 1.19.12.2 16-Jan-2013  yamt sync with (a bit old) head
 1.19.12.1 17-Apr-2012  yamt sync with head
 1.20.2.3 03-Dec-2017  jdolecek update from HEAD
 1.20.2.2 25-Feb-2013  tls resync with head
 1.20.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.28.14.2 29-May-2016  skrll Sync with HEAD
 1.28.14.1 06-Apr-2015  skrll Sync with HEAD
 1.28.12.1 19-Feb-2018  snj Pull up following revision(s) (requested by sevan in ticket #1558):
sys/fs/msdosfs/msdosfs_fat.c: 1.32
usr.sbin/makefs/msdos/msdosfs_vfsops.c: 1.11
Need strings.h for ffs()
--
Need strings.h for ffs()
Resolves implict declaration warning of ffs() when building tools via
build.sh
 1.31.10.1 04-Feb-2018  martin Pull up following revision(s) (requested by sevan in ticket #518):
sys/fs/msdosfs/msdosfs_fat.c: revision 1.32
usr.sbin/makefs/msdos/msdosfs_vfsops.c: revision 1.11
Need strings.h for ffs()
Need strings.h for ffs()
Resolves implict declaration warning of ffs() when building tools via
build.sh
 1.32.4.1 10-Jun-2019  christos Sync with HEAD
 1.32.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.32.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.41 06-Aug-2022  andvar s/blity/bility/ in various words, mainly in comments.
 1.40 23-Oct-2021  thorpej Sanitize the symbol namespace. NFC.
 1.39 23-Oct-2021  hannken Move msdosfs_rename() and doscheckpath() to new file msdosfs_rename.c.

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

No functional change.
 1.37 24-Jul-2021  andvar Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
 1.36 04-Apr-2020  ad branches: 1.36.8;
Merge the remaining changes from the ad-namecache branch, affecting namei()
and getcwd():

- push vnode locking back as far as possible.
- do most lookups directly in the namecache, avoiding vnode locks & refs.
- don't block new refs to vnodes across VOP_INACTIVE().
- get shared locks for VOP_LOOKUP() if the file system supports it.
- correct lock types for VOP_ACCESS() / VOP_GETATTR() in a few places.

Possible future enhancements:

- make the lookups lockless.
- support dotdot lookups by being lockless and inferring absence of chroot.
- maybe make it work for layered file systems.
- avoid vnode references at the root & cwd.
 1.35 30-Jan-2016  mlelstv branches: 1.35.18; 1.35.24;
Add support to msdosfs and makefs to generate correct Unicode (UCS-2) directory
entries from UTF8 encoded file names.
 1.34 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.33 08-Jul-2014  hannken branches: 1.33.4;
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.32 07-Feb-2014  hannken branches: 1.32.2;
Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
 1.31 23-Jan-2014  hannken 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.30 24-Dec-2013  mlelstv don't treat adjacent members as a larger array
Coverity CID 977367
 1.29 26-Jan-2013  christos branches: 1.29.2;
more cross-compile friendly.
 1.28 26-Jan-2013  christos expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
 1.27 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.26 05-Nov-2012  dholland Excise struct componentname from the namecache.

This uglifies the interface, because several operations need to be
passed the namei flags and cache_lookup also needs for the time being
to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit.

The glop should be able to go away eventually but requires structural
cleanup elsewhere first.

This change requires a kernel bump.
 1.25 05-Nov-2012  dholland Disentangle the namecache from the internals of namei.

- Move the namecache's hash computation to inside the namecache code,
instead of being spread out all over the place. Remove cn_hash from
struct componentname and delete all uses of it.

- It is no longer necessary (if it ever was) for cache_lookup and
cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases
that cache_enter already checks for.

- Rearrange the interface of cache_lookup (and cache_lookup_raw) to
make it somewhat simpler, to exclude certain nonexistent error
conditions, and (most importantly) to make it not require write access
to cnp->cn_flags.

This change requires a kernel bump.
 1.24 22-Jul-2012  rmind branches: 1.24.2;
Move some the test for MAKEENTRY into the cache_enter(9). Make some
variables in vfs_cache.c static, __read_mostly, etc.

No objection on tech-kern@.
 1.23 30-Nov-2010  dholland branches: 1.23.8; 1.23.14;
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.22 30-Jul-2010  mlelstv Return EINVAL for rename and delete operations to the
root directory instead of the erroneous EROFS.
 1.21 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.20 08-Jan-2010  pooka branches: 1.20.2; 1.20.4;
The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase). Plenty of mix'n match upper/lowercase has creeped
into the tree since then. Nuke the macros and convert all callsites
to lowercase.

no functional change
 1.19 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.18 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.17 23-Jan-2009  jmcneill branches: 1.17.2;
From FreeBSD, 10 years ago;

Now empty DOS filesystems default to long file names. Non-empty filesystems
without traces of Win95 default to short file names, as before.
 1.16 16-May-2008  hannken branches: 1.16.6; 1.16.8;
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.15 26-Nov-2007  pooka branches: 1.15.14; 1.15.16; 1.15.18; 1.15.20;
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.14 10-Oct-2007  ad branches: 1.14.4;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.13 08-Oct-2007  ad Merge brelse() changes from the vmlocking branch.
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.14; 1.12.16; 1.12.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 09-Dec-2006  chs branches: 1.11.2;
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.10 25-Nov-2006  scw branches: 1.10.2;
Support FAT filesystems on non-DEV_BSIZE media.

Based on the patches provided in PR kern/17398 by Trevin Beattie.
 1.9 14-May-2006  elad branches: 1.9.8; 1.9.10;
integrate kauth.
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.6; 1.8.8; 1.8.10; 1.8.12;
merge ktrace-lwp.
 1.7 14-Sep-2005  soda mention what is the failure case, from FreeBSD revision 1.46 cvs log
 1.6 14-Sep-2005  christos PR/31312: Juan RP: Don't use negative cacheing on msdosfs, because of the
evil case preserving and case sensitive semantics. From FreeBSD.
 1.5 29-May-2005  christos branches: 1.5.2;
- rename variables to avoid shadowing.
- add a few const.
 1.4 26-Feb-2005  perry nuke trailing whitespace
 1.3 29-Jun-2003  fvdl branches: 1.3.2; 1.3.10; 1.3.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.2 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.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_lookup.c was added on branch nathanw_sa on 2002-12-29 19:56:03 +0000
 1.3.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.10.1 29-Apr-2005  kent sync with -current
 1.3.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.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.5.2.5 07-Dec-2007  yamt sync with head
 1.5.2.4 27-Oct-2007  yamt sync with head.
 1.5.2.3 03-Sep-2007  yamt sync with head.
 1.5.2.2 30-Dec-2006  yamt sync with head.
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.8.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.10.1 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.8.8.1 24-May-2006  yamt sync with head.
 1.8.6.1 01-Jun-2006  kardel Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.9.10.1 10-Dec-2006  yamt sync with head.
 1.9.8.1 12-Jan-2007  ad Sync with head.
 1.10.2.2 04-Aug-2010  bouyer Pull up following revision(s) (requested by mlelstv in ticket #1402):
sys/fs/msdosfs/msdosfs_lookup.c: revision 1.22
Return EINVAL for rename and delete operations to the
root directory instead of the erroneous EROFS.
 1.10.2.1 17-Feb-2007  tron Apply patch (requested by chs in ticket #422):
- Fix various deadlock problems with nullfs and unionfs.
- Speed up path lookups by upto 25%.
 1.11.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.18.1 14-Oct-2007  yamt sync with head.
 1.12.16.2 09-Jan-2008  matt sync with HEAD
 1.12.16.1 06-Nov-2007  matt sync with HEAD
 1.12.14.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.12.14.1 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.12.2.2 17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.12.2.1 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.14.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.15.20.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.18.3 11-Aug-2010  yamt sync with head.
 1.15.18.2 11-Mar-2010  yamt sync with head
 1.15.18.1 04-May-2009  yamt sync with head.
 1.15.16.1 18-May-2008  yamt sync with head.
 1.15.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.8.2 21-Nov-2010  riz Pull up following revision(s) (requested by mlelstv in ticket #1434):
sys/fs/msdosfs/msdosfs_lookup.c: revision 1.22
Return EINVAL for rename and delete operations to the
root directory instead of the erroneous EROFS.
 1.16.8.1 02-Feb-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #383):
sys/fs/msdosfs/msdosfs_lookup.c: revision 1.17
From FreeBSD, 10 years ago;
Now empty DOS filesystems default to long file names. Non-empty filesystems
without traces of Win95 default to short file names, as before.
 1.16.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.16.6.1 03-Mar-2009  skrll Sync with HEAD.
 1.17.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.4.2 05-Mar-2011  rmind sync with head
 1.20.4.1 03-Jul-2010  rmind sync with head
 1.20.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.23.14.1 12-Aug-2012  martin Pull up following revision(s) (requested by manu in ticket #484):
sys/fs/nilfs/nilfs_vnops.c: revision 1.18
sys/ufs/ufs/ufs_lookup.c: revision 1.117
sys/nfs/nfs_vnops.c: revision 1.295
sys/ufs/chfs/chfs_vnops.c: revision 1.8
sys/ufs/ext2fs/ext2fs_lookup.c: revision 1.70
sys/fs/unionfs/unionfs_vnops.c: revision 1.6
sys/kern/vfs_cache.c: revision 1.89
sys/fs/efs/efs_vnops.c: revision 1.26
sys/fs/hfs/hfs_vnops.c: revision 1.26
sys/fs/adosfs/adlookup.c: revision 1.16
sys/fs/puffs/puffs_vnops.c: revision 1.168
sys/fs/tmpfs/tmpfs_vnops.c: revision 1.98
sys/fs/ntfs/ntfs_vnops.c: revision 1.52
sys/fs/cd9660/cd9660_lookup.c: revision 1.20
sys/fs/msdosfs/msdosfs_lookup.c: revision 1.24
sys/fs/smbfs/smbfs_vnops.c: revision 1.80
sys/fs/udf/udf_vnops.c: revision 1.72
sys/fs/filecorefs/filecore_lookup.c: revision 1.14
sys/fs/puffs/puffs_node.c: revision 1.25
Move some the test for MAKEENTRY into the cache_enter(9). Make some
variables in vfs_cache.c static, __read_mostly, etc.
No objection on tech-kern@.
 1.23.8.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.23.8.3 23-Jan-2013  yamt sync with head
 1.23.8.2 16-Jan-2013  yamt sync with (a bit old) head
 1.23.8.1 30-Oct-2012  yamt sync with head
 1.24.2.4 03-Dec-2017  jdolecek update from HEAD
 1.24.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.24.2.2 25-Feb-2013  tls resync with head
 1.24.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.29.2.1 18-May-2014  rmind sync with head
 1.32.2.1 10-Aug-2014  tls Rebase.
 1.33.4.2 19-Mar-2016  skrll Sync with HEAD
 1.33.4.1 06-Apr-2015  skrll Sync with HEAD
 1.35.24.1 19-Jan-2020  ad Set IMNT_SHRLOOKUP and use it for the in-cache case. Need to check what
more can be done with tmpfs though, it can probably do the whole lookup.
 1.35.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.36.8.1 01-Aug-2021  thorpej Sync with HEAD.
 1.4 04-May-2024  mlelstv From genfs_rename.c:

* XXX Want a better equality test. `tcnp->cn_cred == cred'
* hoses p2k because puffs transmits the creds separately and
* allocates distinct but equivalent structures for them.

Fixes rename crash in rump_msdos.
 1.3 23-Oct-2021  thorpej branches: 1.3.4;
Sanitize the symbol namespace. NFC.
 1.2 23-Oct-2021  hannken Convert msdosfs_rename() to use genfs_sane_rename().

Based on work by Taylor R Campbell.
 1.1 23-Oct-2021  hannken Move msdosfs_rename() and doscheckpath() to new file msdosfs_rename.c.

No functional change.
 1.3.4.1 20-Jun-2024  martin Pull up following revision(s) (requested by rhialto in ticket #706):

sys/fs/msdosfs/msdosfs_rename.c: revision 1.4

From genfs_rename.c:
* XXX Want a better equality test. `tcnp->cn_cred == cred'
* hoses p2k because puffs transmits the creds separately and
* allocates distinct but equivalent structures for them.

Fixes rename crash in rump_msdos.
 1.2 06-Feb-2016  joerg branches: 1.2.2; 1.2.18;
Toolify.
 1.1 06-Feb-2016  mlelstv Split case folding table into separate source file and add full
copyright and permission notice from http://www.unicode.org/copyright.html
 1.2.18.2 03-Dec-2017  jdolecek update from HEAD
 1.2.18.1 06-Feb-2016  jdolecek file msdosfs_unicode.c was added on branch tls-maxphys on 2017-12-03 11:38:41 +0000
 1.2.2.2 19-Mar-2016  skrll Sync with HEAD
 1.2.2.1 06-Feb-2016  skrll file msdosfs_unicode.c was added on branch nick-nhusb on 2016-03-19 11:30:31 +0000
 1.138 16-Apr-2022  hannken Lock vnode for vinvalbuf().
 1.137 23-Oct-2021  thorpej Sanitize the symbol namespace. NFC.
 1.136 11-Feb-2021  ryoon Enable to mount Raspberry Pi Pico's USB mass storage partition

Fix PR kern/55985.
O.k. by thorpej@.

Pull-up to netbsd-8 and netbsd-9.
 1.135 13-Apr-2020  ad branches: 1.135.2;
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.134 04-Apr-2020  ad branches: 1.134.2;
Merge the remaining changes from the ad-namecache branch, affecting namei()
and getcwd():

- push vnode locking back as far as possible.
- do most lookups directly in the namecache, avoiding vnode locks & refs.
- don't block new refs to vnodes across VOP_INACTIVE().
- get shared locks for VOP_LOOKUP() if the file system supports it.
- correct lock types for VOP_ACCESS() / VOP_GETATTR() in a few places.

Possible future enhancements:

- make the lookups lockless.
- support dotdot lookups by being lockless and inferring absence of chroot.
- maybe make it work for layered file systems.
- avoid vnode references at the root & cwd.
 1.133 16-Mar-2020  pgoyette Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.

Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself. These are not changed.
 1.132 27-Feb-2020  ad Tighten up the locking around vp->v_iflag a little more after the recent
split of vmobjlock & v_interlock.
 1.131 17-Jan-2020  ad VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.
 1.130 03-Sep-2018  riastradh branches: 1.130.4; 1.130.6;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.129 27-Nov-2017  mlelstv branches: 1.129.2; 1.129.4;
relax sanity check. It's ok to have more FAT sectors than needed.
 1.128 20-Aug-2017  mlelstv Add more sanity checks for BPB parameters. Handle FAT12 format for media
with sectors >= 32kByte.

Does fix PR 52485.
 1.127 17-Apr-2017  hannken branches: 1.127.2; 1.127.4;
Remove unused argument "nextp" from vfs_busy() and vfs_unbusy().
Remove argument "keepref" from vfs_unbusy() and add vfs_ref() where needed.
 1.126 17-Apr-2017  hannken Add vfs_ref(mp) and vfs_rele(mp) to add or remove a reference to
struct mount. Rename vfs_destroy(mp) to vfs_rele(mp) and replace
incrementing mp->mnt_refcnt with vfs_ref(mp).
 1.125 01-Apr-2017  riastradh KASSERT(mutex_owned(vp->v_interlock)) in vnode iterator selector.
 1.124 01-Mar-2017  hannken Remove now redundant calls to fstrans_start()/fstrans_done().
 1.123 22-Feb-2017  hannken Enable fstrans on all file systems.

Welcome to 7.99.61
 1.122 17-Feb-2017  hannken Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.
 1.121 17-Feb-2017  hannken Untangle VFS_SYNC() from VFS_SUSPENDCTL().
 1.120 17-Feb-2017  hannken Take vnode lock for VOP_FSYNC().
 1.119 14-Dec-2016  hannken branches: 1.119.2;
Move vnode members "v_freelisthd" and "v_freelist" from "struct vnode"
to "struct vnode_impl" and rename to "vi_lrulisthd" and "vi_lrulist".

No functional change intended.

Welcome to 7.99.48
 1.118 28-Mar-2015  maxv branches: 1.118.2;
Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
 1.117 23-Jan-2015  christos catch up with DPRINTF change
 1.116 23-Jan-2015  christos add some more paranoid checks about secsize and struct use.
 1.115 18-Jul-2014  maxv branches: 1.115.2; 1.115.4;
Make DPRINTF more understandable, and replace my previous #ifdef DIAGNOSTIC...
 1.114 16-Jul-2014  maxv Limit the minimum size of a disk sector to 512 bytes, to prevent memory
overflow on extremely low secsize. This normally conforms to the old standard
(for which there doesn't seem to be a clear spec). Since 2011, IDEMA's Advanced
Format standardizes it to 4k, so this change won't cause any trouble on
new devices.

Put the printf under DIAGNOSTIC temporarily to see if someone complains.

after a quick discussion on tech-kern
 1.113 15-Jul-2014  christos Correct the bread size of struct fsinfo from Gerald Lee at DELL dot com
 1.112 09-Jul-2014  maxv Minor changes:
- malloc()+memset() -> malloc(|M_ZERO)
- rename 'vers' to 'FSVers'
- declare 'ExtFlags' instead of calling getushort() two times
 1.111 09-Jul-2014  maxv Remove ROOTNAME (unused).
 1.110 08-Jul-2014  maxv - Perform sanity checks not just for GEMDOSFS, but for all FAT devices. This
also fixes a division-by-zero bug that could crash the system.
- Define GEMDOSFS_BSIZE instead of a hard-coded 512 value, and remove 'bsize'.
- Rename 'tmp' to 'BlkPerSec'.

From me, FreeBSD, OpenBSD and the FAT specification.

ok christos@
 1.109 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.108 24-May-2014  christos Introduce a selector function to the vfs vnode iterator so that we don't
need to vget() vnodes that we are not interested at, and optimize locking
a bit. Iterator changes reviewed by Hannken (thanks), the rest of the bugs
are mine.
 1.107 16-Apr-2014  maxv An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@
 1.106 23-Mar-2014  hannken branches: 1.106.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.
 1.105 17-Mar-2014  hannken Change msdosfs_sync() to use vfs_vnode_iterator.
 1.104 25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.103 23-Nov-2013  christos change the mountlist CIRCLEQ into a TAILQ
 1.102 30-Sep-2013  hannken Replace macro v_specmountpoint with two functions spec_node_getmountedfs()
and spec_node_setmountedfs() to manage the file system mounted on a device.
Assert the device is a block device.

Welcome to 6.99.24

Discussed on tech-kern@ some time ago.

Reviewed by: David Holland <dholland@netbsd.org>
 1.101 15-Apr-2013  jakllsch branches: 1.101.4;
Don't attempt to mount file system with clusters larger than MAXBSIZE.
 1.100 04-Nov-2012  jakllsch Stylistic changes in comments/strings:
"FAT" and "fat" are different things, use the appropriate case.
"GEMDOS" is all caps.
 1.99 04-Nov-2012  jakllsch Check that the FSInfo block's next free cluster suggestion is actually
a cluster within the bounds of the volume too.
 1.98 04-Nov-2012  jakllsch ((u_long)-1) will not always be 0xffffffff, which is what we actually
want to test against to determine if the FSInfo block's next free
cluster suggestion is valid
 1.97 03-Oct-2012  jakllsch We don't actually want to round the number of elements in the bitmap
down. Fixes a self-inflicted buffer overrun.

(This was detected by chance that the top of the bitmap coincided with
a page boundary.)
 1.96 07-Jul-2012  tsutsui branches: 1.96.2;
Revert rev 1.95 since getdisksize() no longer returns secsize=0.
 1.95 30-Jun-2012  tsutsui Add a sanity check if secsize returned from getdisksize() isn't bogus.
This prevent possible panic "panic: buf mem pool index 23" later in
vfs_bio.c:buf_mempoolidx().
(I'm not sure if it's okay for getdisksize() to assume that
partinfo taken from DIOCGPART is properly initialized
on all disk(9) devices or not)

See also:
http://mail-index.NetBSD.org/source-changes/2012/06/30/msg035298.html
 1.94 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.93 14-Nov-2011  hannken branches: 1.93.4; 1.93.6;
VOP_OPEN() needs a locked vnode. All these copy-and-pasted xxxfs_mount()
implementations need more review.
 1.92 07-Oct-2011  hannken branches: 1.92.2;
As vnalloc() always allocates with PR_WAITOK there is no longer the need
to test its result for NULL.
 1.91 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.90 04-Apr-2011  hannken branches: 1.90.2;
Msdosfs on-disk meta data is not sufficient to create or validate file handles.

Maintain a tree of file handles, create nodes from msdosfs_vptofh() and keep
them until either the file gets unlinked or the file system gets unmounted.

Fixes the msdosfs part of PR #43745 (fhopen of an unlinked file causes problems
on multiple file systems)
 1.89 27-Dec-2010  hannken branches: 1.89.2;
Extend the range of fstrans transactions to a sequence of vnode operations
on a locked vnode. This leaves a suspended file system and therefore a
snapshot with either all or no operations of such a sequence done.
 1.88 14-Dec-2010  hannken msdosfs_sync: check for dead vnode (denode == NULL) before testing denode flags.
 1.87 21-Jul-2010  hannken Make holding v_interlock mandatory for callers of vget().

Announced some time ago on tech-kern.
 1.86 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.85 13-Apr-2010  pooka polish previous
 1.84 13-Apr-2010  pooka If getdisksize() fails (happens e.g. on fss block devices), don't
give up if we don't really need the information provided by it.
 1.83 11-Apr-2010  mlelstv The *_modcmd functions use the module name as prefix.
 1.82 11-Apr-2010  pooka Make module name match MOUNT_NAME. Inspired by PR kern/43110.
 1.81 09-Apr-2010  hannken Add file system suspension support (vfs_suspend(9)) to msdosfs.

Reviewed by: Antti Kantee <pooka@netbsd.org>
 1.80 07-Apr-2010  pooka * Don't care about VOP_CLOSE() error in unmount. In the extremely
unlike event it did fail, the kernel would double lutz to doom
(in failure devvp now remains unmountable until reboot. fans
of complicated & untested error branches may attempt to gunk this
up. i'm not one of them).
* cosmetic surgery: cut extra ;
 1.79 31-Jan-2010  mlelstv branches: 1.79.2; 1.79.4;
Replace individual queries for partition information with
new helper function.
 1.78 26-Jan-2010  mlelstv Drop two uses of disk label data.

msdosfs and cd9660 are the only filesystems that verify the filesystem
type in the label. This is the wrong place, sanity checks should only
rely on the inner structure of the filesystem (like signatures or
magic numbers).

msdosfs also used the device type information from the label to
deduce a filesystem parameter heuristically for the gemdos variant.
If there is no information inside the filesystem data itself, this
should be an explicit mount option.
 1.77 25-Jan-2010  mlelstv Fetch sector size also from wedges.
 1.76 29-Jun-2009  dholland Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.75 25-Apr-2009  elad Wrap some long lines in a comment, pointed out by ad@ - thanks!

While here, wrap two more long lines.
 1.74 25-Apr-2009  elad Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
 1.73 15-Mar-2009  cegger ansify function definitions
 1.72 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.71 05-Feb-2009  abs branches: 1.71.2;
Remove additional GEMDOS only check on fstype, and update comment
 1.70 26-Dec-2008  jmcneill Remove pm_Heads check in msdosfs_mountfs; this value isn't really used,
FreeBSD and OpenBSD both removed this check years ago, and this makes an
8GB Memory Stick Pro Duo formatted with a PSP work.
 1.69 16-Dec-2008  pooka The great QUOTA purge of '08: get rid of those #ifdef QUOTA and
#include "opt_quota.h" which do exactly nothing. Speeds up kernel
compilation by 1.375*10^-20001 seconds. But leave the most moxious
comment in msdosfs_vfsops untouched.
 1.68 28-Jun-2008  rumble branches: 1.68.4; 1.68.6;
Create sysctl entries during module initialisation and destroy them
appropriately.

Many of these file systems are now ready for modularisation.
 1.67 16-May-2008  hannken branches: 1.67.2;
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.66 10-May-2008  rumble Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.
 1.65 06-May-2008  ad branches: 1.65.2;
PR kern/38141 lookup/vfs_busy acquire rwlock recursively

Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
and is only ever write locked in dounmount(). A write hold can't be taken
on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
example when going r/o -> r/w, and is only present to serialize updates.
In order to take this lock, a read hold must first be taken on
mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
 1.64 30-Apr-2008  ad Make various bits of debug code compile again.
 1.63 30-Apr-2008  ad PR kern/38135 vfs_busy/vfs_trybusy confusion

The previous fix worked, but it opened a window where mounts could have
disappeared from mountlist while the caller was traversing it using
vfs_trybusy(). Fix that.
 1.62 29-Apr-2008  ad PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.
 1.61 30-Jan-2008  ad branches: 1.61.6; 1.61.8; 1.61.10;
PR kern/37706 (forced unmount of file systems is unsafe):

- Do reference counting for 'struct mount'. Each vnode associated with a
mount takes a reference, and in turn the mount takes a reference to the
vfsops.
- Now that mounts are reference counted, replace the overcomplicated mount
locking inherited from 4.4BSD with a recursable rwlock.
 1.60 28-Jan-2008  dholland Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.
 1.59 24-Jan-2008  ad specfs changes for PR kern/37717 (raidclose() is no longer called on
shutdown). There are still problems with device access and a PR will be
filed.

- Kill checkalias(). Allow multiple vnodes to reference a single device.

- Don't play dangerous tricks with block vnodes to ensure that only one
vnode can describe a block device. Instead, prohibit concurrent opens of
block devices. As a bonus remove the unreliable code that prevents
multiple file system mounts on the same device. It's no longer needed.

- Track opens by vnode and by device. Issue cdev_close() when the last open
goes away, instead of abusing vnode::v_usecount to tell if the device is
open.
 1.58 04-Jan-2008  pooka Politely refuse to mount a file system which says its FAT size is
zero - our implementation can't handle it (how sensible handling
a case like that would be is a whole other debate).

fixes panic reported by Jukka Salmi on current-users
 1.57 03-Jan-2008  pooka valloc -> vnalloc, vfree -> vnfree
Avoids collision with userland valloc(3).

no functional change
ad ok
 1.56 02-Jan-2008  ad Merge vmlocking2 to head.
 1.55 08-Dec-2007  pooka branches: 1.55.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.54 26-Nov-2007  pooka branches: 1.54.2;
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.53 10-Oct-2007  ad branches: 1.53.4;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.52 08-Oct-2007  ad Merge brelse() changes from the vmlocking branch.
 1.51 24-Sep-2007  rumble Avoid stack allocation of large dirent structures in foo_readdir().
 1.50 31-Jul-2007  pooka branches: 1.50.2; 1.50.4; 1.50.6; 1.50.8;
* nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods
 1.49 26-Jul-2007  pooka Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.
 1.48 20-Jul-2007  pooka In sync, skip over vnodes based on if they are clean rather than
if they have pages.
 1.47 17-Jul-2007  pooka branches: 1.47.2;
Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok
 1.46 12-Jul-2007  dsl Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.
 1.45 30-Jun-2007  pooka Using POOL_INIT here makes no sense, since file systems always have
an init method. So get rid of it and #ifdef _LKM and just always
init in the init method. Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.
 1.44 17-Feb-2007  kochi branches: 1.44.4; 1.44.6;
fix the problem reported in kern/35457, "cant mount msdosfs on floppy".

Since 1.40, which introduced support for non-DEV_BSIZE media,
mounting msdos floppy returned ENOTTY.

This is because floppy driver does not support DIOCGPART or DIOCWEDGEINFO
ioctl.

Those ioctls should not be a requirement for mounting msdosfs.

This patch is made by Christian Biere.
 1.43 22-Jan-2007  reinoud branches: 1.43.2;
Fix typo
- * assoicated with this mount point, start over.
+ * associated with this mount point, start over.
 1.42 20-Jan-2007  christos - If the filesystem lives on a wedge, then we try to get wedge information
since DIOCGPART is going to fail. Unfortunately there is no way to get the
geometry information we need from the wedge; it would be nice for wedges
to support a geometry ioctl. The values we cannot retrieve are marked with
XXX.
- Add a lot more debugging.
 1.41 19-Jan-2007  hannken New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE. This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).
 1.40 25-Nov-2006  scw branches: 1.40.2;
Support FAT filesystems on non-DEV_BSIZE media.

Based on the patches provided in PR kern/17398 by Trevin Beattie.
 1.39 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.38 25-Oct-2006  reinoud Revisit mnt_vnodelist TAILQ patch. Remove all suspicious TAILQ_FOREACH()
loops where vnodes can get removed or added during the loops. This could
lead to panic's on unmount since nodes are skipped or otherwise
TAILQ_NEXT(0xdeadbeef, ...) was dereferenced.
 1.37 20-Oct-2006  reinoud Replace the LIST structure mp->mnt_vnodelist to a TAILQ structure since all
vnodes were synced and processed backwards. This meant that the last
accessed node was processed first and the earlierst last.

An extra benefit is the removal of the ugly hack from the Berkly days on
LFS.

In the proces, i've also replaced the various variations hand written loops
by the TAILQ_FOREACH() macro's.
 1.36 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.35 02-Sep-2006  christos branches: 1.35.2; 1.35.4;
add missing initializers
 1.34 14-Aug-2006  gdt When mounting an MSDOS fileysystem, do not require that bytes 252 and
253 of the superblock be zero. Searching the net failed to find any
justification for checking these bytes; all available references say
that they are part of the boot code and not BOOTSIG2 and BOOTSIG3.

Modify the MSDOS 7.1 bootsector definition to have 420 bytes of boot
code and no BOOTSIG[23], rather than 418 bytes of boot code, to follow
available references and apparent Windows practice. A test build
showed that these defines are not used other than in the check removed
by this commit.

Patch tested on netbsd-3, and enabled mounting of a 4 GB CF formatted
under Windows XP and then in a digital camera. The CF was previously
unmountable.

Concept approved on tech-kern by christos@ and martin@.
 1.33 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.32 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.31 14-May-2006  elad branches: 1.31.4;
integrate kauth.
 1.30 21-Feb-2006  thorpej branches: 1.30.2; 1.30.4; 1.30.6;
Use device_class() instead of accessing dv_class directly.
 1.29 11-Dec-2005  christos branches: 1.29.2; 1.29.4; 1.29.6;
merge ktrace-lwp.
 1.28 23-Sep-2005  jmmv Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
 1.27 10-Sep-2005  christos PR/23773: Tero Kivinen: Cannot mount msdos filesystems if filesystem size >
128GB
PR/31287: Fabien Devaux: msdosfs now can mount >128MB filesystems
 1.26 29-Aug-2005  xtraeme Remove __P()
 1.25 05-Aug-2005  jmmv Let this build when MSDOSFS_DEBUG is defined (v_id disappeared a long time
ago but it was still used here).
 1.24 29-May-2005  christos branches: 1.24.2;
- rename variables to avoid shadowing.
- add a few const.
 1.23 29-Mar-2005  thorpej - Define a VFS_ATTACH() macro that places a reference to a vfsops structure
into the "vfsops" link set.
- Use VFS_ATTACH() where vfsops are declared for individual file systems.
- In vfsinit(), traverse the "vfsops" link set, rather than vfs_list_initial[].
 1.22 09-Jan-2005  mycroft branches: 1.22.2;
Rework the mountroot interface so that vfs_mountroot() opens the root device
and just passes it on to the file system functions. This avoids opening and
closing the device several times.

Mentioned on tech-kern some time ago, IIRC. I've been running this for a
long time.
 1.21 02-Jan-2005  thorpej Add the system call and VFS infrastructure for file system extended
attributes.

From FreeBSD.
 1.20 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.19 27-Jun-2004  jdolecek set gmtoff in the structure returned by MNT_GETARGS call
 1.18 25-May-2004  hannken Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.

- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
Snapshots may not be opened for writing and the attributes are read-only.
Use the mtime as the time this snapshot was taken.
Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
 1.17 25-May-2004  atatat Sysctl descriptions under vfs subtree
 1.16 27-Apr-2004  jrf First pass for some caddr_t removal and changes to get rid of it where we
no longer use and/or need it

- removed casts from unionfs, deadfs and fdesc
(there are more to hunt down still)
- changed vfs_quotactl args argumet from caddr_t to void *
- changed vfs_quotactl structures/callers to reflect the api change

Compiled fine and ran for about a day. Approved/reviewed by
christos@netbsd.org and gimpy@netbsd.org.
 1.15 27-Apr-2004  jdolecek initialize gmtoff in mount structure if mount version is < 3
 1.14 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.13 24-Mar-2004  atatat branches: 1.13.2;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.12 04-Dec-2003  atatat Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.11 14-Oct-2003  dbj add mnt_iflag field to struct mount for internal flags
mv MNT_GONE, MNT_UNMOUNT and MNT_WANTRDWR to this field
additonally add mnt_writeopcountupper and mnt_writeopcountlower fields
in preparation for pending write suspension support work
bump kernel version to 1.6ZD
 1.10 06-Oct-2003  lukem Consistently use "bsBPB" as the struct member for the BIOS parameter block.
 1.9 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.8 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.7 29-Jun-2003  fvdl branches: 1.7.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.6 29-Jun-2003  thorpej Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.5 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.4 16-Apr-2003  christos PR/1796: John Kohl: statfs misbehaves under chrooted environments.

- Under chroot it displays only the visible filesystems with appropriate paths.
- The statfs f_mntonname gets adjusted to contain the real path from root.
- While was there, fixed a bug in ext2fs, locking problems with vfs_getfsstat(),
and factored out some of the vfsop statfs() code to copy_statfs_info(). This
fixes the problem where some filesystems forgot to set fsid.
- Made coda look more like a normal fs.
 1.3 21-Mar-2003  dsl Use 'void *' instead of 'caddr_t' in prototypes of VOP_IOCTL, VOP_FCNTL
and VOP_ADVLOCK, delete casts from callers (and some to copyin/out).
 1.2 01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 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_vfsops.c was added on branch nathanw_sa on 2002-12-29 19:56:05 +0000
 1.7.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.2.7 01-Apr-2005  skrll Sync with HEAD.
 1.7.2.6 17-Jan-2005  skrll Sync with HEAD.
 1.7.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.3 24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.7.2.2 03-Aug-2004  skrll Sync with HEAD
 1.7.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.13.2.2 27-Jun-2004  he Pull up revision 1.19 (requested by jdolecek in ticket #562):
Set gmtoff in the structure returned by the MNT_GETARGS call.
 1.13.2.1 29-May-2004  tron Pull up revision 1.17 (requested by atatat in ticket #393):
Sysctl descriptions under vfs subtree
 1.22.2.1 29-Apr-2005  kent sync with -current
 1.24.2.8 04-Feb-2008  yamt sync with head.
 1.24.2.7 21-Jan-2008  yamt sync with head
 1.24.2.6 07-Dec-2007  yamt sync with head
 1.24.2.5 27-Oct-2007  yamt sync with head.
 1.24.2.4 03-Sep-2007  yamt sync with head.
 1.24.2.3 26-Feb-2007  yamt sync with head.
 1.24.2.2 30-Dec-2006  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.29.6.2 01-Jun-2006  kardel Sync with head.
 1.29.6.1 22-Apr-2006  simonb Sync with head.
 1.29.4.1 09-Sep-2006  rpaulo sync with head
 1.29.2.1 01-Mar-2006  yamt sync with head.
 1.30.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.30.4.3 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.30.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.30.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.30.2.3 03-Sep-2006  yamt sync with head.
 1.30.2.2 11-Aug-2006  yamt sync with head
 1.30.2.1 24-May-2006  yamt sync with head.
 1.31.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.35.4.2 10-Dec-2006  yamt sync with head.
 1.35.4.1 22-Oct-2006  yamt sync with head
 1.35.2.3 01-Feb-2007  ad Sync with head.
 1.35.2.2 12-Jan-2007  ad Sync with head.
 1.35.2.1 18-Nov-2006  ad Sync with head.
 1.40.2.1 27-Feb-2007  riz Pull up following revision(s) (requested by kochi in ticket #453):
sys/fs/msdosfs/msdosfs_vfsops.c: revisions 1.41-1.44 via patch
fix the problem reported in kern/35457, "cant mount msdosfs on floppy".

Since 1.40, which introduced support for non-DEV_BSIZE media,
mounting msdos floppy returned ENOTTY.

This is because floppy driver does not support DIOCGPART or DIOCWEDGEINFO
ioctl.

Those ioctls should not be a requirement for mounting msdosfs.

This patch is made by Christian Biere.
 1.43.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.44.6.1 11-Jul-2007  mjf Sync with head.
 1.44.4.10 25-Oct-2007  ad Fix up mnt_vnodelist handling.
 1.44.4.9 09-Oct-2007  ad Sync with head.
 1.44.4.8 09-Oct-2007  ad Sync with head.
 1.44.4.7 24-Aug-2007  ad Sync with buffer cache locking changes. See buf.h/vfs_bio.c for details.
Some minor portions are incomplete and needs to be verified as a whole.
 1.44.4.6 20-Aug-2007  ad Sync with HEAD.
 1.44.4.5 29-Jul-2007  ad Add vfs_destroy() to free mount structures. The specificdata_ref was being
leaked.
 1.44.4.4 15-Jul-2007  ad Sync with head.
 1.44.4.3 17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.44.4.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.44.4.1 13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.47.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.50.8.2 31-Jul-2007  pooka * nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
use VFS_PROTOS() instead of manually prototyping the methods
 1.50.8.1 31-Jul-2007  pooka file msdosfs_vfsops.c was added on branch matt-mips64 on 2007-07-31 21:14:18 +0000
 1.50.6.2 14-Oct-2007  yamt sync with head.
 1.50.6.1 06-Oct-2007  yamt sync with head.
 1.50.4.3 23-Mar-2008  matt sync with HEAD
 1.50.4.2 09-Jan-2008  matt sync with HEAD
 1.50.4.1 06-Nov-2007  matt sync with HEAD
 1.50.2.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.50.2.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.50.2.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.50.2.1 02-Oct-2007  joerg Sync with HEAD.
 1.53.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.53.4.2 27-Dec-2007  mjf Sync with HEAD.
 1.53.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.54.2.2 26-Dec-2007  ad Sync with head.
 1.54.2.1 04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.55.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.55.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.61.10.5 11-Aug-2010  yamt sync with head.
 1.61.10.4 11-Mar-2010  yamt sync with head
 1.61.10.3 18-Jul-2009  yamt sync with head.
 1.61.10.2 04-May-2009  yamt sync with head.
 1.61.10.1 16-May-2008  yamt sync with head.
 1.61.8.1 18-May-2008  yamt sync with head.
 1.61.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.61.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.61.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.65.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.65.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.67.2.1 03-Jul-2008  simonb Sync with head.
 1.68.6.3 25-Apr-2014  sborrill Pull up the following revisions(s) (requested by maxv in ticket #1901):
sys/kern/vfs_syscalls.c: revision 1.478, 1.480 via patch
sys/coda/coda_vfsops.c: revision 1.81
sys/fs/adosfs/advfsops.c: revision 1.70
sys/fs/cd9660/cd9660_vfsops.c: revision 1.84
sys/fs/efs/efs_vfsops.c: revision 1.25
sys/fs/filecorefs/filecore_vfsops.c: revision 1.76
sys/fs/hfs/hfs_vfsops.c: revision 1.31
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.107
sys/fs/ntfs/ntfs_vfsops.c: revision 1.94
sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.50 via patch
sys/fs/puffs/puffs_vfsops.c: revision 1.110 via patch
sys/fs/smbfs/smbfs_vfsops.c: revision 1.100
sys/fs/sysvbfs/sysvbfs_vfsops.c: revision 1.43
sys/fs/tmpfs/tmpfs_vfsops.c: revision 1.59 via patch
sys/fs/udf/udf_vfsops.c: revision 1.67
sys/fs/union/union_vfsops.c: revision 1.72
sys/fs/unionfs/unionfs_vfsops.c: revision 1.13
sys/kern/vfs_syscalls.c: revision 1.479
sys/miscfs/nullfs/null_vfsops.c: revision 1.88 via patch
sys/miscfs/overlay/overlay_vfsops.c: revision 1.61
sys/miscfs/procfs/procfs_vfsops.c: revision 1.91
sys/miscfs/umapfs/umap_vfsops.c: revision 1.92
sys/nfs/nfs_vfsops.c: revision 1.227
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.180
sys/ufs/ffs/ffs_vfsops.c: revision 1.297
sys/ufs/lfs/lfs_vfsops.c: revision 1.321
sys/ufs/mfs/mfs_vfsops.c: revision 1.107

Due to missing checks in the mount syscall, and a wrong assumption on the
file systems side, the kernel could allocate an unbounded or zero-sized
memory buffer, and could dereference a NULL pointer when particular
arguments are given by a user.
 1.68.6.2 08-Feb-2009  snj branches: 1.68.6.2.6; 1.68.6.2.10;
Pull up following revision(s) (requested by abs in ticket #420):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.71
Remove additional GEMDOS only check on fstype, and update comment
 1.68.6.1 02-Jan-2009  snj Pull up following revision(s) (requested by jmcneill in ticket #209):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.70
Remove pm_Heads check in msdosfs_mountfs; this value isn't really used,
FreeBSD and OpenBSD both removed this check years ago, and this makes an
8GB Memory Stick Pro Duo formatted with a PSP work.
 1.68.6.2.10.1 28-Apr-2014  sborrill Pull up the following revisions(s) (requested by maxv in ticket #1901):
sys/kern/vfs_syscalls.c: revision 1.478, 1.480 via patch
sys/coda/coda_vfsops.c: revision 1.81
sys/fs/adosfs/advfsops.c: revision 1.70
sys/fs/cd9660/cd9660_vfsops.c: revision 1.84
sys/fs/efs/efs_vfsops.c: revision 1.25
sys/fs/filecorefs/filecore_vfsops.c: revision 1.76
sys/fs/hfs/hfs_vfsops.c: revision 1.31
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.107
sys/fs/ntfs/ntfs_vfsops.c: revision 1.94
sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.50 via patch
sys/fs/puffs/puffs_vfsops.c: revision 1.110 via patch
sys/fs/smbfs/smbfs_vfsops.c: revision 1.100
sys/fs/sysvbfs/sysvbfs_vfsops.c: revision 1.43
sys/fs/tmpfs/tmpfs_vfsops.c: revision 1.59 via patch
sys/fs/udf/udf_vfsops.c: revision 1.67
sys/fs/union/union_vfsops.c: revision 1.72
sys/fs/unionfs/unionfs_vfsops.c: revision 1.13
sys/kern/vfs_syscalls.c: revision 1.479
sys/miscfs/nullfs/null_vfsops.c: revision 1.88 via patch
sys/miscfs/overlay/overlay_vfsops.c: revision 1.61
sys/miscfs/procfs/procfs_vfsops.c: revision 1.91
sys/miscfs/umapfs/umap_vfsops.c: revision 1.92
sys/nfs/nfs_vfsops.c: revision 1.227
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.180
sys/ufs/ffs/ffs_vfsops.c: revision 1.297
sys/ufs/lfs/lfs_vfsops.c: revision 1.321
sys/ufs/mfs/mfs_vfsops.c: revision 1.107

Due to missing checks in the mount syscall, and a wrong assumption on the
file systems side, the kernel could allocate an unbounded or zero-sized
memory buffer, and could dereference a NULL pointer when particular
arguments are given by a user.
 1.68.6.2.6.1 28-Apr-2014  sborrill Pull up the following revisions(s) (requested by maxv in ticket #1901):
sys/kern/vfs_syscalls.c: revision 1.478, 1.480 via patch
sys/coda/coda_vfsops.c: revision 1.81
sys/fs/adosfs/advfsops.c: revision 1.70
sys/fs/cd9660/cd9660_vfsops.c: revision 1.84
sys/fs/efs/efs_vfsops.c: revision 1.25
sys/fs/filecorefs/filecore_vfsops.c: revision 1.76
sys/fs/hfs/hfs_vfsops.c: revision 1.31
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.107
sys/fs/ntfs/ntfs_vfsops.c: revision 1.94
sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.50 via patch
sys/fs/puffs/puffs_vfsops.c: revision 1.110 via patch
sys/fs/smbfs/smbfs_vfsops.c: revision 1.100
sys/fs/sysvbfs/sysvbfs_vfsops.c: revision 1.43
sys/fs/tmpfs/tmpfs_vfsops.c: revision 1.59 via patch
sys/fs/udf/udf_vfsops.c: revision 1.67
sys/fs/union/union_vfsops.c: revision 1.72
sys/fs/unionfs/unionfs_vfsops.c: revision 1.13
sys/kern/vfs_syscalls.c: revision 1.479
sys/miscfs/nullfs/null_vfsops.c: revision 1.88 via patch
sys/miscfs/overlay/overlay_vfsops.c: revision 1.61
sys/miscfs/procfs/procfs_vfsops.c: revision 1.91
sys/miscfs/umapfs/umap_vfsops.c: revision 1.92
sys/nfs/nfs_vfsops.c: revision 1.227
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.180
sys/ufs/ffs/ffs_vfsops.c: revision 1.297
sys/ufs/lfs/lfs_vfsops.c: revision 1.321
sys/ufs/mfs/mfs_vfsops.c: revision 1.107

Due to missing checks in the mount syscall, and a wrong assumption on the
file systems side, the kernel could allocate an unbounded or zero-sized
memory buffer, and could dereference a NULL pointer when particular
arguments are given by a user.
 1.68.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.68.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.68.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.71.2.2 23-Jul-2009  jym Sync with HEAD.
 1.71.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.79.4.5 21-Apr-2011  rmind sync with head
 1.79.4.4 05-Mar-2011  rmind sync with head
 1.79.4.3 03-Jul-2010  rmind sync with head
 1.79.4.2 30-May-2010  rmind sync with head
 1.79.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.79.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.79.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.89.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.90.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.92.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.92.2.3 16-Jan-2013  yamt sync with (a bit old) head
 1.92.2.2 30-Oct-2012  yamt sync with head
 1.92.2.1 17-Apr-2012  yamt sync with head
 1.93.6.5 17-Oct-2017  martin Apply patch form mlelstv to fix the build after pullup #1506
 1.93.6.4 13-Oct-2017  snj Pull up following revision(s) (requested by mlelstv in ticket #1506):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.128
Add more sanity checks for BPB parameters. Handle FAT12 format for media
with sectors >= 32kByte.
Does fix PR 52485.
 1.93.6.3 09-Nov-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1171):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.110 via patch
- From me, FreeBSD, OpenBSD and the FAT specification. Ok christos@
- Perform sanity checks not just for GEMDOSFS, but for all FAT devices. This
also fixes a division-by-zero bug that could crash the system.
- Define GEMDOSFS_BSIZE instead of a hard-coded 512 value, and remove 'bsize'.
- Rename 'tmp' to 'BlkPerSec'.
- Remove 'secsize==0' and added 'secsize<DEV_BSIZE'
 1.93.6.2 21-Apr-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1050):
sys/ufs/chfs/chfs_vfsops.c: revision 1.11
sys/fs/unionfs/unionfs_vfsops.c: revision 1.13
sys/fs/nilfs/nilfs_vfsops.c: revision 1.16
sys/ufs/mfs/mfs_vfsops.c: revision 1.107
sys/fs/sysvbfs/sysvbfs_vfsops.c: revision 1.43
sys/ufs/ffs/ffs_vfsops.c: revision 1.297
sys/kern/vfs_syscalls.c: revision 1.478
sys/kern/vfs_syscalls.c: revision 1.479
sys/fs/puffs/puffs_vfsops.c: revision 1.110
sys/fs/cd9660/cd9660_vfsops.c: revision 1.84
sys/nfs/nfs_vfsops.c: revision 1.227
sys/fs/v7fs/v7fs_vfsops.c: revision 1.10
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.180
sys/miscfs/umapfs/umap_vfsops.c: revision 1.92
sys/fs/filecorefs/filecore_vfsops.c: revision 1.76
sys/miscfs/nullfs/null_vfsops.c: revision 1.88
sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.50
sys/coda/coda_vfsops.c: revision 1.81
sys/ufs/lfs/lfs_vfsops.c: revision 1.321
sys/fs/tmpfs/tmpfs_vfsops.c: revision 1.59
sys/fs/hfs/hfs_vfsops.c: revision 1.31
sys/miscfs/overlay/overlay_vfsops.c: revision 1.61
sys/fs/union/union_vfsops.c: revision 1.72
sys/fs/ntfs/ntfs_vfsops.c: revision 1.94
sys/kern/vfs_syscalls.c: revision 1.480
sys/fs/efs/efs_vfsops.c: revision 1.25
sys/kern/vfs_syscalls.c: revision 1.482
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.107
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c: revision 1.12
sys/miscfs/procfs/procfs_vfsops.c: revision 1.91
sys/fs/smbfs/smbfs_vfsops.c: revision 1.100
sys/fs/adosfs/advfsops.c: revision 1.70
sys/fs/udf/udf_vfsops.c: revision 1.67
Limit check for 'data_len'. Otherwise a (un)privileged user can easily
panic the system by passing a huge size.
ok christos@
An (un)privileged user can easily make the kernel dereference a NULL
pointer.
The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).
ok christos@
Some fs's - like kernfs - set their vfs_min_mount_data to zero. Add a check
to prevent an (un)privileged user from requesting a zero-sized allocation
(and thus a panic).
This thing is totally buggy: 'data_len' is modified by the fs, so calling
kmem_free with it while its value has changed since the kmem_alloc is far
from being a good idea.
If the kernel figures out that something mismatches, it will panic
(typically with kernfs).
 1.93.6.1 05-Jul-2012  riz branches: 1.93.6.1.4; 1.93.6.1.6;
Pull up following revision(s) (requested by tsutsui in ticket #395):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.95
sys/arch/atari/atari/autoconf.c: revision 1.62
sys/dev/md.c: revision 1.67
Add a dirty hack for atari's ancient installation ramdisk:
Forcibly configure md0, md1, and md2 devices before setroot()
for atari's traditional "auto-load from floppy on open" md_root device
which loads installation ramdisk image from floppy.
md(4) has been changed dynamically configured at first open after 5.0
and md devices won't appear in "root device:" prompt without this hack.
Tested on TT030.
Should be pulled up to netbsd-6.
Make sure that disklabel of md(4) device is initialized
in the case where it's configured in MD md_open_hook().
Without this, msdosfs_mountfs() (which is called from msdosfs_mountroot())
will be called with uninitialized disklabel (d_secsize == 0) and
it gets "panic: buf mem pool index 23" later on atari.
This is because getdisksize() doesn't check returned d_secsize value
and msdosfs_mountfs() blindly calls bread(9) with size==0 in that case.
Should be pulled up to netbsd-6 (at least for atari).
Add a sanity check if secsize returned from getdisksize() isn't bogus.
This prevent possible panic "panic: buf mem pool index 23" later in
vfs_bio.c:buf_mempoolidx().
(I'm not sure if it's okay for getdisksize() to assume that
partinfo taken from DIOCGPART is properly initialized
on all disk(9) devices or not)
See also:
http://mail-index.NetBSD.org/source-changes/2012/06/30/msg035298.html
 1.93.6.1.6.2 09-Nov-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1171):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.110 via patch
- From me, FreeBSD, OpenBSD and the FAT specification. Ok christos@
- Perform sanity checks not just for GEMDOSFS, but for all FAT devices. This
also fixes a division-by-zero bug that could crash the system.
- Define GEMDOSFS_BSIZE instead of a hard-coded 512 value, and remove 'bsize'.
- Rename 'tmp' to 'BlkPerSec'.
- Remove 'secsize==0' and added 'secsize<DEV_BSIZE'
 1.93.6.1.6.1 21-Apr-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1050):
sys/ufs/chfs/chfs_vfsops.c: revision 1.11
sys/fs/unionfs/unionfs_vfsops.c: revision 1.13
sys/fs/nilfs/nilfs_vfsops.c: revision 1.16
sys/ufs/mfs/mfs_vfsops.c: revision 1.107
sys/fs/sysvbfs/sysvbfs_vfsops.c: revision 1.43
sys/ufs/ffs/ffs_vfsops.c: revision 1.297
sys/kern/vfs_syscalls.c: revision 1.478
sys/kern/vfs_syscalls.c: revision 1.479
sys/fs/puffs/puffs_vfsops.c: revision 1.110
sys/fs/cd9660/cd9660_vfsops.c: revision 1.84
sys/nfs/nfs_vfsops.c: revision 1.227
sys/fs/v7fs/v7fs_vfsops.c: revision 1.10
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.180
sys/miscfs/umapfs/umap_vfsops.c: revision 1.92
sys/fs/filecorefs/filecore_vfsops.c: revision 1.76
sys/miscfs/nullfs/null_vfsops.c: revision 1.88
sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.50
sys/coda/coda_vfsops.c: revision 1.81
sys/ufs/lfs/lfs_vfsops.c: revision 1.321
sys/fs/tmpfs/tmpfs_vfsops.c: revision 1.59
sys/fs/hfs/hfs_vfsops.c: revision 1.31
sys/miscfs/overlay/overlay_vfsops.c: revision 1.61
sys/fs/union/union_vfsops.c: revision 1.72
sys/fs/ntfs/ntfs_vfsops.c: revision 1.94
sys/kern/vfs_syscalls.c: revision 1.480
sys/fs/efs/efs_vfsops.c: revision 1.25
sys/kern/vfs_syscalls.c: revision 1.482
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.107
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c: revision 1.12
sys/miscfs/procfs/procfs_vfsops.c: revision 1.91
sys/fs/smbfs/smbfs_vfsops.c: revision 1.100
sys/fs/adosfs/advfsops.c: revision 1.70
sys/fs/udf/udf_vfsops.c: revision 1.67
Limit check for 'data_len'. Otherwise a (un)privileged user can easily
panic the system by passing a huge size.
ok christos@
An (un)privileged user can easily make the kernel dereference a NULL
pointer.
The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).
ok christos@
Some fs's - like kernfs - set their vfs_min_mount_data to zero. Add a check
to prevent an (un)privileged user from requesting a zero-sized allocation
(and thus a panic).
This thing is totally buggy: 'data_len' is modified by the fs, so calling
kmem_free with it while its value has changed since the kmem_alloc is far
from being a good idea.
If the kernel figures out that something mismatches, it will panic
(typically with kernfs).
 1.93.6.1.4.2 09-Nov-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1171):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.110 via patch
- From me, FreeBSD, OpenBSD and the FAT specification. Ok christos@
- Perform sanity checks not just for GEMDOSFS, but for all FAT devices. This
also fixes a division-by-zero bug that could crash the system.
- Define GEMDOSFS_BSIZE instead of a hard-coded 512 value, and remove 'bsize'.
- Rename 'tmp' to 'BlkPerSec'.
- Remove 'secsize==0' and added 'secsize<DEV_BSIZE'
 1.93.6.1.4.1 21-Apr-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1050):
sys/ufs/chfs/chfs_vfsops.c: revision 1.11
sys/fs/unionfs/unionfs_vfsops.c: revision 1.13
sys/fs/nilfs/nilfs_vfsops.c: revision 1.16
sys/ufs/mfs/mfs_vfsops.c: revision 1.107
sys/fs/sysvbfs/sysvbfs_vfsops.c: revision 1.43
sys/ufs/ffs/ffs_vfsops.c: revision 1.297
sys/kern/vfs_syscalls.c: revision 1.478
sys/kern/vfs_syscalls.c: revision 1.479
sys/fs/puffs/puffs_vfsops.c: revision 1.110
sys/fs/cd9660/cd9660_vfsops.c: revision 1.84
sys/nfs/nfs_vfsops.c: revision 1.227
sys/fs/v7fs/v7fs_vfsops.c: revision 1.10
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.180
sys/miscfs/umapfs/umap_vfsops.c: revision 1.92
sys/fs/filecorefs/filecore_vfsops.c: revision 1.76
sys/miscfs/nullfs/null_vfsops.c: revision 1.88
sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.50
sys/coda/coda_vfsops.c: revision 1.81
sys/ufs/lfs/lfs_vfsops.c: revision 1.321
sys/fs/tmpfs/tmpfs_vfsops.c: revision 1.59
sys/fs/hfs/hfs_vfsops.c: revision 1.31
sys/miscfs/overlay/overlay_vfsops.c: revision 1.61
sys/fs/union/union_vfsops.c: revision 1.72
sys/fs/ntfs/ntfs_vfsops.c: revision 1.94
sys/kern/vfs_syscalls.c: revision 1.480
sys/fs/efs/efs_vfsops.c: revision 1.25
sys/kern/vfs_syscalls.c: revision 1.482
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.107
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c: revision 1.12
sys/miscfs/procfs/procfs_vfsops.c: revision 1.91
sys/fs/smbfs/smbfs_vfsops.c: revision 1.100
sys/fs/adosfs/advfsops.c: revision 1.70
sys/fs/udf/udf_vfsops.c: revision 1.67
Limit check for 'data_len'. Otherwise a (un)privileged user can easily
panic the system by passing a huge size.
ok christos@
An (un)privileged user can easily make the kernel dereference a NULL
pointer.
The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).
ok christos@
Some fs's - like kernfs - set their vfs_min_mount_data to zero. Add a check
to prevent an (un)privileged user from requesting a zero-sized allocation
(and thus a panic).
This thing is totally buggy: 'data_len' is modified by the fs, so calling
kmem_free with it while its value has changed since the kmem_alloc is far
from being a good idea.
If the kernel figures out that something mismatches, it will panic
(typically with kernfs).
 1.93.4.1 05-Apr-2012  mrg sync to latest -current.
 1.96.2.4 03-Dec-2017  jdolecek update from HEAD
 1.96.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.96.2.2 23-Jun-2013  tls resync from head
 1.96.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.101.4.1 18-May-2014  rmind sync with head
 1.106.2.1 10-Aug-2014  tls Rebase.
 1.115.4.3 28-Aug-2017  skrll Sync with HEAD
 1.115.4.2 05-Feb-2017  skrll Sync with HEAD
 1.115.4.1 06-Apr-2015  skrll Sync with HEAD
 1.115.2.2 25-Feb-2018  snj Pull up following revision(s) (requested by mlelstv in ticket #1574):
sys/fs/msdosfs/msdosfs_vfsops.c: 1.129
relax sanity check. It's ok to have more FAT sectors than needed.
 1.115.2.1 23-Oct-2017  snj Pull up following revision(s) (requested by mlelstv in ticket #1514):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.128
Add more sanity checks for BPB parameters. Handle FAT12 format for media
with sectors >= 32kByte.
Does fix PR 52485.
 1.118.2.4 26-Apr-2017  pgoyette Sync with HEAD
 1.118.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.118.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.118.2.1 20-Jul-2016  pgoyette Adapt machine-independant code to the new {b,c}devsw reference-counting
(using localcount(9)). All callers of {b,c}devsw_lookup() now call
{b,c}devsw_lookup_acquire() which retains a reference on the 'struct
{b,c}devsw'. This reference must be released by the caller once it is
finished with the structure's content (or other data that would disappear
if the 'struct {b,c}devsw' were to disappear).
 1.119.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.127.4.3 11-Feb-2021  martin Pull up following revision(s) (requested by ryoon in ticket #1653):

sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.136

Enable to mount Raspberry Pi Pico's USB mass storage partition
Fix PR kern/55985.

O.k. by thorpej@.
Pull-up to netbsd-8 and netbsd-9.
 1.127.4.2 22-Jan-2018  martin Pull up following revision(s) (requested by mlelstv in ticket #508):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.129
relax sanity check. It's ok to have more FAT sectors than needed.
 1.127.4.1 23-Sep-2017  snj Pull up following revision(s) (requested by mlelstv in ticket #292):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.128
Add more sanity checks for BPB parameters. Handle FAT12 format for media
with sectors >= 32kByte.
Does fix PR 52485.
 1.127.2.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.129.4.3 21-Apr-2020  martin Sync with HEAD
 1.129.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.129.4.1 10-Jun-2019  christos Sync with HEAD
 1.129.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.130.6.3 29-Feb-2020  ad Sync with head.
 1.130.6.2 19-Jan-2020  ad Set IMNT_SHRLOOKUP and use it for the in-cache case. Need to check what
more can be done with tmpfs though, it can probably do the whole lookup.
 1.130.6.1 17-Jan-2020  ad Sync with head.
 1.130.4.1 11-Feb-2021  martin Pull up following revision(s) (requested by ryoon in ticket #1204):

sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.136

Enable to mount Raspberry Pi Pico's USB mass storage partition
Fix PR kern/55985.

O.k. by thorpej@.
Pull-up to netbsd-8 and netbsd-9.
 1.134.2.1 20-Apr-2020  bouyer Sync with HEAD
 1.135.2.1 03-Apr-2021  thorpej Sync with HEAD.
 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 branches: 1.112.6;
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.
 1.112.6.1 02-Aug-2025  perseant Sync with HEAD
 1.21 30-Jan-2016  mlelstv Add support to msdosfs and makefs to generate correct Unicode (UCS-2) directory
entries from UTF8 encoded file names.
 1.20 08-Jul-2014  hannken branches: 1.20.4;
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.19 26-Jan-2013  christos branches: 1.19.10;
more cross-compile friendly.
 1.18 26-Jan-2013  christos expose more stuff if MAKEFS is defined for the headers, and arrange for
the source file to be compilable from userland.
 1.17 04-Nov-2012  jakllsch Stylistic changes in comments/strings:
"FAT" and "fat" are different things, use the appropriate case.
"GEMDOS" is all caps.
 1.16 03-Feb-2012  joerg branches: 1.16.6;
Only use MALLOC_DECLARE if it exists. Helps with the dirty _KERNEL
tricks fstat is using.
 1.15 28-Jun-2008  rumble branches: 1.15.30; 1.15.34;
Create sysctl entries during module initialisation and destroy them
appropriately.

Many of these file systems are now ready for modularisation.
 1.14 24-Sep-2007  rumble branches: 1.14.18; 1.14.22; 1.14.24; 1.14.26;
Avoid stack allocation of large dirent structures in foo_readdir().
 1.13 04-Mar-2007  christos branches: 1.13.2; 1.13.14; 1.13.16; 1.13.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12 25-Nov-2006  scw branches: 1.12.4;
Support FAT filesystems on non-DEV_BSIZE media.

Based on the patches provided in PR kern/17398 by Trevin Beattie.
 1.11 03-Dec-2005  christos branches: 1.11.20; 1.11.22;
- protect userland exported files against multiple inclusion.
- make sure that kernel only files don't compile in userland using #error
- XXX: some kernel only files still get installed.
- XXX: some files used in userland, don't get installed.
 1.10 25-Sep-2005  jmmv Follow compat naming tradition: rename compat_export_args to export_args30.
 1.9 23-Sep-2005  jmmv Apply the NFS exports list rototill patch:

- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.

Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
 1.8 30-Aug-2005  xtraeme Remove __P()
 1.7 20-May-2004  atatat branches: 1.7.12;
Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.6 19-Apr-2004  jdolecek properly version the msdosfs mount structure after addition
of gmt time offset support (Hi Itojun!); adresses most important
part of PR kern/25226 by Todd Whitesel
 1.5 03-Oct-2003  yamt branches: 1.5.2;
terminate snprintb 'new' format strings correctly.
(fixes overrun in mount_*)
 1.4 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.3 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.2 01-Feb-2003  thorpej branches: 1.2.2;
Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 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 msdosfsmount.h was added on branch nathanw_sa on 2002-12-29 19:56:07 +0000
 1.2.2.5 11-Dec-2005  christos Sync with head.
 1.2.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.2.2 23-May-2004  tron Pull up revision 1.7 (requested by atatat in ticket #374):
Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.
This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.
linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.5.2.1 21-Apr-2004  jmc Pullup rev 1.6 (requested by jdolecek in ticket #160)

Properly version the msdosfs mount structure after addition
of gmt time offset support. PR#25226
 1.7.12.4 27-Oct-2007  yamt sync with head.
 1.7.12.3 03-Sep-2007  yamt sync with head.
 1.7.12.2 30-Dec-2006  yamt sync with head.
 1.7.12.1 21-Jun-2006  yamt sync with head.
 1.11.22.1 10-Dec-2006  yamt sync with head.
 1.11.20.1 12-Jan-2007  ad Sync with head.
 1.12.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.18.1 06-Oct-2007  yamt sync with head.
 1.13.16.1 06-Nov-2007  matt sync with HEAD
 1.13.14.1 02-Oct-2007  joerg Sync with HEAD.
 1.13.2.1 09-Oct-2007  ad Sync with head.
 1.14.26.1 03-Jul-2008  simonb Sync with head.
 1.14.24.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.14.22.1 04-May-2009  yamt sync with head.
 1.14.18.1 29-Jun-2008  mjf Sync with HEAD.
 1.15.34.1 18-Feb-2012  mrg merge to -current.
 1.15.30.3 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.15.30.2 16-Jan-2013  yamt sync with (a bit old) head
 1.15.30.1 17-Apr-2012  yamt sync with head
 1.16.6.4 03-Dec-2017  jdolecek update from HEAD
 1.16.6.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.6.2 25-Feb-2013  tls resync with head
 1.16.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.19.10.1 10-Aug-2014  tls Rebase.
 1.20.4.1 19-Mar-2016  skrll Sync with HEAD

RSS XML Feed