Re: [RFC] killing boilerplate checks in ->link/->mkdir/->rename

From: Al Viro
Date: Thu Feb 02 2012 - 20:45:51 EST


On Fri, Feb 03, 2012 at 01:16:12AM +0000, Al Viro wrote:

> After looking a bit more: nlink_t is a f*cking mess. Almost any code
> using that type kernel-side is broken. Crap galore:
> * sometimes it's 32 bits, sometimes 16, sometimes 64. Essentially
> at random.
> * almost all have it unsigned, except for sparc32, where it's
> signed short [inherited from v7 via SunOS? BTW, in v6 it used to be even
> funnier - char, which is where ridiculous LINK_MAX == 127 comes from]
>
> IOW, nlink_t is an attractive nuisance - it's nearly impossible to use in
> a portable way and we are lucky that almost nobody tries to.

Incidentally, why the hell do we have
typedef __kernel_nlink_t nlink_t;
anyway? It's *not* exposed to userland and it's different from the
userland nlink_t (which is unsigned int on 32bit and unsigned long on 64bit).
Why not use __kernel_nlink_t (or explicitly-sized __uNN) in
arch/*/include/asm/stat.h and declare nlink_t kernel-side as __u32?

Why do we have daddr_t, while we are at it? There is exactly one user -
fs/freevxfs and there we definitely want a fixed-sized type.
--
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/