![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 #ifndef _LINUX_TTY_DRIVER_H 0003 #define _LINUX_TTY_DRIVER_H 0004 0005 #include <linux/export.h> 0006 #include <linux/fs.h> 0007 #include <linux/kref.h> 0008 #include <linux/list.h> 0009 #include <linux/cdev.h> 0010 #include <linux/termios.h> 0011 #include <linux/seq_file.h> 0012 0013 struct tty_struct; 0014 struct tty_driver; 0015 struct serial_icounter_struct; 0016 struct serial_struct; 0017 0018 /** 0019 * struct tty_operations -- interface between driver and tty 0020 * 0021 * @lookup: ``struct tty_struct *()(struct tty_driver *self, struct file *, 0022 * int idx)`` 0023 * 0024 * Return the tty device corresponding to @idx, %NULL if there is not 0025 * one currently in use and an %ERR_PTR value on error. Called under 0026 * %tty_mutex (for now!) 0027 * 0028 * Optional method. Default behaviour is to use the @self->ttys array. 0029 * 0030 * @install: ``int ()(struct tty_driver *self, struct tty_struct *tty)`` 0031 * 0032 * Install a new @tty into the @self's internal tables. Used in 0033 * conjunction with @lookup and @remove methods. 0034 * 0035 * Optional method. Default behaviour is to use the @self->ttys array. 0036 * 0037 * @remove: ``void ()(struct tty_driver *self, struct tty_struct *tty)`` 0038 * 0039 * Remove a closed @tty from the @self's internal tables. Used in 0040 * conjunction with @lookup and @remove methods. 0041 * 0042 * Optional method. Default behaviour is to use the @self->ttys array. 0043 * 0044 * @open: ``int ()(struct tty_struct *tty, struct file *)`` 0045 * 0046 * This routine is called when a particular @tty device is opened. This 0047 * routine is mandatory; if this routine is not filled in, the attempted 0048 * open will fail with %ENODEV. 0049 * 0050 * Required method. Called with tty lock held. May sleep. 0051 * 0052 * @close: ``void ()(struct tty_struct *tty, struct file *)`` 0053 * 0054 * This routine is called when a particular @tty device is closed. At the 0055 * point of return from this call the driver must make no further ldisc 0056 * calls of any kind. 0057 * 0058 * Remark: called even if the corresponding @open() failed. 0059 * 0060 * Required method. Called with tty lock held. May sleep. 0061 * 0062 * @shutdown: ``void ()(struct tty_struct *tty)`` 0063 * 0064 * This routine is called under the tty lock when a particular @tty device 0065 * is closed for the last time. It executes before the @tty resources 0066 * are freed so may execute while another function holds a @tty kref. 0067 * 0068 * @cleanup: ``void ()(struct tty_struct *tty)`` 0069 * 0070 * This routine is called asynchronously when a particular @tty device 0071 * is closed for the last time freeing up the resources. This is 0072 * actually the second part of shutdown for routines that might sleep. 0073 * 0074 * @write: ``int ()(struct tty_struct *tty, const unsigned char *buf, 0075 * int count)`` 0076 * 0077 * This routine is called by the kernel to write a series (@count) of 0078 * characters (@buf) to the @tty device. The characters may come from 0079 * user space or kernel space. This routine will return the 0080 * number of characters actually accepted for writing. 0081 * 0082 * May occur in parallel in special cases. Because this includes panic 0083 * paths drivers generally shouldn't try and do clever locking here. 0084 * 0085 * Optional: Required for writable devices. May not sleep. 0086 * 0087 * @put_char: ``int ()(struct tty_struct *tty, unsigned char ch)`` 0088 * 0089 * This routine is called by the kernel to write a single character @ch to 0090 * the @tty device. If the kernel uses this routine, it must call the 0091 * @flush_chars() routine (if defined) when it is done stuffing characters 0092 * into the driver. If there is no room in the queue, the character is 0093 * ignored. 0094 * 0095 * Optional: Kernel will use the @write method if not provided. Do not 0096 * call this function directly, call tty_put_char(). 0097 * 0098 * @flush_chars: ``void ()(struct tty_struct *tty)`` 0099 * 0100 * This routine is called by the kernel after it has written a 0101 * series of characters to the tty device using @put_char(). 0102 * 0103 * Optional. Do not call this function directly, call 0104 * tty_driver_flush_chars(). 0105 * 0106 * @write_room: ``unsigned int ()(struct tty_struct *tty)`` 0107 * 0108 * This routine returns the numbers of characters the @tty driver 0109 * will accept for queuing to be written. This number is subject 0110 * to change as output buffers get emptied, or if the output flow 0111 * control is acted. 0112 * 0113 * The ldisc is responsible for being intelligent about multi-threading of 0114 * write_room/write calls 0115 * 0116 * Required if @write method is provided else not needed. Do not call this 0117 * function directly, call tty_write_room() 0118 * 0119 * @chars_in_buffer: ``unsigned int ()(struct tty_struct *tty)`` 0120 * 0121 * This routine returns the number of characters in the device private 0122 * output queue. Used in tty_wait_until_sent() and for poll() 0123 * implementation. 0124 * 0125 * Optional: if not provided, it is assumed there is no queue on the 0126 * device. Do not call this function directly, call tty_chars_in_buffer(). 0127 * 0128 * @ioctl: ``int ()(struct tty_struct *tty, unsigned int cmd, 0129 * unsigned long arg)`` 0130 * 0131 * This routine allows the @tty driver to implement device-specific 0132 * ioctls. If the ioctl number passed in @cmd is not recognized by the 0133 * driver, it should return %ENOIOCTLCMD. 0134 * 0135 * Optional. 0136 * 0137 * @compat_ioctl: ``long ()(struct tty_struct *tty, unsigned int cmd, 0138 * unsigned long arg)`` 0139 * 0140 * Implement ioctl processing for 32 bit process on 64 bit system. 0141 * 0142 * Optional. 0143 * 0144 * @set_termios: ``void ()(struct tty_struct *tty, struct ktermios *old)`` 0145 * 0146 * This routine allows the @tty driver to be notified when device's 0147 * termios settings have changed. New settings are in @tty->termios. 0148 * Previous settings are passed in the @old argument. 0149 * 0150 * The API is defined such that the driver should return the actual modes 0151 * selected. This means that the driver is responsible for modifying any 0152 * bits in @tty->termios it cannot fulfill to indicate the actual modes 0153 * being used. 0154 * 0155 * Optional. Called under the @tty->termios_rwsem. May sleep. 0156 * 0157 * @set_ldisc: ``void ()(struct tty_struct *tty)`` 0158 * 0159 * This routine allows the @tty driver to be notified when the device's 0160 * line discipline is being changed. At the point this is done the 0161 * discipline is not yet usable. 0162 * 0163 * Optional. Called under the @tty->ldisc_sem and @tty->termios_rwsem. 0164 * 0165 * @throttle: ``void ()(struct tty_struct *tty)`` 0166 * 0167 * This routine notifies the @tty driver that input buffers for the line 0168 * discipline are close to full, and it should somehow signal that no more 0169 * characters should be sent to the @tty. 0170 * 0171 * Serialization including with @unthrottle() is the job of the ldisc 0172 * layer. 0173 * 0174 * Optional: Always invoke via tty_throttle_safe(). Called under the 0175 * @tty->termios_rwsem. 0176 * 0177 * @unthrottle: ``void ()(struct tty_struct *tty)`` 0178 * 0179 * This routine notifies the @tty driver that it should signal that 0180 * characters can now be sent to the @tty without fear of overrunning the 0181 * input buffers of the line disciplines. 0182 * 0183 * Optional. Always invoke via tty_unthrottle(). Called under the 0184 * @tty->termios_rwsem. 0185 * 0186 * @stop: ``void ()(struct tty_struct *tty)`` 0187 * 0188 * This routine notifies the @tty driver that it should stop outputting 0189 * characters to the tty device. 0190 * 0191 * Called with @tty->flow.lock held. Serialized with @start() method. 0192 * 0193 * Optional. Always invoke via stop_tty(). 0194 * 0195 * @start: ``void ()(struct tty_struct *tty)`` 0196 * 0197 * This routine notifies the @tty driver that it resumed sending 0198 * characters to the @tty device. 0199 * 0200 * Called with @tty->flow.lock held. Serialized with stop() method. 0201 * 0202 * Optional. Always invoke via start_tty(). 0203 * 0204 * @hangup: ``void ()(struct tty_struct *tty)`` 0205 * 0206 * This routine notifies the @tty driver that it should hang up the @tty 0207 * device. 0208 * 0209 * Optional. Called with tty lock held. 0210 * 0211 * @break_ctl: ``int ()(struct tty_struct *tty, int state)`` 0212 * 0213 * This optional routine requests the @tty driver to turn on or off BREAK 0214 * status on the RS-232 port. If @state is -1, then the BREAK status 0215 * should be turned on; if @state is 0, then BREAK should be turned off. 0216 * 0217 * If this routine is implemented, the high-level tty driver will handle 0218 * the following ioctls: %TCSBRK, %TCSBRKP, %TIOCSBRK, %TIOCCBRK. 0219 * 0220 * If the driver sets %TTY_DRIVER_HARDWARE_BREAK in tty_alloc_driver(), 0221 * then the interface will also be called with actual times and the 0222 * hardware is expected to do the delay work itself. 0 and -1 are still 0223 * used for on/off. 0224 * 0225 * Optional: Required for %TCSBRK/%BRKP/etc. handling. May sleep. 0226 * 0227 * @flush_buffer: ``void ()(struct tty_struct *tty)`` 0228 * 0229 * This routine discards device private output buffer. Invoked on close, 0230 * hangup, to implement %TCOFLUSH ioctl and similar. 0231 * 0232 * Optional: if not provided, it is assumed there is no queue on the 0233 * device. Do not call this function directly, call 0234 * tty_driver_flush_buffer(). 0235 * 0236 * @wait_until_sent: ``void ()(struct tty_struct *tty, int timeout)`` 0237 * 0238 * This routine waits until the device has written out all of the 0239 * characters in its transmitter FIFO. Or until @timeout (in jiffies) is 0240 * reached. 0241 * 0242 * Optional: If not provided, the device is assumed to have no FIFO. 0243 * Usually correct to invoke via tty_wait_until_sent(). May sleep. 0244 * 0245 * @send_xchar: ``void ()(struct tty_struct *tty, char ch)`` 0246 * 0247 * This routine is used to send a high-priority XON/XOFF character (@ch) 0248 * to the @tty device. 0249 * 0250 * Optional: If not provided, then the @write method is called under 0251 * the @tty->atomic_write_lock to keep it serialized with the ldisc. 0252 * 0253 * @tiocmget: ``int ()(struct tty_struct *tty)`` 0254 * 0255 * This routine is used to obtain the modem status bits from the @tty 0256 * driver. 0257 * 0258 * Optional: If not provided, then %ENOTTY is returned from the %TIOCMGET 0259 * ioctl. Do not call this function directly, call tty_tiocmget(). 0260 * 0261 * @tiocmset: ``int ()(struct tty_struct *tty, 0262 * unsigned int set, unsigned int clear)`` 0263 * 0264 * This routine is used to set the modem status bits to the @tty driver. 0265 * First, @clear bits should be cleared, then @set bits set. 0266 * 0267 * Optional: If not provided, then %ENOTTY is returned from the %TIOCMSET 0268 * ioctl. Do not call this function directly, call tty_tiocmset(). 0269 * 0270 * @resize: ``int ()(struct tty_struct *tty, struct winsize *ws)`` 0271 * 0272 * Called when a termios request is issued which changes the requested 0273 * terminal geometry to @ws. 0274 * 0275 * Optional: the default action is to update the termios structure 0276 * without error. This is usually the correct behaviour. Drivers should 0277 * not force errors here if they are not resizable objects (e.g. a serial 0278 * line). See tty_do_resize() if you need to wrap the standard method 0279 * in your own logic -- the usual case. 0280 * 0281 * @get_icount: ``int ()(struct tty_struct *tty, 0282 * struct serial_icounter *icount)`` 0283 * 0284 * Called when the @tty device receives a %TIOCGICOUNT ioctl. Passed a 0285 * kernel structure @icount to complete. 0286 * 0287 * Optional: called only if provided, otherwise %ENOTTY will be returned. 0288 * 0289 * @get_serial: ``int ()(struct tty_struct *tty, struct serial_struct *p)`` 0290 * 0291 * Called when the @tty device receives a %TIOCGSERIAL ioctl. Passed a 0292 * kernel structure @p (&struct serial_struct) to complete. 0293 * 0294 * Optional: called only if provided, otherwise %ENOTTY will be returned. 0295 * Do not call this function directly, call tty_tiocgserial(). 0296 * 0297 * @set_serial: ``int ()(struct tty_struct *tty, struct serial_struct *p)`` 0298 * 0299 * Called when the @tty device receives a %TIOCSSERIAL ioctl. Passed a 0300 * kernel structure @p (&struct serial_struct) to set the values from. 0301 * 0302 * Optional: called only if provided, otherwise %ENOTTY will be returned. 0303 * Do not call this function directly, call tty_tiocsserial(). 0304 * 0305 * @show_fdinfo: ``void ()(struct tty_struct *tty, struct seq_file *m)`` 0306 * 0307 * Called when the @tty device file descriptor receives a fdinfo request 0308 * from VFS (to show in /proc/<pid>/fdinfo/). @m should be filled with 0309 * information. 0310 * 0311 * Optional: called only if provided, otherwise nothing is written to @m. 0312 * Do not call this function directly, call tty_show_fdinfo(). 0313 * 0314 * @poll_init: ``int ()(struct tty_driver *driver, int line, char *options)`` 0315 * 0316 * kgdboc support (Documentation/dev-tools/kgdb.rst). This routine is 0317 * called to initialize the HW for later use by calling @poll_get_char or 0318 * @poll_put_char. 0319 * 0320 * Optional: called only if provided, otherwise skipped as a non-polling 0321 * driver. 0322 * 0323 * @poll_get_char: ``int ()(struct tty_driver *driver, int line)`` 0324 * 0325 * kgdboc support (see @poll_init). @driver should read a character from a 0326 * tty identified by @line and return it. 0327 * 0328 * Optional: called only if @poll_init provided. 0329 * 0330 * @poll_put_char: ``void ()(struct tty_driver *driver, int line, char ch)`` 0331 * 0332 * kgdboc support (see @poll_init). @driver should write character @ch to 0333 * a tty identified by @line. 0334 * 0335 * Optional: called only if @poll_init provided. 0336 * 0337 * @proc_show: ``int ()(struct seq_file *m, void *driver)`` 0338 * 0339 * Driver @driver (cast to &struct tty_driver) can show additional info in 0340 * /proc/tty/driver/<driver_name>. It is enough to fill in the information 0341 * into @m. 0342 * 0343 * Optional: called only if provided, otherwise no /proc entry created. 0344 * 0345 * This structure defines the interface between the low-level tty driver and 0346 * the tty routines. These routines can be defined. Unless noted otherwise, 0347 * they are optional, and can be filled in with a %NULL pointer. 0348 */ 0349 struct tty_operations { 0350 struct tty_struct * (*lookup)(struct tty_driver *driver, 0351 struct file *filp, int idx); 0352 int (*install)(struct tty_driver *driver, struct tty_struct *tty); 0353 void (*remove)(struct tty_driver *driver, struct tty_struct *tty); 0354 int (*open)(struct tty_struct * tty, struct file * filp); 0355 void (*close)(struct tty_struct * tty, struct file * filp); 0356 void (*shutdown)(struct tty_struct *tty); 0357 void (*cleanup)(struct tty_struct *tty); 0358 int (*write)(struct tty_struct * tty, 0359 const unsigned char *buf, int count); 0360 int (*put_char)(struct tty_struct *tty, unsigned char ch); 0361 void (*flush_chars)(struct tty_struct *tty); 0362 unsigned int (*write_room)(struct tty_struct *tty); 0363 unsigned int (*chars_in_buffer)(struct tty_struct *tty); 0364 int (*ioctl)(struct tty_struct *tty, 0365 unsigned int cmd, unsigned long arg); 0366 long (*compat_ioctl)(struct tty_struct *tty, 0367 unsigned int cmd, unsigned long arg); 0368 void (*set_termios)(struct tty_struct *tty, struct ktermios * old); 0369 void (*throttle)(struct tty_struct * tty); 0370 void (*unthrottle)(struct tty_struct * tty); 0371 void (*stop)(struct tty_struct *tty); 0372 void (*start)(struct tty_struct *tty); 0373 void (*hangup)(struct tty_struct *tty); 0374 int (*break_ctl)(struct tty_struct *tty, int state); 0375 void (*flush_buffer)(struct tty_struct *tty); 0376 void (*set_ldisc)(struct tty_struct *tty); 0377 void (*wait_until_sent)(struct tty_struct *tty, int timeout); 0378 void (*send_xchar)(struct tty_struct *tty, char ch); 0379 int (*tiocmget)(struct tty_struct *tty); 0380 int (*tiocmset)(struct tty_struct *tty, 0381 unsigned int set, unsigned int clear); 0382 int (*resize)(struct tty_struct *tty, struct winsize *ws); 0383 int (*get_icount)(struct tty_struct *tty, 0384 struct serial_icounter_struct *icount); 0385 int (*get_serial)(struct tty_struct *tty, struct serial_struct *p); 0386 int (*set_serial)(struct tty_struct *tty, struct serial_struct *p); 0387 void (*show_fdinfo)(struct tty_struct *tty, struct seq_file *m); 0388 #ifdef CONFIG_CONSOLE_POLL 0389 int (*poll_init)(struct tty_driver *driver, int line, char *options); 0390 int (*poll_get_char)(struct tty_driver *driver, int line); 0391 void (*poll_put_char)(struct tty_driver *driver, int line, char ch); 0392 #endif 0393 int (*proc_show)(struct seq_file *m, void *driver); 0394 } __randomize_layout; 0395 0396 /** 0397 * struct tty_driver -- driver for TTY devices 0398 * 0399 * @magic: set to %TTY_DRIVER_MAGIC in __tty_alloc_driver() 0400 * @kref: reference counting. Reaching zero frees all the internals and the 0401 * driver. 0402 * @cdevs: allocated/registered character /dev devices 0403 * @owner: modules owning this driver. Used drivers cannot be rmmod'ed. 0404 * Automatically set by tty_alloc_driver(). 0405 * @driver_name: name of the driver used in /proc/tty 0406 * @name: used for constructing /dev node name 0407 * @name_base: used as a number base for constructing /dev node name 0408 * @major: major /dev device number (zero for autoassignment) 0409 * @minor_start: the first minor /dev device number 0410 * @num: number of devices allocated 0411 * @type: type of tty driver (%TTY_DRIVER_TYPE_) 0412 * @subtype: subtype of tty driver (%SYSTEM_TYPE_, %PTY_TYPE_, %SERIAL_TYPE_) 0413 * @init_termios: termios to set to each tty initially (e.g. %tty_std_termios) 0414 * @flags: tty driver flags (%TTY_DRIVER_) 0415 * @proc_entry: proc fs entry, used internally 0416 * @other: driver of the linked tty; only used for the PTY driver 0417 * @ttys: array of active &struct tty_struct, set by tty_standard_install() 0418 * @ports: array of &struct tty_port; can be set during initialization by 0419 * tty_port_link_device() and similar 0420 * @termios: storage for termios at each TTY close for the next open 0421 * @driver_state: pointer to driver's arbitrary data 0422 * @ops: driver hooks for TTYs. Set them using tty_set_operations(). Use &struct 0423 * tty_port helpers in them as much as possible. 0424 * @tty_drivers: used internally to link tty_drivers together 0425 * 0426 * The usual handling of &struct tty_driver is to allocate it by 0427 * tty_alloc_driver(), set up all the necessary members, and register it by 0428 * tty_register_driver(). At last, the driver is torn down by calling 0429 * tty_unregister_driver() followed by tty_driver_kref_put(). 0430 * 0431 * The fields required to be set before calling tty_register_driver() include 0432 * @driver_name, @name, @type, @subtype, @init_termios, and @ops. 0433 */ 0434 struct tty_driver { 0435 int magic; 0436 struct kref kref; 0437 struct cdev **cdevs; 0438 struct module *owner; 0439 const char *driver_name; 0440 const char *name; 0441 int name_base; 0442 int major; 0443 int minor_start; 0444 unsigned int num; 0445 short type; 0446 short subtype; 0447 struct ktermios init_termios; 0448 unsigned long flags; 0449 struct proc_dir_entry *proc_entry; 0450 struct tty_driver *other; 0451 0452 /* 0453 * Pointer to the tty data structures 0454 */ 0455 struct tty_struct **ttys; 0456 struct tty_port **ports; 0457 struct ktermios **termios; 0458 void *driver_state; 0459 0460 /* 0461 * Driver methods 0462 */ 0463 0464 const struct tty_operations *ops; 0465 struct list_head tty_drivers; 0466 } __randomize_layout; 0467 0468 extern struct list_head tty_drivers; 0469 0470 struct tty_driver *__tty_alloc_driver(unsigned int lines, struct module *owner, 0471 unsigned long flags); 0472 struct tty_driver *tty_find_polling_driver(char *name, int *line); 0473 0474 void tty_driver_kref_put(struct tty_driver *driver); 0475 0476 /* Use TTY_DRIVER_* flags below */ 0477 #define tty_alloc_driver(lines, flags) \ 0478 __tty_alloc_driver(lines, THIS_MODULE, flags) 0479 0480 static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) 0481 { 0482 kref_get(&d->kref); 0483 return d; 0484 } 0485 0486 static inline void tty_set_operations(struct tty_driver *driver, 0487 const struct tty_operations *op) 0488 { 0489 driver->ops = op; 0490 } 0491 0492 /* tty driver magic number */ 0493 #define TTY_DRIVER_MAGIC 0x5402 0494 0495 /** 0496 * DOC: TTY Driver Flags 0497 * 0498 * TTY_DRIVER_RESET_TERMIOS 0499 * Requests the tty layer to reset the termios setting when the last 0500 * process has closed the device. Used for PTYs, in particular. 0501 * 0502 * TTY_DRIVER_REAL_RAW 0503 * Indicates that the driver will guarantee not to set any special 0504 * character handling flags if this is set for the tty: 0505 * 0506 * ``(IGNBRK || (!BRKINT && !PARMRK)) && (IGNPAR || !INPCK)`` 0507 * 0508 * That is, if there is no reason for the driver to 0509 * send notifications of parity and break characters up to the line 0510 * driver, it won't do so. This allows the line driver to optimize for 0511 * this case if this flag is set. (Note that there is also a promise, if 0512 * the above case is true, not to signal overruns, either.) 0513 * 0514 * TTY_DRIVER_DYNAMIC_DEV 0515 * The individual tty devices need to be registered with a call to 0516 * tty_register_device() when the device is found in the system and 0517 * unregistered with a call to tty_unregister_device() so the devices will 0518 * be show up properly in sysfs. If not set, all &tty_driver.num entries 0519 * will be created by the tty core in sysfs when tty_register_driver() is 0520 * called. This is to be used by drivers that have tty devices that can 0521 * appear and disappear while the main tty driver is registered with the 0522 * tty core. 0523 * 0524 * TTY_DRIVER_DEVPTS_MEM 0525 * Don't use the standard arrays (&tty_driver.ttys and 0526 * &tty_driver.termios), instead use dynamic memory keyed through the 0527 * devpts filesystem. This is only applicable to the PTY driver. 0528 * 0529 * TTY_DRIVER_HARDWARE_BREAK 0530 * Hardware handles break signals. Pass the requested timeout to the 0531 * &tty_operations.break_ctl instead of using a simple on/off interface. 0532 * 0533 * TTY_DRIVER_DYNAMIC_ALLOC 0534 * Do not allocate structures which are needed per line for this driver 0535 * (&tty_driver.ports) as it would waste memory. The driver will take 0536 * care. This is only applicable to the PTY driver. 0537 * 0538 * TTY_DRIVER_UNNUMBERED_NODE 0539 * Do not create numbered ``/dev`` nodes. For example, create 0540 * ``/dev/ttyprintk`` and not ``/dev/ttyprintk0``. Applicable only when a 0541 * driver for a single tty device is being allocated. 0542 */ 0543 #define TTY_DRIVER_INSTALLED 0x0001 0544 #define TTY_DRIVER_RESET_TERMIOS 0x0002 0545 #define TTY_DRIVER_REAL_RAW 0x0004 0546 #define TTY_DRIVER_DYNAMIC_DEV 0x0008 0547 #define TTY_DRIVER_DEVPTS_MEM 0x0010 0548 #define TTY_DRIVER_HARDWARE_BREAK 0x0020 0549 #define TTY_DRIVER_DYNAMIC_ALLOC 0x0040 0550 #define TTY_DRIVER_UNNUMBERED_NODE 0x0080 0551 0552 /* tty driver types */ 0553 #define TTY_DRIVER_TYPE_SYSTEM 0x0001 0554 #define TTY_DRIVER_TYPE_CONSOLE 0x0002 0555 #define TTY_DRIVER_TYPE_SERIAL 0x0003 0556 #define TTY_DRIVER_TYPE_PTY 0x0004 0557 #define TTY_DRIVER_TYPE_SCC 0x0005 /* scc driver */ 0558 #define TTY_DRIVER_TYPE_SYSCONS 0x0006 0559 0560 /* system subtypes (magic, used by tty_io.c) */ 0561 #define SYSTEM_TYPE_TTY 0x0001 0562 #define SYSTEM_TYPE_CONSOLE 0x0002 0563 #define SYSTEM_TYPE_SYSCONS 0x0003 0564 #define SYSTEM_TYPE_SYSPTMX 0x0004 0565 0566 /* pty subtypes (magic, used by tty_io.c) */ 0567 #define PTY_TYPE_MASTER 0x0001 0568 #define PTY_TYPE_SLAVE 0x0002 0569 0570 /* serial subtype definitions */ 0571 #define SERIAL_TYPE_NORMAL 1 0572 0573 int tty_register_driver(struct tty_driver *driver); 0574 void tty_unregister_driver(struct tty_driver *driver); 0575 struct device *tty_register_device(struct tty_driver *driver, unsigned index, 0576 struct device *dev); 0577 struct device *tty_register_device_attr(struct tty_driver *driver, 0578 unsigned index, struct device *device, void *drvdata, 0579 const struct attribute_group **attr_grp); 0580 void tty_unregister_device(struct tty_driver *driver, unsigned index); 0581 0582 #ifdef CONFIG_PROC_FS 0583 void proc_tty_register_driver(struct tty_driver *); 0584 void proc_tty_unregister_driver(struct tty_driver *); 0585 #else 0586 static inline void proc_tty_register_driver(struct tty_driver *d) {} 0587 static inline void proc_tty_unregister_driver(struct tty_driver *d) {} 0588 #endif 0589 0590 #endif /* #ifdef _LINUX_TTY_DRIVER_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |