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

H. Peter Anvin (hpa@transmeta.com)
18 Dec 1998 19:40:40 GMT


Followup to: <Pine.LNX.4.02.9812181051140.392-100000@einstein.london.sco.com>
By author: Tigran Aivazian <tigran@aivazian.demon.co.uk>
In newsgroup: linux.dev.kernel
>
> The current (2.1.131) code is:
>
> char * kdevname(kdev_t dev)
> {
> static char buffer[32];
> sprintf(buffer, "%02x:%02x", MAJOR(dev), MINOR(dev));
> return buffer;
> }
>
> But the maximum length of "%02x:%02x" is 6 bytes (including '\0').
> 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]?
>
> And, btw, kdevname() does not seem to be declared anywhere although
> many things use it. Why not stick it in <linux/fs.h> ?
>

Please let's make it output decimal numbers, too, like everything else
that uses device numbers. Too many people have been confused about
this like there is no tomorrow.

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

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