Home | History | Annotate | only in /src/sys/fs/udf
History log of /src/sys/fs/udf
RevisionDateAuthorComments
 1.1 02-Feb-2006  reinoud branches: 1.1.4; 1.1.16; 1.1.22;
Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 02-Feb-2006  rpaulo file Makefile was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 02-Feb-2006  yamt file Makefile was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.1.4.2 18-Feb-2006  yamt sync with head.
 1.1.4.1 02-Feb-2006  yamt file Makefile was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.17 18-Mar-2022  reinoud Replace the variable field data[0] to data[1] to avoid undefined behaviour.
 1.16 09-Aug-2018  reinoud Sync with UDFclient
 1.15 25-Jul-2018  kamil Avoid undefined behavior in ecma167-udf.h

Define the UDF_EXT_* symbols as unsigned values.
This prevents undefined behavior of altering the signedness bit in a part
of them. Swap the remaining symbols to unsigned values to keep the
consistency.

Required by GCC when building with Undefined Behavior Sanitizer.
 1.14 07-Jul-2011  reinoud branches: 1.14.52; 1.14.54;
English checked and corrected, courtisy of
Igor Sobrado <sobrado@orion.ciencias.uniovi.es> as noted in OpenBSD that has a
copy of this file.
 1.13 23-Dec-2009  mbalmer Fix typo in comments, no code change.
 1.12 18-May-2009  reinoud Make ecma167 header file compilable by pcc
 1.11 25-Jul-2008  reinoud branches: 1.11.4; 1.11.8; 1.11.12;
Add metadata bitmap ICB file type
 1.10 24-Jun-2008  reinoud branches: 1.10.2;
Fix attribute length calculation and fix naming convention.
 1.9 21-Jun-2008  reinoud Elaborate file times extension times definition.
 1.8 14-May-2008  reinoud branches: 1.8.2;
Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.7 25-Dec-2007  perry branches: 1.7.6; 1.7.8; 1.7.10; 1.7.12;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.6 04-Jan-2007  reinoud branches: 1.6.20; 1.6.26; 1.6.28; 1.6.32;
Add UDF_ICB_FILETYPE_REALTIME type as found on UDF 2.50 discs. Also revert
a multiplication order to enforce 64 bit math.
 1.5 22-Oct-2006  reinoud branches: 1.5.2;
Add extended attribute numbers associated with the two defined structures
for times and device specification.
 1.4 31-Aug-2006  reinoud branches: 1.4.2; 1.4.4; 1.4.6;
Add shortcut for struct long_ad 's Unique ID hint that covers the lower 32
bits of the targeted files 64 bits Unique ID for recovery purposes.
 1.3 25-Aug-2006  reinoud Fix small though important errors in the Ecma-167 structure definitions.
 1.2 02-Feb-2006  reinoud branches: 1.2.4; 1.2.6; 1.2.16; 1.2.18;
Replace reinclude protection names with less generic versions.
 1.1 02-Feb-2006  reinoud Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.2.18.2 08-Sep-2006  rpaulo Pull up following revision(s) (requested by reinoud in ticket #125):
sys/fs/udf/udf_subr.c: revision 1.15
sys/fs/udf/udf_vfsops.c: revision 1.13
sys/fs/udf/ecma167-udf.h: revision 1.4
Add shortcut for struct long_ad 's Unique ID hint that covers the lower 32
bits of the targeted files 64 bits Unique ID for recovery purposes.
Fix locking scheme in udf_mount() to follow more the other filingsystems.
For yet unknown reasons passing the LOCKLEAF flag to namei() did return a
locked vnode as was meant but would panic when a raw device was passed.
Fix copying too much space from a small buffer. The chances of it actually
happening are small but corrupt media could trigger it.
 1.2.18.1 27-Aug-2006  riz Pull up following revision(s) (requested by reinoud in ticket #66):
sys/fs/udf/ecma167-udf.h: revision 1.3
Fix small though important errors in the Ecma-167 structure definitions.
 1.2.16.5 21-Jan-2008  yamt sync with head
 1.2.16.4 26-Feb-2007  yamt sync with head.
 1.2.16.3 30-Dec-2006  yamt sync with head.
 1.2.16.2 21-Jun-2006  yamt sync with head.
 1.2.16.1 02-Feb-2006  yamt file ecma167-udf.h was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.2.6.1 03-Sep-2006  yamt sync with head.
 1.2.4.2 18-Feb-2006  yamt sync with head.
 1.2.4.1 02-Feb-2006  yamt file ecma167-udf.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.4.6.1 22-Oct-2006  yamt sync with head
 1.4.4.2 09-Sep-2006  rpaulo sync with head
 1.4.4.1 31-Aug-2006  rpaulo file ecma167-udf.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.4.2.2 12-Jan-2007  ad Sync with head.
 1.4.2.1 18-Nov-2006  ad Sync with head.
 1.5.2.1 04-Jan-2007  bouyer Pull up following revision(s) (requested by reinoud in ticket #333):
sys/fs/udf/udf_subr.c: revision 1.27-1.29
sys/fs/udf/udf_vnops.c: revision 1.9
sys/fs/udf/ecma167-udf.h: revision 1.6
Fix compilation issue when specifying different flags or compiling with a
different compiler. Thanks to Jared for noting.
Add UDF_ICB_FILETYPE_REALTIME type as found on UDF 2.50 discs. Also revert
a multiplication order to enforce 64 bit math.
Forgot one place for UDF_ICB_FILETYPE_RANDOMACCESS.
 1.6.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.28.1 26-Dec-2007  ad Sync with head.
 1.6.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.6.20.1 09-Jan-2008  matt sync with HEAD
 1.7.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.7.10.4 11-Mar-2010  yamt sync with head
 1.7.10.3 20-Jun-2009  yamt sync with head
 1.7.10.2 04-May-2009  yamt sync with head.
 1.7.10.1 16-May-2008  yamt sync with head.
 1.7.8.1 18-May-2008  yamt sync with head.
 1.7.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.7.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.7.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.2.2 28-Jul-2008  simonb Sync with head.
 1.8.2.1 27-Jun-2008  simonb Sync with head.
 1.10.2.1 19-Oct-2008  haad Sync with HEAD.
 1.11.12.1 21-Apr-2010  matt sync to netbsd-5
 1.11.8.1 23-Jul-2009  jym Sync with HEAD.
 1.11.4.1 06-Jun-2009  bouyer Pull up following revision(s) (requested by reinoud in ticket #769):
sys/fs/udf/ecma167-udf.h: revision 1.12
Make ecma167 header file compilable by pcc
 1.14.54.1 10-Jun-2019  christos Sync with HEAD
 1.14.52.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.14.52.1 28-Jul-2018  pgoyette Sync with HEAD
 1.6 11-Oct-2014  uebayasi Define filesystem attributes with vfs dependency.
 1.5 10-Jul-2013  reinoud Implement udf_rename() using the new genfs_rename() framework.

Fixes PR kern/47986
 1.4 02-Mar-2010  pooka branches: 1.4.10; 1.4.20; 1.4.24;
Don't generate unused fs_thefs.h headers.
 1.3 29-Aug-2008  reinoud branches: 1.3.14;
Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
 1.2 14-May-2008  reinoud branches: 1.2.4;
Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.1 02-Feb-2006  reinoud branches: 1.1.4; 1.1.16; 1.1.22; 1.1.72; 1.1.74; 1.1.76; 1.1.78;
Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.1.78.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.78.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.1.76.3 11-Mar-2010  yamt sync with head
 1.1.76.2 04-May-2009  yamt sync with head.
 1.1.76.1 16-May-2008  yamt sync with head.
 1.1.74.1 18-May-2008  yamt sync with head.
 1.1.72.2 28-Sep-2008  mjf Sync with HEAD.
 1.1.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 02-Feb-2006  rpaulo file files.udf was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 02-Feb-2006  yamt file files.udf was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.1.4.2 18-Feb-2006  yamt sync with head.
 1.1.4.1 02-Feb-2006  yamt file files.udf was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.2.4.1 19-Oct-2008  haad Sync with HEAD.
 1.3.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.4.24.1 28-Aug-2013  rmind sync with head
 1.4.20.2 03-Dec-2017  jdolecek update from HEAD
 1.4.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.10.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.56 18-May-2024  thorpej Move the include of <sys/malloc.h> to where it's truly needed.
 1.55 27-Jun-2023  reinoud Convert UDF file system code from the depricated tsleep(9)/wakeup(9) to the MP
friendly condvar(9). No functional change intended.
 1.54 07-Aug-2022  andvar fix various typos in comments, documentation and messages.
mainly s/paramater/parameter/ and s/reduntant/redundant/.
 1.53 16-Apr-2022  andvar fix various typos in comments and log messages.
 1.52 24-May-2016  reinoud Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
 1.51 10-May-2016  reinoud Rework VAT searching on recordable media. It is now a lot more resilliant to
errors and it allows for VAT searching on crashed writeouts.

While here, make sure the node pointer is always initialised in
udf_get_node().
 1.50 24-Aug-2015  hannken Use vfs_vnode_iterator for udf_do_sync.

- Build rb_tree to get an ordered list of nodes, sync them and
clean the tree.

- Stop abusing mntvnode_lock to serialize udf_do_sync, use new
mutex ump->sync_lock instead.
 1.49 24-Aug-2015  hannken Remove dirtynodes_cv, it is only used for timed waits without any signals.

Replace the cv_timedwait with kpause.
 1.48 06-Apr-2015  hannken Change udf to vcache, keyed on udf_node->loc.loc.
 1.47 17-Sep-2014  reinoud branches: 1.47.2;
As pointed out by wiz@ prevent a possible attack or corruption that results in
an endless loop of indirect descriptors being processed.

The number of indirect descriptors followed is now maximized.
While here, also fix a use-after-free bug!
 1.46 18-Oct-2013  christos fix unused variable warnings
 1.45 27-Jul-2012  drochner branches: 1.45.2; 1.45.4;
gcc -fno-common fallout
 1.44 27-Sep-2011  christos branches: 1.44.2;
- rename UDF_MAX_NAMELEN -> UDF_MAXNAMLEN
- use NAME_MAX instead of MAXNAMLEN
 1.43 25-Sep-2010  matt Rename rb.h to rbtree.h, as it is more appropriate (c.f. ptree.h). Also
helps find code that hasn't been updated to use the new rbtree API.
 1.42 24-Sep-2010  rmind Fixes/improvements to RB-tree implementation:
1. Fix inverted node order, so that negative value from comparison operator
would represent lower (left) node, and positive - higher (right) node.
2. Add an argument (i.e. "context"), passed to comparison operators.
3. Change rb_tree_insert_node() to return a node - either inserted one or
already existing one.
4. Amend the interface to manipulate the actual object, instead of the
rb_node (in a similar way as Patricia-tree interface does).
5. Update all RB-tree users accordingly.

XXX: Perhaps rename rb.h to rbtree.h, since cleaning-up..

1-3 address the PR/43488 by Jeremy Huddleston.

Passes RB-tree regression tests.
Reviewed by: matt@, christos@
 1.41 25-Feb-2010  reinoud branches: 1.41.2;
First part of shrinking/growing metadata partition support:

- extending the metadata partition

Still to follow:
- sparsify metadata partition
- growing the metadata partition
- unsparsifying metadata partition
 1.40 24-Feb-2010  reinoud Rename metadata partition parameters to be less generic and add the flags.
 1.39 24-Feb-2010  reinoud Extract UDF metadata partition parameters as already done for VAT and sparable
partitions.
 1.38 05-Aug-2009  reinoud branches: 1.38.2;
Typo fix
 1.37 08-Jul-2009  reinoud Remove unused LIST_ENTRY()'s now replaced by the rbtree.
 1.36 07-Jul-2009  reinoud Replace the old hashtable and sorted list implemenation by a RB-tree.

Benefits are significant speed improvements on node creation/insertion while
keeping the lookup times low and still allowing sequential iteration over the
nodes.
 1.35 06-Jul-2009  reinoud Reduce the number of active ecclines; low memory systems could get into
trouble otherwise.

XXX this value should be computed eventually.
 1.34 24-Jun-2009  reinoud Commit first stage of free-space accounting. It is estimating the underlimit
of free blocks on the device and when free blocks are getting tight it tries
to readjust/recalculate that value by syncing the FS.

Second stage will be resizing the data/metadata partitions.
 1.33 23-Jun-2009  reinoud Bump the NetBSD kernel UDF id to version 0.5
 1.32 18-Jun-2009  reinoud Add RESERVE bitmask flag to DEBUG print constants adding another 0 prefix to
the constants already defined.
 1.31 18-Jun-2009  reinoud Remove now unused UDF_DIRHASH constants
 1.30 08-Feb-2009  reinoud branches: 1.30.2;
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.29 09-Dec-2008  reinoud Fix two buf_init()'s that are not needed since they were already initialised
by getiobuf().

Also remove ancient IPL_BIO reference from the time it was called from
interrupt context instead of the current soft interrupt.
 1.28 05-Dec-2008  reinoud Two fold commit:

1) Enhance write speed significantly on RMW media like CD-RW, DVD-RW but also
on the DVD+RW and all other ECC blocked media. Significant speedups of access
to the device for say compilation on the DVD. Streaming copy is also still at
maximum speed though vast amounts of directory copy work can show side effects
that appear it to slow down but are actually logical when you consider that
most small files are embedded into the descriptors itself.

2) explicit wait for the created RMW thread to spinup
 1.27 27-Sep-2008  reinoud branches: 1.27.2; 1.27.4;
Switch UDF over to the vfs_dirhash.c dirhash code.
 1.26 06-Aug-2008  reinoud Rewrite allocation scheme's determination and implementation replacing the
old somewhat naive selection scheme that didn't allow different allocation
settings for nodes, directory information (FIDs) and data.

Also fix some curious side-effects of atime updates on RMW devices.
 1.25 29-Jul-2008  reinoud Remove comments on `need to read in'; they are read in.
 1.24 28-Jul-2008  reinoud Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
 1.23 27-Jul-2008  reinoud Unify naming scheme and source code beautify for better readablility.
 1.22 26-Jul-2008  reinoud Clarify the current spacemap read/write code is reading/writing physical
partition space maps. This in preperation of Metadata spacetable
reading/writeout work.
 1.21 22-Jul-2008  reinoud Limit the UDF dirhash to a configurable amount of memory. The performance
penalty even with a limited dirhash of 128kb is acceptable but it should be
set by machine memory size though.
 1.20 19-Jul-2008  reinoud Use ecma-167 constants instead of homegrown to prevent double mapping.
 1.19 19-Jul-2008  reinoud Choose which time of allocation descriptors to use on new nodes based on
the number of partition mappings.
 1.18 17-Jul-2008  reinoud Implement directory hashing to speed up directory traversals. Speed
improvements of at least 4 times in untarring and roughly 100 to 500 times
on file creation in big directories. Lookup of files was O(n*n) and is now
O(1) even for file creation. Free spaces in the directory are kept in a
seperate list for fast file creation.

The postmark benchmark gives:

UDF old:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
1593 seconds total
681 seconds of transactions (2 per second)

Files:
3956 created (2 per second)
Creation alone: 3000 files (4 per second)
Mixed with transactions: 956 files (1 per second)
990 read (1 per second)
1010 appended (1 per second)
3956 deleted (2 per second)
Deletion alone: 2912 files (9 per second)
Mixed with transactions: 1044 files (1 per second)

Data:
5.26 megabytes read (3.38 kilobytes per second)
21.93 megabytes written (14.10 kilobytes per second)
pm>



UDF new:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
19 seconds total
3 seconds of transactions (666 per second)

Files:
3956 created (208 per second)
Creation alone: 3000 files (230 per second)
Mixed with transactions: 956 files (318 per second)
990 read (330 per second)
1010 appended (336 per second)
3956 deleted (208 per second)
Deletion alone: 2912 files (970 per second)
Mixed with transactions: 1044 files (348 per second)

Data:
5.26 megabytes read (283.66 kilobytes per second)
21.93 megabytes written (1.15 megabytes per second)
 1.17 07-Jul-2008  reinoud Support for allocation extents descriptor writing to allow for arbitrary
heavily fragmented files.

Also fixing some (rare) allocation bugs and function name streamlining.

Tested on harddisc, CD-RW and CD-R i.e. all three basic backend classes.
 1.16 03-Jul-2008  reinoud branches: 1.16.2;
Add node-rebuild flag to indicate that the node was rebuild up and thus the
allocation extents have changed.
 1.15 03-Jul-2008  reinoud Create new udf_verbose class.
 1.14 28-Jun-2008  rumble Create sysctl entries during module initialisation and destroy them
appropriately.

Many of these file systems are now ready for modularisation.
 1.13 25-Jun-2008  reinoud Bump maximum number of allocation extents descriptors in a file/directory;
10 did seem far too many, but aparently ``640 kb should be enough for
everyone''.
 1.12 15-May-2008  reinoud branches: 1.12.2;
Introduce new UDF debug class and split rmw strategy debugging prints.
 1.11 14-May-2008  reinoud Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.10 10-Oct-2007  ad branches: 1.10.18; 1.10.20; 1.10.22; 1.10.24;
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.9 04-Jan-2007  reinoud branches: 1.9.6; 1.9.18; 1.9.20; 1.9.22;
Implement read-only access to UDF 2.50 and UDF 2.60 discs that use metadata
partition mappings. This brings the NetBSD implementation to read all discs
upto date and will read all discs currently defined by OSTA.
 1.8 29-Sep-2006  reinoud branches: 1.8.2;
Add `vfs.udf.verbose' sysctl when running a DEBUG kernel to dynamically set
the udf_verbose variable. So when something goes wrong, it can be examined
on the spot without needing to reboot a new kernel and possibly loosing
state.
 1.7 19-Sep-2006  reinoud Make VOP_LOOKUP's O(1) instead of O(n log(n)) giving a speedup of 7500% on
a 1400 file directory.
 1.6 22-Aug-2006  reinoud branches: 1.6.2; 1.6.4; 1.6.6;
Fix pool allocation/freeing problem for once and for all correctly. Since
it was initialised quite late due to its reliance on disc data the mount
process could have stopped before initialising and thus could panic again
only now for uninitialising an not initialised pool! *sigh*
 1.5 21-Aug-2006  reinoud Make a better guess on VAT locations so discs that are semi-standard
formatted can be recognised. This also fixes the bug that prevented UDF to
mount an empty CD-R/DVD*R disc.
 1.4 02-Feb-2006  christos branches: 1.4.4; 1.4.6; 1.4.16; 1.4.18;
protect the whole file, not parts of it.
 1.3 02-Feb-2006  reinoud Fix header re-inclusion protection defines to a less generic naming
scheme.
 1.2 02-Feb-2006  reinoud Fix $NetBSD$ tags. (sorry)
 1.1 02-Feb-2006  reinoud Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.4.18.3 25-Sep-2006  riz Pull up following revision(s) (requested by reinoud in ticket #185):
sys/fs/udf/udf_subr.c: revision 1.18
sys/fs/udf/udf.h: revision 1.7
Make VOP_LOOKUP's O(1) instead of O(n log(n)) giving a speedup of 7500% on
a 1400 file directory.
 1.4.18.2 27-Aug-2006  riz Pull up following revision(s) (requested by reinoud in ticket #50):
sys/fs/udf/udf_subr.c: revision 1.14
sys/fs/udf/udf.h: revision 1.6
sys/fs/udf/udf_vfsops.c: revision 1.11
Fix pool allocation/freeing problem for once and for all correctly. Since
it was initialised quite late due to its reliance on disc data the mount
process could have stopped before initialising and thus could panic again
only now for uninitialising an not initialised pool! *sigh*
 1.4.18.1 24-Aug-2006  tron Pull up following revision(s) (requested by reinoud in ticket #46):
sys/fs/udf/udf_subr.c: revision 1.13
sys/fs/udf/udf.h: revision 1.5
Make a better guess on VAT locations so discs that are semi-standard
formatted can be recognised. This also fixes the bug that prevented UDF to
mount an empty CD-R/DVD*R disc.
 1.4.16.5 27-Oct-2007  yamt sync with head.
 1.4.16.4 26-Feb-2007  yamt sync with head.
 1.4.16.3 30-Dec-2006  yamt sync with head.
 1.4.16.2 21-Jun-2006  yamt sync with head.
 1.4.16.1 02-Feb-2006  yamt file udf.h was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.4.6.1 03-Sep-2006  yamt sync with head.
 1.4.4.2 18-Feb-2006  yamt sync with head.
 1.4.4.1 02-Feb-2006  yamt file udf.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.6.6.1 22-Oct-2006  yamt sync with head
 1.6.4.2 09-Sep-2006  rpaulo sync with head
 1.6.4.1 22-Aug-2006  rpaulo file udf.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.6.2.2 12-Jan-2007  ad Sync with head.
 1.6.2.1 18-Nov-2006  ad Sync with head.
 1.8.2.1 04-Jan-2007  bouyer Pull up following revision(s) (requested by reinoud in ticket #332):
sys/fs/udf/udf_subr.c: revision 1.26
sys/fs/udf/udf.h: revision 1.9
sys/fs/udf/udf_vfsops.c: revision 1.19
Implement read-only access to UDF 2.50 and UDF 2.60 discs that use metadata
partition mappings. This brings the NetBSD implementation to read all discs
upto date and will read all discs currently defined by OSTA.
 1.9.22.1 14-Oct-2007  yamt sync with head.
 1.9.20.1 06-Nov-2007  matt sync with HEAD
 1.9.18.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.9.6.1 05-Apr-2007  ad Compile fixes.
 1.10.24.3 10-Oct-2008  skrll Sync with HEAD.
 1.10.24.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.10.24.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.10.22.6 09-Oct-2010  yamt sync with head
 1.10.22.5 11-Mar-2010  yamt sync with head
 1.10.22.4 19-Aug-2009  yamt sync with head.
 1.10.22.3 18-Jul-2009  yamt sync with head.
 1.10.22.2 04-May-2009  yamt sync with head.
 1.10.22.1 16-May-2008  yamt sync with head.
 1.10.20.1 18-May-2008  yamt sync with head.
 1.10.18.5 17-Jan-2009  mjf Sync with HEAD.
 1.10.18.4 05-Oct-2008  mjf Sync with HEAD.
 1.10.18.3 28-Sep-2008  mjf Sync with HEAD.
 1.10.18.2 29-Jun-2008  mjf Sync with HEAD.
 1.10.18.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.2.6 31-Jul-2008  simonb Sync with head.
 1.12.2.5 28-Jul-2008  simonb Sync with head.
 1.12.2.4 22-Jul-2008  simonb Sync with head.
 1.12.2.3 18-Jul-2008  simonb Sync with head.
 1.12.2.2 03-Jul-2008  simonb Sync with head.
 1.12.2.1 27-Jun-2008  simonb Sync with head.
 1.16.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.2.1 19-Oct-2008  haad Sync with HEAD.
 1.27.4.4 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.27.4.3 18-Feb-2009  snj branches: 1.27.4.3.4;
Pull up following revision(s) (requested by reinoud in ticket #447):
sys/fs/udf/udf.h: revision 1.30
sys/fs/udf/udf_readwrite.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.8
sys/fs/udf/udf_strat_rmw.c: revision 1.18
sys/fs/udf/udf_strat_sequential.c: revision 1.8
sys/fs/udf/udf_subr.c: revision 1.85
sys/fs/udf/udf_subr.h: revision 1.13
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.27.4.2 10-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #174):
sys/fs/udf/udf_strat_rmw.c: revision 1.15
sys/fs/udf/udf.h: revision 1.29
Fix two buf_init()'s that are not needed since they were already initialised
by getiobuf().
Also remove ancient IPL_BIO reference from the time it was called from
interrupt context instead of the current soft interrupt.
 1.27.4.1 06-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #167):
sys/fs/udf/udf.h: revision 1.28
sys/fs/udf/udf_strat_rmw.c: revision 1.13
Two fold commit:
1) Enhance write speed significantly on RMW media like CD-RW, DVD-RW but also
on the DVD+RW and all other ECC blocked media. Significant speedups of access
to the device for say compilation on the DVD. Streaming copy is also still at
maximum speed though vast amounts of directory copy work can show side effects
that appear it to slow down but are actually logical when you consider that
most small files are embedded into the descriptors itself.
2) explicit wait for the created RMW thread to spinup
 1.27.4.3.4.1 21-Apr-2010  matt sync to netbsd-5
 1.27.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.27.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.30.2.1 23-Jul-2009  jym Sync with HEAD.
 1.38.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.38.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.41.2.1 05-Mar-2011  rmind sync with head
 1.44.2.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.44.2.1 30-Oct-2012  yamt sync with head
 1.45.4.1 18-May-2014  rmind sync with head
 1.45.2.2 03-Dec-2017  jdolecek update from HEAD
 1.45.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.2.3 29-May-2016  skrll Sync with HEAD
 1.47.2.2 22-Sep-2015  skrll Sync with HEAD
 1.47.2.1 06-Apr-2015  skrll Sync with HEAD
 1.48 05-Jan-2025  andvar fix various typos in comments.
 1.47 22-May-2022  andvar branches: 1.47.10;
fix various small typos, mainly in comments.
 1.46 03-Feb-2022  reinoud Revere modification of initializer; it can lead to race conditions where two
allocation would pick the `empty' space causing a panic later on.
 1.45 28-Jan-2022  reinoud On freeing a virtual address in the VAT, use the correct value; this might
confuse other implementations who can reject the VAT on this.
 1.44 03-Sep-2021  andvar fix typos in comments, mainly s/extention/extension/ and s/sufficent/sufficient/
 1.43 20-Aug-2021  andvar fix various typos in comments and log messages.
 1.42 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.41 23-Apr-2020  ad branches: 1.41.6;
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.40 14-Oct-2018  jdolecek branches: 1.40.4; 1.40.10;
remove M_CANFAIL flag for malloc(9) - it was completely ignored, so had
actually no effect
 1.39 04-Jan-2017  christos branches: 1.39.14; 1.39.16;
PR/51777: David Binderman: Remove unused computation
 1.38 24-Aug-2015  hannken branches: 1.38.2;
Remove dirtynodes_cv, it is only used for timed waits without any signals.

Replace the cv_timedwait with kpause.
 1.37 03-Dec-2014  reinoud Relax the KASSERT since an equal size is no issue
 1.36 30-Oct-2013  mrg branches: 1.36.6;
used __diagused where appropriate.
 1.35 18-Oct-2013  christos fix unused variable warnings
 1.34 09-Aug-2013  reinoud Fix 32 bit issue in main file read-in function. On both 32 bit and 64 bit
hosts a missing cast would result in `garbage' after the 4Gbyte limit.
 1.33 03-Jul-2013  reinoud On growing a node that was recorded inside the (E)FE, don't forget to set the
size of the node to the NEW size. This was reported by the `t_io
udf_shrinkfile' testcase.

Fixes PR kern/47985
 1.32 16-Jun-2011  hannken branches: 1.32.2; 1.32.8; 1.32.12; 1.32.14; 1.32.16; 1.32.22;
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.31 14-Jan-2011  reinoud branches: 1.31.6;
Metadata partition (v2.50+) bugfix commit :

* fix copying of the extents of the metadata node to the metadatamirror node;
it was not copying all extents.

* fix truncing metadata partition:
* fix endian conversions
* fix information length calculation so its truncated to the right length!

* allow for setting maximum extent length in extent merging. This is needed
since extents in the metadata partition files are only to be in allocation
unit sizes.

* adjust grow and shrink node to set the granularity of the maximum length of
an extent when encountering a metadatafile or metadatamirror file.
 1.30 22-Dec-2010  reinoud Growing the metadata partition is not yet implemented. Be so kind to report
this as unimplemented when the debug flag asks for it!
 1.29 26-Feb-2010  reinoud branches: 1.29.2;
Typo and style
 1.28 25-Feb-2010  reinoud First part of shrinking/growing metadata partition support:

- extending the metadata partition

Still to follow:
- sparsify metadata partition
- growing the metadata partition
- unsparsifying metadata partition
 1.27 27-Jun-2009  reinoud branches: 1.27.2;
Fix corner-case in truncing files. It could forget to free the last block.
This would result in a free-space map with one block orphaned.
 1.26 24-Jun-2009  reinoud Commit first stage of free-space accounting. It is estimating the underlimit
of free blocks on the device and when free blocks are getting tight it tries
to readjust/recalculate that value by syncing the FS.

Second stage will be resizing the data/metadata partitions.
 1.25 18-Jun-2009  reinoud Fix nitpicky spacing and debug printout
 1.24 18-Jun-2009  reinoud Remove unneeded (and unused) inclusion of "opt_quota.h"
 1.23 19-May-2009  reinoud Account for the logical blocks recorded by the extent in the right endian!
 1.22 19-May-2009  reinoud A descriptor's CRC lenth is 16 bit so use udf_rw16() on tag.desc_crc_len.
 1.21 21-Apr-2009  reinoud Fix endian related bug when using discs with a meta-data partition on
big-endian machines.
 1.20 25-Mar-2009  reinoud Fix possible overshoot when allocating from a space bitmap when ffs(3) returns
a too big offset for the bitmap.
 1.19 16-Dec-2008  pooka branches: 1.19.2;
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.18 29-Aug-2008  reinoud branches: 1.18.2; 1.18.4;
Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
 1.17 06-Aug-2008  reinoud Rewrite allocation scheme's determination and implementation replacing the
old somewhat naive selection scheme that didn't allow different allocation
settings for nodes, directory information (FIDs) and data.

Also fix some curious side-effects of atime updates on RMW devices.
 1.16 28-Jul-2008  reinoud Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
 1.15 26-Jul-2008  reinoud Clarify not implemented allocation schemes; mostly UDF 2.50
HD-DVD/BluRay-RE and UDF 2.60 for BluRay-R
 1.14 19-Jul-2008  reinoud Use the allocation descriptor types selected on mount when growing from an
internal to an extent recording.
 1.13 18-Jul-2008  reinoud Hopefully fix gcc type puned warning.
 1.12 16-Jul-2008  reinoud Make UDF allocation-sanity check optional even if the DEBUG flag is
specified. This should be sysctl-able when compiled with the DEBUG flag
eventually.
 1.11 07-Jul-2008  reinoud Support for allocation extents descriptor writing to allow for arbitrary
heavily fragmented files.

Also fixing some (rare) allocation bugs and function name streamlining.

Tested on harddisc, CD-RW and CD-R i.e. all three basic backend classes.
 1.10 03-Jul-2008  reinoud branches: 1.10.2;
Fix rare allocation problem when a fragmented file is truncated to a
non-zero length and the last extent was allocated.
 1.9 02-Jul-2008  reinoud Update node sanity check system and redo allocation recording fixing
corruptions that could take place when overwriting sparse files.

Still one rare corruption possible where blocks are accidentally marked
free, but the cause is not yet found and looking at the pattern it won't
happen in every day use.
 1.8 30-Jun-2008  reinoud Fix serious allocation recording bug if overwriting piece that was
allocated before. Fixes regression test on random overwriting data.

Also fix endian issues and add extra documentation to variables.
 1.7 28-Jun-2008  reinoud When shrinking the file, do clean the freed part in the descriptor; all
unused space need to be zero filled.
 1.6 26-Jun-2008  reinoud Count the length correctly when encountering an allocation extension
redirect in the sanity checking.
 1.5 25-Jun-2008  reinoud Fix lookup problems in very fragmented metadata partitions that use
allocation extent descriptors.
 1.4 25-Jun-2008  reinoud Fix extended allocation descriptor handling in translate file extent
 1.3 25-Jun-2008  reinoud Fix allocation extensions descriptor reading and do free them on node
destruction!
 1.2 20-May-2008  reinoud branches: 1.2.2; 1.2.4; 1.2.6;
Remove bogus KASSERT(); if we shrink the file, the number of allocated
blocsk are of course not the same... duh!
 1.1 14-May-2008  reinoud branches: 1.1.2; 1.1.4;
Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.1.4.3 04-Jun-2008  yamt sync with head
 1.1.4.2 18-May-2008  yamt sync with head.
 1.1.4.1 14-May-2008  yamt file udf_allocation.c was added on branch yamt-pf42 on 2008-05-18 12:35:05 +0000
 1.1.2.6 11-Mar-2010  yamt sync with head
 1.1.2.5 18-Jul-2009  yamt sync with head.
 1.1.2.4 20-Jun-2009  yamt sync with head
 1.1.2.3 04-May-2009  yamt sync with head.
 1.1.2.2 16-May-2008  yamt sync with head.
 1.1.2.1 14-May-2008  yamt file udf_allocation.c was added on branch yamt-nfs-mp on 2008-05-16 02:25:21 +0000
 1.2.6.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.2.6.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.2.6.1 20-May-2008  wrstuden file udf_allocation.c was added on branch wrstuden-revivesa on 2008-06-23 05:02:13 +0000
 1.2.4.6 31-Jul-2008  simonb Sync with head.
 1.2.4.5 28-Jul-2008  simonb Sync with head.
 1.2.4.4 22-Jul-2008  simonb Sync with head.
 1.2.4.3 18-Jul-2008  simonb Sync with head.
 1.2.4.2 03-Jul-2008  simonb Sync with head.
 1.2.4.1 27-Jun-2008  simonb Sync with head.
 1.2.2.6 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.5 28-Sep-2008  mjf Sync with HEAD.
 1.2.2.4 02-Jul-2008  mjf Sync with HEAD.
 1.2.2.3 29-Jun-2008  mjf Sync with HEAD.
 1.2.2.2 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.1 20-May-2008  mjf file udf_allocation.c was added on branch mjf-devfs2 on 2008-06-02 13:24:06 +0000
 1.10.2.1 19-Oct-2008  haad Sync with HEAD.
 1.18.4.4 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.18.4.3 06-Jun-2009  bouyer Pull up following revision(s) (requested by reinoud in ticket #770):
sys/fs/udf/udf_subr.c: revision 1.88, 1.89
sys/fs/udf/udf_bswap.h: revision 1.6, 1.7
sys/fs/udf/udf_allocation.c: revision 1.22, 1.23
sbin/newfs_udf/udf_create.c: revision 1.16
Fix *serious* bug in bswapping definitions for big endian machines.
ANSI-fy. No idea why they weren't so in the first place.
Fix newfs_udf to create a valid disc images on bigendian machines.
A descriptor's CRC lenth is 16 bit so use udf_rw16() on tag.desc_crc_len.
Forgot to use the udf_rw16() on the descriptor crc lengths of FID's!
Also fix a few dubiously formatted checks.
On creation of a new node, don't forget to set the length of the allocated
space in the right endian!
Account for the logical blocks recorded by the extent in the right endian!
 1.18.4.2 23-Apr-2009  snj branches: 1.18.4.2.4;
Pull up following revision(s) (requested by reinoud in ticket #716):
sys/fs/udf/udf_allocation.c: revision 1.21
Fix endian related bug when using discs with a meta-data partition on
big-endian machines.
 1.18.4.1 31-Mar-2009  snj Pull up following revision(s) (requested by reinoud in ticket #610):
sys/fs/udf/udf_allocation.c: revision 1.20
Fix possible overshoot when allocating from a space bitmap when ffs(3) returns
a too big offset for the bitmap.
 1.18.4.2.4.1 21-Apr-2010  matt sync to netbsd-5
 1.18.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.18.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.2.2 23-Jul-2009  jym Sync with HEAD.
 1.19.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.29.2.1 05-Mar-2011  rmind sync with head
 1.31.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.32.22.1 07-Sep-2013  bouyer Pull up following revision(s) (requested by reinoud in ticket #930):
sys/fs/udf/udf_allocation.c: revision 1.34
Fix 32 bit issue in main file read-in function. On both 32 bit and 64 bit
hosts a missing cast would result in `garbage' after the 4Gbyte limit.
 1.32.16.2 18-May-2014  rmind sync with head
 1.32.16.1 28-Aug-2013  rmind sync with head
 1.32.14.1 07-Sep-2013  bouyer Pull up following revision(s) (requested by reinoud in ticket #930):
sys/fs/udf/udf_allocation.c: revision 1.34
Fix 32 bit issue in main file read-in function. On both 32 bit and 64 bit
hosts a missing cast would result in `garbage' after the 4Gbyte limit.
 1.32.12.2 03-Dec-2017  jdolecek update from HEAD
 1.32.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.8.1 07-Sep-2013  bouyer Pull up following revision(s) (requested by reinoud in ticket #930):
sys/fs/udf/udf_allocation.c: revision 1.34
Fix 32 bit issue in main file read-in function. On both 32 bit and 64 bit
hosts a missing cast would result in `garbage' after the 4Gbyte limit.
 1.32.2.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.36.6.3 05-Feb-2017  skrll Sync with HEAD
 1.36.6.2 22-Sep-2015  skrll Sync with HEAD
 1.36.6.1 06-Apr-2015  skrll Sync with HEAD
 1.38.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.39.16.1 10-Jun-2019  christos Sync with HEAD
 1.39.14.1 20-Oct-2018  pgoyette Sync with head
 1.40.10.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.40.4.2 18-Apr-2022  martin Pull up following revision(s) (requested by reinoud in ticket #1437):

sys/fs/udf/udf_allocation.c: revision 1.46

Revere modification of initializer; it can lead to race conditions where two
allocation would pick the `empty' space causing a panic later on.
 1.40.4.1 13-Mar-2022  martin Pull up following revision(s), all via patch,
requested by reinoud in ticket #1432:

sys/fs/udf/udf_vfsops.c: revision 1.83
sys/fs/udf/udf_allocation.c: revision 1.45
sys/fs/udf/udf_subr.c: revision 1.160
sys/fs/udf/udf_subr.c: revision 1.161

While searching the VAT on recordable media, search the last sector too!
This fixes Win10 formatted discs from being mounted incorrectly.

Make sysctl udf.verbose dependent on UDF_DEBUG instead of DEBUG

Fix serious issue with recordable media formatted with Win10. When closing it
after modification the VAT was written out corrupted making the disc
unreadable anymore on remount. Thanks for ig@ for spotting it in the wild!

On freeing a virtual address in the VAT, use the correct value; this might
confuse other implementations who can reject the VAT on this.
 1.41.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.47.10.1 02-Aug-2025  perseant Sync with HEAD
 1.8 22-Oct-2009  bouyer Remove closes 3 and 4 from my copyright.
 1.7 18-May-2009  reinoud ANSI-fy. No idea why they weren't so in the first place.
 1.6 18-May-2009  reinoud Fix *serious* bug in bswapping definitions for big endian machines.
 1.5 14-May-2008  reinoud branches: 1.5.8; 1.5.12; 1.5.16;
Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.4 05-Mar-2006  christos branches: 1.4.10; 1.4.16; 1.4.66; 1.4.68; 1.4.70; 1.4.72;
remove trailing newlines
 1.3 02-Feb-2006  reinoud branches: 1.3.2; 1.3.4; 1.3.6;
De __P() prototypes.
 1.2 02-Feb-2006  reinoud Fix header re-inclusion protection defines to a less generic naming
scheme.
 1.1 02-Feb-2006  reinoud Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.3.6.1 13-Mar-2006  yamt sync with head.
 1.3.4.2 18-Feb-2006  yamt sync with head.
 1.3.4.1 02-Feb-2006  yamt file udf_bswap.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.3.2.1 22-Apr-2006  simonb Sync with head.
 1.4.72.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4.70.3 11-Mar-2010  yamt sync with head
 1.4.70.2 20-Jun-2009  yamt sync with head
 1.4.70.1 16-May-2008  yamt sync with head.
 1.4.68.1 18-May-2008  yamt sync with head.
 1.4.66.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.16.2 09-Sep-2006  rpaulo sync with head
 1.4.16.1 05-Mar-2006  rpaulo file udf_bswap.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.4.10.2 21-Jun-2006  yamt sync with head.
 1.4.10.1 05-Mar-2006  yamt file udf_bswap.h was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.5.16.1 21-Apr-2010  matt sync to netbsd-5
 1.5.12.1 23-Jul-2009  jym Sync with HEAD.
 1.5.8.1 06-Jun-2009  bouyer Pull up following revision(s) (requested by reinoud in ticket #770):
sys/fs/udf/udf_subr.c: revision 1.88, 1.89
sys/fs/udf/udf_bswap.h: revision 1.6, 1.7
sys/fs/udf/udf_allocation.c: revision 1.22, 1.23
sbin/newfs_udf/udf_create.c: revision 1.16
Fix *serious* bug in bswapping definitions for big endian machines.
ANSI-fy. No idea why they weren't so in the first place.
Fix newfs_udf to create a valid disc images on bigendian machines.
A descriptor's CRC lenth is 16 bit so use udf_rw16() on tag.desc_crc_len.
Forgot to use the udf_rw16() on the descriptor crc lengths of FID's!
Also fix a few dubiously formatted checks.
On creation of a new node, don't forget to set the length of the allocated
space in the right endian!
Account for the logical blocks recorded by the extent in the right endian!
 1.4 16-Oct-2019  maya Switch files copyright Reinoud Zandijk from BSD 4 clause to BSD 2 clause.

OK'd by reinoud in email (from 4 Feb 2019).
 1.3 02-Feb-2006  reinoud branches: 1.3.4; 1.3.16; 1.3.22; 1.3.166;
Fix header re-inclusion protection defines to a less generic naming
scheme.
 1.2 02-Feb-2006  reinoud Fix $NetBSD$ tags. (sorry)
 1.1 02-Feb-2006  reinoud Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.3.166.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.22.2 09-Sep-2006  rpaulo sync with head
 1.3.22.1 02-Feb-2006  rpaulo file udf_mount.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.3.16.2 21-Jun-2006  yamt sync with head.
 1.3.16.1 02-Feb-2006  yamt file udf_mount.h was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.3.4.2 18-Feb-2006  yamt sync with head.
 1.3.4.1 02-Feb-2006  yamt file udf_mount.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.11 11-Feb-2022  reinoud Translate 254/255 compID values used for deleted entries as per UDF spec. This
allows the printing of the names of deleted file entries.
 1.10 05-Aug-2013  joerg Support tools build.
 1.9 18-Mar-2009  cegger branches: 1.9.12; 1.9.22; 1.9.26;
Ansify function definitions w/o arguments. Generated with sed.
 1.8 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.7 19-May-2008  reinoud branches: 1.7.6; 1.7.8; 1.7.12; 1.7.16;
Implement wide char support for UDF by properly implementing unicode-16 to
UTF-8 like cd9660 and ntfs already do.
 1.6 14-May-2008  reinoud Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.5 11-Dec-2007  lukem branches: 1.5.8; 1.5.10; 1.5.12; 1.5.14;
use __KERNEL_RCSID() instead of __RCSID()
 1.4 22-Feb-2007  thorpej branches: 1.4.18; 1.4.26; 1.4.28; 1.4.30;
TRUE -> true, FALSE -> false
 1.3 10-Aug-2006  reinoud branches: 1.3.4; 1.3.10;
The local variable `index' seems shadowing an inbuild gcc variable (???)
when compiling from userland (kernel ok) so rename the variable to Index to
avoid the confusing warning.
 1.2 12-Jun-2006  christos branches: 1.2.4;
remove ; from };
 1.1 02-Feb-2006  reinoud branches: 1.1.4; 1.1.6; 1.1.12;
Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.1.12.1 19-Jun-2006  chap Sync with head.
 1.1.6.2 11-Aug-2006  yamt sync with head
 1.1.6.1 26-Jun-2006  yamt sync with head.
 1.1.4.2 18-Feb-2006  yamt sync with head.
 1.1.4.1 02-Feb-2006  yamt file udf_osta.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.2.4.5 21-Jan-2008  yamt sync with head
 1.2.4.4 26-Feb-2007  yamt sync with head.
 1.2.4.3 30-Dec-2006  yamt sync with head.
 1.2.4.2 21-Jun-2006  yamt sync with head.
 1.2.4.1 12-Jun-2006  yamt file udf_osta.c was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.3.10.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 10-Aug-2006  rpaulo file udf_osta.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.4.30.1 13-Dec-2007  bouyer Sync with HEAD
 1.4.28.1 11-Dec-2007  yamt sync with head.
 1.4.26.1 26-Dec-2007  ad Sync with head.
 1.4.18.1 09-Jan-2008  matt sync with HEAD
 1.5.14.2 24-Jun-2008  wrstuden Hand-merge files that didn't merge right in recent sync w/ current.
 1.5.14.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5.12.2 04-May-2009  yamt sync with head.
 1.5.12.1 16-May-2008  yamt sync with head.
 1.5.10.2 04-Jun-2008  yamt sync with head
 1.5.10.1 18-May-2008  yamt sync with head.
 1.5.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.16.1 21-Apr-2010  matt sync to netbsd-5
 1.7.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.8.1 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.7.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.9.26.1 28-Aug-2013  rmind sync with head
 1.9.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.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.5 05-Feb-2024  andvar s/dependancies/dependencies/ and s/independantly/independently/ in comments and
distrib notes.
 1.4 14-May-2008  reinoud Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.3 05-Mar-2006  christos branches: 1.3.10; 1.3.16; 1.3.66; 1.3.68; 1.3.70; 1.3.72;
remove trailing newlines
 1.2 02-Feb-2006  reinoud branches: 1.2.2; 1.2.4; 1.2.6;
Replace reinclude protection names with less generic versions.
 1.1 02-Feb-2006  reinoud Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.2.6.1 13-Mar-2006  yamt sync with head.
 1.2.4.2 18-Feb-2006  yamt sync with head.
 1.2.4.1 02-Feb-2006  yamt file udf_osta.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.2.2.1 22-Apr-2006  simonb Sync with head.
 1.3.72.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.3.70.1 16-May-2008  yamt sync with head.
 1.3.68.1 18-May-2008  yamt sync with head.
 1.3.66.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.16.2 09-Sep-2006  rpaulo sync with head
 1.3.16.1 05-Mar-2006  rpaulo file udf_osta.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.3.10.2 21-Jun-2006  yamt sync with head.
 1.3.10.1 05-Mar-2006  yamt file udf_osta.h was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.14 10-Feb-2024  andvar fix various typos in comments and log messages.
 1.13 05-Dec-2021  msaitoh s/checkum/checksum/ in comment.
 1.12 24-May-2016  reinoud Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
 1.11 12-Jun-2011  rmind branches: 1.11.12; 1.11.30;
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.10 08-Feb-2009  reinoud branches: 1.10.6; 1.10.12;
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.9 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.8 29-Aug-2008  reinoud branches: 1.8.2; 1.8.4;
Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
 1.7 05-Aug-2008  reinoud Fixup important bug in internal recorded data fixup. Although most unlikely
it could result in theory result in descriptor trashing.

On the performance side, it would try to fixup *every* descriptor even if
it wasn't an internally allocated one. Performance loss wasn't that big but
every bit helps.
 1.6 28-Jul-2008  reinoud Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
 1.5 09-Jul-2008  reinoud Force allocation extent descriptor CRC length to 8 for UDF versions prior
to version 2.01.
 1.4 03-Jul-2008  reinoud branches: 1.4.2;
Avoid panic when trying to mount a non existent block device like a
/dev/vnd0 that is not configured.
 1.3 30-Jun-2008  perry __FUNCTION__ -> __func__
 1.2 24-Jun-2008  reinoud If we're fixing up the internal attributes, is it then wise to check if
they are valid first? Might be on the safe side in the end but disabled for
now.
 1.1 14-May-2008  reinoud branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10;
Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.1.10.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.10.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.1.10.1 14-May-2008  wrstuden file udf_readwrite.c was added on branch wrstuden-revivesa on 2008-06-23 05:02:14 +0000
 1.1.8.4 31-Jul-2008  simonb Sync with head.
 1.1.8.3 18-Jul-2008  simonb Sync with head.
 1.1.8.2 03-Jul-2008  simonb Sync with head.
 1.1.8.1 27-Jun-2008  simonb Sync with head.
 1.1.6.6 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.5 28-Sep-2008  mjf Sync with HEAD.
 1.1.6.4 02-Jul-2008  mjf Sync with HEAD.
 1.1.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.1.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.1 14-May-2008  mjf file udf_readwrite.c was added on branch mjf-devfs2 on 2008-06-02 13:24:06 +0000
 1.1.4.2 18-May-2008  yamt sync with head.
 1.1.4.1 14-May-2008  yamt file udf_readwrite.c was added on branch yamt-pf42 on 2008-05-18 12:35:06 +0000
 1.1.2.3 04-May-2009  yamt sync with head.
 1.1.2.2 16-May-2008  yamt sync with head.
 1.1.2.1 14-May-2008  yamt file udf_readwrite.c was added on branch yamt-nfs-mp on 2008-05-16 02:25:21 +0000
 1.4.2.1 19-Oct-2008  haad Sync with HEAD.
 1.8.4.2 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.8.4.1 18-Feb-2009  snj branches: 1.8.4.1.4;
Pull up following revision(s) (requested by reinoud in ticket #447):
sys/fs/udf/udf.h: revision 1.30
sys/fs/udf/udf_readwrite.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.8
sys/fs/udf/udf_strat_rmw.c: revision 1.18
sys/fs/udf/udf_strat_sequential.c: revision 1.8
sys/fs/udf/udf_subr.c: revision 1.85
sys/fs/udf/udf_subr.h: revision 1.13
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.8.4.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.8.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.8.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.10.12.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.6.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.11.30.1 29-May-2016  skrll Sync with HEAD
 1.11.12.1 03-Dec-2017  jdolecek update from HEAD
 1.16 18-May-2024  thorpej Move the include of <sys/malloc.h> to where it's truly needed.
 1.15 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.14 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.13 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.12 10-Nov-2014  riz branches: 1.12.20; 1.12.26;
Revert previous, it is actually needed. (builds are failing)
 1.11 10-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.10 16-Jul-2013  reinoud branches: 1.10.4; 1.10.8; 1.10.12;
Remove udf_node * as state variables and add the loop invariants UFS and tmpfs
carry to make it easier to debug.
 1.9 15-Jul-2013  reinoud First step in rewriting the genealogy case
 1.8 13-Jul-2013  reinoud udf_gro_genealogy() : source and destination should never be the same on call,
KASSERT it instead of checking for it.
 1.7 13-Jul-2013  reinoud vp is used, so don't (void) it
 1.6 13-Jul-2013  reinoud Rework udf_gro_rename() to be more linear instead of nesting if/else
branching.
 1.5 12-Jul-2013  reinoud In case there is trouble determining the number of entries in a directory,
return its not empty to be on the safe side.
 1.4 11-Jul-2013  reinoud Resort to the easiest way to check if a directory is deleted: the flag that
tells that there is no FID (dirent) pointing to it anymore.
 1.3 11-Jul-2013  reinoud Small cleanup
 1.2 10-Jul-2013  reinoud Remove the dirent checks and references. UDF doesn't need/use them on rename
so just to make sure, we remove all references/checks to not trigger bugs
thats are not really ours.
 1.1 10-Jul-2013  reinoud Implement udf_rename() using the new genfs_rename() framework.

Fixes PR kern/47986
 1.10.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.12.1 16-Jul-2013  tls file udf_rename.c was added on branch tls-maxphys on 2014-08-20 00:04:28 +0000
 1.10.8.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.10.8.1 16-Jul-2013  yamt file udf_rename.c was added on branch yamt-pagecache on 2014-05-22 11:41:02 +0000
 1.10.4.2 28-Aug-2013  rmind sync with head
 1.10.4.1 16-Jul-2013  rmind file udf_rename.c was added on branch rmind-smpnet on 2013-08-28 23:59:35 +0000
 1.12.26.1 17-Jan-2020  ad Sync with head.
 1.12.20.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5 24-May-2016  reinoud Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
 1.4 10-Nov-2014  maxv branches: 1.4.2;
Do not uselessly include <sys/malloc.h>.
 1.3 16-Dec-2008  pooka branches: 1.3.24; 1.3.40;
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.2 29-Aug-2008  reinoud branches: 1.2.2; 1.2.4; 1.2.10;
Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
 1.1 14-May-2008  reinoud branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.12;
Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.1.12.1 19-Oct-2008  haad Sync with HEAD.
 1.1.10.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.10.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.1.10.1 14-May-2008  wrstuden file udf_strat_bootstrap.c was added on branch wrstuden-revivesa on 2008-06-23 05:02:14 +0000
 1.1.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.1.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.1 14-May-2008  mjf file udf_strat_bootstrap.c was added on branch mjf-devfs2 on 2008-06-02 13:24:06 +0000
 1.1.4.2 18-May-2008  yamt sync with head.
 1.1.4.1 14-May-2008  yamt file udf_strat_bootstrap.c was added on branch yamt-pf42 on 2008-05-18 12:35:06 +0000
 1.1.2.3 04-May-2009  yamt sync with head.
 1.1.2.2 16-May-2008  yamt sync with head.
 1.1.2.1 14-May-2008  yamt file udf_strat_bootstrap.c was added on branch yamt-nfs-mp on 2008-05-16 02:25:21 +0000
 1.2.10.1 21-Apr-2010  matt sync to netbsd-5
 1.2.4.1 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.2.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.3.40.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.3.24.1 03-Dec-2017  jdolecek update from HEAD
 1.4.2.1 29-May-2016  skrll Sync with HEAD
 1.17 10-Feb-2024  andvar fix various typos in comments and log messages.
 1.16 27-Jun-2023  reinoud Convert UDF file system code from the depricated tsleep(9)/wakeup(9) to the MP
friendly condvar(9). No functional change intended.
 1.15 15-Jan-2022  msaitoh s/adressing/addressing/
 1.14 24-May-2016  reinoud Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
 1.13 06-Oct-2015  hannken Remove dubious vhold()/holdrele() from write_logvol_dscr strategies.

The udf_node already gets locked with UDF_LOCK_NODE() and udf_reclaim()
will wait for the lock to clear.
 1.12 30-Oct-2013  mrg branches: 1.12.6;
used __diagused where appropriate.
 1.11 18-Oct-2013  christos fix unused variable warnings
 1.10 20-May-2009  reinoud branches: 1.10.12; 1.10.22; 1.10.26;
Retire IN_CALLBACK_ULK flagging since its not used anymore and the old
assertions on it would trigger without cause.
 1.9 10-Feb-2009  reinoud Remove dead code and double check if its allowed to write out non-sequential
there.
 1.8 08-Feb-2009  reinoud branches: 1.8.2;
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.7 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.6 28-Nov-2008  reinoud Allow for the exclusive selection of `direct' for rdonly mounts; its disabled
for now since its a lot slower than `rmw' access.

For archs that have trouble with `rmw' for whatever reason can so use it as a
scapegoat to allways mount savely rdonly though slower.
 1.5 29-Aug-2008  reinoud branches: 1.5.2; 1.5.4;
Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
 1.4 06-Aug-2008  reinoud Rewrite allocation scheme's determination and implementation replacing the
old somewhat naive selection scheme that didn't allow different allocation
settings for nodes, directory information (FIDs) and data.

Also fix some curious side-effects of atime updates on RMW devices.
 1.3 28-Jul-2008  reinoud Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
 1.2 07-Jul-2008  reinoud Support for allocation extents descriptor writing to allow for arbitrary
heavily fragmented files.

Also fixing some (rare) allocation bugs and function name streamlining.

Tested on harddisc, CD-RW and CD-R i.e. all three basic backend classes.
 1.1 14-May-2008  reinoud branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.1.12.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.12.1 19-Oct-2008  haad Sync with HEAD.
 1.1.10.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.10.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.1.10.1 14-May-2008  wrstuden file udf_strat_direct.c was added on branch wrstuden-revivesa on 2008-06-23 05:02:14 +0000
 1.1.8.2 31-Jul-2008  simonb Sync with head.
 1.1.8.1 18-Jul-2008  simonb Sync with head.
 1.1.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.1.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.1 14-May-2008  mjf file udf_strat_direct.c was added on branch mjf-devfs2 on 2008-06-02 13:24:06 +0000
 1.1.4.2 18-May-2008  yamt sync with head.
 1.1.4.1 14-May-2008  yamt file udf_strat_direct.c was added on branch yamt-pf42 on 2008-05-18 12:35:06 +0000
 1.1.2.4 20-Jun-2009  yamt sync with head
 1.1.2.3 04-May-2009  yamt sync with head.
 1.1.2.2 16-May-2008  yamt sync with head.
 1.1.2.1 14-May-2008  yamt file udf_strat_direct.c was added on branch yamt-nfs-mp on 2008-05-16 02:25:21 +0000
 1.5.4.5 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.5.4.4 01-Jun-2009  liamjfoy Pull up following revision(s) (requested by reinoud in ticket #772):
sys/fs/udf/udf_strat_rmw.c: revision 1.19
sys/fs/udf/udf_strat_sequential.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.10
sys/fs/udf/udf_subr.c: revision 1.90
sys/fs/udf/udf_subr.c: revision 1.91
Descriptor version is 16 bit and not 8 so use udf_rw16() to access them.
UniqueID was written in the logical volume integrity without byteswapping for
bigendian machines.

Retire IN_CALLBACK_ULK flagging since its not used anymore and the old
assertions on it would trigger without cause.
 1.5.4.3 18-Mar-2009  snj branches: 1.5.4.3.4;
Apply patch (requested by reinoud in ticket #569):
Remove dead code and double check if it's allowed to write out
non-sequential there.
--
Sequential writing goes before normal write. Its not likely to ever go
wrong but there could be a race otherwise.
--
Add simplistic UBC async flushing as other FS's seem to do. Its a clutch
and needs to be addressed in UBC properly.
Improve write throttling by doing it on page-size basis. The `standard'
solution would cut up files unnessisary during allocation. It also made
assumptions about ucb wich were propably right but still.
 1.5.4.2 18-Feb-2009  snj Pull up following revision(s) (requested by reinoud in ticket #447):
sys/fs/udf/udf.h: revision 1.30
sys/fs/udf/udf_readwrite.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.8
sys/fs/udf/udf_strat_rmw.c: revision 1.18
sys/fs/udf/udf_strat_sequential.c: revision 1.8
sys/fs/udf/udf_subr.c: revision 1.85
sys/fs/udf/udf_subr.h: revision 1.13
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.5.4.1 06-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #167):
sys/fs/udf/udf_strat_direct.c: revision 1.6
sys/fs/udf/udf_subr.c: revision 1.75
Allow for the exclusive selection of `direct' for rdonly mounts; its disabled
for now since its a lot slower than `rmw' access.
For archs that have trouble with `rmw' for whatever reason can so use it as a
scapegoat to allways mount savely rdonly though slower.
 1.5.4.3.4.1 21-Apr-2010  matt sync to netbsd-5
 1.5.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.5.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.2.2 23-Jul-2009  jym Sync with HEAD.
 1.8.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.10.26.1 18-May-2014  rmind sync with head
 1.10.22.2 03-Dec-2017  jdolecek update from HEAD
 1.10.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.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.12.6.2 29-May-2016  skrll Sync with HEAD
 1.12.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.31 27-Jun-2023  reinoud Convert UDF file system code from the depricated tsleep(9)/wakeup(9) to the MP
friendly condvar(9). No functional change intended.
 1.30 15-Jan-2022  msaitoh s/adressing/addressing/
 1.29 21-Aug-2021  andvar s/helt/held+s/eroneously/erroneously/+s/splitted/split/+s/recommented/recommended/
 1.28 24-May-2016  reinoud Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
 1.27 06-Oct-2015  hannken Remove dubious vhold()/holdrele() from write_logvol_dscr strategies.

The udf_node already gets locked with UDF_LOCK_NODE() and udf_reclaim()
will wait for the lock to clear.
 1.26 12-Sep-2015  christos diagused some variables.
 1.25 12-Sep-2015  christos remove identity assignment, found by brainy.
 1.24 30-Oct-2013  mrg branches: 1.24.6;
used __diagused where appropriate.
 1.23 18-Oct-2013  christos fix unused variable warnings
 1.22 08-Jul-2009  reinoud branches: 1.22.12; 1.22.22; 1.22.26;
Fix alternating oddity in RMW strategy. Even when in the reading state it
would push out elements to fillup-read only when the time had come for them.
This could then trickle feed the read queue slowly, but fast enough to prevent
it from switching state.
 1.21 06-Jul-2009  reinoud Re-implement read-modify-write backend strategy. This version is a lot more
clean locking-wise and will consume less CPU power on needless moving-around.
 1.20 02-Jul-2009  reinoud Enhance dumping on buffer screwup. Also prevent races or invalid combinations
to exist for ecclines.
 1.19 20-May-2009  reinoud Retire IN_CALLBACK_ULK flagging since its not used anymore and the old
assertions on it would trigger without cause.
 1.18 08-Feb-2009  reinoud branches: 1.18.2;
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.17 13-Jan-2009  yamt g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.16 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.15 09-Dec-2008  reinoud Fix two buf_init()'s that are not needed since they were already initialised
by getiobuf().

Also remove ancient IPL_BIO reference from the time it was called from
interrupt context instead of the current soft interrupt.
 1.14 06-Dec-2008  reinoud UDF_SHED_FREE state is now also handled by the state machine, so DO signal it.
Free'd up ecclines can now far more quicker be recycled.
 1.13 05-Dec-2008  reinoud Two fold commit:

1) Enhance write speed significantly on RMW media like CD-RW, DVD-RW but also
on the DVD+RW and all other ECC blocked media. Significant speedups of access
to the device for say compilation on the DVD. Streaming copy is also still at
maximum speed though vast amounts of directory copy work can show side effects
that appear it to slow down but are actually logical when you consider that
most small files are embedded into the descriptors itself.

2) explicit wait for the created RMW thread to spinup
 1.12 15-Nov-2008  reinoud Specify blobsize as the `pagingsize' of the eccline blob pool. This will relax
the requirements of the pagingsize.
 1.11 01-Nov-2008  reinoud Introduce an extra state to wich all pushed ecclines are pushed on. This
extra state has a holding time in wich no writeouts will be done
effectively collecting more sectors before its even sheduled for writing.
 1.10 01-Nov-2008  reinoud Explicitly set buffer's block numbers. Blocks were always read/written
correctly only the sheduling could go less than optimal.
 1.9 29-Aug-2008  reinoud branches: 1.9.2; 1.9.4;
Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
 1.8 07-Aug-2008  reinoud Don't panic on read-errors but set flag that the packet is doomed. Its not
clear if i could read the individual sectors correctly since the entire
read packet is also one big ECC block.
 1.7 06-Aug-2008  reinoud Rewrite allocation scheme's determination and implementation replacing the
old somewhat naive selection scheme that didn't allow different allocation
settings for nodes, directory information (FIDs) and data.

Also fix some curious side-effects of atime updates on RMW devices.
 1.6 28-Jul-2008  reinoud Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
 1.5 07-Jul-2008  reinoud Support for allocation extents descriptor writing to allow for arbitrary
heavily fragmented files.

Also fixing some (rare) allocation bugs and function name streamlining.

Tested on harddisc, CD-RW and CD-R i.e. all three basic backend classes.
 1.4 17-Jun-2008  reinoud branches: 1.4.2; 1.4.4;
Change comments on marking buffer busy.
 1.3 15-May-2008  reinoud branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8;
Introduce new UDF debug class and split rmw strategy debugging prints.
 1.2 15-May-2008  reinoud Add accidently removed lines when i pruned the code for release. Important
update.
 1.1 14-May-2008  reinoud Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.3.8.3 31-Jul-2008  simonb Sync with head.
 1.3.8.2 18-Jul-2008  simonb Sync with head.
 1.3.8.1 18-Jun-2008  simonb Sync with head.
 1.3.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.3.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.3.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.3.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.3.6.1 15-May-2008  mjf file udf_strat_rmw.c was added on branch mjf-devfs2 on 2008-06-02 13:24:06 +0000
 1.3.4.2 18-May-2008  yamt sync with head.
 1.3.4.1 15-May-2008  yamt file udf_strat_rmw.c was added on branch yamt-pf42 on 2008-05-18 12:35:06 +0000
 1.3.2.5 18-Jul-2009  yamt sync with head.
 1.3.2.4 20-Jun-2009  yamt sync with head
 1.3.2.3 04-May-2009  yamt sync with head.
 1.3.2.2 16-May-2008  yamt sync with head.
 1.3.2.1 15-May-2008  yamt file udf_strat_rmw.c was added on branch yamt-nfs-mp on 2008-05-16 02:25:21 +0000
 1.4.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.4.1 19-Oct-2008  haad Sync with HEAD.
 1.4.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.2.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.4.2.1 17-Jun-2008  wrstuden file udf_strat_rmw.c was added on branch wrstuden-revivesa on 2008-06-23 05:02:14 +0000
 1.9.4.10 09-Jul-2009  snj Pull up following revision(s) (requested by reinoud in ticket #853):
sys/fs/udf/udf_strat_rmw.c: revision 1.22
Fix alternating oddity in RMW strategy. Even when in the reading state it
would push out elements to fillup-read only when the time had come for them.
This could then trickle feed the read queue slowly, but fast enough to prevent
it from switching state.
 1.9.4.9 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.9.4.8 01-Jun-2009  liamjfoy Pull up following revision(s) (requested by reinoud in ticket #772):
sys/fs/udf/udf_strat_rmw.c: revision 1.19
sys/fs/udf/udf_strat_sequential.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.10
sys/fs/udf/udf_subr.c: revision 1.90
sys/fs/udf/udf_subr.c: revision 1.91
Descriptor version is 16 bit and not 8 so use udf_rw16() to access them.
UniqueID was written in the logical volume integrity without byteswapping for
bigendian machines.

Retire IN_CALLBACK_ULK flagging since its not used anymore and the old
assertions on it would trigger without cause.
 1.9.4.7 18-Feb-2009  snj branches: 1.9.4.7.4;
Pull up following revision(s) (requested by reinoud in ticket #447):
sys/fs/udf/udf.h: revision 1.30
sys/fs/udf/udf_readwrite.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.8
sys/fs/udf/udf_strat_rmw.c: revision 1.18
sys/fs/udf/udf_strat_sequential.c: revision 1.8
sys/fs/udf/udf_subr.c: revision 1.85
sys/fs/udf/udf_subr.h: revision 1.13
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.9.4.6 10-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #174):
sys/fs/udf/udf_strat_rmw.c: revision 1.15
sys/fs/udf/udf.h: revision 1.29
Fix two buf_init()'s that are not needed since they were already initialised
by getiobuf().
Also remove ancient IPL_BIO reference from the time it was called from
interrupt context instead of the current soft interrupt.
 1.9.4.5 10-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #174):
sys/fs/udf/udf_strat_rmw.c: revision 1.14
UDF_SHED_FREE state is now also handled by the state machine, so DO signal it.
Free'd up ecclines can now far more quicker be recycled.
 1.9.4.4 06-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #167):
sys/fs/udf/udf.h: revision 1.28
sys/fs/udf/udf_strat_rmw.c: revision 1.13
Two fold commit:
1) Enhance write speed significantly on RMW media like CD-RW, DVD-RW but also
on the DVD+RW and all other ECC blocked media. Significant speedups of access
to the device for say compilation on the DVD. Streaming copy is also still at
maximum speed though vast amounts of directory copy work can show side effects
that appear it to slow down but are actually logical when you consider that
most small files are embedded into the descriptors itself.
2) explicit wait for the created RMW thread to spinup
 1.9.4.3 27-Nov-2008  snj Pull up following revision(s) (requested by reinoud in ticket #133):
sys/fs/udf/udf_strat_rmw.c: revision 1.12
Specify blobsize as the `pagingsize' of the eccline blob pool. This will relax
the requirements of the pagingsize.
 1.9.4.2 02-Nov-2008  snj Pull up following revision(s) (requested by reinoud in ticket #8):
sys/fs/udf/udf_strat_rmw.c: revision 1.11
Introduce an extra state to wich all pushed ecclines are pushed on. This
extra state has a holding time in wich no writeouts will be done
effectively collecting more sectors before its even sheduled for writing.
 1.9.4.1 02-Nov-2008  snj Pull up following revision(s) (requested by reinoud in ticket #6):
sys/fs/udf/udf_strat_rmw.c: revision 1.10
Explicitly set buffer's block numbers. Blocks were always read/written
correctly only the sheduling could go less than optimal.
 1.9.4.7.4.1 21-Apr-2010  matt sync to netbsd-5
 1.9.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.9.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.18.2.1 23-Jul-2009  jym Sync with HEAD.
 1.22.26.1 18-May-2014  rmind sync with head
 1.22.22.2 03-Dec-2017  jdolecek update from HEAD
 1.22.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.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.24.6.3 29-May-2016  skrll Sync with HEAD
 1.24.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.24.6.1 22-Sep-2015  skrll Sync with HEAD
 1.20 27-Jun-2023  reinoud Convert UDF file system code from the depricated tsleep(9)/wakeup(9) to the MP
friendly condvar(9). No functional change intended.
 1.19 27-Aug-2022  skrll Spell approximately correctly.
 1.18 27-Aug-2022  skrll Trailing whitespace
 1.17 16-Apr-2022  andvar fix various typos in comments and log messages.
 1.16 08-Mar-2022  reinoud On switching from writing to reading explicitly synchronize the caches. It
isn't strictly needed but some devices in the wild will otherwise bluntly
ignore all reading commands resulting in a kernel and device lockup.
 1.15 24-May-2016  reinoud branches: 1.15.22;
Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
 1.14 06-Oct-2015  hannken Remove dubious vhold()/holdrele() from write_logvol_dscr strategies.

The udf_node already gets locked with UDF_LOCK_NODE() and udf_reclaim()
will wait for the lock to clear.
 1.13 23-Mar-2014  christos branches: 1.13.6;
fix unused
 1.12 18-Oct-2013  christos fix unused variable warnings
 1.11 03-Jan-2011  drochner branches: 1.11.8; 1.11.18; 1.11.22;
destroy mutex/cv before freeing the struct holding them, fixes
LOCKDEBUG panic
 1.10 20-May-2009  reinoud branches: 1.10.4;
Retire IN_CALLBACK_ULK flagging since its not used anymore and the old
assertions on it would trigger without cause.
 1.9 10-Feb-2009  reinoud Sequential writing goes before normal write. Its not likely to ever go wrong
but there could be a race otherwise.
 1.8 08-Feb-2009  reinoud branches: 1.8.2;
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.7 13-Jan-2009  yamt g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.6 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.5 29-Aug-2008  reinoud branches: 1.5.2; 1.5.4;
Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
 1.4 06-Aug-2008  reinoud Rewrite allocation scheme's determination and implementation replacing the
old somewhat naive selection scheme that didn't allow different allocation
settings for nodes, directory information (FIDs) and data.

Also fix some curious side-effects of atime updates on RMW devices.
 1.3 28-Jul-2008  reinoud Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
 1.2 07-Jul-2008  reinoud Support for allocation extents descriptor writing to allow for arbitrary
heavily fragmented files.

Also fixing some (rare) allocation bugs and function name streamlining.

Tested on harddisc, CD-RW and CD-R i.e. all three basic backend classes.
 1.1 14-May-2008  reinoud branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.1.12.1 19-Oct-2008  haad Sync with HEAD.
 1.1.10.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.10.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.1.10.1 14-May-2008  wrstuden file udf_strat_sequential.c was added on branch wrstuden-revivesa on 2008-06-23 05:02:14 +0000
 1.1.8.2 31-Jul-2008  simonb Sync with head.
 1.1.8.1 18-Jul-2008  simonb Sync with head.
 1.1.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.1.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.1 14-May-2008  mjf file udf_strat_sequential.c was added on branch mjf-devfs2 on 2008-06-02 13:24:06 +0000
 1.1.4.2 18-May-2008  yamt sync with head.
 1.1.4.1 14-May-2008  yamt file udf_strat_sequential.c was added on branch yamt-pf42 on 2008-05-18 12:35:06 +0000
 1.1.2.4 20-Jun-2009  yamt sync with head
 1.1.2.3 04-May-2009  yamt sync with head.
 1.1.2.2 16-May-2008  yamt sync with head.
 1.1.2.1 14-May-2008  yamt file udf_strat_sequential.c was added on branch yamt-nfs-mp on 2008-05-16 02:25:21 +0000
 1.5.4.4 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.5.4.3 01-Jun-2009  liamjfoy Pull up following revision(s) (requested by reinoud in ticket #772):
sys/fs/udf/udf_strat_rmw.c: revision 1.19
sys/fs/udf/udf_strat_sequential.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.10
sys/fs/udf/udf_subr.c: revision 1.90
sys/fs/udf/udf_subr.c: revision 1.91
Descriptor version is 16 bit and not 8 so use udf_rw16() to access them.
UniqueID was written in the logical volume integrity without byteswapping for
bigendian machines.

Retire IN_CALLBACK_ULK flagging since its not used anymore and the old
assertions on it would trigger without cause.
 1.5.4.2 18-Mar-2009  snj branches: 1.5.4.2.4;
Apply patch (requested by reinoud in ticket #569):
Remove dead code and double check if it's allowed to write out
non-sequential there.
--
Sequential writing goes before normal write. Its not likely to ever go
wrong but there could be a race otherwise.
--
Add simplistic UBC async flushing as other FS's seem to do. Its a clutch
and needs to be addressed in UBC properly.
Improve write throttling by doing it on page-size basis. The `standard'
solution would cut up files unnessisary during allocation. It also made
assumptions about ucb wich were propably right but still.
 1.5.4.1 18-Feb-2009  snj Pull up following revision(s) (requested by reinoud in ticket #447):
sys/fs/udf/udf.h: revision 1.30
sys/fs/udf/udf_readwrite.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.8
sys/fs/udf/udf_strat_rmw.c: revision 1.18
sys/fs/udf/udf_strat_sequential.c: revision 1.8
sys/fs/udf/udf_subr.c: revision 1.85
sys/fs/udf/udf_subr.h: revision 1.13
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.5.4.2.4.1 21-Apr-2010  matt sync to netbsd-5
 1.5.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.5.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.2.2 23-Jul-2009  jym Sync with HEAD.
 1.8.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.10.4.1 05-Mar-2011  rmind sync with head
 1.11.22.1 18-May-2014  rmind sync with head
 1.11.18.2 03-Dec-2017  jdolecek update from HEAD
 1.11.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.8.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.13.6.2 29-May-2016  skrll Sync with HEAD
 1.13.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.15.22.1 13-Mar-2022  martin Pull up following revision(s) (requested by reinoud in ticket #1431):

sys/fs/udf/udf_strat_sequential.c: revision 1.16
sys/fs/udf/udf_subr.c: revision 1.167

On switching from writing to reading explicitly synchronize the caches. It
isn't strictly needed but some devices in the wild will otherwise bluntly
ignore all reading commands resulting in a kernel and device lockup.

For bug-compatibility with Windows, the last VAT sector must be a multiple of
16/32 from the start of the track. To allow for scratches, write out at least
a 32 pieces.
 1.177 28-Mar-2025  andvar s/beyong/beyond/ in comment.
 1.176 10-Feb-2024  andvar branches: 1.176.2;
fix various typos in comments and log messages.
 1.175 04-Feb-2024  andvar s/substract/subtract/ in comments.
 1.174 03-Jun-2023  andvar fix various typos in comments and messages.
 1.173 03-Apr-2023  gutteridge Fix typos: s/trough/through/
 1.172 31-Oct-2022  andvar fix various typos in comments and one output message.
 1.171 28-May-2022  andvar fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.
 1.170 15-May-2022  andvar s/wich/which in comments.
 1.169 22-Apr-2022  reinoud Fix endian issue with UDF extended attribute handling
 1.168 10-Apr-2022  andvar fix various typos in comments and output/log messages.
 1.167 08-Mar-2022  reinoud For bug-compatibility with Windows, the last VAT sector must be a multiple of
16/32 from the start of the track. To allow for scratches, write out at least
a 32 pieces.
 1.166 06-Feb-2022  andvar fix various typos in comments, log messages and documentation.
mainly s/aparently/apparently/ and s/implmented/implemented/.
 1.165 25-Jan-2022  andvar fix various typos in comments.
 1.164 24-Jan-2022  andvar remove double "with" in comments and usage text. Also fix one typo.
 1.163 01-Jan-2022  msaitoh s/implemenation/implementation/ in comment.
 1.162 16-Dec-2021  reinoud Fix typo: reader -> header
 1.161 16-Dec-2021  reinoud Fix serious issue with recordable media formatted with Win10. When closing it
after modification the VAT was written out corrupted making the disc
unreadable anymore on remount. Thanks for ig@ for spotting it in the wild!
 1.160 15-Dec-2021  reinoud While searching the VAT on recordable media, search the last sector too!
This fixes Win10 formatted discs from being mounted incorrectly.
 1.159 05-Dec-2021  msaitoh s/alloction/allocation/
 1.158 16-Sep-2021  andvar fix typos in word "successful".
 1.157 03-Sep-2021  andvar fix typos in comments, mainly s/extention/extension/ and s/sufficent/sufficient/
 1.156 21-Aug-2021  andvar s/helt/held+s/eroneously/erroneously/+s/splitted/split/+s/recommented/recommended/
 1.155 20-Aug-2021  andvar fix various typos in comments and log messages.
 1.154 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.153 13-Apr-2021  mrg branches: 1.153.2;
more GCC 10 fixes.

mDNSResponder: another wrong return local address

dhcp: ignore a seemingly impossible stringop overflow

hpacel: avoid maybe uninitialised error that is wrong.

rsh: avoid impossible malloc(0)

udf: cast pointers through (uintptr_t) to fool invalid boundary checks
 1.152 11-Jan-2021  skrll branches: 1.152.2;
Trailing whitespace
 1.151 11-Jan-2021  skrll Fix spelling of preferred in comments. While here improve grammar in
one of the comments.
 1.150 06-Apr-2020  hannken branches: 1.150.4;
udf_get_node(): fix typo and honor "lktype" argument.
 1.149 27-Feb-2020  ad Tighten up the locking around vp->v_iflag a little more after the recent
split of vmobjlock & v_interlock.
 1.148 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.147 18-Sep-2019  christos branches: 1.147.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.146 03-Jun-2019  msaitoh branches: 1.146.2;
Fix typo in comment (s/seperate/separate/).
 1.145 01-Jan-2019  hannken Add "void *extra" argument to vcache_new() so a file system may
pass more information about the file to create.

Welcome to 8.99.30
 1.144 14-Oct-2018  jdolecek remove M_CANFAIL flag for malloc(9) - it was completely ignored, so had
actually no effect
 1.143 09-Aug-2018  reinoud Fix length calculation
 1.142 25-Jul-2018  reinoud Enhance logical volume integrity descriptor handling and provide
bug-compatibility for Linux mkudffs 1.3 images.
 1.141 06-Jun-2018  maya branches: 1.141.2;
Remove duplicate ;
 1.140 28-May-2018  chs 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.139 01-Apr-2017  riastradh branches: 1.139.6; 1.139.12;
KASSERT(mutex_owned(vp->v_interlock)) in vnode iterator selector.
 1.138 24-May-2016  reinoud branches: 1.138.2; 1.138.4;
Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
 1.137 10-May-2016  reinoud Rework VAT searching on recordable media. It is now a lot more resilliant to
errors and it allows for VAT searching on crashed writeouts.

While here, make sure the node pointer is always initialised in
udf_get_node().
 1.136 27-Jan-2016  reinoud Fix filename creation and deleting with illegal file names. UDF has a
machanism for it but it allowed to create a file with a name it considered
illegal that then couldn't be deleted with the same name.

Fixes PR kern/50608. When confirmed, it can be closed.
 1.135 19-Dec-2015  dholland Improve misleading variable name. Related to PR 50571.

XXX: also there should be real bounds-check logic in here.
XXX: if the on-disk data structure contains rubbish this code will
XXX: leak or trample arbitrary kernel memory.
 1.134 19-Dec-2015  christos add missing ,
 1.133 19-Dec-2015  christos PR/50571: David Binderman: src/sys/fs/udf/udf_subr.c:6465: obvious
performance tidyup
 1.132 24-Aug-2015  hannken Use vfs_vnode_iterator for udf_do_sync.

- Build rb_tree to get an ordered list of nodes, sync them and
clean the tree.

- Stop abusing mntvnode_lock to serialize udf_do_sync, use new
mutex ump->sync_lock instead.
 1.131 24-Aug-2015  hannken Remove dirtynodes_cv, it is only used for timed waits without any signals.

Replace the cv_timedwait with kpause.
 1.130 20-Apr-2015  riastradh Make vget always return vnode unlocked.

Convert callers who want locks to use vn_lock afterward.

Add extra argument so the compiler will report stragglers.
 1.129 06-Apr-2015  hannken Change udf to vcache, keyed on udf_node->loc.loc.
 1.128 07-Feb-2015  christos fix udf_node leak. Reported by:
http://www.m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-4
 1.127 17-Sep-2014  reinoud branches: 1.127.2;
Fix bug introduced in last patch
 1.126 17-Sep-2014  reinoud As pointed out by wiz@ prevent a possible attack or corruption that results in
an endless loop of indirect descriptors being processed.

The number of indirect descriptors followed is now maximized.
While here, also fix a use-after-free bug!
 1.125 29-Jul-2014  reinoud branches: 1.125.2;
Fix debug printout of udf_write_metadata_partition_spacetable(), it referred
to an old variable.
 1.124 23-Mar-2014  christos branches: 1.124.2;
fix unused
 1.123 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.122 21-Nov-2013  riz Don't create a variable just to assert() on it - assert on the
thing the variable got assigned.
 1.121 18-Oct-2013  christos fix unused variable warnings
 1.120 07-Jul-2013  reinoud Implement a real empty-directory checking for rmdir().

Should should fix the other part of PR kern/47987
Solves tests/vfs/t_vnops udf_dir_notempty
 1.119 29-Apr-2012  chs branches: 1.119.2; 1.119.4;
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.118 13-Nov-2011  christos branches: 1.118.4; 1.118.6;
use getdisksize()
 1.117 27-Sep-2011  christos branches: 1.117.2;
- rename UDF_MAX_NAMELEN -> UDF_MAXNAMLEN
- use NAME_MAX instead of MAXNAMLEN
 1.116 16-Aug-2011  mbalmer Fix some typos.
 1.115 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.114 26-Apr-2011  hannken branches: 1.114.2;
Change vflushbuf() to return an error if a synchronous write fails.

Welcome to 5.99.51.
 1.113 22-Jan-2011  reinoud A not rewritable disc can be pseudo-overwritable. A pseudo-overwritable disc
can overwrite its logical volume integrity sequence so no need to make it
append-only for this class of discs.
 1.112 22-Jan-2011  reinoud Lookup the physical partition backing up the logical one when searching for the
metadata partition overlap for BD-R.

Fixes a kernel panic on mounting a BD-R formatted with UDF 2.60
 1.111 21-Jan-2011  reinoud Split out the raw to indexed partitioning code protecting against roque
implementations that use `ramdom' numbers for the physical partitions breaking
lots of implementations. Known curlpit is MicroSoft Windows 7.

Not only the partition mappings need to be protected against this but also the metadata partition files.
 1.110 13-Jan-2011  reinoud branches: 1.110.2; 1.110.4;
Fix the case in where a file with a latin1 file name was created. It was then
erronously entered as thelatin1 file name in the dirhash whereas the matching
routing assumes both UTF-8. This would result in a file being created but not
stat-able since the dirhash couldn't find the entry unless it was remounted.
 1.109 22-Dec-2010  reinoud Running with DEBUG again revealed locking errors previously undetected. The
VAT writeout was done locked while marked locked as were the readin and
writeout of the metadata partition space table.

While here, also protect the (vp) argument of the UDF_SET_SYSTEMFILE() macro.

Tested on UDF 1.50 sequential, UDF 2.01 RW and UDF 2.50 metadata RW meda.
 1.108 24-Sep-2010  rmind Fixes/improvements to RB-tree implementation:
1. Fix inverted node order, so that negative value from comparison operator
would represent lower (left) node, and positive - higher (right) node.
2. Add an argument (i.e. "context"), passed to comparison operators.
3. Change rb_tree_insert_node() to return a node - either inserted one or
already existing one.
4. Amend the interface to manipulate the actual object, instead of the
rb_node (in a similar way as Patricia-tree interface does).
5. Update all RB-tree users accordingly.

XXX: Perhaps rename rb.h to rbtree.h, since cleaning-up..

1-3 address the PR/43488 by Jeremy Huddleston.

Passes RB-tree regression tests.
Reviewed by: matt@, christos@
 1.107 21-Jul-2010  hannken Make holding v_interlock mandatory for callers of vget().

Announced some time ago on tech-kern.
 1.106 01-Jul-2010  hannken Remove vlockmgr(). Generic vnode lock operations now use a rwlock located
in the vnode. All LK_* flags move from sys/lock.h to sys/vnode.h. Calls
to vlockmgr() in file systems get replaced with VOP_LOCK() or VOP_UNLOCK().

Welcome to 5.99.34.

Discussed on tech-kern.
 1.105 06-Jun-2010  hannken Change layered file systems to always pass the locking VOP's down to the
leaf file system. Remove now unused member v_vnlock from struct vnode.
Welcome to 5.99.30

Discussed on tech-kern.
 1.104 25-Feb-2010  reinoud branches: 1.104.2;
First part of shrinking/growing metadata partition support:

- extending the metadata partition

Still to follow:
- sparsify metadata partition
- growing the metadata partition
- unsparsifying metadata partition
 1.103 24-Feb-2010  reinoud Rename metadata partition parameters to be less generic and add the flags.
 1.102 24-Feb-2010  reinoud Extract UDF metadata partition parameters as already done for VAT and sparable
partitions.
 1.101 05-Jan-2010  mbalmer branches: 1.101.2;
Remove extra semicolons.
 1.100 23-Dec-2009  mbalmer Fix typo in comments, no code change.
 1.99 27-Jul-2009  reinoud Issue extra synchronise caches before closing tracks or sessions. It shouldn't
be needed as the caches should already be synchronised, but better be safe.
 1.98 07-Jul-2009  reinoud Replace the old hashtable and sorted list implemenation by a RB-tree.

Benefits are significant speed improvements on node creation/insertion while
keeping the lookup times low and still allowing sequential iteration over the
nodes.
 1.97 06-Jul-2009  reinoud Make source prettier
 1.96 25-Jun-2009  reinoud Rewrite of udf_on_rootpath(), and vop_rename() code that calls it, after the
UFS way. The tree walking is now done the same and the code hasn't locked up
on examples that made it lockup before.
 1.95 24-Jun-2009  reinoud Commit first stage of free-space accounting. It is estimating the underlimit
of free blocks on the device and when free blocks are getting tight it tries
to readjust/recalculate that value by syncing the FS.

Second stage will be resizing the data/metadata partitions.
 1.94 23-Jun-2009  reinoud Renaming in UDF was already possible but directories could only be renamed in
the same directory.

This patch finally allows a directory to be moved between parent directories.
 1.93 18-Jun-2009  reinoud Enhance comment on node locking when writing out a node's descriptors.
 1.92 18-Jun-2009  reinoud Remove unneeded wait for SYNC being finished on node disposal of deleted node;
this could interfere and lockup.
 1.91 20-May-2009  reinoud Retire IN_CALLBACK_ULK flagging since its not used anymore and the old
assertions on it would trigger without cause.
 1.90 20-May-2009  reinoud Descriptor version is 16 bit and not 8 so use udf_rw16() to access them.
UniqueID was written in the logical volume integrity without byteswapping for
bigendian machines.
 1.89 19-May-2009  reinoud On creation of a new node, don't forget to set the length of the allocated
space in the right endian!
 1.88 19-May-2009  reinoud Forgot to use the udf_rw16() on the descriptor crc lengths of FID's!
Also fix a few dubiously formatted checks.
 1.87 18-Mar-2009  cegger bzero -> memset
 1.86 22-Feb-2009  yamt udf_write_filebuf: remove an write-only variable
 1.85 08-Feb-2009  reinoud branches: 1.85.2;
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.84 05-Feb-2009  pooka Specify BROKEN DIRECTORY ENTRY printf comes from udf
(can happen e.g. with medium error)
 1.83 19-Dec-2008  cegger use M_ZERO on malloc() and remove subsequent bzero().
 1.82 18-Dec-2008  reinoud Implement auto-track repair on tracks marked damaged when searching for
writable tracks on session opening. Note that this an optionally implemented
feature and thus no error will be generated if it fails; the drive will most
likely autorepair it.
 1.81 18-Dec-2008  reinoud Fix critital panic when mounting a CD-R/DVD*R disc. The check for VV_ROOT was
not done correctly and could panic when requested to load a VAT descriptor
since the fileset was not yet fetched.
 1.80 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.79 16-Dec-2008  reinoud Check for a node being root on node creation so when the root node is disposed
of when working deep into the directory tree it can reliably be reget and
marked correctly as the FS root.

Fixed pwd(1) lock panic and possible endless loop in other tools.
 1.78 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.77 16-Dec-2008  reinoud Elaborate SYNC debug messages and rename some debug messages to a more
proper category.
 1.76 01-Dec-2008  reinoud Split uid/gid remapping code to be independent of eachother.
 1.75 28-Nov-2008  reinoud Allow for the exclusive selection of `direct' for rdonly mounts; its disabled
for now since its a lot slower than `rmw' access.

For archs that have trouble with `rmw' for whatever reason can so use it as a
scapegoat to allways mount savely rdonly though slower.
 1.74 28-Nov-2008  reinoud Remove old comment and remove unused calculated variable
 1.73 27-Sep-2008  reinoud branches: 1.73.2; 1.73.4;
Switch UDF over to the vfs_dirhash.c dirhash code.
 1.72 29-Aug-2008  reinoud Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
 1.71 06-Aug-2008  reinoud Rewrite allocation scheme's determination and implementation replacing the
old somewhat naive selection scheme that didn't allow different allocation
settings for nodes, directory information (FIDs) and data.

Also fix some curious side-effects of atime updates on RMW devices.
 1.70 28-Jul-2008  reinoud Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
 1.69 27-Jul-2008  reinoud Delay physical partition spacebitmaps from volume-descriptor-checking until
the other supporting structures are read in.
 1.68 26-Jul-2008  reinoud Clarify the current spacemap read/write code is reading/writing physical
partition space maps. This in preperation of Metadata spacetable
reading/writeout work.
 1.67 22-Jul-2008  reinoud No use walking empty hashtables when purging.
 1.66 22-Jul-2008  reinoud Limit the UDF dirhash to a configurable amount of memory. The performance
penalty even with a limited dirhash of 128kb is acceptable but it should be
set by machine memory size though.
 1.65 19-Jul-2008  reinoud Use ecma-167 constants instead of homegrown to prevent double mapping.
 1.64 19-Jul-2008  reinoud Choose which time of allocation descriptors to use on new nodes based on
the number of partition mappings.
 1.63 18-Jul-2008  reinoud fix comment
 1.62 18-Jul-2008  reinoud On dirhash lookup, don't retrieve info you already have.
 1.61 18-Jul-2008  reinoud Remove double check
 1.60 18-Jul-2008  reinoud First retrieve length and hash values *before* advancing to the next entry.
On hashline collision it would check a random one next.
 1.59 17-Jul-2008  reinoud Implement directory hashing to speed up directory traversals. Speed
improvements of at least 4 times in untarring and roughly 100 to 500 times
on file creation in big directories. Lookup of files was O(n*n) and is now
O(1) even for file creation. Free spaces in the directory are kept in a
seperate list for fast file creation.

The postmark benchmark gives:

UDF old:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
1593 seconds total
681 seconds of transactions (2 per second)

Files:
3956 created (2 per second)
Creation alone: 3000 files (4 per second)
Mixed with transactions: 956 files (1 per second)
990 read (1 per second)
1010 appended (1 per second)
3956 deleted (2 per second)
Deletion alone: 2912 files (9 per second)
Mixed with transactions: 1044 files (1 per second)

Data:
5.26 megabytes read (3.38 kilobytes per second)
21.93 megabytes written (14.10 kilobytes per second)
pm>



UDF new:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
19 seconds total
3 seconds of transactions (666 per second)

Files:
3956 created (208 per second)
Creation alone: 3000 files (230 per second)
Mixed with transactions: 956 files (318 per second)
990 read (330 per second)
1010 appended (336 per second)
3956 deleted (208 per second)
Deletion alone: 2912 files (970 per second)
Mixed with transactions: 1044 files (348 per second)

Data:
5.26 megabytes read (283.66 kilobytes per second)
21.93 megabytes written (1.15 megabytes per second)
 1.58 17-Jul-2008  reinoud Dont round up nanosecond count; if its nearing wrap one could get a count
of >1 second resulting in invalid time stamps on disc.
 1.57 11-Jul-2008  reinoud Fix spelling in comment
 1.56 10-Jul-2008  reinoud On node creation, follow tmpfs and UFS by generating the uid/gid pair. This
fixes the lack of file ownership preservation on file/directory creation.

See PR kern/39124
 1.55 07-Jul-2008  reinoud Support for allocation extents descriptor writing to allow for arbitrary
heavily fragmented files.

Also fixing some (rare) allocation bugs and function name streamlining.

Tested on harddisc, CD-RW and CD-R i.e. all three basic backend classes.
 1.54 25-Jun-2008  reinoud branches: 1.54.2;
Disable read/write mounting for metadatapartition since attempts to delete
files now corrupt the image due to the lack of allocation scheme support.
 1.53 25-Jun-2008  reinoud Allow metadata partitioned discs to be mounted read-write even though its
allocation scheme is not implemented yet. Creating new files or deleting
anything is thus not possible.
 1.52 25-Jun-2008  reinoud Fix allocation extensions descriptor reading and do free them on node
destruction!
 1.51 24-Jun-2008  reinoud Support the creation of extended attributes for file creation in the
kernel and check and update them when found.

Note that it won't *insert* an extended attribute yet if it hasn't found it
while updating the birthtime.
 1.50 18-Jun-2008  reinoud Cleanup file access,modification,attribute and birthtime setting of files
and make the modification time when set never older than the creation time.
 1.49 19-May-2008  christos branches: 1.49.2;
fix argument type.
 1.48 19-May-2008  reinoud Implement wide char support for UDF by properly implementing unicode-16 to
UTF-8 like cd9660 and ntfs already do.
 1.47 17-May-2008  reinoud Cleaner gcc initialisation detection failure notice.
 1.46 17-May-2008  reinoud Fix `uninitialised variable' warning issued by the sh3 compiler. gcc can't
detect that the `last_node' variable will be set before used since it can't
parse the semantics of `TAILQ_EMPTY()' that is used as a guard first.

Thanks for H?rvard for finding and reporting it :)
 1.45 14-May-2008  reinoud Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.44 02-Jan-2008  ad branches: 1.44.6; 1.44.8; 1.44.10; 1.44.12;
Merge vmlocking2 to head.
 1.43 11-Dec-2007  lukem use __KERNEL_RCSID() instead of __RCSID()
 1.42 27-Nov-2007  reinoud branches: 1.42.2; 1.42.4; 1.42.6;
Pullup fixes from UDF RW support project. This commit fixes the
mmc_discinfo conceptional bug and also vastly improves VAT searching.
 1.41 26-Nov-2007  pooka 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.40 31-Oct-2007  reinoud branches: 1.40.2;
Fix panic when the VAT couldn't be found. It would refer an stale
udf_node->vnode.
 1.39 10-Oct-2007  ad branches: 1.39.2;
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.38 08-Oct-2007  ad Merge brelse() changes from the vmlocking branch.
 1.37 24-Sep-2007  rumble Avoid stack allocation of large dirent structures in foo_readdir().
 1.36 29-Jul-2007  ad branches: 1.36.4; 1.36.6; 1.36.8; 1.36.10;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.35 23-Jul-2007  pooka Initialize size and/or writesize when creating a vnode.
 1.34 29-Apr-2007  msaitoh branches: 1.34.2;
fix typos
 1.33 12-Apr-2007  reinoud Some rogue implementations use random physical partion numbers just to
break other implementations so lookup the physical number instead of
indexing it. Choosing random numbers here is legal according to the specs,
but not a logical choice and most likely done as a wierd kind of copy
protection.

Rogue implementation found to use this
*Microsoft CDIMAGE UDF
 1.32 20-Feb-2007  ad branches: 1.32.4; 1.32.6;
Call genfs_node_destroy() where appropriate.
 1.31 17-Jan-2007  reinoud branches: 1.31.2;
Fix important directory lookup bug that could result in an endless loop. It
fixes the case where a directory lookup is done in a directory has never
been visted/listed; the search optimalisation that searches the directory
from where it left behind the last time would never reach the initial
offset of zero since it would always have at least processed one entry.
 1.30 17-Jan-2007  reinoud Use the generic clock_ymdhms_to_secs() instead of home-brewn version to
translate UDF timestamps to timespec.
 1.29 04-Jan-2007  reinoud Forgot one place for UDF_ICB_FILETYPE_RANDOMACCESS.
 1.28 04-Jan-2007  reinoud Add UDF_ICB_FILETYPE_REALTIME type as found on UDF 2.50 discs. Also revert
a multiplication order to enforce 64 bit math.
 1.27 04-Jan-2007  reinoud Fix compilation issue when specifying different flags or compiling with a
different compiler. Thanks to Jared for noting.
 1.26 04-Jan-2007  reinoud Implement read-only access to UDF 2.50 and UDF 2.60 discs that use metadata
partition mappings. This brings the NetBSD implementation to read all discs
upto date and will read all discs currently defined by OSTA.
 1.25 25-Dec-2006  wiz Spell "separate" correctly. From Zafer Aydogan.
 1.24 25-Dec-2006  wiz Spell "schedule" correctly. From Zafer Aydogan.
 1.23 16-Nov-2006  christos branches: 1.23.2;
__unused removal on arguments; approved by core.
 1.22 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.21 04-Oct-2006  reinoud Fix panic on unmounting VAT file systems. The VAT table was allocated and
freed on the wrong malloc type.
 1.20 03-Oct-2006  reinoud Fix memory leaks on mounting and dismounting UDF volumes.
 1.19 28-Sep-2006  reinoud Fix lookup bug that could result in not finding the last entry. The check
for the cycling was too early. Also fix potential endless loop when the
last entry was deleted.
 1.18 19-Sep-2006  reinoud Make VOP_LOOKUP's O(1) instead of O(n log(n)) giving a speedup of 7500% on
a 1400 file directory.
 1.17 19-Sep-2006  reinoud Fix serious file-corruption issue on sparable partitions.
 1.16 19-Sep-2006  reinoud Fix panic when the sparable table didn't read in correctly.
 1.15 05-Sep-2006  reinoud branches: 1.15.2; 1.15.4; 1.15.6;
Fix copying too much space from a small buffer. The chances of it actually
happening are small but corrupt media could trigger it.
 1.14 22-Aug-2006  reinoud Fix pool allocation/freeing problem for once and for all correctly. Since
it was initialised quite late due to its reliance on disc data the mount
process could have stopped before initialising and thus could panic again
only now for uninitialising an not initialised pool! *sigh*
 1.13 21-Aug-2006  reinoud Make a better guess on VAT locations so discs that are semi-standard
formatted can be recognised. This also fixes the bug that prevented UDF to
mount an empty CD-R/DVD*R disc.
 1.12 11-Aug-2006  reinoud Fix comment; it stated a mimimum of 128 translations duh! a maximum it is!
 1.11 09-Jul-2006  reinoud branches: 1.11.2;
Fixing a bad case of walking/writing out of allocated space.... the
allocated space was 2048 bytes, but when adding 1024 to the variable
`unix_name' to split the allocated space in half it effectively starts just
OUTSIDE the allocated space. This ought to fix memory corruption bugs when
using UDF.

This is a routine to revisit one day.
 1.10 20-Jun-2006  christos branches: 1.10.2;
Don't allocate too much stuff on the stack.
 1.9 12-Jun-2006  christos branches: 1.9.2;
stack polics: Don't allocate 4K on the stack.
remove ; from };
 1.8 15-May-2006  christos branches: 1.8.2;
kauth fallout
 1.7 14-May-2006  elad integrate kauth.
 1.6 25-Apr-2006  snj s/allready/already/
 1.5 01-Mar-2006  yamt branches: 1.5.2; 1.5.4; 1.5.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.4 04-Feb-2006  reinoud branches: 1.4.2;
VND and harddiscs have their own defect free space management.
 1.3 04-Feb-2006  reinoud Change a comment into a TODO and fix up case where we could return an
illegal allready-freed memory space.
 1.2 02-Feb-2006  reinoud branches: 1.2.2;
Fix $NetBSD$ tags. (sorry)
 1.1 02-Feb-2006  reinoud Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.2.2.2 01-Jun-2006  kardel Sync with head.
 1.2.2.1 22-Apr-2006  simonb Sync with head.
 1.4.2.3 01-Mar-2006  yamt adapt udf.
 1.4.2.2 18-Feb-2006  yamt sync with head.
 1.4.2.1 04-Feb-2006  yamt file udf_subr.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.5.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.4.2 11-May-2006  elad sync with head
 1.5.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.5.2.5 14-Sep-2006  yamt sync with head.
 1.5.2.4 03-Sep-2006  yamt sync with head.
 1.5.2.3 11-Aug-2006  yamt sync with head
 1.5.2.2 26-Jun-2006  yamt sync with head.
 1.5.2.1 24-May-2006  yamt sync with head.
 1.8.2.1 19-Jun-2006  chap Sync with head.
 1.9.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.10.2.9 21-Jan-2008  yamt sync with head
 1.10.2.8 07-Dec-2007  yamt sync with head
 1.10.2.7 15-Nov-2007  yamt sync with head.
 1.10.2.6 27-Oct-2007  yamt sync with head.
 1.10.2.5 03-Sep-2007  yamt sync with head.
 1.10.2.4 26-Feb-2007  yamt sync with head.
 1.10.2.3 30-Dec-2006  yamt sync with head.
 1.10.2.2 21-Jun-2006  yamt sync with head.
 1.10.2.1 20-Jun-2006  yamt file udf_subr.c was added on branch yamt-lazymbuf on 2006-06-21 15:09:36 +0000
 1.11.2.6 25-Sep-2006  riz Pull up following revision(s) (requested by reinoud in ticket #185):
sys/fs/udf/udf_subr.c: revision 1.18
sys/fs/udf/udf.h: revision 1.7
Make VOP_LOOKUP's O(1) instead of O(n log(n)) giving a speedup of 7500% on
a 1400 file directory.
 1.11.2.5 25-Sep-2006  riz Pull up following revision(s) (requested by reinoud in ticket #184):
sys/fs/udf/udf_subr.c: revision 1.17
Fix serious file-corruption issue on sparable partitions.
 1.11.2.4 25-Sep-2006  riz Pull up following revision(s) (requested by reinoud in ticket #181):
sys/fs/udf/udf_subr.c: revision 1.16
Fix panic when the sparable table didn't read in correctly.
 1.11.2.3 08-Sep-2006  rpaulo Pull up following revision(s) (requested by reinoud in ticket #125):
sys/fs/udf/udf_subr.c: revision 1.15
sys/fs/udf/udf_vfsops.c: revision 1.13
sys/fs/udf/ecma167-udf.h: revision 1.4
Add shortcut for struct long_ad 's Unique ID hint that covers the lower 32
bits of the targeted files 64 bits Unique ID for recovery purposes.
Fix locking scheme in udf_mount() to follow more the other filingsystems.
For yet unknown reasons passing the LOCKLEAF flag to namei() did return a
locked vnode as was meant but would panic when a raw device was passed.
Fix copying too much space from a small buffer. The chances of it actually
happening are small but corrupt media could trigger it.
 1.11.2.2 27-Aug-2006  riz Pull up following revision(s) (requested by reinoud in ticket #50):
sys/fs/udf/udf_subr.c: revision 1.14
sys/fs/udf/udf.h: revision 1.6
sys/fs/udf/udf_vfsops.c: revision 1.11
Fix pool allocation/freeing problem for once and for all correctly. Since
it was initialised quite late due to its reliance on disc data the mount
process could have stopped before initialising and thus could panic again
only now for uninitialising an not initialised pool! *sigh*
 1.11.2.1 24-Aug-2006  tron Pull up following revision(s) (requested by reinoud in ticket #46):
sys/fs/udf/udf_subr.c: revision 1.13
sys/fs/udf/udf.h: revision 1.5
Make a better guess on VAT locations so discs that are semi-standard
formatted can be recognised. This also fixes the bug that prevented UDF to
mount an empty CD-R/DVD*R disc.
 1.15.6.2 10-Dec-2006  yamt sync with head.
 1.15.6.1 22-Oct-2006  yamt sync with head
 1.15.4.2 09-Sep-2006  rpaulo sync with head
 1.15.4.1 05-Sep-2006  rpaulo file udf_subr.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.15.2.3 01-Feb-2007  ad Sync with head.
 1.15.2.2 12-Jan-2007  ad Sync with head.
 1.15.2.1 18-Nov-2006  ad Sync with head.
 1.23.2.6 01-Feb-2008  riz Pull up following revision(s) (requested by reinoud in ticket #1004):
sys/dev/scsipi/cd.c: revision 1.270
sys/sys/cdio.h: revision 1.29
sys/fs/udf/udf_subr.c: revision 1.42
Pullup fixes from UDF write development project. This patch fixes a
conceptional bug in mmc_discinfo, improves DVD+R feature detection and
prevents corruption of mmc_trackinfo readout on some devices that return
short trackinfo structures.
Pullup fixes from UDF RW support project. This commit fixes the
mmc_discinfo conceptional bug and also vastly improves VAT searching.
 1.23.2.5 04-Nov-2007  xtraeme Pull up following revision(s) (requested by reinoud in ticket #966):
sys/fs/udf/udf_subr.c: revision 1.40

Fix panic when the VAT couldn't be found. It would refer an stale
udf_node->vnode.
 1.23.2.4 12-Apr-2007  bouyer branches: 1.23.2.4.2;
Pull up following revision(s) (requested by reinoud in ticket #567):
sys/fs/udf/udf_subr.c: revision 1.33
Some rogue implementations use random physical partion numbers just to
break other implementations so lookup the physical number instead of
indexing it. Choosing random numbers here is legal according to the specs,
but not a logical choice and most likely done as a wierd kind of copy
protection.
Rogue implementation found to use this
*Microsoft CDIMAGE UDF
 1.23.2.3 21-Jan-2007  bouyer Pull up following revision(s) (requested by reinoud in ticket #376):
sys/fs/udf/udf_subr.c: revisions 1.30 - 1.31
sys/fs/udf/udf_subr.c: revision 1.31
Use the generic clock_ymdhms_to_secs() instead of home-brewn version to
translate UDF timestamps to timespec.
Fix important directory lookup bug that could result in an endless loop. It
fixes the case where a directory lookup is done in a directory has never
been visted/listed; the search optimalisation that searches the directory
from where it left behind the last time would never reach the initial
offset of zero since it would always have at least processed one entry.
 1.23.2.2 04-Jan-2007  bouyer Pull up following revision(s) (requested by reinoud in ticket #333):
sys/fs/udf/udf_subr.c: revision 1.27-1.29
sys/fs/udf/udf_vnops.c: revision 1.9
sys/fs/udf/ecma167-udf.h: revision 1.6
Fix compilation issue when specifying different flags or compiling with a
different compiler. Thanks to Jared for noting.
Add UDF_ICB_FILETYPE_REALTIME type as found on UDF 2.50 discs. Also revert
a multiplication order to enforce 64 bit math.
Forgot one place for UDF_ICB_FILETYPE_RANDOMACCESS.
 1.23.2.1 04-Jan-2007  bouyer Pull up following revision(s) (requested by reinoud in ticket #332):
sys/fs/udf/udf_subr.c: revision 1.26
sys/fs/udf/udf.h: revision 1.9
sys/fs/udf/udf_vfsops.c: revision 1.19
Implement read-only access to UDF 2.50 and UDF 2.60 discs that use metadata
partition mappings. This brings the NetBSD implementation to read all discs
upto date and will read all discs currently defined by OSTA.
 1.23.2.4.2.2 03-Jun-2008  skrll Sync with netbsd-4.
 1.23.2.4.2.1 06-Jan-2008  wrstuden Catch up to netbsd-4.0 release.
 1.31.2.3 07-May-2007  yamt sync with head.
 1.31.2.2 15-Apr-2007  yamt sync with head.
 1.31.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.32.6.1 11-Jul-2007  mjf Sync with head.
 1.32.4.8 09-Oct-2007  ad Sync with head.
 1.32.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.32.4.6 20-Aug-2007  ad Sync with HEAD.
 1.32.4.5 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.32.4.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.32.4.3 09-Jun-2007  ad Sync with head.
 1.32.4.2 08-Jun-2007  ad Sync with head.
 1.32.4.1 05-Apr-2007  ad Compile fixes.
 1.34.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.36.10.2 29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.36.10.1 29-Jul-2007  ad file udf_subr.c was added on branch matt-mips64 on 2007-07-29 13:31:12 +0000
 1.36.8.2 14-Oct-2007  yamt sync with head.
 1.36.8.1 06-Oct-2007  yamt sync with head.
 1.36.6.2 09-Jan-2008  matt sync with HEAD
 1.36.6.1 06-Nov-2007  matt sync with HEAD
 1.36.4.5 03-Dec-2007  joerg Sync with HEAD.
 1.36.4.4 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.36.4.3 31-Oct-2007  joerg Sync with HEAD.
 1.36.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.36.4.1 02-Oct-2007  joerg Sync with HEAD.
 1.39.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.40.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.40.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.40.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.42.6.2 02-Jan-2008  bouyer Sync with HEAD
 1.42.6.1 13-Dec-2007  bouyer Sync with HEAD
 1.42.4.1 11-Dec-2007  yamt sync with head.
 1.42.2.2 26-Dec-2007  ad Sync with head.
 1.42.2.1 04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.44.12.3 10-Oct-2008  skrll Sync with HEAD.
 1.44.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.44.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.44.10.8 09-Oct-2010  yamt sync with head
 1.44.10.7 11-Aug-2010  yamt sync with head.
 1.44.10.6 11-Mar-2010  yamt sync with head
 1.44.10.5 19-Aug-2009  yamt sync with head.
 1.44.10.4 18-Jul-2009  yamt sync with head.
 1.44.10.3 20-Jun-2009  yamt sync with head
 1.44.10.2 04-May-2009  yamt sync with head.
 1.44.10.1 16-May-2008  yamt sync with head.
 1.44.8.2 04-Jun-2008  yamt sync with head
 1.44.8.1 18-May-2008  yamt sync with head.
 1.44.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.44.6.4 05-Oct-2008  mjf Sync with HEAD.
 1.44.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.44.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.44.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.49.2.5 31-Jul-2008  simonb Sync with head.
 1.49.2.4 28-Jul-2008  simonb Sync with head.
 1.49.2.3 22-Jul-2008  simonb Sync with head.
 1.49.2.2 18-Jul-2008  simonb Sync with head.
 1.49.2.1 27-Jun-2008  simonb Sync with head.
 1.54.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.54.2.1 19-Oct-2008  haad Sync with HEAD.
 1.73.4.12 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.73.4.11 06-Jun-2009  bouyer Pull up following revision(s) (requested by reinoud in ticket #770):
sys/fs/udf/udf_subr.c: revision 1.88, 1.89
sys/fs/udf/udf_bswap.h: revision 1.6, 1.7
sys/fs/udf/udf_allocation.c: revision 1.22, 1.23
sbin/newfs_udf/udf_create.c: revision 1.16
Fix *serious* bug in bswapping definitions for big endian machines.
ANSI-fy. No idea why they weren't so in the first place.
Fix newfs_udf to create a valid disc images on bigendian machines.
A descriptor's CRC lenth is 16 bit so use udf_rw16() on tag.desc_crc_len.
Forgot to use the udf_rw16() on the descriptor crc lengths of FID's!
Also fix a few dubiously formatted checks.
On creation of a new node, don't forget to set the length of the allocated
space in the right endian!
Account for the logical blocks recorded by the extent in the right endian!
 1.73.4.10 01-Jun-2009  liamjfoy Pull up following revision(s) (requested by reinoud in ticket #772):
sys/fs/udf/udf_strat_rmw.c: revision 1.19
sys/fs/udf/udf_strat_sequential.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.10
sys/fs/udf/udf_subr.c: revision 1.90
sys/fs/udf/udf_subr.c: revision 1.91
Descriptor version is 16 bit and not 8 so use udf_rw16() to access them.
UniqueID was written in the logical volume integrity without byteswapping for
bigendian machines.

Retire IN_CALLBACK_ULK flagging since its not used anymore and the old
assertions on it would trigger without cause.
 1.73.4.9 19-Feb-2009  snj branches: 1.73.4.9.4;
Apply patch (requested by plunky in ticket #447):
Use bitmask_snprintf instead of snprintb.
 1.73.4.8 18-Feb-2009  snj Pull up following revision(s) (requested by reinoud in ticket #447):
sys/fs/udf/udf.h: revision 1.30
sys/fs/udf/udf_readwrite.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.8
sys/fs/udf/udf_strat_rmw.c: revision 1.18
sys/fs/udf/udf_strat_sequential.c: revision 1.8
sys/fs/udf/udf_subr.c: revision 1.85
sys/fs/udf/udf_subr.h: revision 1.13
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.73.4.7 22-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #194):
sys/fs/udf/udf_subr.c: revision 1.82
Implement auto-track repair on tracks marked damaged when searching for
writable tracks on session opening. Note that this an optionally implemented
feature and thus no error will be generated if it fails; the drive will most
likely autorepair it.
 1.73.4.6 22-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #194):
sys/fs/udf/udf_subr.c: revision 1.81
Fix critital panic when mounting a CD-R/DVD*R disc. The check for VV_ROOT was
not done correctly and could panic when requested to load a VAT descriptor
since the fileset was not yet fetched.
 1.73.4.5 18-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #192):
sys/fs/udf/udf_subr.c: revision 1.79
sys/fs/udf/udf_vfsops.c: revision 1.54
Check for a node being root on node creation so when the root node is disposed
of when working deep into the directory tree it can reliably be reget and
marked correctly as the FS root.
Fixed pwd(1) lock panic and possible endless loop in other tools.
 1.73.4.4 18-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #192):
sys/fs/udf/udf_subr.c: revision 1.77
sys/fs/udf/udf_vnops.c: revision 1.33
Elaborate SYNC debug messages and rename some debug messages to a more
proper category.
 1.73.4.3 06-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #167):
sys/fs/udf/udf_subr.c: revision 1.76
sys/fs/udf/udf_vnops.c: revision 1.32
Split uid/gid remapping code to be independent of eachother.
 1.73.4.2 06-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #167):
sys/fs/udf/udf_strat_direct.c: revision 1.6
sys/fs/udf/udf_subr.c: revision 1.75
Allow for the exclusive selection of `direct' for rdonly mounts; its disabled
for now since its a lot slower than `rmw' access.
For archs that have trouble with `rmw' for whatever reason can so use it as a
scapegoat to allways mount savely rdonly though slower.
 1.73.4.1 06-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #167):
sys/fs/udf/udf_subr.c: revision 1.74
Remove old comment and remove unused calculated variable
 1.73.4.9.4.1 21-Apr-2010  matt sync to netbsd-5
 1.73.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.73.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.73.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.85.2.2 23-Jul-2009  jym Sync with HEAD.
 1.85.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.101.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.101.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.101.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.104.2.5 31-May-2011  rmind sync with head
 1.104.2.4 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.104.2.3 05-Mar-2011  rmind sync with head
 1.104.2.2 03-Jul-2010  rmind sync with head
 1.104.2.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.110.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.110.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.114.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.117.2.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.117.2.2 23-May-2012  yamt sync with head.
 1.117.2.1 17-Apr-2012  yamt sync with head
 1.118.6.1 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.118.4.1 02-Jun-2012  mrg sync to latest -current.
 1.119.4.2 18-May-2014  rmind sync with head
 1.119.4.1 28-Aug-2013  rmind sync with head
 1.119.2.2 03-Dec-2017  jdolecek update from HEAD
 1.119.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.124.2.1 10-Aug-2014  tls Rebase.
 1.125.2.2 27-Jul-2018  martin Pull up following revision(s) (requested by reinoud in ticket #1622):

sys/fs/udf/udf_subr.c: revision 1.142

Enhance logical volume integrity descriptor handling and provide
bug-compatibility for Linux mkudffs 1.3 images.
 1.125.2.1 16-Feb-2015  martin Pull up following revision(s) (requested by maxv in ticket #520):
sys/ufs/chfs/ebh.c: revision 1.6
sys/dev/sdmmc/sdmmc_mem.c: revision 1.33
sys/dev/ic/aic7xxx.c: revision 1.132
sys/fs/nfs/common/krpc_subr.c: revision 1.2
sys/modules/lua/lua.c: revision 1.16
sys/fs/udf/udf_subr.c: revision 1.128
sys/ufs/chfs/chfs_scan.c: revision 1.6
sys/dev/ic/an.c: revision 1.62

Fix six memory leaks and two inconsistencies.
 1.127.2.7 28-Aug-2017  skrll Sync with HEAD
 1.127.2.6 29-May-2016  skrll Sync with HEAD
 1.127.2.5 19-Mar-2016  skrll Sync with HEAD
 1.127.2.4 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.127.2.3 22-Sep-2015  skrll Sync with HEAD
 1.127.2.2 06-Jun-2015  skrll Sync with HEAD
 1.127.2.1 06-Apr-2015  skrll Sync with HEAD
 1.138.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.138.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.139.12.5 18-Jan-2019  pgoyette Synch with HEAD
 1.139.12.4 20-Oct-2018  pgoyette Sync with head
 1.139.12.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.139.12.2 28-Jul-2018  pgoyette Sync with HEAD
 1.139.12.1 25-Jun-2018  pgoyette Sync with HEAD
 1.139.6.1 27-Jul-2018  martin Pull up following revision(s) (requested by reinoud in ticket #942):

sys/fs/udf/udf_subr.c: revision 1.142

Enhance logical volume integrity descriptor handling and provide
bug-compatibility for Linux mkudffs 1.3 images.
 1.141.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.141.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.141.2.1 10-Jun-2019  christos Sync with HEAD
 1.146.2.3 24-Apr-2022  martin Pull up following revision(s) (requested by reinoud in ticket #1438):

sys/compat/netbsd32/netbsd32.h: revision 1.140
sys/compat/netbsd32/netbsd32_fs.c: revision 1.95
sys/fs/udf/udf_subr.c: revision 1.169

Fix endian issue with UDF extended attribute handling

Implement support for mounting UDF in compat32
Fixes PR#56801
 1.146.2.2 13-Mar-2022  martin Pull up following revision(s), all via patch,
requested by reinoud in ticket #1432:

sys/fs/udf/udf_vfsops.c: revision 1.83
sys/fs/udf/udf_allocation.c: revision 1.45
sys/fs/udf/udf_subr.c: revision 1.160
sys/fs/udf/udf_subr.c: revision 1.161

While searching the VAT on recordable media, search the last sector too!
This fixes Win10 formatted discs from being mounted incorrectly.

Make sysctl udf.verbose dependent on UDF_DEBUG instead of DEBUG

Fix serious issue with recordable media formatted with Win10. When closing it
after modification the VAT was written out corrupted making the disc
unreadable anymore on remount. Thanks for ig@ for spotting it in the wild!

On freeing a virtual address in the VAT, use the correct value; this might
confuse other implementations who can reject the VAT on this.
 1.146.2.1 13-Mar-2022  martin Pull up following revision(s) (requested by reinoud in ticket #1431):

sys/fs/udf/udf_strat_sequential.c: revision 1.16
sys/fs/udf/udf_subr.c: revision 1.167

On switching from writing to reading explicitly synchronize the caches. It
isn't strictly needed but some devices in the wild will otherwise bluntly
ignore all reading commands resulting in a kernel and device lockup.

For bug-compatibility with Windows, the last VAT sector must be a multiple of
16/32 from the start of the track. To allow for scratches, write out at least
a 32 pieces.
 1.147.2.2 29-Feb-2020  ad Sync with head.
 1.147.2.1 17-Jan-2020  ad Sync with head.
 1.150.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.152.2.1 17-Apr-2021  thorpej Sync with HEAD.
 1.153.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.176.2.1 02-Aug-2025  perseant Sync with HEAD
 1.21 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.20 24-May-2016  reinoud branches: 1.20.18; 1.20.24;
Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
 1.19 07-Jul-2013  reinoud branches: 1.19.8;
Implement a real empty-directory checking for rmdir().

Should should fix the other part of PR kern/47987
Solves tests/vfs/t_vnops udf_dir_notempty
 1.18 25-Feb-2010  reinoud branches: 1.18.10; 1.18.20; 1.18.24;
First part of shrinking/growing metadata partition support:

- extending the metadata partition

Still to follow:
- sparsify metadata partition
- growing the metadata partition
- unsparsifying metadata partition
 1.17 07-Jul-2009  reinoud branches: 1.17.2;
Replace the old hashtable and sorted list implemenation by a RB-tree.

Benefits are significant speed improvements on node creation/insertion while
keeping the lookup times low and still allowing sequential iteration over the
nodes.
 1.16 25-Jun-2009  reinoud Rewrite of udf_on_rootpath(), and vop_rename() code that calls it, after the
UFS way. The tree walking is now done the same and the code hasn't locked up
on examples that made it lockup before.
 1.15 24-Jun-2009  reinoud Commit first stage of free-space accounting. It is estimating the underlimit
of free blocks on the device and when free blocks are getting tight it tries
to readjust/recalculate that value by syncing the FS.

Second stage will be resizing the data/metadata partitions.
 1.14 23-Jun-2009  reinoud Renaming in UDF was already possible but directories could only be renamed in
the same directory.

This patch finally allows a directory to be moved between parent directories.
 1.13 08-Feb-2009  reinoud branches: 1.13.2;
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.12 06-Aug-2008  reinoud branches: 1.12.2; 1.12.4;
Rewrite allocation scheme's determination and implementation replacing the
old somewhat naive selection scheme that didn't allow different allocation
settings for nodes, directory information (FIDs) and data.

Also fix some curious side-effects of atime updates on RMW devices.
 1.11 28-Jul-2008  reinoud Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
 1.10 26-Jul-2008  reinoud Forgot to rename those two references to write_space_bitmap too.
 1.9 17-Jul-2008  reinoud Implement directory hashing to speed up directory traversals. Speed
improvements of at least 4 times in untarring and roughly 100 to 500 times
on file creation in big directories. Lookup of files was O(n*n) and is now
O(1) even for file creation. Free spaces in the directory are kept in a
seperate list for fast file creation.

The postmark benchmark gives:

UDF old:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
1593 seconds total
681 seconds of transactions (2 per second)

Files:
3956 created (2 per second)
Creation alone: 3000 files (4 per second)
Mixed with transactions: 956 files (1 per second)
990 read (1 per second)
1010 appended (1 per second)
3956 deleted (2 per second)
Deletion alone: 2912 files (9 per second)
Mixed with transactions: 1044 files (1 per second)

Data:
5.26 megabytes read (3.38 kilobytes per second)
21.93 megabytes written (14.10 kilobytes per second)
pm>



UDF new:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
19 seconds total
3 seconds of transactions (666 per second)

Files:
3956 created (208 per second)
Creation alone: 3000 files (230 per second)
Mixed with transactions: 956 files (318 per second)
990 read (330 per second)
1010 appended (336 per second)
3956 deleted (208 per second)
Deletion alone: 2912 files (970 per second)
Mixed with transactions: 1044 files (348 per second)

Data:
5.26 megabytes read (283.66 kilobytes per second)
21.93 megabytes written (1.15 megabytes per second)
 1.8 07-Jul-2008  reinoud Support for allocation extents descriptor writing to allow for arbitrary
heavily fragmented files.

Also fixing some (rare) allocation bugs and function name streamlining.

Tested on harddisc, CD-RW and CD-R i.e. all three basic backend classes.
 1.7 18-Jun-2008  reinoud branches: 1.7.2;
Cleanup file access,modification,attribute and birthtime setting of files
and make the modification time when set never older than the creation time.
 1.6 19-May-2008  reinoud branches: 1.6.2;
Implement wide char support for UDF by properly implementing unicode-16 to
UTF-8 like cd9660 and ntfs already do.
 1.5 14-May-2008  reinoud Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.4 05-Mar-2006  christos branches: 1.4.10; 1.4.16; 1.4.66; 1.4.68; 1.4.70; 1.4.72;
remove trailing newlines
 1.3 02-Feb-2006  reinoud branches: 1.3.2; 1.3.4; 1.3.6;
Fix header re-inclusion protection defines to a less generic naming
scheme.
 1.2 02-Feb-2006  reinoud Fix $NetBSD$ tags. (sorry)
 1.1 02-Feb-2006  reinoud Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.3.6.1 13-Mar-2006  yamt sync with head.
 1.3.4.2 18-Feb-2006  yamt sync with head.
 1.3.4.1 02-Feb-2006  yamt file udf_subr.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.3.2.1 22-Apr-2006  simonb Sync with head.
 1.4.72.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.72.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4.70.4 11-Mar-2010  yamt sync with head
 1.4.70.3 18-Jul-2009  yamt sync with head.
 1.4.70.2 04-May-2009  yamt sync with head.
 1.4.70.1 16-May-2008  yamt sync with head.
 1.4.68.2 04-Jun-2008  yamt sync with head
 1.4.68.1 18-May-2008  yamt sync with head.
 1.4.66.3 28-Sep-2008  mjf Sync with HEAD.
 1.4.66.2 29-Jun-2008  mjf Sync with HEAD.
 1.4.66.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.16.2 09-Sep-2006  rpaulo sync with head
 1.4.16.1 05-Mar-2006  rpaulo file udf_subr.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.4.10.2 21-Jun-2006  yamt sync with head.
 1.4.10.1 05-Mar-2006  yamt file udf_subr.h was added on branch yamt-lazymbuf on 2006-06-21 15:09:37 +0000
 1.6.2.4 31-Jul-2008  simonb Sync with head.
 1.6.2.3 28-Jul-2008  simonb Sync with head.
 1.6.2.2 18-Jul-2008  simonb Sync with head.
 1.6.2.1 27-Jun-2008  simonb Sync with head.
 1.7.2.1 19-Oct-2008  haad Sync with HEAD.
 1.12.4.2 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.12.4.1 18-Feb-2009  snj branches: 1.12.4.1.4;
Pull up following revision(s) (requested by reinoud in ticket #447):
sys/fs/udf/udf.h: revision 1.30
sys/fs/udf/udf_readwrite.c: revision 1.10
sys/fs/udf/udf_strat_direct.c: revision 1.8
sys/fs/udf/udf_strat_rmw.c: revision 1.18
sys/fs/udf/udf_strat_sequential.c: revision 1.8
sys/fs/udf/udf_subr.c: revision 1.85
sys/fs/udf/udf_subr.h: revision 1.13
Implement session closure on sequential media when requested on mount. It will
allow CD-ROM/DVD-ROM/DB-ROM drives to read the media while still allowing them
to be appended later. It can also be seen as a way to make mountable
snapshots.
 1.12.4.1.4.1 21-Apr-2010  matt sync to netbsd-5
 1.12.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.13.2.1 23-Jul-2009  jym Sync with HEAD.
 1.17.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.18.24.1 28-Aug-2013  rmind sync with head
 1.18.20.2 03-Dec-2017  jdolecek update from HEAD
 1.18.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.10.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.19.8.1 29-May-2016  skrll Sync with HEAD
 1.20.24.1 17-Jan-2020  ad Sync with head.
 1.20.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.86 25-Aug-2025  reinoud Assert that udf_get_node()/udf_loadvnode() returns a valid root node when it doesn't return an error.
 1.85 03-May-2022  hannken Lock devvp for vinvalbuf().
 1.84 23-Mar-2022  andvar fix few typos for word "previous(ly)" in comments.
 1.83 16-Dec-2021  reinoud Make sysctl udf.verbose dependent on UDF_DEBUG instead of DEBUG
 1.82 16-Sep-2021  andvar fix typos in word "successful".
 1.81 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.80 14-Apr-2020  reinoud branches: 1.80.6;
Move comment related to the sysctl_createv() in SYSCTL_SETUP() from the old
place to the new place too.
 1.79 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.78 16-Mar-2020  pgoyette branches: 1.78.2;
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.77 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.76 24-Jun-2017  hannken branches: 1.76.6; 1.76.10; 1.76.12;
No need to call vflush from failing udf_mount(). If the system nodes
really have to disappear we should change vrele() to vrecycle() here.
 1.75 01-Apr-2017  riastradh branches: 1.75.4; 1.75.6;
KASSERT(mutex_owned(vp->v_interlock)) in vnode iterator selector.
 1.74 17-Feb-2017  hannken Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.
 1.73 07-Jul-2016  msaitoh branches: 1.73.2; 1.73.4;
KNF. Remove extra spaces. No functional change.
 1.72 29-Jan-2016  christos It is meaningless to check the root node if there was an error.
 1.71 24-Aug-2015  hannken Use vfs_vnode_iterator for udf_do_sync.

- Build rb_tree to get an ordered list of nodes, sync them and
clean the tree.

- Stop abusing mntvnode_lock to serialize udf_do_sync, use new
mutex ump->sync_lock instead.
 1.70 24-Aug-2015  hannken Use vfs_vnode_iterator for udf_unmount_sanity_check.
 1.69 24-Aug-2015  hannken Remove dirtynodes_cv, it is only used for timed waits without any signals.

Replace the cv_timedwait with kpause.
 1.68 06-Apr-2015  hannken Change udf to vcache, keyed on udf_node->loc.loc.
 1.67 16-Apr-2014  maxv branches: 1.67.4;
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.66 23-Mar-2014  hannken branches: 1.66.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.
 1.65 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.64 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.63 13-Mar-2012  elad branches: 1.63.2; 1.63.4;
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.62 14-Nov-2011  hannken branches: 1.62.4; 1.62.6; 1.62.10; 1.62.12;
VOP_OPEN() needs a locked vnode. All these copy-and-pasted xxxfs_mount()
implementations need more review.
 1.61 27-Sep-2011  christos branches: 1.61.2;
- rename UDF_MAX_NAMELEN -> UDF_MAXNAMLEN
- use NAME_MAX instead of MAXNAMLEN
 1.60 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.59 07-Jul-2009  reinoud branches: 1.59.2; 1.59.4;
Replace the old hashtable and sorted list implemenation by a RB-tree.

Benefits are significant speed improvements on node creation/insertion while
keeping the lookup times low and still allowing sequential iteration over the
nodes.
 1.58 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.57 24-Jun-2009  reinoud Commit first stage of free-space accounting. It is estimating the underlimit
of free blocks on the device and when free blocks are getting tight it tries
to readjust/recalculate that value by syncing the FS.

Second stage will be resizing the data/metadata partitions.
 1.56 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.55 08-Feb-2009  reinoud branches: 1.55.2;
If mounting for read-write dont allow a session number to be specified since
its currently still misbehaving. If supported later, it would allow one or a
series of sessions on a sequential recordable media to be ignored as if they
never were created.

Also fix a small comment: its not the direct but the bootstrap disc strategy
that we close down.
 1.54 16-Dec-2008  reinoud Check for a node being root on node creation so when the root node is disposed
of when working deep into the directory tree it can reliably be reget and
marked correctly as the FS root.

Fixed pwd(1) lock panic and possible endless loop in other tools.
 1.53 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.52 29-Oct-2008  reinoud branches: 1.52.2;
Fix to prevent a closed sequential media to be opened for read/write.
 1.51 27-Sep-2008  reinoud branches: 1.51.2;
Switch UDF over to the vfs_dirhash.c dirhash code.
 1.50 29-Aug-2008  reinoud Remove all remaining traces of UDF_READWRITE since it has been removed as
option.
 1.49 29-Aug-2008  reinoud forgot to destroy an additional mutex and an condition variable.
 1.48 08-Aug-2008  reinoud Remove the need for the kernel option UDF_READWRITE to be able to write to
discs since writing is mature enough.
 1.47 06-Aug-2008  reinoud Rewrite allocation scheme's determination and implementation replacing the
old somewhat naive selection scheme that didn't allow different allocation
settings for nodes, directory information (FIDs) and data.

Also fix some curious side-effects of atime updates on RMW devices.
 1.46 28-Jul-2008  reinoud Streamline allocation to prepare it for metadata partition. Also add
preliminary Metadata partition write support but its disabled still since
its not finished yet and not functioning correctly. All other formats are
checked and should work fine.
 1.45 27-Jul-2008  reinoud Unify naming scheme and source code beautify for better readablility.
 1.44 26-Jul-2008  reinoud Forgot to rename those two references to write_space_bitmap too.
 1.43 22-Jul-2008  reinoud Limit the UDF dirhash to a configurable amount of memory. The performance
penalty even with a limited dirhash of 128kb is acceptable but it should be
set by machine memory size though.
 1.42 19-Jul-2008  reinoud Limit sectorsize to max. 4096 bytes. This prevents a panic when declaring
the node pool since standard pools are limited upto 4096 aparently.
Pagesize limit even?
 1.41 18-Jul-2008  reinoud Instead of bombing out when trying to mount a disc RW when UDF_READWRITE is
not defined, downgrade it to a read-only mount.
 1.40 17-Jul-2008  reinoud Implement directory hashing to speed up directory traversals. Speed
improvements of at least 4 times in untarring and roughly 100 to 500 times
on file creation in big directories. Lookup of files was O(n*n) and is now
O(1) even for file creation. Free spaces in the directory are kept in a
seperate list for fast file creation.

The postmark benchmark gives:

UDF old:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
1593 seconds total
681 seconds of transactions (2 per second)

Files:
3956 created (2 per second)
Creation alone: 3000 files (4 per second)
Mixed with transactions: 956 files (1 per second)
990 read (1 per second)
1010 appended (1 per second)
3956 deleted (2 per second)
Deletion alone: 2912 files (9 per second)
Mixed with transactions: 1044 files (1 per second)

Data:
5.26 megabytes read (3.38 kilobytes per second)
21.93 megabytes written (14.10 kilobytes per second)
pm>



UDF new:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
19 seconds total
3 seconds of transactions (666 per second)

Files:
3956 created (208 per second)
Creation alone: 3000 files (230 per second)
Mixed with transactions: 956 files (318 per second)
990 read (330 per second)
1010 appended (336 per second)
3956 deleted (208 per second)
Deletion alone: 2912 files (970 per second)
Mixed with transactions: 1044 files (348 per second)

Data:
5.26 megabytes read (283.66 kilobytes per second)
21.93 megabytes written (1.15 megabytes per second)
 1.39 28-Jun-2008  rumble branches: 1.39.2;
Create sysctl entries during module initialisation and destroy them
appropriately.

Many of these file systems are now ready for modularisation.
 1.38 14-May-2008  reinoud branches: 1.38.2;
Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.37 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.36 29-Apr-2008  ad branches: 1.36.2;
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.35 28-Jan-2008  dholland branches: 1.35.6; 1.35.8; 1.35.10;
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.34 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.33 11-Dec-2007  lukem use __KERNEL_RCSID() instead of __RCSID()
 1.32 08-Dec-2007  pooka branches: 1.32.2; 1.32.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.31 26-Nov-2007  pooka branches: 1.31.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.30 10-Oct-2007  ad branches: 1.30.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.29 31-Jul-2007  pooka branches: 1.29.2; 1.29.4; 1.29.6; 1.29.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.28 26-Jul-2007  pooka Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter.
 1.27 17-Jul-2007  pooka branches: 1.27.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.26 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.25 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.24 29-Apr-2007  msaitoh fix typos
 1.23 12-Mar-2007  ad branches: 1.23.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.22 29-Jan-2007  hubertf branches: 1.22.2; 1.22.6;
Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
 1.21 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.20 04-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.19 04-Jan-2007  reinoud Implement read-only access to UDF 2.50 and UDF 2.60 discs that use metadata
partition mappings. This brings the NetBSD implementation to read all discs
upto date and will read all discs currently defined by OSTA.
 1.18 16-Nov-2006  christos branches: 1.18.2;
__unused removal on arguments; approved by core.
 1.17 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.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 03-Oct-2006  reinoud Fix memory leaks on mounting and dismounting UDF volumes.
 1.14 29-Sep-2006  reinoud Add `vfs.udf.verbose' sysctl when running a DEBUG kernel to dynamically set
the udf_verbose variable. So when something goes wrong, it can be examined
on the spot without needing to reboot a new kernel and possibly loosing
state.
 1.13 05-Sep-2006  reinoud branches: 1.13.2; 1.13.4; 1.13.6;
Fix locking scheme in udf_mount() to follow more the other filingsystems.

For yet unknown reasons passing the LOCKLEAF flag to namei() did return a
locked vnode as was meant but would panic when a raw device was passed.
 1.12 03-Sep-2006  christos add missing initializers
 1.11 22-Aug-2006  reinoud Fix pool allocation/freeing problem for once and for all correctly. Since
it was initialised quite late due to its reliance on disc data the mount
process could have stopped before initialising and thus could panic again
only now for uninitialising an not initialised pool! *sigh*
 1.10 21-Aug-2006  reinoud Fix spurious panic when twice remounting a bad filingsystem. It then gets
the same memory block allocated as before and it bombs out on its
descriptor pool allready being initialised. It turns out that the pool was
not allways destroyed. This fix ought to clean it up whatever the cause of
the mishap that results in a reject.
 1.9 10-Aug-2006  reinoud Fix panic on badly or curruptly formatted discs due to an oddity in the
error handling chain.

If NetBSD 4.0 is allready branched at this time this ought to be pulled up.
 1.8 23-Jul-2006  ad branches: 1.8.2;
Use the LWP cached credentials where sane.
 1.7 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.6 12-Jun-2006  christos branches: 1.6.2; 1.6.4;
remove ; from };
 1.5 15-May-2006  christos branches: 1.5.2;
kauth fallout
 1.4 14-May-2006  elad integrate kauth.
 1.3 25-Apr-2006  snj s/allready/already/
 1.2 02-Feb-2006  reinoud branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.10;
Fix $NetBSD$ tags. (sorry)
 1.1 02-Feb-2006  reinoud Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.2.10.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.8.2 11-May-2006  elad sync with head
 1.2.8.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.2.6.5 14-Sep-2006  yamt sync with head.
 1.2.6.4 03-Sep-2006  yamt sync with head.
 1.2.6.3 11-Aug-2006  yamt sync with head
 1.2.6.2 26-Jun-2006  yamt sync with head.
 1.2.6.1 24-May-2006  yamt sync with head.
 1.2.4.2 18-Feb-2006  yamt sync with head.
 1.2.4.1 02-Feb-2006  yamt file udf_vfsops.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.2.2.1 01-Jun-2006  kardel Sync with head.
 1.5.2.1 19-Jun-2006  chap Sync with head.
 1.6.4.9 04-Feb-2008  yamt sync with head.
 1.6.4.8 21-Jan-2008  yamt sync with head
 1.6.4.7 07-Dec-2007  yamt sync with head
 1.6.4.6 27-Oct-2007  yamt sync with head.
 1.6.4.5 03-Sep-2007  yamt sync with head.
 1.6.4.4 26-Feb-2007  yamt sync with head.
 1.6.4.3 30-Dec-2006  yamt sync with head.
 1.6.4.2 21-Jun-2006  yamt sync with head.
 1.6.4.1 12-Jun-2006  yamt file udf_vfsops.c was added on branch yamt-lazymbuf on 2006-06-21 15:09:37 +0000
 1.6.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.8.2.4 08-Sep-2006  rpaulo Pull up following revision(s) (requested by reinoud in ticket #125):
sys/fs/udf/udf_subr.c: revision 1.15
sys/fs/udf/udf_vfsops.c: revision 1.13
sys/fs/udf/ecma167-udf.h: revision 1.4
Add shortcut for struct long_ad 's Unique ID hint that covers the lower 32
bits of the targeted files 64 bits Unique ID for recovery purposes.
Fix locking scheme in udf_mount() to follow more the other filingsystems.
For yet unknown reasons passing the LOCKLEAF flag to namei() did return a
locked vnode as was meant but would panic when a raw device was passed.
Fix copying too much space from a small buffer. The chances of it actually
happening are small but corrupt media could trigger it.
 1.8.2.3 27-Aug-2006  riz Pull up following revision(s) (requested by reinoud in ticket #50):
sys/fs/udf/udf_subr.c: revision 1.14
sys/fs/udf/udf.h: revision 1.6
sys/fs/udf/udf_vfsops.c: revision 1.11
Fix pool allocation/freeing problem for once and for all correctly. Since
it was initialised quite late due to its reliance on disc data the mount
process could have stopped before initialising and thus could panic again
only now for uninitialising an not initialised pool! *sigh*
 1.8.2.2 23-Aug-2006  tron Pull up following revision(s) (requested by reinoud in ticket #45):
sys/fs/udf/udf_vfsops.c: revision 1.10
Fix spurious panic when twice remounting a bad filingsystem. It then gets
the same memory block allocated as before and it bombs out on its
descriptor pool allready being initialised. It turns out that the pool was
not allways destroyed. This fix ought to clean it up whatever the cause of
the mishap that results in a reject.
 1.8.2.1 12-Aug-2006  riz Pull up following revision(s) (requested by reinoud in ticket #12):
sys/fs/udf/udf_vfsops.c: revision 1.9
sys/dev/scsipi/cd.c: revision 1.243
Fix panic on badly or curruptly formatted discs due to an oddity in the
error handling chain.
If NetBSD 4.0 is allready branched at this time this ought to be pulled up.
Fix incorrect `last possible lba' reporting, remove some empty lines and
add mmc classification for some still rare HD DVD device types.
 1.13.6.2 10-Dec-2006  yamt sync with head.
 1.13.6.1 22-Oct-2006  yamt sync with head
 1.13.4.2 09-Sep-2006  rpaulo sync with head
 1.13.4.1 05-Sep-2006  rpaulo file udf_vfsops.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.13.2.3 01-Feb-2007  ad Sync with head.
 1.13.2.2 12-Jan-2007  ad Sync with head.
 1.13.2.1 18-Nov-2006  ad Sync with head.
 1.18.2.1 04-Jan-2007  bouyer Pull up following revision(s) (requested by reinoud in ticket #332):
sys/fs/udf/udf_subr.c: revision 1.26
sys/fs/udf/udf.h: revision 1.9
sys/fs/udf/udf_vfsops.c: revision 1.19
Implement read-only access to UDF 2.50 and UDF 2.60 discs that use metadata
partition mappings. This brings the NetBSD implementation to read all discs
upto date and will read all discs currently defined by OSTA.
 1.22.6.7 20-Aug-2007  ad Sync with HEAD.
 1.22.6.6 15-Jul-2007  ad Sync with head.
 1.22.6.5 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.22.6.4 09-Jun-2007  ad Sync with head.
 1.22.6.3 08-Jun-2007  ad Sync with head.
 1.22.6.2 05-Apr-2007  ad Compile fixes.
 1.22.6.1 13-Mar-2007  ad Sync with head.
 1.22.2.2 07-May-2007  yamt sync with head.
 1.22.2.1 24-Mar-2007  yamt sync with head.
 1.23.2.1 11-Jul-2007  mjf Sync with head.
 1.27.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.29.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.29.8.1 31-Jul-2007  pooka file udf_vfsops.c was added on branch matt-mips64 on 2007-07-31 21:14:20 +0000
 1.29.6.1 14-Oct-2007  yamt sync with head.
 1.29.4.3 23-Mar-2008  matt sync with HEAD
 1.29.4.2 09-Jan-2008  matt sync with HEAD
 1.29.4.1 06-Nov-2007  matt sync with HEAD
 1.29.2.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.29.2.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.29.2.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.30.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.30.4.2 27-Dec-2007  mjf Sync with HEAD.
 1.30.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.31.2.1 26-Dec-2007  ad Sync with head.
 1.32.4.1 13-Dec-2007  bouyer Sync with HEAD
 1.32.2.1 11-Dec-2007  yamt sync with head.
 1.35.10.4 11-Aug-2010  yamt sync with head.
 1.35.10.3 18-Jul-2009  yamt sync with head.
 1.35.10.2 04-May-2009  yamt sync with head.
 1.35.10.1 16-May-2008  yamt sync with head.
 1.35.8.1 18-May-2008  yamt sync with head.
 1.35.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.35.6.4 05-Oct-2008  mjf Sync with HEAD.
 1.35.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.35.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.35.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.2.3 10-Oct-2008  skrll Sync with HEAD.
 1.36.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.36.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.38.2.5 31-Jul-2008  simonb Sync with head.
 1.38.2.4 28-Jul-2008  simonb Sync with head.
 1.38.2.3 22-Jul-2008  simonb Sync with head.
 1.38.2.2 18-Jul-2008  simonb Sync with head.
 1.38.2.1 03-Jul-2008  simonb Sync with head.
 1.39.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.39.2.1 19-Oct-2008  haad Sync with HEAD.
 1.51.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.51.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.51.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.52.2.4 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.52.2.3 09-Jul-2009  snj branches: 1.52.2.3.2; 1.52.2.3.6;
Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.52.2.2 18-Feb-2009  snj branches: 1.52.2.2.4;
Pull up following revision(s) (requested by reinoud in ticket #446):
sys/fs/udf/udf_vfsops.c: revision 1.55
If mounting for read-write dont allow a session number to be specified since
its currently still misbehaving. If supported later, it would allow one or a
series of sessions on a sequential recordable media to be ignored as if they
never were created.
Also fix a small comment: its not the direct but the bootstrap disc strategy
that we close down.
 1.52.2.1 18-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #192):
sys/fs/udf/udf_subr.c: revision 1.79
sys/fs/udf/udf_vfsops.c: revision 1.54
Check for a node being root on node creation so when the root node is disposed
of when working deep into the directory tree it can reliably be reget and
marked correctly as the FS root.
Fixed pwd(1) lock panic and possible endless loop in other tools.
 1.52.2.3.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.52.2.3.2.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.52.2.2.4.1 21-Apr-2010  matt sync to netbsd-5
 1.55.2.2 23-Jul-2009  jym Sync with HEAD.
 1.55.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.59.4.1 03-Jul-2010  rmind sync with head
 1.59.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.61.2.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.61.2.1 17-Apr-2012  yamt sync with head
 1.62.12.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.62.10.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.62.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.62.4.1 05-Apr-2012  mrg sync to latest -current.
 1.63.4.1 18-May-2014  rmind sync with head
 1.63.2.2 03-Dec-2017  jdolecek update from HEAD
 1.63.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.66.2.1 10-Aug-2014  tls Rebase.
 1.67.4.4 28-Aug-2017  skrll Sync with HEAD
 1.67.4.3 19-Mar-2016  skrll Sync with HEAD
 1.67.4.2 22-Sep-2015  skrll Sync with HEAD
 1.67.4.1 06-Apr-2015  skrll Sync with HEAD
 1.73.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.73.2.3 26-Apr-2017  pgoyette Sync with HEAD
 1.73.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.73.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.75.6.1 01-Jul-2017  snj Pull up following revision(s) (requested by hannken in ticket #75):
sys/fs/udf/udf_vfsops.c: revision 1.76
No need to call vflush from failing udf_mount(). If the system nodes
really have to disappear we should change vrele() to vrecycle() here.
 1.75.4.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.76.12.1 17-Jan-2020  ad Sync with head.
 1.76.10.1 13-Mar-2022  martin Pull up following revision(s), all via patch,
requested by reinoud in ticket #1432:

sys/fs/udf/udf_vfsops.c: revision 1.83
sys/fs/udf/udf_allocation.c: revision 1.45
sys/fs/udf/udf_subr.c: revision 1.160
sys/fs/udf/udf_subr.c: revision 1.161

While searching the VAT on recordable media, search the last sector too!
This fixes Win10 formatted discs from being mounted incorrectly.

Make sysctl udf.verbose dependent on UDF_DEBUG instead of DEBUG

Fix serious issue with recordable media formatted with Win10. When closing it
after modification the VAT was written out corrupted making the disc
unreadable anymore on remount. Thanks for ig@ for spotting it in the wild!

On freeing a virtual address in the VAT, use the correct value; this might
confuse other implementations who can reject the VAT on this.
 1.76.6.2 21-Apr-2020  martin Sync with HEAD
 1.76.6.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.78.2.1 20-Apr-2020  bouyer Sync with HEAD
 1.80.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.127 27-Jun-2023  reinoud Convert UDF file system code from the depricated tsleep(9)/wakeup(9) to the MP
friendly condvar(9). No functional change intended.
 1.126 28-May-2022  andvar fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.
 1.125 03-May-2022  andvar fix various typos, mainly s/trasfering/transferring/ and s/theese/these/.
 1.124 03-May-2022  hannken No IO_NODELOCKED for unlocked vnode.
 1.123 10-Apr-2022  andvar fix various typos in comments and output/log messages.
 1.122 01-Apr-2022  reinoud Fix malformed DPRINTF() macro
 1.121 30-Mar-2022  christos Fix locking in udf_link(). XXX: udf_symlink is prolly similarly broken.
 1.120 27-Mar-2022  christos add a kauth vnode check for creating links
 1.119 16-Feb-2022  andvar fix various typos, mainly in comments.
 1.118 06-Feb-2022  andvar fix various typos in comments, log messages and documentation.
mainly s/aparently/apparently/ and s/implmented/implemented/.
 1.117 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.116 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.115 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.114 27-Jun-2020  christos branches: 1.114.6;
Introduce genfs_pathconf() and use it for the default case in all filesystems.
 1.113 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.112 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.111 14-Apr-2020  reinoud fix debug print flag
 1.110 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.109 23-Feb-2020  ad branches: 1.109.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.108 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.107 27-Dec-2019  msaitoh branches: 1.107.2;
s/transfered/transferred/
 1.106 26-May-2017  riastradh branches: 1.106.10;
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.105 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.104 26-Apr-2017  riastradh 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.103 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.102 20-Aug-2016  hannken branches: 1.102.2;
Remove now obsolete operation vcache_remove().

Welcome to 7.99.36
 1.101 20-Apr-2015  riastradh branches: 1.101.2;
Make VOP_LINK return directory still locked and referenced.

Ride 7.99.10 bump.
 1.100 06-Apr-2015  hannken Change udf to vcache, keyed on udf_node->loc.loc.
 1.99 06-Apr-2015  hannken Move the removal of unlinked nodes from udf_inactive() to udf_reclaim().
 1.98 04-Apr-2015  riastradh Fix remaining read(fd, NULL, 1) cases.
 1.97 28-Jan-2015  martin When udf_symlink() fails, do not explicitly call udf_delete_node(), as
vrele() called next will do that again - avoids a double free of the
bitmap, leading to a KASSERT failure (or worse in real life) in the
udf_symlink_long in the fs/vfs::t_vnops test.
 1.96 04-Jan-2015  reinoud Add missing vrele() as found by the testsuite.

Thanks Jurgen Hannken for the patch.
 1.95 03-Dec-2014  reinoud Explicitly delete the failing node; it would be killed with the unlink too but
explicitly deleting it is better than just setting the file size to zero.
 1.94 29-Jul-2014  reinoud branches: 1.94.4;
Posix requires the va_size of a symlink to be pathlength for symbolic links.
This fixes yet another atf case.
 1.93 29-Jul-2014  reinoud Access time should only be set on accessing the data or messing with the
contents, not on inode access rights and ownership changes. Should address
PR kern/49033 for UDF.

Test results now come clean for bugs related to this issue in the ATF.
 1.92 25-Jul-2014  dholland 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.91 23-Mar-2014  christos branches: 1.91.2;
fix unused
 1.90 07-Feb-2014  hannken 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.89 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.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 18-Oct-2013  christos fix unused variable warnings
 1.86 04-Oct-2013  hannken Remove a bogus vrecycle() from udf_inactive(). Vrecycle() works on inactive
vnodes while VOP_INACTIVE() should never be called on an inactive vnode.

Ok: Reinoud Zandijk <reinoud@netbsd.org>
 1.85 10-Jul-2013  reinoud Implement udf_rename() using the new genfs_rename() framework.

Fixes PR kern/47986
 1.84 08-Jul-2013  reinoud Clarify the sticky-bit check
 1.83 07-Jul-2013  reinoud Pull forward the node creation returned from the lookup call. Its vnode is
used in the access determination on delete/rename of TXT files.

Thanks for joerg@ and clang for detecting this!
 1.82 07-Jul-2013  reinoud Implement a real empty-directory checking for rmdir().

Should should fix the other part of PR kern/47987
Solves tests/vfs/t_vnops udf_dir_notempty
 1.81 05-Jul-2013  reinoud Fixes chflags. They were silently rejected before but the VFS standard demands
it complains with EOPNOTSUPP.

Fixes chflags test case.
 1.80 05-Jul-2013  reinoud Provide additional checks to udf_lookup and restructure it a bit.

Should fix PR 47988
 1.79 03-Jul-2013  reinoud Remove spurious empty line
 1.78 03-Jul-2013  reinoud On removing a directory make sure the leaf directory doesn't have a valid '..'
link anymore. In a corner case this leaf can be held by a process as a CWD. It
is guaranteed to be empty at this stage so we trunc it removing the only valid
FID, being the '..' entry.

Solves part of PR kern/47987
Solves tests/vfs/t_vnops udf_dir_rmdirdotdot
 1.77 03-Jul-2013  reinoud Typo in debug message: we are removing a directory and not a file.
 1.76 27-Jun-2013  reinoud branches: 1.76.2;
Since UDF volumes are always mounted async, the simple UBC purging with
VOP_PUTPAGES() was never triggered resulting in far too much data in the UBC
that needed to be written out. This could result in instability on small
memory machines.
 1.75 18-Mar-2013  plunky 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.74 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.73 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.72 22-Jul-2012  rmind branches: 1.72.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.71 29-Apr-2012  chs 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.70 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.69 18-Nov-2011  christos branches: 1.69.4; 1.69.6;
Obey MNT_RELATIME, the only addition is that mkdir in ufs sets IN_ACCESS too.
 1.68 18-Oct-2011  hannken branches: 1.68.2;
VOP_GETATTR() needs a shared lock at least.

While here fix a typo (fvp -> tvp).
 1.67 27-Sep-2011  christos return UDF_MAXNAMLEN instead of NAME_MAX
 1.66 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.65 19-May-2011  rmind branches: 1.65.2;
Remove cache_purge(9) calls from reclamation routines in the file systems,
as vclean(9) performs it for us since Lite2 merge.
 1.64 26-Apr-2011  hannken Change vflushbuf() to return an error if a synchronous write fails.

Welcome to 5.99.51.
 1.63 24-Apr-2011  rmind sys_link: prevent hard links on directories (cross-mount operations are
already prevented). File systems are no longer responsible to check this.
Clean up and add asserts (note that dvp == vp cannot happen in vop_link).

OK dholland@
 1.62 02-Jan-2011  dholland branches: 1.62.2;
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.61 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.60 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.59 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.58 24-Jun-2010  hannken Clean up vnode lock operations:

- VOP_LOCK(vp, flags): Limit the set of allowed flags to LK_EXCLUSIVE,
LK_SHARED and LK_NOWAIT. LK_INTERLOCK is no longer allowed as it
makes no sense here.

- VOP_ISLOCKED(vp): Remove the for some time unused return value
LK_EXCLOTHER. Mark this operation as "diagnostic only".
Making a lock decision based on this operation is no longer allowed.

Discussed on tech-kern.
 1.57 08-Jan-2010  pooka branches: 1.57.2; 1.57.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.56 05-Jan-2010  mbalmer Remove extra semicolons.
 1.55 14-Sep-2009  reinoud Rework simplistic UBC flushing. Recent changes to genfs made the old flush
system generate heaps of odd allocations since the end of write request was
overwritten by the start of the second resulting in another relocation.

Also added a full flush of the file on a VOP_CLOSE(). This automatically
flushes file tails to disc.
 1.54 30-Jul-2009  reinoud Fix uid/gid check; it was checking if the old values would fit in 32 bits
instead of checking if the new values would.
 1.53 27-Jul-2009  reinoud System nodes are not written out on becomming inactive; they should be written
out before automatically.

However, when dealing with faulty discs that fail to mount, system nodes are
of course not written out and thus may still be marked dirty, if only due to
access. Especially on sequential media this gave rise to panics on reading
trackinfo since the write track section had not yet been initialised.
 1.52 08-Jul-2009  reinoud Since OSTA has not defined a good set of flags to cover our flags, its not
usefull to implement chflags(). Instead ignore it for now since the error
codes might confuse esp. gui's.
 1.51 07-Jul-2009  reinoud Replace the old hashtable and sorted list implemenation by a RB-tree.

Benefits are significant speed improvements on node creation/insertion while
keeping the lookup times low and still allowing sequential iteration over the
nodes.
 1.50 06-Jul-2009  reinoud Make source prettier
 1.49 03-Jul-2009  pgoyette Pass the vp arg to udf_check_possible() so we can access its v_mount
member.

XXX No idea if this is the right solution to this problem, but it does
XXX at least allow thebuild to continue. The original committed should
XXX verify that this does what was intended!

(Hello again, Elad)
 1.48 03-Jul-2009  elad 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.47 25-Jun-2009  reinoud Rewrite of udf_on_rootpath(), and vop_rename() code that calls it, after the
UFS way. The tree walking is now done the same and the code hasn't locked up
on examples that made it lockup before.
 1.46 24-Jun-2009  reinoud Commit first stage of free-space accounting. It is estimating the underlimit
of free blocks on the device and when free blocks are getting tight it tries
to readjust/recalculate that value by syncing the FS.

Second stage will be resizing the data/metadata partitions.
 1.45 23-Jun-2009  reinoud Renaming in UDF was already possible but directories could only be renamed in
the same directory.

This patch finally allows a directory to be moved between parent directories.
 1.44 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.43 18-Jun-2009  reinoud Add overlooked `cred' declaration in udf_write() when i committed the catchup
patches.
 1.42 18-Jun-2009  reinoud Pass-on credentials to size reversal on aborted write due to error. It could
be that in the future this credentials need to be changed to allways-allow
since its an reverting-on-error behaviour.
 1.41 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.40 22-Apr-2009  elad Per discussion on tech-kern@:

- Replace use of label/goto with returns

- Rename, change prototype of, and move functions from vfs_subr.c to
genfs_vnops.c
 1.39 20-Apr-2009  elad Refactor some duplicated file-system code.

Proposed and received no objections on tech-kern@:

http://mail-index.netbsd.org/tech-kern/2009/04/18/msg004843.html
 1.38 20-Mar-2009  reinoud Fix panic due to memory leak on symlink creation. A test copy with 3000+
symlinks could get the machine down.
 1.37 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.36 11-Feb-2009  reinoud Improve write throttling by doing it on page-size basis. The `standard'
solution would cut up files unnessisary during allocation. It also made
assumptions about ucb wich were propably right but still.
 1.35 10-Feb-2009  reinoud Add simplistic UBC async flushing as other FS's seem to do. Its a clutch and
needs to be addressed in UBC properly.
 1.34 16-Dec-2008  reinoud branches: 1.34.2;
Fix endless loop occuring on empty directories listing on 512 bytes/sector
media like harddiscs. Also provide provide a `safety net' on readdir so it
will signal EOF when its requested an entry outside the directory.
 1.33 16-Dec-2008  reinoud Elaborate SYNC debug messages and rename some debug messages to a more
proper category.
 1.32 01-Dec-2008  reinoud Split uid/gid remapping code to be independent of eachother.
 1.31 26-Nov-2008  pooka Rototill all remaining file systems to use ubc_uiomove() instead
of the ubc_alloc() - uiomove() - ubc_release() dance.
 1.30 17-Jul-2008  reinoud branches: 1.30.2; 1.30.4;
Implement directory hashing to speed up directory traversals. Speed
improvements of at least 4 times in untarring and roughly 100 to 500 times
on file creation in big directories. Lookup of files was O(n*n) and is now
O(1) even for file creation. Free spaces in the directory are kept in a
seperate list for fast file creation.

The postmark benchmark gives:

UDF old:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
1593 seconds total
681 seconds of transactions (2 per second)

Files:
3956 created (2 per second)
Creation alone: 3000 files (4 per second)
Mixed with transactions: 956 files (1 per second)
990 read (1 per second)
1010 appended (1 per second)
3956 deleted (2 per second)
Deletion alone: 2912 files (9 per second)
Mixed with transactions: 1044 files (1 per second)

Data:
5.26 megabytes read (3.38 kilobytes per second)
21.93 megabytes written (14.10 kilobytes per second)
pm>



UDF new:
pm>set transactions 2000
pm>set number 3000
pm>run
Creating files...Done
Performing transactions..........Done
Deleting files...Done
Time:
19 seconds total
3 seconds of transactions (666 per second)

Files:
3956 created (208 per second)
Creation alone: 3000 files (230 per second)
Mixed with transactions: 956 files (318 per second)
990 read (330 per second)
1010 appended (336 per second)
3956 deleted (208 per second)
Deletion alone: 2912 files (970 per second)
Mixed with transactions: 1044 files (348 per second)

Data:
5.26 megabytes read (283.66 kilobytes per second)
21.93 megabytes written (1.15 megabytes per second)
 1.29 17-Jul-2008  reinoud Since the rename logic now locks its source directory too, we ought to
unlock the source directory again on exit. The stub that doesn't allow
cross directory renames for now jumped to the wrong exit point and thus
left a locked directory node that paniced on next locking.
 1.28 15-Jul-2008  reinoud Keep the directory to read '..' from locked until its dirent is read and
its location is extracted.

Also lock the source directory so its contents can safely be changed...
patch from tmpfs.
 1.27 10-Jul-2008  reinoud Fix chtimes permission checking. This sanitised version is hopefully DTRT.
 1.26 10-Jul-2008  reinoud Allow the renaming of directories *within* their current directory. No
cross-directory renaming is allowed yet.
 1.25 10-Jul-2008  reinoud Clarifying comments
 1.24 07-Jul-2008  reinoud Support for allocation extents descriptor writing to allow for arbitrary
heavily fragmented files.

Also fixing some (rare) allocation bugs and function name streamlining.

Tested on harddisc, CD-RW and CD-R i.e. all three basic backend classes.
 1.23 24-Jun-2008  reinoud branches: 1.23.2;
Make readsymlink bug-tolerant to MacOS X symlink construction bug. It puts
the name ".." on a parent path component. To prevent other similar errors,
name length checking is not done but the passed name that shouldn't be
passed is ignored.
 1.22 24-Jun-2008  reinoud We are not allowed zero length names in softlinks.
 1.21 24-Jun-2008  reinoud Support the creation of extended attributes for file creation in the
kernel and check and update them when found.

Note that it won't *insert* an extended attribute yet if it hasn't found it
while updating the birthtime.
 1.20 18-Jun-2008  reinoud Cleanup file access,modification,attribute and birthtime setting of files
and make the modification time when set never older than the creation time.
 1.19 19-May-2008  reinoud branches: 1.19.2;
Implement wide char support for UDF by properly implementing unicode-16 to
UTF-8 like cd9660 and ntfs already do.
 1.18 14-May-2008  reinoud Import writing part of the UDF file system making optical media like CD's
and DVD's behave like floppy discs. Writing is supported upto and including
version 2.01; version 2.50 and 2.60 will follow.

Also extending the UDF implementation to support symbolic links and
hardlinks.

Added are the mmcformat(8) tool to format rewritable CD/DVD discs and
newfs_udf(8).

Limitations:
all operations can be performed on the file system though the
sheduling is currently optimised for archiving workloads.

mv(1)/rename(2) is currently only implemented for non-directories.
 1.17 25-Jan-2008  ad branches: 1.17.6; 1.17.8; 1.17.10; 1.17.12;
Remove VOP_LEASE. Discussed on tech-kern.
 1.16 17-Jan-2008  ad Fix dodgy tests of v_usecount.
 1.15 02-Jan-2008  ad Merge vmlocking2 to head.
 1.14 11-Dec-2007  lukem use __KERNEL_RCSID() instead of __RCSID()
 1.13 26-Nov-2007  pooka branches: 1.13.2; 1.13.4; 1.13.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.12 08-Oct-2007  ad branches: 1.12.4;
Merge from vmlocking: fix dodgy use of VOP_ISLOCKED().
 1.11 24-Sep-2007  rumble Avoid stack allocation of large dirent structures in foo_readdir().
 1.10 29-Apr-2007  msaitoh branches: 1.10.6; 1.10.8; 1.10.10;
fix typos
 1.9 04-Jan-2007  reinoud branches: 1.9.2; 1.9.6; 1.9.8;
Add UDF_ICB_FILETYPE_REALTIME type as found on UDF 2.50 discs. Also revert
a multiplication order to enforce 64 bit math.
 1.8 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.7 12-Oct-2006  christos branches: 1.7.2;
- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.6 12-Jun-2006  christos branches: 1.6.4; 1.6.8; 1.6.10; 1.6.12;
remove ; from };
 1.5 14-May-2006  elad branches: 1.5.2;
integrate kauth.
 1.4 11-May-2006  mrg quell GCC 4.1 uninitialised variable warnings.

XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
 1.3 25-Apr-2006  snj s/allready/already/
 1.2 02-Feb-2006  reinoud branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.10;
Fix $NetBSD$ tags. (sorry)
 1.1 02-Feb-2006  reinoud Initial import of a UDF file system implementation for NetBSD.

The code supports read access to all media types that CD/DVD type drives
can recognize including DVD-RAM and BD- drives as well as harddisc partions
and vnd devices. UDF versions upto the latest 2.60 are to be supported
though due to lack of test media version 2.50 and 2.60 are not implemented
yet though easy to add. Both open and closed media are supported.

Write access is planned and in preparation. To facilitate this some hooks
are present in the code that are not strictly needed in a read-only
implementation but which allow writing to be added more easily.

Implemented and tested media types are CD-ROM, CD-R, CD-RW, CD-MRW,
DVD-ROM, DVD*R, DVD*RW, DVD+MRW but the same code can also read DVD-RAM,
HD-DVD and BluRay discs. Also vnd devices have been tested with several
sector sizes.

Discs created and written by UDFclient, Nero's InCD and Roxio's
DirectCD/Drag2Disc read fine.
 1.2.10.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.8.2 11-May-2006  elad sync with head
 1.2.8.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.2.6.2 26-Jun-2006  yamt sync with head.
 1.2.6.1 24-May-2006  yamt sync with head.
 1.2.4.2 18-Feb-2006  yamt sync with head.
 1.2.4.1 02-Feb-2006  yamt file udf_vnops.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:18 +0000
 1.2.2.1 01-Jun-2006  kardel Sync with head.
 1.5.2.1 19-Jun-2006  chap Sync with head.
 1.6.12.2 10-Dec-2006  yamt sync with head.
 1.6.12.1 22-Oct-2006  yamt sync with head
 1.6.10.2 09-Sep-2006  rpaulo sync with head
 1.6.10.1 12-Jun-2006  rpaulo file udf_vnops.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:06 +0000
 1.6.8.2 12-Jan-2007  ad Sync with head.
 1.6.8.1 18-Nov-2006  ad Sync with head.
 1.6.4.9 04-Feb-2008  yamt sync with head.
 1.6.4.8 21-Jan-2008  yamt sync with head
 1.6.4.7 07-Dec-2007  yamt sync with head
 1.6.4.6 27-Oct-2007  yamt sync with head.
 1.6.4.5 03-Sep-2007  yamt sync with head.
 1.6.4.4 26-Feb-2007  yamt sync with head.
 1.6.4.3 30-Dec-2006  yamt sync with head.
 1.6.4.2 21-Jun-2006  yamt sync with head.
 1.6.4.1 12-Jun-2006  yamt file udf_vnops.c was added on branch yamt-lazymbuf on 2006-06-21 15:09:37 +0000
 1.7.2.2 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.7.2.1 04-Jan-2007  bouyer Pull up following revision(s) (requested by reinoud in ticket #333):
sys/fs/udf/udf_subr.c: revision 1.27-1.29
sys/fs/udf/udf_vnops.c: revision 1.9
sys/fs/udf/ecma167-udf.h: revision 1.6
Fix compilation issue when specifying different flags or compiling with a
different compiler. Thanks to Jared for noting.
Add UDF_ICB_FILETYPE_REALTIME type as found on UDF 2.50 discs. Also revert
a multiplication order to enforce 64 bit math.
Forgot one place for UDF_ICB_FILETYPE_RANDOMACCESS.
 1.9.8.1 11-Jul-2007  mjf Sync with head.
 1.9.6.4 09-Oct-2007  ad Sync with head.
 1.9.6.3 22-Aug-2007  ad Fix dodgy use of VOP_ISLOCKED().
 1.9.6.2 08-Jun-2007  ad Sync with head.
 1.9.6.1 05-Apr-2007  ad Compile fixes.
 1.9.2.1 07-May-2007  yamt sync with head.
 1.10.10.2 14-Oct-2007  yamt sync with head.
 1.10.10.1 06-Oct-2007  yamt sync with head.
 1.10.8.3 23-Mar-2008  matt sync with HEAD
 1.10.8.2 09-Jan-2008  matt sync with HEAD
 1.10.8.1 06-Nov-2007  matt sync with HEAD
 1.10.6.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.10.6.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.10.6.1 02-Oct-2007  joerg Sync with HEAD.
 1.12.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.12.4.2 27-Dec-2007  mjf Sync with HEAD.
 1.12.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.13.6.3 19-Jan-2008  bouyer Sync with HEAD
 1.13.6.2 02-Jan-2008  bouyer Sync with HEAD
 1.13.6.1 13-Dec-2007  bouyer Sync with HEAD
 1.13.4.1 11-Dec-2007  yamt sync with head.
 1.13.2.2 26-Dec-2007  ad Sync with head.
 1.13.2.1 04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.17.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.17.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.17.10.8 11-Aug-2010  yamt sync with head.
 1.17.10.7 11-Mar-2010  yamt sync with head
 1.17.10.6 16-Sep-2009  yamt sync with head
 1.17.10.5 19-Aug-2009  yamt sync with head.
 1.17.10.4 18-Jul-2009  yamt sync with head.
 1.17.10.3 16-May-2009  yamt sync with head
 1.17.10.2 04-May-2009  yamt sync with head.
 1.17.10.1 16-May-2008  yamt sync with head.
 1.17.8.2 04-Jun-2008  yamt sync with head
 1.17.8.1 18-May-2008  yamt sync with head.
 1.17.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.17.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.17.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.2.2 18-Jul-2008  simonb Sync with head.
 1.19.2.1 27-Jun-2008  simonb Sync with head.
 1.23.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.2.1 19-Oct-2008  haad Sync with HEAD.
 1.30.4.8 26-Sep-2009  snj Apply patch (requested by reinoud in ticket #959):
UDF's flushing algorithm was susceptible to interference with genfs.
This patch fixes that and also ensures that there aren't tails around
being allocated later.
 1.30.4.7 09-Jul-2009  snj Apply patch (requested by reinoud in ticket #852):
Numerous UDF improvements:
- a much saner rmw backend
- free space management done right
- the high system time usage when encountering huge numbers of nodes
are a thing of the past due to refactoring
- various small fixes
 1.30.4.6 24-Mar-2009  snj branches: 1.30.4.6.4;
Pull up following revision(s) (requested by reinoud in ticket #592):
sys/fs/udf/udf_vnops.c: revision 1.38
Fix panic due to memory leak on symlink creation. A test copy with 3000+
symlinks could get the machine down.
 1.30.4.5 18-Mar-2009  snj Apply patch (requested by reinoud in ticket #585):
Fix build by bringing in part of 1.35 that was left out.
 1.30.4.4 18-Mar-2009  snj Apply patch (requested by reinoud in ticket #569):
Remove dead code and double check if it's allowed to write out
non-sequential there.
--
Sequential writing goes before normal write. Its not likely to ever go
wrong but there could be a race otherwise.
--
Add simplistic UBC async flushing as other FS's seem to do. Its a clutch
and needs to be addressed in UBC properly.
Improve write throttling by doing it on page-size basis. The `standard'
solution would cut up files unnessisary during allocation. It also made
assumptions about ucb wich were propably right but still.
 1.30.4.3 18-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #192):
sys/fs/udf/udf_vnops.c: revision 1.34
Fix endless loop occuring on empty directories listing on 512 bytes/sector
media like harddiscs. Also provide provide a `safety net' on readdir so it
will signal EOF when its requested an entry outside the directory.
 1.30.4.2 18-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #192):
sys/fs/udf/udf_subr.c: revision 1.77
sys/fs/udf/udf_vnops.c: revision 1.33
Elaborate SYNC debug messages and rename some debug messages to a more
proper category.
 1.30.4.1 06-Dec-2008  snj Pull up following revision(s) (requested by reinoud in ticket #167):
sys/fs/udf/udf_subr.c: revision 1.76
sys/fs/udf/udf_vnops.c: revision 1.32
Split uid/gid remapping code to be independent of eachother.
 1.30.4.6.4.1 21-Apr-2010  matt sync to netbsd-5
 1.30.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.30.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.30.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.34.2.2 23-Jul-2009  jym Sync with HEAD.
 1.34.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.57.4.4 31-May-2011  rmind sync with head
 1.57.4.3 05-Mar-2011  rmind sync with head
 1.57.4.2 03-Jul-2010  rmind sync with head
 1.57.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.57.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.62.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.65.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.68.2.5 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.68.2.4 16-Jan-2013  yamt sync with (a bit old) head
 1.68.2.3 30-Oct-2012  yamt sync with head
 1.68.2.2 23-May-2012  yamt sync with head.
 1.68.2.1 17-Apr-2012  yamt sync with head
 1.69.6.2 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.69.6.1 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.69.4.2 02-Jun-2012  mrg sync to latest -current.
 1.69.4.1 05-Apr-2012  mrg sync to latest -current.
 1.72.2.4 03-Dec-2017  jdolecek update from HEAD
 1.72.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.72.2.2 23-Jun-2013  tls resync from head
 1.72.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.76.2.2 18-May-2014  rmind sync with head
 1.76.2.1 28-Aug-2013  rmind sync with head
 1.91.2.1 10-Aug-2014  tls Rebase.
 1.94.4.4 28-Aug-2017  skrll Sync with HEAD
 1.94.4.3 05-Oct-2016  skrll Sync with HEAD
 1.94.4.2 06-Jun-2015  skrll Sync with HEAD
 1.94.4.1 06-Apr-2015  skrll Sync with HEAD
 1.101.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.102.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.106.10.2 21-Apr-2020  martin Sync with HEAD
 1.106.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.107.2.2 29-Feb-2020  ad Sync with head.
 1.107.2.1 17-Jan-2020  ad Sync with head.
 1.109.4.2 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.109.4.1 20-Apr-2020  bouyer Sync with HEAD
 1.114.6.1 01-Aug-2021  thorpej Sync with HEAD.

RSS XML Feed