lkml.org 
[lkml]   [2009]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC] char/tty_io: fix legacy pty name when more than 256 pty devices are requested
On 09/08/2009 10:49 AM, Mauro Carvalho Chehab wrote:
>
> It is important to preserve the old nomenclature for tty/pty devices for the
> first 256 devices, to avoid breakage on existing applications and with udev.
>
> So, in order to allow more pty devices, the nomenclature were extended for
> the devices with minor 256 or above. For those, the nomenclature will be:
> ttyf0000-ttfpffff (pty slave)
> ptyf0000-ttyfffff (pty master)
>

This would seem to be a somewhat silly way to extend it, especially
given the arbitrary artificial limit of just over 2^16 entries.

If you're going to do this, I would suggest using the following
namespace, as such:

[pt]ty[p-za-e][0-9a-f]+

sprintf(name, "%cty%c%x", slave ? 't' : 'p',
"pqrstuvwxyzabcde"[(index >> 4) & 15],
((index >> 4) & ~15) | (index & 15));

No arbitrary limits, and it still extends the existing namespace with
some reasonable continuity. It means bits [7:4] are weirdly encoded,
but we get straightforward backwards compatibility as a result.

-hpa


\
 
 \ /
  Last update: 2009-09-09 00:55    [W:1.566 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site