From: Sergei Organov <osv@topconrd.ru>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Linux tty layer hackery: Heads up and RFC
Date: 21 Jul 2005 21:47:11 +0400 [thread overview]
Message-ID: <878y00831c.fsf@osv.topcon.com> (raw)
In-Reply-To: <1121967993.19424.18.camel@localhost.localdomain>
Alan Cox <alan@lxorguk.ukuu.org.uk> writes:
> At the moment tty buffers are attached directly to the tty. This is
> causing a lot of the problems related to tty layer locking, also
> problems at high speed and also with bursty data (such as occurs in
> virtualised environments)
>
> I'm working on ripping out the flip buffers and replacing them with a
> pool of dynamically allocated buffers. This allows both for old style
> "byte I/O" devices and also helps virtualisation and smart devices where
> large blocks of data suddenely materialise and need storing.
Great! Really good news!
>
> So far so good. Lots of drivers reference tty->flip.*. Several of them
> also call directly and unsafely into function pointers it provides. This
> will all break. Most drivers can use tty_insert_flip_char which can be
> kept as an API but others need more.
>
> At the moment I've added the following interfaces, if people think more
> will be needed now is a good time to say
>
> int tty_buffer_request_room(tty, size)
>
> Try and ensure at least size bytes are available, returns actual room
> (may be zero). At the moment it just uses the flipbuf space but that
> will change. Repeated calls without characters being added are not
> cumulative. (ie if you call it with 1, 1, 1, and then 4 you'll have four
> characters of space. The other functions will also try and grow buffers
> in future but this will be a more efficient way when you know block
> sizes.
>
> int tty_insert_flip_char(tty, ch, flag)
>
> As before insert a character if there is room. Now returns 1 for
> success, 0 for failure.
>
> int tty_insert_flip_string(tty, str, len)
>
> Insert a block of non error characters. Returns the number inserted.
>
> int tty_prepare_flip_string(tty, strptr, len)
>
> Adjust the buffer to allow len characters to be added. Returns a buffer
> pointer in strptr and the length available. This allows for hardware
> that needs to use functions like insl or mencpy_fromio.
As you are going to replace flip buffers with different implementation
anyway, isn't it better to get rid of "flip" in the interface names as
well (maybe providing some synonyms for backward compatibility)? What I
mean is that names like
tty_buffer_insert_char()
tty_buffer_insert_string()
for the new interfaces would probably make more sense.
Otherwise I find the interfaces you suggest just fine and suitable for
the task I was unable to achieve without ugly hacks using current flip
buffers interfaces (reliable high-speed bulk USB tty driver).
--
Sergei.
next prev parent reply other threads:[~2005-07-21 17:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-21 17:46 Linux tty layer hackery: Heads up and RFC Alan Cox
2005-07-21 17:47 ` Sergei Organov [this message]
2005-07-22 14:57 ` Rogier Wolff
2005-07-22 16:16 ` Alan Cox
2005-07-26 9:55 ` Mark Underwood
2005-07-26 11:11 ` Alan Cox
2005-07-26 12:38 ` Mark Underwood
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=878y00831c.fsf@osv.topcon.com \
--to=osv@topconrd.ru \
--cc=alan@lxorguk.ukuu.org.uk \
--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