Re: Request for comments (kdev_t and friends...)

Martin Dalecki (dalecki@cs.net.pl)
Fri, 26 Nov 1999 10:54:37 +0100


Andries.Brouwer@cwi.nl wrote:
>
> Marcin,
>
> I just looked at your patch, but you make things much worse.
> A kdev_t is a pointer, not a struct.
>
> Going to a pointer is trivial, I have done it maybe ten times
> the past four years. Look at earlier posts of mine maybe one or
> two months ago.
>
> So, code like
> if (!dev)
> is OK - it tests whether the pointer is NULL.
> On the other hand,
> if (!kdev_t_to_nr(dev))
> is terrible.
>
> Notice that kdev_t_to_nr is something the kernel never wants
> to do - it is looking at certain numbers in the struct and
> assembling them to something that is written in a filesystem
> or returned by the stat call.

Maybe it is something he never want's but it is something
he does indeed very frequently. Basicaly NOT going to
a pointer in a first place just helps to identify correctly
all the places where this kdev_t get's used ;-)

--Marcin Dalecki

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