Re: [patch-2.3.99-pre10-3] BUGFIX /proc/sys/fs/file-nr is wrong.

From: Tigran Aivazian (tigran@veritas.com)
Date: Fri May 26 2000 - 05:42:33 EST


On Thu, 25 May 2000, Bill Wendling wrote:
> } - {FS_NRFILE, "file-nr", &nr_files, 3*sizeof(int),
> } + {FS_NRFILE, "file-nr", &files_stat, 3*sizeof(int),
>
> This might not be "absolutely" correct either. C doesn't guarantee that a
> structure's size is the size of all its elements added together. There's
> byte padding and junk. Couldn't one just use sizeof(struct files_stat_struct)?

No. Because, if sizeof(struct files_stat_struct) != 3*sizeof(int), then it
is better to pass the right size and have some of the data be wrong
instead of passing the wrong size (and still have some of the data wrong).

Same thing applies to inodes_stat handling as well, if you noticed.

Regards,
Tigran

-
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/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:15 EST