On Maw, 2005-11-08 at 15:06 +0100, Oliver Neukum wrote:
> Am Dienstag, 8. November 2005 00:47 schrieb Andrew Morton:
> > Guys, I had to fix a clash between recent changes in this file and Alan's
> > rework of the tty buffering scheme.  I'm not 100% confident in the result.
> 
> Are the change to the tty layer documented somewhere?

Linux-kernel July 21st - pasted again below. Since then _flags variants
have been added which let you do blocks of data + flags.

The big thing is that the tty layer now does real buffering so all the
horrible driver hacks can go away.

-----

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.

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.


I've converted a fair number of drivers to this API ready and I'll post
some patches for review soon.



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to