aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2021-01-24 20:04:01 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2021-01-25 19:45:24 +0000
commit868643e7229b7959024880cda396fef87602b948 (patch)
tree25034e3cdd12d79e2dea01a96b1657878cdcfa28
parent1c7a65adb002cf96bda1f72d9a26dd4237368263 (diff)
downloadsrc-868643e7229b7959024880cda396fef87602b948.tar.gz
src-868643e7229b7959024880cda396fef87602b948.zip
cache: assorted cleanups
-rw-r--r--sys/kern/vfs_cache.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index 9d3b935a3047..e3098ac7c5d5 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -5079,54 +5079,54 @@ cache_fplookup_is_mp(struct cache_fpl *fpl)
*/
#ifdef INVARIANTS
static void
-cache_fpl_pathlen_dec(struct cache_fpl *fpl)
+cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n)
{
- cache_fpl_pathlen_sub(fpl, 1);
+ fpl->debug.ni_pathlen += n;
+ KASSERT(fpl->debug.ni_pathlen <= PATH_MAX,
+ ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen));
}
static void
-cache_fpl_pathlen_inc(struct cache_fpl *fpl)
+cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n)
{
- cache_fpl_pathlen_add(fpl, 1);
+ fpl->debug.ni_pathlen -= n;
+ KASSERT(fpl->debug.ni_pathlen <= PATH_MAX,
+ ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen));
}
static void
-cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n)
+cache_fpl_pathlen_inc(struct cache_fpl *fpl)
{
- fpl->debug.ni_pathlen += n;
- KASSERT(fpl->debug.ni_pathlen <= PATH_MAX,
- ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen));
+ cache_fpl_pathlen_add(fpl, 1);
}
static void
-cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n)
+cache_fpl_pathlen_dec(struct cache_fpl *fpl)
{
- fpl->debug.ni_pathlen -= n;
- KASSERT(fpl->debug.ni_pathlen <= PATH_MAX,
- ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen));
+ cache_fpl_pathlen_sub(fpl, 1);
}
#else
-static void __always_inline
-cache_fpl_pathlen_dec(struct cache_fpl *fpl)
+static void
+cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n)
{
}
-static void __always_inline
-cache_fpl_pathlen_inc(struct cache_fpl *fpl)
+static void
+cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n)
{
}
static void
-cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n)
+cache_fpl_pathlen_inc(struct cache_fpl *fpl)
{
}
static void
-cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n)
+cache_fpl_pathlen_dec(struct cache_fpl *fpl)
{
}
#endif
@@ -5258,7 +5258,7 @@ cache_fplookup_parse_advance(struct cache_fpl *fpl)
*
* Lockless lookup tries to elide checking for spurious slashes and should they
* be present is guaranteed to fail to find an entry. In this case the caller
- * must check if the name starts with a slash and this call routine. It is
+ * must check if the name starts with a slash and call this routine. It is
* going to fast forward across the spurious slashes and set the state up for
* retry.
*/
@@ -5342,11 +5342,13 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error)
* Hack: handle O_SEARCH.
*
* Open Group Base Specifications Issue 7, 2018 edition states:
+ * <quote>
* If the access mode of the open file description associated with the
* file descriptor is not O_SEARCH, the function shall check whether
* directory searches are permitted using the current permissions of
* the directory underlying the file descriptor. If the access mode is
* O_SEARCH, the function shall not perform the check.
+ * </quote>
*
* Regular lookup tests for the NOEXECCHECK flag for every path
* component to decide whether to do the permission check. However,