[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nlink_t typedef, which is correct?



>In /usr/include/types.h (mntlib32) nlink_t is typedef'ed to short, whereas
>in minixfs.h (part of the minix filesystem release 6.0.4) it's typedef'ed to
>unsigned char.
>
>Both of these can't be correct, which one is?

The mint library is correct.  nlink_t is defined by POSIX as the type
of st st_nlink element of struct stat.  This element is a short, not a
char (actually it's supposed to be an unsigned short according to
mint's file.h...oops...but it's still a word sized element).

Minixfs should use its own type (i suggest mnlink_t in the same way as
it uses mgid_t for its internal version of a byte-sized gid) instead
of the POSIX-reserved name nlink_t.

Actually it would be better if minixfs didn't define any names ending
with _t as these are all reserved in the POSIX namespace. Perhaps
nlink_mt, gid_mt, and so on would be better for all these internal
types.

Cheers,
entropy