Re: [PATCH -mm] mm: Unify pte_to_pgoff and pgoff_to_pte helpers

From: Andrew Morton
Date: Wed Aug 14 2013 - 04:11:32 EST


On Wed, 14 Aug 2013 11:43:33 +0400 Cyrill Gorcunov <gorcunov@xxxxxxxxx> wrote:

> On Wed, Aug 14, 2013 at 12:33:36AM -0700, Andrew Morton wrote:
> > > > B_it_F_ield_OP_eration, Peter I don't mind to use any other
> > > > name, this was just short enough to type.
> > > >
> > >
> > > I think it would be useful to have a comment what it means and what
> > > v,r,m,l represent.
>
> Sure, maybe simply better names as value, rshift, mask, lshift would
> look more understandable. I'll try to use width for mask as well
> (which reminds me BFEXT helpers Andrew mentioned in this thread).
>
> > Can it be written in C with types and proper variable names and such
> > radical stuff?
>
> Could you elaborate? You mean inline helper or macro with type checks?

/*
* description goes here
*/
static inline pteval_t pte_bfop(pteval_t val, int rightshift, ...)
{
...
}

So much better! We really should only implement code in a macro if it
*has* to be done as a macro and I don't think that's the case here?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/