From: Alan Cox <alan@redhat.com>
To: Christoph Hellwig <hch@infradead.org>, Alan Cox <alan@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: PATCH: tty ldisc locking/ordering
Date: Fri, 10 Sep 2004 12:01:40 -0400 [thread overview]
Message-ID: <20040910160140.GA24179@devserv.devel.redhat.com> (raw)
In-Reply-To: <20040910165520.A25852@infradead.org>
On Fri, Sep 10, 2004 at 04:55:20PM +0100, Christoph Hellwig wrote:
> > +return -EBUSY if the ldisc is currently in use. Since the ldisc referencing
> > +code manages the module counts this should not usually be a concern.
>
> So what is a module supposed to do if this fails? It's usually called from
> module_exit so there's no way to recover.
Thats an interesting question. For the modular case we manage owner counts
so I think it cannot fail for modules using it at that point. If you want to
rescind a line discipline at some other time however then that isnt true.
> > +Three calls are now provided
> > +
> > + ldisc = tty_ldisc_ref(tty);
> > +
> > +takes a handle to the line discipline in the tty and returns it. If no ldisc
> > +is currently attached or the ldisc is being closed and re-opened at this
> > +point then NULL is returned. While this handle is held the ldisc will not
> > +change or go away.
> > +
> > + tty_ldisc_deref(ldisc)
>
> We tend to call these _get/_put just about everywhere else in the kernel,
> maybe some consisteny is a good idea?
ldisc_get and ldisc_put are used for taking references to each ldisc class
ldisc_ref/deref to each instance of the ldisc class. The two are not the
same thing in the tty layer. The count on the class tells you when you can
unload the module, the count on the driver is users of that instance.
When I named them it seemed that the get/put methods belonged with the case
that behaves most like the other _get/_put cases
Thoughts - I've not found a simple answer for this one ?
Alan
prev parent reply other threads:[~2004-09-10 16:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-10 15:38 PATCH: tty ldisc locking/ordering Alan Cox
2004-09-10 15:55 ` Christoph Hellwig
2004-09-10 16:01 ` Alan Cox [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040910160140.GA24179@devserv.devel.redhat.com \
--to=alan@redhat.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox