Lines Matching refs:the
4 Your guide to the ancient and twisted locking policies of the tty layer and
5 the warped logic behind them. Beware all ye who read on.
7 FIXME: still need to work out the full set of BKL assumptions and document
14 Line disciplines are registered with tty_register_ldisc() passing the
15 discipline number and the ldisc structure. At the point of registration the
17 the call returns success. If the call returns an error then it won't get
18 called. Do not re-use ldisc numbers as they are part of the userspace ABI
20 After the return the ldisc data has been copied so you may free your own
21 copy of the structure. You must not re-register over the top of the line
22 discipline even with the same data or your computer again will be eaten by
26 In ancient times this always worked. In modern times the function will
27 return -EBUSY if the ldisc is currently in use. Since the ldisc referencing
28 code manages the module counts this should not usually be a concern.
30 Heed this warning: the reference count field of the registered copies of the
31 tty_ldisc structure in the ldisc table counts the number of lines using this
32 discipline. The reference count of the tty_ldisc structure within a tty
33 counts the number of active users of the ldisc at this instant. In effect it
34 counts the number of threads of execution within an ldisc method (plus those
42 open() - Called when the line discipline is attached to
43 the terminal. No other call into the line
46 prevent the ldisc from being attached. Can sleep.
48 close() - This is called on a terminal when the line
49 discipline is being unplugged. At the point of
50 execution no further users will enter the
53 hangup() - Called when the tty line is hung up.
54 The line discipline should cease I/O to the tty.
55 No further calls into the ldisc code will occur.
58 write() - A process is writing data through the line
60 by the tty layer for the ldisc. May sleep.
63 open and close, and instructs the line discipline
66 chars_in_buffer() - (optional) Report the number of bytes in the input
70 The caller passes the old termios data and the
71 current data is in the tty. Called under the
75 read() - Move data from the line discipline to the user.
76 Multiple read calls may occur in parallel and the
80 poll() - Check the status for the poll/select calls. Multiple
83 ioctl() - Called when an ioctl is handed to the tty layer
84 that might be for the ldisc. Multiple ioctl calls
87 compat_ioctl() - Called when a 32 bit ioctl is handed to the tty layer
88 that might be for the ldisc. Multiple ioctl calls
93 receive_buf() - Hand buffers of bytes from the driver to the ldisc
99 is needed but always races versus calls. Thus the
104 from the ->write call from the ldisc as the ldisc
105 is permitted to call the driver write method from
108 dcd_change() - Report to the tty line the current DCD pin status
109 changes and the relative timestamp. The timestamp
115 Line discipline methods can call the following methods of the underlying
116 hardware driver through the function pointers within the tty->driver
119 write() Write a block of characters to the tty device.
120 Returns the number of characters accepted. The
124 put_char() Queues a character for writing to the tty device.
125 If there is no room in the queue, the character is
132 write_room() Returns the numbers of characters the tty driver
139 set_termios() Notify the tty driver that the device's termios
142 the "old" argument.
144 The API is defined such that the driver should return
145 the actual modes selected. This means that the
147 bits in the request it cannot fulfill to indicate
148 the actual modes being used. A device with no
152 throttle() Notify the tty driver that input buffers for the
155 sent to the tty.
157 unthrottle() Notify the tty driver that characters can now be
158 sent to the tty without fear of overrunning the
159 input buffers of the line disciplines.
161 stop() Ask the tty driver to stop outputting characters
162 to the tty device.
164 start() Ask the tty driver to resume sending characters
165 to the tty device.
167 hangup() Ask the tty driver to hang up the tty device.
169 break_ctl() (Optional) Ask the tty driver to turn on or off
170 BREAK status on the RS-232 port. If state is -1,
171 then the BREAK status should be turned on; if
176 wait_until_sent() Waits until the device has written out all of the
179 send_xchar() Send a high-priority XON/XOFF character to the device.
184 Line discipline methods have access to tty->flags field containing the
191 TTY_DO_WRITE_WAKEUP If set, causes the driver to call the ldisc's
197 calls on the tty to fail, returning -EIO.
199 TTY_OTHER_CLOSED Device is a pty and the other side has closed.
207 Callers to the line discipline functions from the tty layer are required to
208 take line discipline locks. The same is true of calls from the driver side
215 takes a handle to the line discipline in the tty and returns it. If no ldisc
216 is currently attached or the ldisc is being closed and re-opened at this
217 point then NULL is returned. While this handle is held the ldisc will not
222 Returns the ldisc reference and allows the ldisc to be closed. Returning the
223 reference takes away your right to call the ldisc functions until you take
228 Performs the same function as tty_ldisc_ref except that it will wait for an
229 ldisc change to complete and then return a reference to the new ldisc.
231 While these functions are slightly slower than the old code they should have
232 minimal impact as most receive logic uses the flip buffers and they only
233 need to take a reference when they push bits up through the driver.
236 functions are called with the ldisc unavailable. Thus tty_ldisc_ref will
246 close() - Called when a device is closed. At the point of
247 return from this call the driver must make no
250 write() - Called to write bytes to the device. May not
255 put_char() - Stuff a single character onto the queue. The
259 flush_chars() - Ask the kernel to write put_char queue
261 write_room() - Return the number of characters that can be stuffed
262 into the port buffers without overflow (or less).
266 ioctl() - Called when an ioctl may be for the driver
271 set_ldisc() - Notifier for discipline change. At the point this
272 is done the discipline is not yet usable. Can now
275 throttle() - Called by the ldisc to ask the driver to do flow
277 is the job of the ldisc layer.
279 unthrottle() - Called by the ldisc to ask the driver to stop flow
282 stop() - Ldisc notifier to the driver to stop output. As with
283 throttle the serializations with start() are down
284 to the ldisc layer.
286 start() - Ldisc notifier to the driver to start output.
288 hangup() - Ask the tty driver to cause a hangup initiated
289 from the host side. [Can sleep ??]
295 wait_until_sent() - Wait for characters to exit the hardware queue
296 of the driver. Can sleep
298 send_xchar() - Send XON/XOFF and if possible jump the queue with