Re: memory waste in fs/devices.c/kdevname()

Kurt Garloff (garloff@kg1.ping.de)
Fri, 18 Dec 1998 18:34:19 +0100


On Fri, Dec 18, 1998 at 03:27:01PM +0000, Jamie Lokier wrote:
> On Fri, Dec 18, 1998 at 12:41:12PM +0000, Tigran Aivazian wrote:
> > static char buffer[32];
> > sprintf(buffer, "%02x:%02x", MAJOR(dev), MINOR(dev));
> > But the maximum length of "%02x:%02x" is 6 bytes (including '\0').

You mean the length ... (it's constant)

> > We can throw in a couple of bytes "for good measure" and have
> > static char buffer[8] but why on earth do we declare it as [32]?
>
> You're right. Better change it to [42] ready for 64-bit major & minor
> numbers...

... what would result in 34 bytes (%08x%08x:%08x%08x), if my
brain-integrated calculator has no builtin Pentium.
42 of course, is a much more beautiful number ;-)

Seriously: Are we really going to 64:64 bits for maj:min device numbers ?
16:16 would be fine for the next 100 years (nobody wants to manage a box
harddisk with 64k terminals?), but we can go 32:32, if we think it's
necessary. But 64:64 ???

-- 
Kurt Garloff <K.Garloff@ping.de>  (Dortmund, FRG)
PGP key on http://student.physik.uni-dortmund.de/homepages/garloff

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