Re: 2G file size limitation question

Linus Torvalds (torvalds@transmeta.com)
9 Jan 1998 20:01:19 GMT


In article <19980109180340Z92174-260+1@mea.tmt.tele.fi>,
Matti Aarnio <matti.aarnio@tele.fi> wrote:
>
> Yes and no. Well, at least the interfaces that FS modules
> get are somewhat mixed:
>
>long long ext2_file_lseek( FILP*, long long offset, int pos )
>ssize_t ext2_file_write( FILP*, char *buf, size_t len, loff_t *ppos)
> (read thru generic_file_read(), which params looks alike..)

Note that one reason there is mixing in the kernel is that I personally
prefer to have the types explicit in the code rather than using "size_t"
and other "standard" types in the kernel. So I've tried to avoid using
the standard types, but others have tended to like them..

The reason I dislike "size_t" &co is that it leads to stupid and
unnecessary problems: try

printk("%d", size_t_type_thing);

on a few different architectures, and you'll see what I mean (on some
architectures it will be correct, on other architectures it will
complain about a long argument but a integer format). To get rid of the
warning you have to use "%ld" and a cast to (long), which is just bad:
it means that the value might as well have been of type "long" in the
first place.

In user programs the standard types make more sense, but the kernel
really fixes the sizes of things anyway, so there is little real reason
to use the made-up sizes for anything that is internal to the kernel.

Linus