Home | History | Annotate | only in /src/sys/fs/v7fs
History log of /src/sys/fs/v7fs
RevisionDateAuthorComments
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.2 11-Oct-2014  uebayasi Define filesystem attributes with vfs dependency.
 1.1 27-Jun-2011  uch branches: 1.1.12;
7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.1.12.1 03-Dec-2017  jdolecek update from HEAD
 1.4 24-May-2022  andvar fix various typos in comments, docs and log messages.
 1.3 22-May-2022  andvar fix various small typos, mainly in comments.
 1.2 16-Jul-2011  uch core symlink operation moved to v7fs_file_util.c and introduce V7FSBSD_MAXSYMLINKLEN for makefs
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.5 14-Aug-2011  apb Rename all static functions to have "v7fs_" prefix. Fixes a problem
in the tools build, where the static link() and unlink() functions
conflicted with those declared in <unistd.h>.
 1.4 18-Jul-2011  apb In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.3 16-Jul-2011  uch export v7fs_datablock_addr for makefs
 1.2 13-Jul-2011  uch When filesize is zero, correctly return V7FS_ITERATOR_END
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.2 16-Jul-2011  uch export v7fs_datablock_addr for makefs
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.3 11-Feb-2022  hannken A component name is a counted string (cn_nameptr, cn_namelen),
not a zero terminated string cn_nameptr.

Change the following operations to work with counted strings:

v7fs_file_lookup_by_name()
v7fs_file_allocate()
v7fs_file_deallocate()
v7fs_directory_add_entry()
v7fs_directory_remove_entry()
v7fs_file_rename()
v7fs_file_link()
v7fs_dirent_filename()

Adapt all vnode operations with component names as argument.
 1.2 18-Jul-2011  apb In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.2 11-Feb-2022  hannken A component name is a counted string (cn_nameptr, cn_namelen),
not a zero terminated string cn_nameptr.

Change the following operations to work with counted strings:

v7fs_file_lookup_by_name()
v7fs_file_allocate()
v7fs_file_deallocate()
v7fs_directory_add_entry()
v7fs_directory_remove_entry()
v7fs_file_rename()
v7fs_file_link()
v7fs_dirent_filename()

Adapt all vnode operations with component names as argument.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.2 18-Jul-2011  apb In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.9 18-Jul-2021  dholland Use macros for the canned parts of device and fifo vnode op tables.

Add GENFS_SPECOP_ENTRIES and GENFS_FIFOOP_ENTRIES macros that contain
the portion of the vnode ops table declaration that is
(conservatively) the same in every fs. Use these in every fs that
supports devices and/or fifos with separate ops tables.

Note that ptyfs works differently (it has one type of vnode with
open-coded dispatch to the specfs code, which I haven't changed in
this commit) and rump/librump/rumpvfs/rumpfs.c has an indirect dynamic
dispatch that already does more or less the same thing, which I also
haven't changed.

Also note that this anticipates a few bits in the next changeset here
and there, and adds missing but unreachable calls in some cases (e.g.
most fses weren't defining whiteout on devices and fifos, but it isn't
reachable there), and it changes parsepath on devices and fifos to
genfs_badop from genfs_parsepath (but it's not reachable there
either).

It appears that devices in kernfs were missing kqfilter, so it's
possible that if you try to use kqueue on /kern/rootdev that it'll
explode.

And finally note that the ops declaration tables aren't
order-dependent. (Other than vop_default_desc has to come first.)
Otherwise this wouldn't work.
 1.8 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.7 16-May-2020  christos branches: 1.7.6;
Add ACL support for FFS. From FreeBSD.
 1.6 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.5 17-Feb-2017  hannken branches: 1.5.12;
Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.
 1.4 29-Dec-2014  hannken branches: 1.4.2; 1.4.4;
Change v7fs to vcache.
 1.3 25-Jul-2014  dholland branches: 1.3.4;
Add VOP_FALLOCATE and VOP_FDISCARD to every vnode ops table I can
find.

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

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

The fifo ones all call vn_fifo_bypass, which also ends up being
EOPNOTSUPP.
 1.2 23-Mar-2014  hannken branches: 1.2.2;
Change all vfsops to use C99 designated initializers.

No functional changes intended.
 1.1 27-Jun-2011  uch branches: 1.1.2; 1.1.12; 1.1.16;
7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.1.16.1 18-May-2014  rmind sync with head
 1.1.12.2 03-Dec-2017  jdolecek update from HEAD
 1.1.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.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.2.2.1 10-Aug-2014  tls Rebase.
 1.3.4.2 28-Aug-2017  skrll Sync with HEAD
 1.3.4.1 06-Apr-2015  skrll Sync with HEAD
 1.4.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.4.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.5.12.1 25-Jun-2018  pgoyette Sync with HEAD
 1.7.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.2 29-Dec-2014  hannken Change v7fs to vcache.
 1.1 27-Jun-2011  uch branches: 1.1.12; 1.1.30;
7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.1.30.1 06-Apr-2015  skrll Sync with HEAD
 1.1.12.1 03-Dec-2017  jdolecek update from HEAD
 1.7 11-Feb-2022  hannken A component name is a counted string (cn_nameptr, cn_namelen),
not a zero terminated string cn_nameptr.

Change the following operations to work with counted strings:

v7fs_file_lookup_by_name()
v7fs_file_allocate()
v7fs_file_deallocate()
v7fs_directory_add_entry()
v7fs_directory_remove_entry()
v7fs_file_rename()
v7fs_file_link()
v7fs_dirent_filename()

Adapt all vnode operations with component names as argument.
 1.6 29-Dec-2014  hannken Defer deallocating unlinked inodes to v7fs_reclaim().

Remove v7fs_vnode_reload() and always use v7fs_inode_load(). No need
to search for a vnode we already hold a reference on.
 1.5 07-Dec-2012  msaitoh branches: 1.5.12; 1.5.14;
Fix off by one error.
 1.4 21-Mar-2012  christos branches: 1.4.2;
don't re-define MIN
 1.3 30-Jul-2011  uch branches: 1.3.2; 1.3.6; 1.3.8; 1.3.12;
Fix return vaule. Pass t_vnops:rename_dotdot, dir_noempty, rename_dir(6)
 1.2 18-Jul-2011  apb In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.3.12.1 16-Dec-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #748):
sys/fs/v7fs/v7fs_file.c: revision 1.5
Fix off by one error.
 1.3.8.1 16-Dec-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #748):
sys/fs/v7fs/v7fs_file.c: revision 1.5
Fix off by one error.
 1.3.6.1 05-Apr-2012  mrg sync to latest -current.
 1.3.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.3.2.1 17-Apr-2012  yamt sync with head
 1.4.2.2 03-Dec-2017  jdolecek update from HEAD
 1.4.2.1 25-Feb-2013  tls resync with head
 1.5.14.1 06-Apr-2015  skrll Sync with HEAD
 1.5.12.1 07-Jan-2015  martin Pull up following revision(s) (requested by hannken in ticket #386):
sys/fs/v7fs/v7fs_file.c: revision 1.6
sys/fs/v7fs/v7fs_vnops.c: revision 1.18
sys/fs/v7fs/v7fs_vnops.c: revision 1.19
sys/fs/v7fs/v7fs_vfsops.c: revision 1.11
v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL.
Should fix the v7fs part of PR kern/48864.
Defer deallocating unlinked inodes to v7fs_reclaim().
Remove v7fs_vnode_reload() and always use v7fs_inode_load(). No need
to search for a vnode we already hold a reference on.
 1.3 11-Feb-2022  hannken A component name is a counted string (cn_nameptr, cn_namelen),
not a zero terminated string cn_nameptr.

Change the following operations to work with counted strings:

v7fs_file_lookup_by_name()
v7fs_file_allocate()
v7fs_file_deallocate()
v7fs_directory_add_entry()
v7fs_directory_remove_entry()
v7fs_file_rename()
v7fs_file_link()
v7fs_dirent_filename()

Adapt all vnode operations with component names as argument.
 1.2 16-Jul-2011  uch core symlink operation moved to v7fs_file_util.c and introduce V7FSBSD_MAXSYMLINKLEN for makefs
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.5 11-Feb-2022  hannken A component name is a counted string (cn_nameptr, cn_namelen),
not a zero terminated string cn_nameptr.

Change the following operations to work with counted strings:

v7fs_file_lookup_by_name()
v7fs_file_allocate()
v7fs_file_deallocate()
v7fs_directory_add_entry()
v7fs_directory_remove_entry()
v7fs_file_rename()
v7fs_file_link()
v7fs_dirent_filename()

Adapt all vnode operations with component names as argument.
 1.4 30-Jul-2011  uch When rename directory, check hierarchy. Pass t_vnops rename_dir(5)
 1.3 18-Jul-2011  apb In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.2 16-Jul-2011  uch core symlink operation moved to v7fs_file_util.c and introduce V7FSBSD_MAXSYMLINKLEN for makefs
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.3 25-Sep-2024  andvar s/corupt/corrupt/ in debug message.
 1.2 18-Jul-2011  apb branches: 1.2.90;
In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.2.90.1 02-Aug-2025  perseant Sync with HEAD
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.2 18-Jul-2011  apb In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.3 28-Jun-2013  christos prevent memory leak on error
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
 1.2 18-Jul-2011  apb branches: 1.2.2; 1.2.12;
In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.2.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.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.5 27-Aug-2017  skrll Remove some unnecessary duplicatioN
 1.4 01-Jun-2017  chs remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.3 28-Mar-2015  maxv Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
 1.2 20-Nov-2013  rmind branches: 1.2.6;
v7fs: replace malloc(9) with kmem(9), fix a memory leak and few missing
mutex destruction cases in the error path.
 1.1 27-Jun-2011  uch branches: 1.1.2; 1.1.12; 1.1.16;
7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.1.16.1 18-May-2014  rmind sync with head
 1.1.12.2 03-Dec-2017  jdolecek update from HEAD
 1.1.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.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.2.6.2 28-Aug-2017  skrll Sync with HEAD
 1.2.6.1 06-Apr-2015  skrll Sync with HEAD
 1.4 08-Aug-2011  uch Remove suspicious warning message.
 1.3 03-Aug-2011  dholland Insert casts to off_t to avoid 32-bit multiplication overflow when
computing device offsets on 32-bit platforms. Should fix PR 45191.
 1.2 18-Jul-2011  apb In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.2 18-Jul-2011  apb In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.2 18-Jul-2011  apb In sources that get compiled into the tools version of makefs, add:

#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.19 03-May-2022  hannken Lock devvp for kauth KAUTH_REQ_SYSTEM_MOUNT_DEVICE.
 1.18 05-Feb-2022  zafer fix membername in dprintf
 1.17 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.16 01-Jun-2017  chs branches: 1.16.10; 1.16.16;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.15 17-Apr-2017  hannken branches: 1.15.2;
Remove unused argument "nextp" from vfs_busy() and vfs_unbusy().
Remove argument "keepref" from vfs_unbusy() and add vfs_ref() where needed.
 1.14 17-Apr-2017  hannken Add vfs_ref(mp) and vfs_rele(mp) to add or remove a reference to
struct mount. Rename vfs_destroy(mp) to vfs_rele(mp) and replace
incrementing mp->mnt_refcnt with vfs_ref(mp).
 1.13 01-Apr-2017  riastradh KASSERT(mutex_owned(vp->v_interlock)) in vnode iterator selector.
 1.12 29-Dec-2014  hannken branches: 1.12.2; 1.12.4;
Change v7fs to vcache.
 1.11 29-Dec-2014  hannken Defer deallocating unlinked inodes to v7fs_reclaim().

Remove v7fs_vnode_reload() and always use v7fs_inode_load(). No need
to search for a vnode we already hold a reference on.
 1.10 16-Apr-2014  maxv branches: 1.10.2; 1.10.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.9 23-Nov-2013  christos branches: 1.9.2;
change the mountlist CIRCLEQ into a TAILQ
 1.8 20-Nov-2013  rmind v7fs: replace malloc(9) with kmem(9), fix a memory leak and few missing
mutex destruction cases in the error path.
 1.7 13-Jun-2012  joerg branches: 1.7.2; 1.7.4;
Ensure that error is initialized in all code paths.
 1.6 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.5 13-Nov-2011  christos branches: 1.5.4; 1.5.6;
use getdisksize()
 1.4 30-Jul-2011  uch branches: 1.4.2;
v7fs_lookup() fix return value. Pass t_vnops rename_dir(3)
v7fs_setttr() check credential. Pass t_unpriv owner
v7fs_rename() reload inode(v7fs_vnode_reload). Pass t_vnops rename_reg_nodir
 1.3 23-Jul-2011  uch remove partition check from v7fs_mount. problem on rump implementation.
 1.2 02-Jul-2011  uch Set missing error number
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.4.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.4.2.2 30-Oct-2012  yamt sync with head
 1.4.2.1 17-Apr-2012  yamt sync with head
 1.5.6.2 21-Apr-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1050):
sys/ufs/chfs/chfs_vfsops.c: revision 1.11
sys/fs/unionfs/unionfs_vfsops.c: revision 1.13
sys/fs/nilfs/nilfs_vfsops.c: revision 1.16
sys/ufs/mfs/mfs_vfsops.c: revision 1.107
sys/fs/sysvbfs/sysvbfs_vfsops.c: revision 1.43
sys/ufs/ffs/ffs_vfsops.c: revision 1.297
sys/kern/vfs_syscalls.c: revision 1.478
sys/kern/vfs_syscalls.c: revision 1.479
sys/fs/puffs/puffs_vfsops.c: revision 1.110
sys/fs/cd9660/cd9660_vfsops.c: revision 1.84
sys/nfs/nfs_vfsops.c: revision 1.227
sys/fs/v7fs/v7fs_vfsops.c: revision 1.10
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.180
sys/miscfs/umapfs/umap_vfsops.c: revision 1.92
sys/fs/filecorefs/filecore_vfsops.c: revision 1.76
sys/miscfs/nullfs/null_vfsops.c: revision 1.88
sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.50
sys/coda/coda_vfsops.c: revision 1.81
sys/ufs/lfs/lfs_vfsops.c: revision 1.321
sys/fs/tmpfs/tmpfs_vfsops.c: revision 1.59
sys/fs/hfs/hfs_vfsops.c: revision 1.31
sys/miscfs/overlay/overlay_vfsops.c: revision 1.61
sys/fs/union/union_vfsops.c: revision 1.72
sys/fs/ntfs/ntfs_vfsops.c: revision 1.94
sys/kern/vfs_syscalls.c: revision 1.480
sys/fs/efs/efs_vfsops.c: revision 1.25
sys/kern/vfs_syscalls.c: revision 1.482
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.107
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c: revision 1.12
sys/miscfs/procfs/procfs_vfsops.c: revision 1.91
sys/fs/smbfs/smbfs_vfsops.c: revision 1.100
sys/fs/adosfs/advfsops.c: revision 1.70
sys/fs/udf/udf_vfsops.c: revision 1.67
Limit check for 'data_len'. Otherwise a (un)privileged user can easily
panic the system by passing a huge size.
ok christos@
An (un)privileged user can easily make the kernel dereference a NULL
pointer.
The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).
ok christos@
Some fs's - like kernfs - set their vfs_min_mount_data to zero. Add a check
to prevent an (un)privileged user from requesting a zero-sized allocation
(and thus a panic).
This thing is totally buggy: 'data_len' is modified by the fs, so calling
kmem_free with it while its value has changed since the kmem_alloc is far
from being a good idea.
If the kernel figures out that something mismatches, it will panic
(typically with kernfs).
 1.5.6.1 24-Jun-2012  jdc branches: 1.5.6.1.4; 1.5.6.1.6;
Pull up revisions:
src/sys/fs/hfs/hfs_vfsops.c revision 1.29
src/sys/fs/sysvbfs/sysvbfs_vfsops.c revision 1.40
src/sys/fs/v7fs/v7fs_vfsops.c revision 1.7
(requested by joerg in ticket #344).
 1.5.6.1.6.1 21-Apr-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1050):
sys/ufs/chfs/chfs_vfsops.c: revision 1.11
sys/fs/unionfs/unionfs_vfsops.c: revision 1.13
sys/fs/nilfs/nilfs_vfsops.c: revision 1.16
sys/ufs/mfs/mfs_vfsops.c: revision 1.107
sys/fs/sysvbfs/sysvbfs_vfsops.c: revision 1.43
sys/ufs/ffs/ffs_vfsops.c: revision 1.297
sys/kern/vfs_syscalls.c: revision 1.478
sys/kern/vfs_syscalls.c: revision 1.479
sys/fs/puffs/puffs_vfsops.c: revision 1.110
sys/fs/cd9660/cd9660_vfsops.c: revision 1.84
sys/nfs/nfs_vfsops.c: revision 1.227
sys/fs/v7fs/v7fs_vfsops.c: revision 1.10
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.180
sys/miscfs/umapfs/umap_vfsops.c: revision 1.92
sys/fs/filecorefs/filecore_vfsops.c: revision 1.76
sys/miscfs/nullfs/null_vfsops.c: revision 1.88
sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.50
sys/coda/coda_vfsops.c: revision 1.81
sys/ufs/lfs/lfs_vfsops.c: revision 1.321
sys/fs/tmpfs/tmpfs_vfsops.c: revision 1.59
sys/fs/hfs/hfs_vfsops.c: revision 1.31
sys/miscfs/overlay/overlay_vfsops.c: revision 1.61
sys/fs/union/union_vfsops.c: revision 1.72
sys/fs/ntfs/ntfs_vfsops.c: revision 1.94
sys/kern/vfs_syscalls.c: revision 1.480
sys/fs/efs/efs_vfsops.c: revision 1.25
sys/kern/vfs_syscalls.c: revision 1.482
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.107
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c: revision 1.12
sys/miscfs/procfs/procfs_vfsops.c: revision 1.91
sys/fs/smbfs/smbfs_vfsops.c: revision 1.100
sys/fs/adosfs/advfsops.c: revision 1.70
sys/fs/udf/udf_vfsops.c: revision 1.67
Limit check for 'data_len'. Otherwise a (un)privileged user can easily
panic the system by passing a huge size.
ok christos@
An (un)privileged user can easily make the kernel dereference a NULL
pointer.
The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).
ok christos@
Some fs's - like kernfs - set their vfs_min_mount_data to zero. Add a check
to prevent an (un)privileged user from requesting a zero-sized allocation
(and thus a panic).
This thing is totally buggy: 'data_len' is modified by the fs, so calling
kmem_free with it while its value has changed since the kmem_alloc is far
from being a good idea.
If the kernel figures out that something mismatches, it will panic
(typically with kernfs).
 1.5.6.1.4.1 21-Apr-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1050):
sys/ufs/chfs/chfs_vfsops.c: revision 1.11
sys/fs/unionfs/unionfs_vfsops.c: revision 1.13
sys/fs/nilfs/nilfs_vfsops.c: revision 1.16
sys/ufs/mfs/mfs_vfsops.c: revision 1.107
sys/fs/sysvbfs/sysvbfs_vfsops.c: revision 1.43
sys/ufs/ffs/ffs_vfsops.c: revision 1.297
sys/kern/vfs_syscalls.c: revision 1.478
sys/kern/vfs_syscalls.c: revision 1.479
sys/fs/puffs/puffs_vfsops.c: revision 1.110
sys/fs/cd9660/cd9660_vfsops.c: revision 1.84
sys/nfs/nfs_vfsops.c: revision 1.227
sys/fs/v7fs/v7fs_vfsops.c: revision 1.10
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.180
sys/miscfs/umapfs/umap_vfsops.c: revision 1.92
sys/fs/filecorefs/filecore_vfsops.c: revision 1.76
sys/miscfs/nullfs/null_vfsops.c: revision 1.88
sys/fs/ptyfs/ptyfs_vfsops.c: revision 1.50
sys/coda/coda_vfsops.c: revision 1.81
sys/ufs/lfs/lfs_vfsops.c: revision 1.321
sys/fs/tmpfs/tmpfs_vfsops.c: revision 1.59
sys/fs/hfs/hfs_vfsops.c: revision 1.31
sys/miscfs/overlay/overlay_vfsops.c: revision 1.61
sys/fs/union/union_vfsops.c: revision 1.72
sys/fs/ntfs/ntfs_vfsops.c: revision 1.94
sys/kern/vfs_syscalls.c: revision 1.480
sys/fs/efs/efs_vfsops.c: revision 1.25
sys/kern/vfs_syscalls.c: revision 1.482
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.107
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c: revision 1.12
sys/miscfs/procfs/procfs_vfsops.c: revision 1.91
sys/fs/smbfs/smbfs_vfsops.c: revision 1.100
sys/fs/adosfs/advfsops.c: revision 1.70
sys/fs/udf/udf_vfsops.c: revision 1.67
Limit check for 'data_len'. Otherwise a (un)privileged user can easily
panic the system by passing a huge size.
ok christos@
An (un)privileged user can easily make the kernel dereference a NULL
pointer.
The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).
ok christos@
Some fs's - like kernfs - set their vfs_min_mount_data to zero. Add a check
to prevent an (un)privileged user from requesting a zero-sized allocation
(and thus a panic).
This thing is totally buggy: 'data_len' is modified by the fs, so calling
kmem_free with it while its value has changed since the kmem_alloc is far
from being a good idea.
If the kernel figures out that something mismatches, it will panic
(typically with kernfs).
 1.5.4.1 05-Apr-2012  mrg sync to latest -current.
 1.7.4.1 18-May-2014  rmind sync with head
 1.7.2.2 03-Dec-2017  jdolecek update from HEAD
 1.7.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.2.1 10-Aug-2014  tls Rebase.
 1.10.4.2 28-Aug-2017  skrll Sync with HEAD
 1.10.4.1 06-Apr-2015  skrll Sync with HEAD
 1.10.2.1 07-Jan-2015  martin Pull up following revision(s) (requested by hannken in ticket #386):
sys/fs/v7fs/v7fs_file.c: revision 1.6
sys/fs/v7fs/v7fs_vnops.c: revision 1.18
sys/fs/v7fs/v7fs_vnops.c: revision 1.19
sys/fs/v7fs/v7fs_vfsops.c: revision 1.11
v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL.
Should fix the v7fs part of PR kern/48864.
Defer deallocating unlinked inodes to v7fs_reclaim().
Remove v7fs_vnode_reload() and always use v7fs_inode_load(). No need
to search for a vnode we already hold a reference on.
 1.12.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.12.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.12.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.15.2.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.16.16.1 17-Jan-2020  ad Sync with head.
 1.16.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.38 31-Jul-2022  mlelstv Don't panic for a negative offset, just fail the operation with EINVAL.
 1.37 22-May-2022  andvar fix various small typos, mainly in comments.
 1.36 30-Mar-2022  christos fix unlock on error.
 1.35 27-Mar-2022  christos add a kauth vnode check for creating links
 1.34 11-Feb-2022  hannken A component name is a counted string (cn_nameptr, cn_namelen),
not a zero terminated string cn_nameptr.

Change the following operations to work with counted strings:

v7fs_file_lookup_by_name()
v7fs_file_allocate()
v7fs_file_deallocate()
v7fs_directory_add_entry()
v7fs_directory_remove_entry()
v7fs_file_rename()
v7fs_file_link()
v7fs_dirent_filename()

Adapt all vnode operations with component names as argument.
 1.33 01-Feb-2022  jakllsch fix spelling of "regular" in comment
 1.32 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.31 27-Jun-2020  christos Introduce genfs_pathconf() and use it for the default case in all filesystems.
 1.30 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.29 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.28 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.27 17-Jan-2020  ad branches: 1.27.4;
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.26 26-May-2017  riastradh branches: 1.26.10; 1.26.16;
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.25 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.24 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.23 08-Apr-2017  hannken Update mtime when updating file size.

PR kern/51762 (mtime not updated by open(O_TRUNC))
 1.22 20-Aug-2016  hannken branches: 1.22.2;
Remove now obsolete operation vcache_remove().

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

Ride 7.99.10 bump.
 1.20 29-Dec-2014  hannken Change v7fs to vcache.
 1.19 29-Dec-2014  hannken Defer deallocating unlinked inodes to v7fs_reclaim().

Remove v7fs_vnode_reload() and always use v7fs_inode_load(). No need
to search for a vnode we already hold a reference on.
 1.18 29-Dec-2014  hannken v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL.

Should fix the v7fs part of PR kern/48864.
 1.17 08-Aug-2014  gson branches: 1.17.2; 1.17.4;
Whitespace fix
 1.16 07-Feb-2014  hannken branches: 1.16.2;
Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
 1.15 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.14 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.13 20-Nov-2013  rmind v7fs: replace malloc(9) with kmem(9), fix a memory leak and few missing
mutex destruction cases in the error path.
 1.12 18-Mar-2013  plunky branches: 1.12.6;
C99 section 6.7.2.3 (Tags) Note 3 states that:

A type specifier of the form

enum identifier

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

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

(ok elad@)
 1.11 29-Apr-2012  chs branches: 1.11.2;
change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
 1.10 31-Mar-2012  njoly Make v7fs_getattr() report file flags, and adjust v7fs_setattr() to
allow unsetting SF_APPEND flag.
 1.9 22-Mar-2012  njoly Pass operations flags to genfs_can_chtimes(), not file ones.
 1.8 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.7 27-Jan-2012  njoly branches: 1.7.2;
Check parent directory write permission for DELETE operation.

ok uch@.
 1.6 30-Jul-2011  uch branches: 1.6.2; 1.6.6;
v7fs_lookup() fix return value. Pass t_vnops rename_dir(3)
v7fs_setttr() check credential. Pass t_unpriv owner
v7fs_rename() reload inode(v7fs_vnode_reload). Pass t_vnops rename_reg_nodir
 1.5 24-Jul-2011  uch Existing inode don't recycle. rump works.
 1.4 16-Jul-2011  uch core symlink operation moved to v7fs_file_util.c and introduce V7FSBSD_MAXSYMLINKLEN for makefs
 1.3 13-Jul-2011  uch Fix readdir eofflag(bogus eofflags was setted). getcwd works.
 1.2 13-Jul-2011  uch Fix inode update method. chown and chmod works.
 1.1 27-Jun-2011  uch 7th Edition(V7) File System support. and NetBSD symbolic-link, socket, FIFO extension. see newfs_v7fs(8).
 1.6.6.3 02-Jun-2012  mrg sync to latest -current.
 1.6.6.2 05-Apr-2012  mrg sync to latest -current.
 1.6.6.1 18-Feb-2012  mrg merge to -current.
 1.6.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.6.2.2 23-May-2012  yamt sync with head.
 1.6.2.1 17-Apr-2012  yamt sync with head
 1.7.2.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.11.2.3 03-Dec-2017  jdolecek update from HEAD
 1.11.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.2.1 23-Jun-2013  tls resync from head
 1.12.6.1 18-May-2014  rmind sync with head
 1.16.2.1 10-Aug-2014  tls Rebase.
 1.17.4.4 28-Aug-2017  skrll Sync with HEAD
 1.17.4.3 05-Oct-2016  skrll Sync with HEAD
 1.17.4.2 06-Jun-2015  skrll Sync with HEAD
 1.17.4.1 06-Apr-2015  skrll Sync with HEAD
 1.17.2.1 07-Jan-2015  martin Pull up following revision(s) (requested by hannken in ticket #386):
sys/fs/v7fs/v7fs_file.c: revision 1.6
sys/fs/v7fs/v7fs_vnops.c: revision 1.18
sys/fs/v7fs/v7fs_vnops.c: revision 1.19
sys/fs/v7fs/v7fs_vfsops.c: revision 1.11
v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL.
Should fix the v7fs part of PR kern/48864.
Defer deallocating unlinked inodes to v7fs_reclaim().
Remove v7fs_vnode_reload() and always use v7fs_inode_load(). No need
to search for a vnode we already hold a reference on.
 1.21.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.22.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.26.16.1 17-Jan-2020  ad Sync with head.
 1.26.10.2 21-Apr-2020  martin Sync with HEAD
 1.26.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.27.4.2 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.27.4.1 20-Apr-2020  bouyer Sync with HEAD

RSS XML Feed