aboutsummaryrefslogtreecommitdiff
path: root/sys/tools/vnode_if.awk
Commit message (Collapse)AuthorAgeFilesLines
* vfs: stop using SDT_PROBES_ENABLED in inlined opsMateusz Guzik2025-09-271-4/+9
| | | | No point after hot patching was introduced.
* vfs: Move DEBUG_VFS_LOCKS checks to INVARIANTSMark Johnston2025-08-031-3/+3
| | | | | | | | | | | | | | | | | | | It is easy to forget to configure DEBUG_VFS_LOCKS, and when one does, no vnode lock assertions are checked when INVARIANTS is configured, so bugs can arise. This has happened to me more than once, and the overhead over DEBUG_VFS_LOCKS does not appear to be high enough to prohibit folding it into INVARIANTS, so let's do that. The change makes vnode lock assertions useful in plain INVARIANTS kernels, and guards VOP debug routines on INVARIANTS rather than DEBUG_VFS_LOCKS. Further, invariants are now checked by plain assertions rather than having various sysctls to finely control what happens the checks fail. The extra complexity didn't seem particularly useful and is at odds with how we handle debugging most everywhere else. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51402
* vfs: Initial revision of inotifyMark Johnston2025-07-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an implementation of inotify_init(), inotify_add_watch(), inotify_rm_watch(), source-compatible with Linux. This provides functionality similar to kevent(2)'s EVFILT_VNODE, i.e., it lets applications monitor filesystem files for accesses. Compared to inotify, however, EVFILT_VNODE has the limitation of requiring the application to open the file to be monitored. This means that activity on a newly created file cannot be monitored reliably, and that a file descriptor per file in the hierarchy is required. inotify on the other hand allows a directory and its entries to be monitored at once. It introduces a new file descriptor type to which "watches" can be attached; a watch is a pseudo-file descriptor associated with a file or directory and a set of events to watch for. When a watched vnode is accessed, a description of the event is queued to the inotify descriptor, readable with read(2). Events for files in a watched directory include the file name. A watched vnode has its usecount bumped, so name cache entries originating from a watched directory are not evicted. Name cache entries are used to populate inotify events for files with a link in a watched directory. In particular, if a file is accessed with, say, read(2), an IN_ACCESS event will be generated for any watched hard link of the file. The inotify_add_watch_at() variant is included so that this functionality is available in capability mode; plain inotify_add_watch() is disallowed in capability mode. When a file in a nullfs mount is watched, the watch is attached to the lower vnode, such that accesses via either layer generate inotify events. Many thanks to Gleb Popov for testing this patch and finding lots of bugs. PR: 258010, 215011 Reviewed by: kib Tested by: arrowd MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315
* vnode_if: Remove some branching around SDT probes in VOP wrappersMark Johnston2025-05-221-7/+3
| | | | | | | | | | Now that SDT is implemented using hot-patching, SDT_PROBE* no longer introduces a branch instruction, so the SDT_PROBES_ENABLED() check in each VOP_*_APV() is not really worth preserving. Reviewed by: olce, kib Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50423
* vnode: Make the vop_vector reference a pointer to constMark Johnston2024-11-261-2/+2
| | | | | | No functional change intended. MFC after: 1 week
* sys: Remove ancient SCCS tags.Warner Losh2023-11-271-3/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* vnode_if: Don't add $FreeBSD$ to the outputWarner Losh2023-08-161-2/+0
| | | | Sponsored by: Netflix
* vfs: validate that vop vectors provide all or none fplookup vopsMateusz Guzik2023-04-061-0/+2
| | | | In order to prevent later susprises.
* Improve debuggability of VOP_* locking assertionsJason A. Harmening2023-01-191-4/+4
| | | | | | | | Include the phase and argument field to make it easier to determine at a glance where the failure originated. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D38091
* vfs: inline vops if there are no pre/post associated callsMateusz Guzik2020-07-301-1/+42
| | | | | | | | | | This removes a level of indirection from frequently used methods, most notably VOP_LOCK1 and VOP_UNLOCK1. Tested by: pho Notes: svn path=/head/; revision=363708
* vfs: stop null checking routines in vop wrappersMateusz Guzik2020-01-261-5/+7
| | | | | | | | | | | Calls to vop_bypass pass the same argument, but type casted to something else. Thus by replacing NULL routines with vop_bypass we avoid a runtime check. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23357 Notes: svn path=/head/; revision=357131
* vfs: allow tail call optimisation in vops in the common caseMateusz Guzik2019-12-161-7/+11
| | | | | | | | | | | | | | | Most frequently used vops boil down to checking SDT probes, doing the call and checking again. There is no vop_post/pre in their case but the check after the call prevents tail call optimisation from taking place. Instead, check once upfront. Kernels with debug or vops with non-empty vop_post still don't short circuit. Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D22739 Notes: svn path=/head/; revision=355791
* vfs: flatten vop vectorsMateusz Guzik2019-12-161-5/+38
| | | | | | | | | | | | | | | This eliminates the following loop from all VOP calls: while(vop != NULL && \ vop->vop_spare2 == NULL && vop->vop_bypass == NULL) vop = vop->vop_default; Reviewed by: jeff Tesetd by: pho Differential Revision: https://reviews.freebsd.org/D22738 Notes: svn path=/head/; revision=355790
* Avoid literal @generated tag in file-generating scriptsEd Maste2019-05-081-1/+4
| | | | | | | | | | | We don't want the generator itself tagged as a generated file. Reviewed by: cem Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20182 Notes: svn path=/head/; revision=347328
* Use @generated tag in generated filesEd Maste2019-05-071-1/+1
| | | | | | | | | | | | Multiple tools use @generated to identify generated files (for example, in a review Phabricator will by default hide diffs in generated files). Use the @generated tag in makeobjops.awk and vnode_if.awk as we've done for other generated files. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=347224
* Only call sigdeferstop() for NFS.Konstantin Belousov2018-10-231-2/+3
| | | | | | | | | | | | | | | | | | | | Use bypass to catch any NFS VOP dispatch and route it through the wrapper which does sigdeferstop() and then dispatches original VOP. NFS does not need a bypass below it, which is not supported. The vop offset in the vop_vector is added since otherwise it is impossible to get vop_op_t from the internal table, and I did not wanted to create the layered fs only to wrap NFS VOPs. VFS_OP()s wrap is straightforward. Requested and reviewed by: mjg (previous version) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D17658 Notes: svn path=/head/; revision=339672
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326023
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* save some bytes by using more concise SDT_PROBE<n> instead of SDT_PROBEAndriy Gapon2015-09-281-2/+2
| | | | | | | | | | | | SDT_PROBE requires 5 parameters whereas SDT_PROBE<n> requires n parameters where n is typically smaller than 5. Perhaps SDT_PROBE should be made a private implementation detail. MFC after: 20 days Notes: svn path=/head/; revision=288336
* dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINEAndriy Gapon2013-11-261-2/+2
| | | | | | | | | | | In its stead use the Solaris / illumos approach of emulating '-' (dash) in probe names with '__' (two consecutive underscores). Reviewed by: markj MFC after: 3 weeks Notes: svn path=/head/; revision=258622
* - For kernel compiled only with KDTRACE_HOOKS and not any lock debuggingAttilio Rao2013-11-251-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | option, unbreak the lock tracing release semantic by embedding calls to LOCKSTAT_PROFILE_RELEASE_LOCK() direclty in the inlined version of the releasing functions for mutex, rwlock and sxlock. Failing to do so skips the lockstat_probe_func invokation for unlocking. - As part of the LOCKSTAT support is inlined in mutex operation, for kernel compiled without lock debugging options, potentially every consumer must be compiled including opt_kdtrace.h. Fix this by moving KDTRACE_HOOKS into opt_global.h and remove the dependency by opt_kdtrace.h for all files, as now only KDTRACE_FRAMES is linked there and it is only used as a compile-time stub [0]. [0] immediately shows some new bug as DTRACE-derived support for debug in sfxge is broken and it was never really tested. As it was not including correctly opt_kdtrace.h before it was never enabled so it was kept broken for a while. Fix this by using a protection stub, leaving sfxge driver authors the responsibility for fixing it appropriately [1]. Sponsored by: EMC / Isilon storage division Discussed with: rstone [0] Reported by: rstone [1] Discussed with: philip Notes: svn path=/head/; revision=258541
* Further refine the handling of stop signals in the NFS client. TheJohn Baldwin2013-02-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | changes in r246417 were incomplete as they did not add explicit calls to sigdeferstop() around all the places that previously passed SBDRY to _sleep(). In addition, nfs_getcacheblk() could trigger a write RPC from getblk() resulting in sigdeferstop() recursing. Rather than manually deferring stop signals in specific places, change the VFS_*() and VOP_*() methods to defer stop signals for filesystems which request this behavior via a new VFCF_SBDRY flag. Note that this has to be a VFC flag rather than a MNTK flag so that it works properly with VFS_MOUNT() when the mount is not yet fully constructed. For now, only the NFS clients are set this new flag in VFS_SET(). A few other related changes: - Add an assertion to ensure that TDF_SBDRY doesn't leak to userland. - When a lookup request uses VOP_READLINK() to follow a symlink, mark the request as being on behalf of the thread performing the lookup (cnp_thread) rather than using a NULL thread pointer. This causes NFS to properly handle signals during this VOP on an interruptible mount. PR: kern/176179 Reported by: Russell Cattelan (sigdeferstop() recursion) Reviewed by: kib MFC after: 1 month Notes: svn path=/head/; revision=247116
* Fix build on ARM (and probably other platforms)Oleksandr Tymoshenko2012-12-281-1/+1
| | | | Notes: svn path=/head/; revision=244765
* - Add new machine parsable KTR macros for timing events.Jeff Roberson2012-12-191-20/+7
| | | | | | | | | | - Use this new format to automatically handle syscalls and VOPs. This changes the earlier format but is still human readable. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=244445
* Make vnode_if.awk parse vnode operations with underscores, like VOP_FOO_BAR.Mikolaj Golub2012-02-211-1/+1
| | | | | | | | Reviewed by: kib MFC after: 1 week Notes: svn path=/head/; revision=231975
* Add an extra comment to the SDT probes definition. This allows us to getRui Paulo2010-08-221-2/+2
| | | | | | | | | | | | use '-' in probe names, matching the probe names in Solaris.[1] Add userland SDT probes definitions to sys/sdt.h. Sponsored by: The FreeBSD Foundation Discussed with: rwaston [1] Notes: svn path=/head/; revision=211616
* Add SDT DTrace probes for VFS vnode operations in the vfs:vopRobert Watson2009-03-291-0/+12
| | | | | | | | | | | | | | | provider namespace. These are inserted dynamically into the VOP_..._AP() functions created from vnode_if.src. Each VOP has entry and return probes, as arg0 the primary vnode, arg1 the vnode operation argument structure pointer, providing access to IN and OUT arguments, and for return probes, arg2 the return value. MFC after: 1 month Sponsored by: Google, Inc. Notes: svn path=/head/; revision=190518
* Remove some unused and broken code that attempted to not invoke lockingJohn Baldwin2008-11-031-6/+0
| | | | | | | | asserts on NULL vnode pointers. All the vnode assertion routines already check for NULL vnode pointers. Notes: svn path=/head/; revision=184598
* - Add two checks for syntax errorsDiomidis Spinellis2006-05-301-7/+13
| | | | | | | | - Improve error reporting - Remove redundant conditionals Notes: svn path=/head/; revision=159083
* Assertion code specifications are introduced using special characterDiomidis Spinellis2006-05-301-5/+5
| | | | | | | | sequences that are distinct from comments. %% is used for argument locks; %! for pre- and post-conditions. Notes: svn path=/head/; revision=159082
* Update usage comment to match reality.Diomidis Spinellis2006-05-261-1/+2
| | | | Notes: svn path=/head/; revision=158936
* Eradicate caddr_t from the VFS API.Dag-Erling Smørgrav2005-12-141-2/+2
| | | | Notes: svn path=/head/; revision=153400
* Nuke vnodeop_desc.vdesc_transports, which has been unused since the dawnDag-Erling Smørgrav2005-12-141-2/+1
| | | | | | | of time (or the inception of ncvs, whichever came last) Notes: svn path=/head/; revision=153397
* Allow EVFILT_VNODE events to work on every filesystem type, not justSuleiman Souhlal2005-06-091-9/+6
| | | | | | | | | | | | | | | | | | UFS by: - Making the pre and post hooks for the VOP functions work even when DEBUG_VFS_LOCKS is not defined. - Moving the KNOTE activations into the corresponding VOP hooks. - Creating a MNTK_NOKNOTE flag for the mnt_kern_flag field of struct mount that permits filesystems to disable the new behavior. - Creating a default VOP_KQFILTER function: vfs_kqfilter() My benchmarks have not revealed any performance degradation. Reviewed by: jeff, bde Approved by: rwatson, jmg (kqueue changes), grehan (mentor) Notes: svn path=/head/; revision=147198
* - Add the character "E" to the understood lock types. This meansJeff Roberson2005-04-111-0/+2
| | | | | | | | | the VOP requires an exclusive lock. Sponsored by: Isilon Systems, Inc. Notes: svn path=/head/; revision=144907
* Add VOP_FOO_APV() which takes a pointer to the vop_vector.Poul-Henning Kamp2005-02-081-6/+11
| | | | | | | | | | This allows stacked or partitioned filesystems to say "Continue the normal resolution from here", for instace from FFS to UFS. Use VNASSERT() instead of KASSERT(). Notes: svn path=/head/; revision=141515
* Get rid of the VDESC() macro while the pot is boiling anyway, it isPoul-Henning Kamp2005-01-131-2/+2
| | | | | | | | only used from generate files now, so we might as well generate the right stuff from the start. Notes: svn path=/head/; revision=140166
* Change the generated VOP_ macro implementations to improve type checkingPoul-Henning Kamp2005-01-131-48/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and KASSERT coverage. After this check there is only one "nasty" cast in this code but there is a KASSERT to protect against the wrong argument structure behind that cast. Un-inlining the meat of VOP_FOO() saves 35kB of text segment on a typical kernel with no change in performance. We also now run the checking and tracing on VOP's which have been layered by nullfs, umapfs, deadfs or unionfs. Add new (non-inline) VOP_FOO_AP() functions which take a "struct foo_args" argument and does everything the VOP_FOO() macros used to do with checks and debugging code. Add KASSERT to VOP_FOO_AP() check for argument type being correct. Slim down VOP_FOO() inline functions to just stuff arguments into the struct foo_args and call VOP_FOO_AP(). Put function pointer to VOP_FOO_AP() into vop_foo_desc structure and make VCALL() use it instead of the current offsetoff() hack. Retire vcall() which implemented the offsetoff() Make deadfs and unionfs use VOP_FOO_AP() calls instead of VCALL(), we know which specific call we want already. Remove unneeded arguments to VCALL() in nullfs and umapfs bypass functions. Remove unused vdesc_offset and VOFFSET(). Generally improve style/readability of the generated code. Notes: svn path=/head/; revision=140165
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-071-1/+2
| | | | Notes: svn path=/head/; revision=139825
* Rather than casting through a (void *) to avoid the aliasing warning,Warner Losh2004-12-131-3/+3
| | | | | | | | | | | | do things correctly from an aliasing perspective. Put the vop_generic_args element as the first element for all the vop_*_args and adjust the code to take the address of that instead of the structure. OK'd based on a vague description by: phk Notes: svn path=/head/; revision=138789
* Cast from the specific vop_*_args to vop_generic_args via a (void *)Warner Losh2004-12-131-1/+1
| | | | | | | | | | | | | pointer to eliminate the hundreds of warnings that we have in tree at the moment. # Chances are good that all the struct vop_*_args should have, as its # first element, the struct vop_generic_args, and when necessary to # reference it, we just take its address rather than going through # this double case. Notes: svn path=/head/; revision=138780
* Back when VOP_* was introduced, we did not have new-style structPoul-Henning Kamp2004-12-011-7/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initializations but we did have lofty goals and big ideals. Adjust to more contemporary circumstances and gain type checking. Replace the entire vop_t frobbing thing with properly typed structures. The only casualty is that we can not add a new VOP_ method with a loadable module. History has not given us reason to belive this would ever be feasible in the the first place. Eliminate in toto VOCALL(), vop_t, VNODEOP_SET() etc. Give coda correct prototypes and function definitions for all vop_()s. Generate a bit more data from the vnode_if.src file: a struct vop_vector and protype typedefs for all vop methods. Add a new vop_bypass() and make vop_default be a pointer to another struct vop_vector. Remove a lot of vfs_init since vop_vector is ready to use from the compiler. Cast various vop_mumble() to void * with uppercase name, for instance VOP_PANIC, VOP_NULL etc. Implement VCALL() by making vdesc_offset the offsetof() the relevant function pointer in vop_vector. This is disgusting but since the code is generated by a script comparatively safe. The alternative for nullfs etc. would be much worse. Fix up all vnode method vectors to remove casts so they become typesafe. (The bulk of this is generated by scripts) Notes: svn path=/head/; revision=138290
* emit a "typedef vop_foo_t(struct vop_foo_args *);" which we can usePoul-Henning Kamp2004-12-011-0/+1
| | | | | | | to prototype VOP functions with. Notes: svn path=/head/; revision=138266
* Remove advertising clause from University of California Regent's license,Warner Losh2004-04-071-4/+0
| | | | | | | | | per letter dated July 22, 1999. Approved by: core Notes: svn path=/head/; revision=127976
* Don't check the state of the vnode interlock if the specification saysDon Lewis2003-06-221-1/+7
| | | | | | | | | | that the lock should not be checked. Skip the lock assertion checks for *vpp or any other pointer to a vnode pointer if vpp (or equivalent) is NULL. Notes: svn path=/head/; revision=116694
* The assertions generated to test VFS locking never included checksStefan Eßer2003-06-201-0/+2
| | | | | | | | | | | | | | | | | | | for vnodes reached through double indirection (i.e. **vpp). This is worked-around by special-casing the identifier "vpp" (adding one level of indirection). The alternative fix mentioned in the PR had required substantial changes to this script. In case there are locking violations that had been hidden without this patch, they may suddenly show up, now ... This change does not affect code compiled without DEBUG_VFS_LOCKS. PR: kern/46652 Notes: svn path=/head/; revision=116614
* - Move ASSERT_VOP_*LOCK* functionality into functions in vfs_subr.cJeff Roberson2002-09-261-1/+1
| | | | | | | | | | - Make the VI asserts more orthogonal to the rest of the asserts by using a new, common vfs_badlock() function and adding a 'str' arg. - Adjust generated ASSERTS to match the new prototype. - Adjust explicit ASSERTS to match the new prototype. Notes: svn path=/head/; revision=103986
* - Automatically generate and insert KTR points in all VOPs.Jeff Roberson2002-09-231-0/+24
| | | | Notes: svn path=/head/; revision=103833
* - Add two new debugging macros: ASSERT_VI_LOCKED and ASSERT_VI_UNLOCKEDJeff Roberson2002-08-211-0/+1
| | | | | | | | | | | - Use the new VI asserts in place of the old mtx_assert checks. - Add the VI asserts to the automated lock checking in the VOP calls. The interlock should not be held across vops with a few exceptions. - Add the vop_(un)lock_{pre,post} functions to assert that interlock is held when LK_INTERLOCK is set. Notes: svn path=/head/; revision=102210