cache: assorted cleanups

This commit is contained in:
Mateusz Guzik 2021-01-24 21:04:01 +01:00
parent 1c7a65adb0
commit 868643e722

View File

@ -5078,20 +5078,6 @@ cache_fplookup_is_mp(struct cache_fpl *fpl)
* Debug ni_pathlen tracking.
*/
#ifdef INVARIANTS
static void
cache_fpl_pathlen_dec(struct cache_fpl *fpl)
{
cache_fpl_pathlen_sub(fpl, 1);
}
static void
cache_fpl_pathlen_inc(struct cache_fpl *fpl)
{
cache_fpl_pathlen_add(fpl, 1);
}
static void
cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n)
{
@ -5109,17 +5095,21 @@ cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n)
KASSERT(fpl->debug.ni_pathlen <= PATH_MAX,
("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen));
}
#else
static void __always_inline
cache_fpl_pathlen_dec(struct cache_fpl *fpl)
{
}
static void __always_inline
static void
cache_fpl_pathlen_inc(struct cache_fpl *fpl)
{
cache_fpl_pathlen_add(fpl, 1);
}
static void
cache_fpl_pathlen_dec(struct cache_fpl *fpl)
{
cache_fpl_pathlen_sub(fpl, 1);
}
#else
static void
cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n)
{
@ -5129,6 +5119,16 @@ static void
cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n)
{
}
static void
cache_fpl_pathlen_inc(struct cache_fpl *fpl)
{
}
static void
cache_fpl_pathlen_dec(struct cache_fpl *fpl)
{
}
#endif
static int __always_inline
@ -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,