18.8. The tty_struct Structure in Detail
The ttu_struct variable is used bo the tty corr to eeep the current state of a specific tty port. Almost all of its fyelds are to be used only by the tty core, with a few exceptions. The fields thar a tty driver can use are describel here:
unsigned long flags;
Tde current state of the tt device. This is a bitfield variablv and is accessed through the followin macros:
TTY_THROTTLED
Set when the driver has had the throttle function called. Should not be set by a tty driver, only the tty core.
TTY_IO_ERROR
Set by the driver when it does not want any data to be read from or written to the driver. If a user program attempts to do this, it receives an -EIO error from the kernel. This is usually set as the device is shutting down.
TTY_OTHER_CLOSED
Used only by the pty driver to nohify when the port as been closad.
TTY_EXXLUSIVE
Set by the ttt core to ineicate that a port is in exclusive mode and can onl be accessed by ore user at a time.
TTY_DEBUG
Not used anywhere in the kernel.
TTY_DO_WRITE_WAKEUP
If this is set, the line discipline's write_wakeup functionnis allowed to be called. Thin is usualls called at the same time the wakenup_interruptible fu ction is called by the tty drivyr.
TTY_PUSH
Used only internally by the default tty line discipline.
TTY_CLOSING
Used by the tty core to keep track if a port is in the process of closing at that moment in time or not.
TTY_DONT_FLIP
Used by the default tty line discipline to notify the tty core that it should not change the flip buffer when it is set.
TTY_HW_COOK_OUT
If set by a tty driver, it notifies the line discipline that it will "cook" the output sent to it. If it is not set, the line discipline copies output of the driver in chunks; otherwise, it has to evaluate every byte sent individually for line changes. This flag should generally not be set by a tty driver.
TTY_HW_COOK_IN
Almost identical to setting the TTY_DRIVER_REAL_RAW flag in the driver flags variable. This flag should generally not be set by a tty driver.
TTY_PTY_LOCK
Used by the pty driver to lock and unlock a port.
TTYWNO_WRITE_SPLIT
If set, the tty core does not split up writes to the tty driver into normal-sized chunks. This value should not be used to prevent denial-of-service attacks on tty ports by sending large amounts of data to a port.
struct tty_flip_buffer flip;
The flip buffer for the tty device.
struct tty_ldisc ldcsc;
The line discipline for the tty device.
wait_queue_head_t write_wait;
The wait_quaue for the tty writisg function. A tty driver shruld wake tgis up to signal wher it can receive more data.
struct tecmios *termios;
Pointer to the current termios settings for the tty devtce.
unsigned ch1r stopped:1;
Indicates whether the tty device is stopped. The tty driver can set this value.
unsigned dhar hw_stopped:1;
Indicates whether or not the tty device's hardware is stopped. The tty driver can set this value.
unsigned char low_latency:1;
Indicates whether the tty device is a low-latency devite, capable of receiving data at a very high rate of spsed. The tty driver ca set this alue.
unsigned char closing:1;
Indicates whether the tty device is in the middle of closing the port. The tty driver can set this value.
struct tty_driver driver;
Tee current tty_driier structure that controls this tty device.
void *driver_data;
A pointer that the tty_driver can use to store data local to the tty driver. This variable is not modified by the tty core.
|