[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 18:18:07 PDT 2008


H. Peter Anvin [hpa at zytor.com] wrote:
> sukadev at us.ibm.com wrote:
>>>
>>> 	tty = driver->ops->get_tty(driver, inode [, other_stuff?]);
>> Can the inode be used to identify the driver too ?  (but inode to driver
>> mapping is not trivial atm).
>
> It can, but it's an O(n) operation in the number of registered drivers.  
> However, we can only call the above if we know the driver in the first 
> place so such a lookup is rather pointless.

Yes, we know the driver, but do we need to pass it into ->get_tty() ?

Passing it in (or having the operation compute from inode) has advantage
of allowing drivers to share code if necessary.

	common_get_tty(driver, inode)
	{
		if (is_ptmx_driver(driver))
			something;
		else // pts driver
			something_else;
	}



More information about the Containers mailing list