lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 17 Nov 2010 14:19:03 -0800
From:	Greg KH <>
To:	Timur Tabi <>
Cc:	Arnd Bergmann <>,
	Linux Kernel Mailing List <>,
	Scott Wood <>,
	Stuart Yoder <>
Subject: Re: How do I choose an arbitrary minor number for my tty device?

On Wed, Nov 17, 2010 at 04:10:21PM -0600, Timur Tabi wrote:
> Greg KH wrote:
> > What is ePAPR?
> It's a specification for an interface between the boot loader and the operating
> system.  It's based on the device tree model that exists on PowerPC today.
> ePAPR defines a bunch of extensions, including one for hypervisors.  The byte
> channel concept is an example of that.
> > Why would you need this mapping?  Just do a first-come-first serve
> > assignment of tty minor devices like all other subsystems do (usb,
> > serial, acm, etc.)
> Without some kind of mapping, there's no way for an application to know which
> /dev entry to open.  Each byte channel goes to a different
> > 
> > sysfs will show the representation between your ePAPR device "handle"
> > and the tty device minor just fine, as it does today for those other
> > types of devices.
> I don't see how.  A byte channel node defines several properties, one of which
> could be a text string that acts as a label.  So if an application is looking
> for the "channel-to-partition-two" byte channel, it can search for that string
> in the device tree.  Once it finds the matching node, it can extract the byte
> channel handle.
> At this point, the application will want to open a /dev entry that corresponds
> to that byte channel handle.  This is the piece I'm missing with the tty layer.
> If I want to create a regular character device, I can do this:
> bc->dev_id = MKDEV(MAJOR(dev_id), MINOR(dev_id) + i);
> device_create(ehv_bc_class, NULL, bc->dev_id, bc, "bc%u", bc->handle);
> Here, I control the name of the /dev entry via "bc%u".  I want something similar
> for tty devices.

No, you want to have a tty device attached to your "byte channel
device".  That will give you the correct mapping here.  Your tty device
number is sequencial and has nothing in its name to do with your "byte
channel device number" just like ttyS1 has nothing in its pci device id
that it lives on with my multi-port serial card.

> > Bonus being that udev will create a persistant device id for your tty
> > device based on that handle so you can just open that if you want to, no
> > need to get the kernel involved in sparse minor mappings at all.
> I'm not sure I understand that.  In order for udev to do this, I need to tell it
> what the byte channel handle actually is.  How do I do that using the tty layer?

You just create your tty device and assign the parent of it to be your
"byte channel device".  Just like we do for PCI, USB, and all other bus
device types.

I think you are forgetting that your byte channel devices must be
"devices" in the system here, right?  There is a 'struct bus_id" for
your bus that these devices live on.  Then you create a tty device in
your tty driver that attaches to the byte channel that shows up as a tty
device on your bus.

Does that help explain things a bit better?


greg k-h
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists