Linux Device Drivers (3rd Edition) [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Linux Device Drivers (3rd Edition) [Electronic resources] - نسخه متنی

Jonathan Corbet, Greg Kroah-Hartman, Alessandro Rubini

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








18.8. The tty_struct Structure in Detail


The tty_struct variable is


used by the tty core to keep the current state of a specific tty
port. Almost all of its fields are to be used only by the tty core,
with a few exceptions. The fields that a tty driver can use are
described here:

unsigned long flags;


The current state of the tty device. This is a bitfield variable and
is accessed through the following 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 notify when the port has been closed.


TTY_EXCLUSIVE


Set by the tty core to indicate that a port is in exclusive mode and
can only be accessed by one 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 function is allowed to be called.
This is usually called at the same time the
wake_up_interruptible function is called by the
tty driver.


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.


TTY_NO_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 ldisc;


The line discipline for the tty device.


wait_queue_head_t write_wait;


The wait_queue for the tty writing function. A
tty driver should wake this up to signal when it can receive more
data.


struct termios *termios;


Pointer to the current termios settings for the tty device.


unsigned char stopped:1;


Indicates whether the tty device is stopped. The tty driver can set
this value.


unsigned char 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 device, capable of
receiving data at a very high rate of speed. The tty driver can set
this value.


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;


The current tty_driver 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.




    / 202