On Feb 24, 2013, at 12:37 AM, Iain Hibbert <plu...@ogmig.net> wrote:
> On Sun, 24 Feb 2013, Matt Thomas wrote: > >> Module Name: src >> Committed By: matt >> Date: Sun Feb 24 06:20:24 UTC 2013 >> >> Modified Files: >> src/sys/sys: tty.h >> >> Log Message: >> Add a t_softc member to struct tty in which a driver can store a pointer >> to its softc. (analogous to if_softc in struct ifnet). > > Currently, all the tty drivers use a macro to extract an index to the > devices private cfdriver array from the dev_t that is formed from the > major/minor numbers and provided by the framework (and incidentally, > already stored in the tty structure as t_dev) > > So what is your intention with this change? Are you changing the design > and if so, has that been discussed on a public list? > > Having written tty drivers in the past, I do think this could do with a > redesign, but I also feel that all uses should remain consistent.. It's not a radical change. You can still use device_lookup_private on tp->t_dev but now there is a cheaper method. But store the sc pointer in tp->t_softc after tty_alloc and then use that to retrieve it. It's simply a little more efficient. As I indicated, if_softc already provides this functionality for struct ifnet.