Re: [PATCH] vfs: replace ints with enum component_type for LAST_XXX

From: Jori Koolstra

Date: Wed Apr 01 2026 - 06:56:43 EST



> Op 01-04-2026 10:29 CEST schreef Amir Goldstein <amir73il@xxxxxxxxx>:
>
> > diff --git a/include/linux/namei.h b/include/linux/namei.h
> > index 58600cf234bc..e79ff97063e9 100644
> > --- a/include/linux/namei.h
> > +++ b/include/linux/namei.h
> > @@ -16,7 +16,7 @@ enum { MAX_NESTED_LINKS = 8 };
> > /*
> > * Type of the last component on LOOKUP_PARENT
> > */
> > -enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT};
> > +enum component_type {NORMAL, ROOT, DOT, DOTDOT};
> >
>
> Nah, I don't think it is a good idea to poluate the global namespace
> with constant as generic as NORMAL, ROOT

Fair enough. I thought also maybe we can keep this purely internal to namei.c,
but it turns out there is one user that I missed in fs/smb/server/vfs.c, so that
one has to be converted still as well.

>
> At the very least this needs a namespace prefix such as
> NDT_ (nameidata type)
>

Maybe I would prefer COMPONENT_XXX.

> But then I don't think it is worth the churn to rename LAST_ to NDT_
> so I would drop the constants name change altogether.
>

I mean if we are going to use a separate type for this might as well clean up
the semantics a bit. But I would be fine with keeping LAST_XXX as well.

> Thanks,
> Amir.

Thanks,
Jori.