Re: [PATCH RFC] char/tty_io: fix legacy pty name when more than 256pty devices are requested

From: Mauro Carvalho Chehab
Date: Tue Sep 08 2009 - 22:55:28 EST


Em Tue, 08 Sep 2009 17:26:39 -0700
"H. Peter Anvin" <hpa@xxxxxxxxx> escreveu:

> Correct. You're missing the point: if you follow my recipe, the legacy
> names fall out of the same algorithm. The first 256 will have the
> traditional names, fully compatible, the 256th entry will be
> /dev/ttyp10, and so on.
>
> >>
> >> sprintf(name, "%cty%c%x", slave ? 't' : 'p',
> >> "pqrstuvwxyzabcde"[(index >> 4) & 15],
> >> ((index >> 4) & ~15) | (index & 15));

> > But it will also be a little more weird.
>
> IMO, no less weird than a random shift from one naming algorithm to
> another in the middle of the sequence.

Ok, your algorithm will be fully compatible with the old naming system, as
you're encoding the nibbles on this order:
[7:4][3:0][*:8]

>From one side, I liked the idea of not having any arbitrary maximum limit, but
from other side, It seems easier to implement than to describe it in English,
at devices.txt. Maybe the solution is to explain it by examples.

Also, if we look at the current device designation, we already have some rule
changes.

For example, for SCSI discs, there are lots of different majors: major 8 (for
the first 16 disks), major 65 (for the next 16 disks), major 66 (for the next
16 disks), major 68 (for more 16 disks)... For sure something that comes from
the time where minors were limited to 256.

Another example: major 112 block has a new rule for devices above 26 (well,
something close to what you're proposing), except that they are just reverting
the nibbles order, instead of using a weird order just to keep backward
compatibility.

Anyway, I'll prepare a new RFC using your algorithm and documenting it.

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/