[RFC][PATCH 1/3] Move parts of init_dev() into new functions

sukadev at us.ibm.com sukadev at us.ibm.com
Mon Aug 25 15:01:25 PDT 2008


Alan Cox [alan at lxorguk.ukuu.org.uk] wrote:
| On Mon, 25 Aug 2008 13:11:10 -0700
| sukadev at us.ibm.com wrote:
| 
| > 
| > init_dev() is doing too many things all in one function, making it
| > harder to understand/extend. This and following two patches attempt
| > to simplify/cleanup the interface a bit.
| > 
| > Only touch tested at this point. Appreciate any comments :-)
| 
| Well this code is very much in flux so I really don't want to get further
| changes mixed up into the plan at the wrong moment. That said:

Ok. Do let me know if there are pieces I can help with.

| 
| > +/*
| > + * 	find_tty() - find an existing tty, if any
| > + * 	@driver: the driver for the tty
| > + * 	@idx:	 the minor number
| 
| This fits very well with where I want to end up - which is
| 
| 
| 	tty = driver->ops->something(driver, idx);

That looks like a good idea. With multiple pts instances, we would also
need an 'instance' parameter to uniquely identify the pty. Other tty
devices could set their 'instance' to NULL.

It could be a void *, although internally if it is the pts inode, we
could optimize devpts (as Peter Anvin pointed out).

By extension, maybe the tty layer would need another interface to determine
the instance:

	instance =  driver->ops->get_instance(driver, inode, other_stuff) 

using this we find the tty

	tty = driver->ops->something(driver, instance, idx);


More information about the Containers mailing list