Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Feb 1995 03:39:12 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        pst@shockwave.com, ugen@netvision.net.il
Cc:        current@FreeBSD.org
Subject:   Re: snp(4)/watch(8) code review comments
Message-ID:  <199502231639.DAA01977@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I want to add a new field to cdevsw[] that is a vector to a function in the
>driver that will return a pointer to the right struct tty element given a
>major/minor number.  This sort of decision needs to be done locally to the
>driver to account for things like major/minor number masking (e.g. cua0 vs
>ttyd1 in the sio driver).

>Does anyone have an objection to my adding this new field?  It will simply
>be NULL for any device not supporting that vector and all invocations of it
>test for non-NULL first before calling.

A good idea...except I'd like to remove the tty struct in the cdevsw
completely.  It is currently only used (officially) by ttselect() and
could easily be replaced by a new arg to ttselect().  Having it in the
struct forces all tty drivers to allocate in the same way as well as
special select routines to clip the minor numbers.

A function field would be flexible enough to handle these problems nicely.
Do you need to call it for possibly-non-open devices?  This would inhibit
really simple implementations such as `table[minor(dev) & MASK]->tty'
(the table can only be guaranteed to be initialized for open devs).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199502231639.DAA01977>