Home | History | Annotate | Download | only in kernfs
History log of /src/sys/miscfs/kernfs/kernfs.h
RevisionDateAuthorComments
 1.45  27-Jun-2025  andvar Grammar and spelling fixes, mainly in comments. A few in documentation,
logging, test description, and SCSI ASC/ASCQ assignment descriptions.
 1.44  07-Apr-2020  jdolecek branches: 1.44.28;
switch KERNFS_ALLOCENTRY() to use kmem_zalloc() instead of malloc()
 1.43  04-Feb-2020  riastradh Use specfs vnops for specnodes in kernfs.

While here, don't filter out rootdev and rrootdev merely because
they're not cached.

Fixes the elusive /kern/rootdev and /kern/rrootdev nodes, which only
appeared sometimes when they felt like it, and fixes operations on
/kern/rootdev and /kern/rrootdev always returning EOPNOTSUPP.

We didn't seem to have a single PR for these issues but the following
PRs are all relevant:

PR bin/13564
PR kern/38265
PR kern/38778
PR kern/45974

XXX pullup-9, pullup-8, pullup-7, pullup-6, pullup-5, pullup-4, pullup-3, pullup-2, pullup-1.4T...
 1.42  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.41  02-Jan-2020  thorpej branches: 1.41.2;
- Eliminate the global "boottime" variable, which was being accessed
without any synchronization against changes by e.g. clock_settime().
- Replace with new getbinboottime() / getnanoboottime() / getmicroboottime()
functions (naming mirrors that of other time access functions in kern_tc.c).
It returns the (maybe-converted) value of timebasebin, which also tracks
our estimate of when the system was booted (i.e. the legacy "boottime" was
redundant).

XXX There needs to be a lockless synchronization mechanism for reading
timebasebin, but this is a problem in kern_tc.c that pre-existed these
"boottime" changes. At least now the problem is centralized in one location.
 1.40  20-Jul-2014  hannken branches: 1.40.28; 1.40.32;
Change kernfs from hashlist to vcache.
 1.39  20-Jul-2014  hannken Remove another KAME IPSEC residue, "struct secasvar" and "struct secpolicy".
 1.38  17-Jul-2014  hannken Finish KAME IPSEC removal:
- Remove field kfs_value, it is always zero. Compute the hash from kt_tag.
- Remove stray definitions kernfs_revoke_sa and kernfs_revoke_sp.

While here, remove kfs_type from allocvp(), it is always kt->kt_tag.
 1.37  22-Mar-2012  drochner branches: 1.37.2; 1.37.12;
remove KAME IPSEC, replaced by FAST_IPSEC
 1.36  27-Sep-2011  christos branches: 1.36.2; 1.36.6;
define KERNFS_MAXNAMLEN and use it.`
 1.35  11-Jan-2009  christos merge christos-time_t
 1.34  01-Aug-2008  apb branches: 1.34.2;
#include <sys/tree.h> to get a definition for SPLAY_ENTRY.
Needed by third party code, such as lsof.
 1.33  28-Jun-2008  rumble branches: 1.33.2;
Create sysctl entries during module initialisation and destroy them
appropriately.

Many of these file systems are now ready for modularisation.
 1.32  28-Dec-2006  alc branches: 1.32.40; 1.32.44; 1.32.46; 1.32.48;
fix comment (forgotten in rev 1.19):
- pfsnode -> kernfs_node
- procfs -> kernfs
 1.31  23-Jun-2006  christos branches: 1.31.4;
remove useless genop
 1.30  23-Jun-2006  bouyer For internal types call kernfs_default_xread() directly, as no entry in
the splay tree has been added for these types. Fix kern/33797 by
Geoff C. Wing.
While here also fix writes the same way (probably broken for 2 years),
and properly implement KERNFS_XREAD.
The IPsec code could probably be moved out now, and use kernfs_alloctype().
 1.29  23-Jun-2006  bouyer Backout previous: of course the change
"Allow optional /kern regular files to have custom read methods..."
works, it's used by Xen.
 1.28  23-Jun-2006  christos PR/33797: Geoff C. Wing: kernfs files are not supplying information
Roll back the change:
'Allow optional /kern regular files to have custom read methods...'
which does not work.
 1.27  14-Mar-2006  bouyer branches: 1.27.6;
Allow optionnal /kern regular files to have custom read methods, the same
way writes are handled: Add KERNFS_XREAD and KERNFS_FILEOP_WRITE files
operations definitions to kfsfileop, a xread function pointer to
kernfs_fileop, rename kernfs_read to kernfs_default_xread and add a
kernfs_read calling kernfs_try_fileop(KERNFS_FILEOP_READ).

Proposed on tech-kern on Feb 18 2006.
 1.26  11-Dec-2005  christos branches: 1.26.4; 1.26.6; 1.26.8; 1.26.10;
merge ktrace-lwp.
 1.25  30-Aug-2005  xtraeme Remove __P()
 1.24  20-May-2005  chs branches: 1.24.2;
kernfs does not support mmap(), remove code that pretends that it does.
 1.23  20-May-2004  atatat branches: 1.23.10;
Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

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

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.22  07-May-2004  cl Allow additional entries (files, subdirs) in kernfs. Also allow
defining additional kfstypes and provide hooks to run arbitrary code
for any vnodeop on the additional types.
 1.21  07-May-2004  cl Make lookup and readdir return the same inode number. kernfs_readdir
now uses kernfs_allocvp to map from kernfs entry to inode number,
kernfs_allocvp is now the only place where entries are mapped to inode
numbers. Also make KERNFS_FILENO not return random results for entries
not in kern_targets.
 1.20  27-Sep-2003  darcy branches: 1.20.2;
Changes as discussed with itojun on tech-kern. I have modified the enums
to have KFS or PFS differentiators. Further I have wrapped the enum in
procfs in "#ifdef _KERNEL" as it is done in kernfs.

To see the discussion go to http://mail-index.NetBSD.org/tech-kern/2003/09/
and look for "Mismatched enums in include files" in the list.
 1.19  26-Sep-2003  atatat Make kernfs peacefully co-exist with procfs.
 1.18  08-Sep-2003  itojun add /kern/ipsecsa and /kern/ipsecsp, which can be inspected by setkey(8).
it allows easier access to ipsecsa/sp. it works around problem where
setkey -D does not work with large number of ipsec SAs due to socket buffer
size.
 1.17  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.16  21-Feb-2001  jdolecek branches: 1.16.24;
make some more constant arrays 'const'
 1.15  27-Jan-2001  jdolecek Back previous out, it was right the way it was. Seems like I should
attend some basic arithmetic lessons to avoid such mistakes :-/
 1.14  27-Jan-2001  jdolecek fix 'physmem' - the actual value we want is ctob(physmem)
 1.13  14-Jul-2000  thorpej Sprinkle some const.
 1.12  01-Mar-1998  fvdl branches: 1.12.14; 1.12.24;
Merge with Lite2 + local changes
 1.11  10-May-1997  pk Move `struct kern_target' definition into kernfs.h
 1.10  09-Feb-1996  christos miscfs prototype changes
 1.9  29-Mar-1995  briggs KERNEL -> _KERNEL
 1.8  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.7  15-Jun-1994  mycroft Minor update from JSP after merging my changes.
 1.6  08-Jun-1994  mycroft Update to 4.4-Lite fs code, with local changes.
 1.5  05-Jan-1994  cgd update with latest kernfs file system from jsp@sequent.com
 1.4  28-May-1993  cgd add some more functionality: a setattr which supports chmod+chown+chgrp,
and the various support elsewhere to deal with it.
 1.3  27-Mar-1993  cgd added ".." and support for "rrootdev"
 1.2  25-Mar-1993  cgd changed copyright notice thanks to following statement:

Return-Path: jsp@compnews.co.uk
Received: from ben.uknet.ac.uk by postgres.Berkeley.EDU (5.61/1.29)
id AA25983; Thu, 25 Mar 93 05:37:37 -0800
Received: from fennel.compnews.co.uk by ben.uknet.ac.uk via UKIP with SMTP (PP)
id <g.05640-0@ben.uknet.ac.uk>; Thu, 25 Mar 1993 13:37:19 +0000
Received: from sage.compnews.co.uk by fennel.compnews.co.uk;
Thu, 25 Mar 93 13:37:08 GMT
Message-Id: <28109.9303251337@sage.compnews.co.uk>
From: jsp@compnews.co.uk (Jan-Simon Pendry)
Date: Thu, 25 Mar 1993 13:37:05 +0100
In-Reply-To: cgd@postgres.berkeley.edu's message as of Mar 25, 5:32am.
Phone-Number-1: +44 430 432450
Phone-Number-2: +44 430 432480 x20
Fax-Number: +44 430 432022
X-Mailer: Mail User's Shell (7.2.5 10/14/92)
To: cgd@postgres.berkeley.edu
Subject: Re: fdesc/kernfs/etc code...

You may put this copyright message on the source code:

/*
* Copyright (c) 1990, 1992 Jan-Simon Pendry
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Jan-Simon Pendry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
 1.1  23-Mar-1993  cgd branches: 1.1.1;
files which implement the kern filesystem. from Jan-Simon Pendry,
pendry@vangogh.cs.berkeley.edu
 1.1.1.2  01-Mar-1998  fvdl Import 4.4BSD-Lite2
 1.1.1.1  01-Mar-1998  fvdl Import 4.4BSD-Lite for reference
 1.12.24.1  14-Jul-2000  thorpej Update from trunk:
Sprinkle some const.
 1.12.14.2  12-Mar-2001  bouyer Sync with HEAD.
 1.12.14.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.16.24.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.24.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.24.3  18-Sep-2004  skrll Sync with HEAD.
 1.16.24.2  24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.16.24.1  03-Aug-2004  skrll Sync with HEAD
 1.20.2.4  24-May-2005  riz Pull up revision 1.24 (requested by chs in ticket #1540):
kernfs does not support mmap(), remove code that pretends that it does.
 1.20.2.3  23-May-2004  tron branches: 1.20.2.3.2;
Pull up revision 1.23 (requested by atatat in ticket #374):
Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.
This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.
linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.20.2.2  15-May-2004  tron Pull up revision 1.22 (requested by cl in ticket #336):
Allow additional entries (files, subdirs) in kernfs. Also allow
defining additional kfstypes and provide hooks to run arbitrary code
for any vnodeop on the additional types.
 1.20.2.1  14-May-2004  jdc Pull up revision 1.21 (requested by cl in ticket #322).

Make lookup and readdir return the same inode number. kernfs_readdir
now uses kernfs_allocvp to map from kernfs entry to inode number,
kernfs_allocvp is now the only place where entries are mapped to inode
numbers. Also make KERNFS_FILENO not return random results for entries
not in kern_targets.
 1.20.2.3.2.1  24-May-2005  riz Pull up revision 1.24 (requested by chs in ticket #1540):
kernfs does not support mmap(), remove code that pretends that it does.
 1.23.10.1  28-May-2005  tron Pull up revision 1.24 (requested by chs in ticket #329):
kernfs does not support mmap(), remove code that pretends that it does.
 1.24.2.2  30-Dec-2006  yamt sync with head.
 1.24.2.1  21-Jun-2006  yamt sync with head.
 1.26.10.1  19-Apr-2006  elad sync with head.
 1.26.8.2  26-Jun-2006  yamt sync with head.
 1.26.8.1  01-Apr-2006  yamt sync with head.
 1.26.6.1  22-Apr-2006  simonb Sync with head.
 1.26.4.1  09-Sep-2006  rpaulo sync with head
 1.27.6.1  13-Jul-2006  gdamore Merge from HEAD.
 1.31.4.1  12-Jan-2007  ad Sync with head.
 1.32.48.1  03-Jul-2008  simonb Sync with head.
 1.32.46.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.44.1  04-May-2009  yamt sync with head.
 1.32.40.3  17-Jan-2009  mjf Sync with HEAD.
 1.32.40.2  28-Sep-2008  mjf Sync with HEAD.
 1.32.40.1  29-Jun-2008  mjf Sync with HEAD.
 1.33.2.1  19-Oct-2008  haad Sync with HEAD.
 1.34.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.36.6.1  05-Apr-2012  mrg sync to latest -current.
 1.36.2.1  17-Apr-2012  yamt sync with head
 1.37.12.1  10-Aug-2014  tls Rebase.
 1.37.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.40.32.1  12-Feb-2020  martin Pull up following revision(s) (requested by riastradh in ticket #702):

sys/miscfs/kernfs/kernfs_vfsops.c: revision 1.98
sys/miscfs/kernfs/kernfs_vnops.c: revision 1.163
sys/miscfs/kernfs/kernfs.h: revision 1.43

Use specfs vnops for specnodes in kernfs.

While here, don't filter out rootdev and rrootdev merely because
they're not cached.

Fixes the elusive /kern/rootdev and /kern/rrootdev nodes, which only
appeared sometimes when they felt like it, and fixes operations on
/kern/rootdev and /kern/rrootdev always returning EOPNOTSUPP.

We didn't seem to have a single PR for these issues but the following
PRs are all relevant:

PR bin/13564
PR kern/38265
PR kern/38778
PR kern/45974

XXX pullup-9, pullup-8, pullup-7, pullup-6, pullup-5, pullup-4, pullup-3, p=
ullup-2, pullup-1.4T...
 1.40.28.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.40.28.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.41.2.2  29-Feb-2020  ad Sync with head.
 1.41.2.1  17-Jan-2020  ad Sync with head.
 1.44.28.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed