Re: [PATCH v2] vfs: replace ints with enum component_type for LAST_XXX
From: Al Viro
Date: Tue Apr 21 2026 - 23:36:02 EST
On Sun, Apr 19, 2026 at 06:16:16PM +0200, Jori Koolstra wrote:
> Several functions in namei.c take an "int *type" parameter, such as
> filename_parentat(). To know what values this can take you have to find
> the anonymous struct that defines the LAST_XXX values.
To find _what_, again?
> I would argue
> that the readability of the code is improved by making this an explicit
> type.
Do argue, then. How does that improve readability?
What I see is a lot of churn. Incidentally, I'm not at all sure that we
should expose those outside of fs/namei.c - if you look at the sole place
where any of those are used anywhere else you'll see this:
err = vfs_path_parent_lookup(filename, flags,
path, &last, &type,
root_share_path);
if (err)
return err;
if (unlikely(type != LAST_NORM)) {
path_put(path);
return -ENOENT;
}
with the only other caller of vfs_path_parent_lookup() being
err = vfs_path_parent_lookup(to, lookup_flags | LOOKUP_BENEATH,
&new_path, &new_last, &new_type,
&share_conf->vfs_path);
if (err)
goto out1;
and having no uses of new_type whatsoever. Smells like missing
check _and_ wrong calling conventions...
Do we ever want to allow anything other thant LAST_NORM in any of
the users?