38
38
#define TERMIOS_TERMIO BIT(2)
39
39
#define TERMIOS_OLD BIT(3)
40
40
41
-
42
41
/**
43
- * tty_chars_in_buffer - characters pending
44
- * @tty: terminal
42
+ * tty_chars_in_buffer - characters pending
43
+ * @tty: terminal
45
44
*
46
- * Return the number of bytes of data in the device private
47
- * output queue. If no private method is supplied there is assumed
48
- * to be no queue on the device.
45
+ * Returns: the number of bytes of data in the device private output queue. If
46
+ * no private method is supplied there is assumed to be no queue on the device.
49
47
*/
50
-
51
48
unsigned int tty_chars_in_buffer (struct tty_struct * tty )
52
49
{
53
50
if (tty -> ops -> chars_in_buffer )
@@ -57,16 +54,15 @@ unsigned int tty_chars_in_buffer(struct tty_struct *tty)
57
54
EXPORT_SYMBOL (tty_chars_in_buffer );
58
55
59
56
/**
60
- * tty_write_room - write queue space
61
- * @tty: terminal
57
+ * tty_write_room - write queue space
58
+ * @tty: terminal
62
59
*
63
- * Return the number of bytes that can be queued to this device
64
- * at the present time. The result should be treated as a guarantee
65
- * and the driver cannot offer a value it later shrinks by more than
66
- * the number of bytes written. If no method is provided 2K is always
67
- * returned and data may be lost as there will be no flow control.
60
+ * Returns: the number of bytes that can be queued to this device at the present
61
+ * time. The result should be treated as a guarantee and the driver cannot
62
+ * offer a value it later shrinks by more than the number of bytes written. If
63
+ * no method is provided, 2K is always returned and data may be lost as there
64
+ * will be no flow control.
68
65
*/
69
-
70
66
unsigned int tty_write_room (struct tty_struct * tty )
71
67
{
72
68
if (tty -> ops -> write_room )
@@ -76,12 +72,12 @@ unsigned int tty_write_room(struct tty_struct *tty)
76
72
EXPORT_SYMBOL (tty_write_room );
77
73
78
74
/**
79
- * tty_driver_flush_buffer - discard internal buffer
80
- * @tty: terminal
75
+ * tty_driver_flush_buffer - discard internal buffer
76
+ * @tty: terminal
81
77
*
82
- * Discard the internal output buffer for this device. If no method
83
- * is provided then either the buffer cannot be hardware flushed or
84
- * there is no buffer driver side.
78
+ * Discard the internal output buffer for this device. If no method is provided,
79
+ * then either the buffer cannot be hardware flushed or there is no buffer
80
+ * driver side.
85
81
*/
86
82
void tty_driver_flush_buffer (struct tty_struct * tty )
87
83
{
@@ -91,18 +87,17 @@ void tty_driver_flush_buffer(struct tty_struct *tty)
91
87
EXPORT_SYMBOL (tty_driver_flush_buffer );
92
88
93
89
/**
94
- * tty_unthrottle - flow control
95
- * @tty: terminal
90
+ * tty_unthrottle - flow control
91
+ * @tty: terminal
96
92
*
97
- * Indicate that a tty may continue transmitting data down the stack.
98
- * Takes the termios rwsem to protect against parallel throttle/unthrottle
99
- * and also to ensure the driver can consistently reference its own
100
- * termios data at this point when implementing software flow control.
93
+ * Indicate that a @ tty may continue transmitting data down the stack. Takes
94
+ * the &tty_struct->termios_rwsem to protect against parallel
95
+ * throttle/unthrottle and also to ensure the driver can consistently reference
96
+ * its own termios data at this point when implementing software flow control.
101
97
*
102
- * Drivers should however remember that the stack can issue a throttle,
103
- * then change flow control method, then unthrottle.
98
+ * Drivers should however remember that the stack can issue a throttle, then
99
+ * change flow control method, then unthrottle.
104
100
*/
105
-
106
101
void tty_unthrottle (struct tty_struct * tty )
107
102
{
108
103
down_write (& tty -> termios_rwsem );
@@ -115,16 +110,15 @@ void tty_unthrottle(struct tty_struct *tty)
115
110
EXPORT_SYMBOL (tty_unthrottle );
116
111
117
112
/**
118
- * tty_throttle_safe - flow control
119
- * @tty: terminal
113
+ * tty_throttle_safe - flow control
114
+ * @tty: terminal
120
115
*
121
- * Indicate that a tty should stop transmitting data down the stack.
122
- * tty_throttle_safe will only attempt throttle if tty->flow_change is
123
- * TTY_THROTTLE_SAFE. Prevents an accidental throttle due to race
124
- * conditions when throttling is conditional on factors evaluated prior to
125
- * throttling.
116
+ * Indicate that a @tty should stop transmitting data down the stack.
117
+ * tty_throttle_safe() will only attempt throttle if @tty->flow_change is
118
+ * %TTY_THROTTLE_SAFE. Prevents an accidental throttle due to race conditions
119
+ * when throttling is conditional on factors evaluated prior to throttling.
126
120
*
127
- * Returns true if tty is throttled (or was already throttled)
121
+ * Returns: % true if @ tty is throttled (or was already throttled)
128
122
*/
129
123
bool tty_throttle_safe (struct tty_struct * tty )
130
124
{
@@ -146,15 +140,15 @@ bool tty_throttle_safe(struct tty_struct *tty)
146
140
}
147
141
148
142
/**
149
- * tty_unthrottle_safe - flow control
150
- * @tty: terminal
143
+ * tty_unthrottle_safe - flow control
144
+ * @tty: terminal
151
145
*
152
- * Similar to tty_unthrottle() but will only attempt unthrottle
153
- * if tty->flow_change is TTY_UNTHROTTLE_SAFE. Prevents an accidental
154
- * unthrottle due to race conditions when unthrottling is conditional
155
- * on factors evaluated prior to unthrottling.
146
+ * Similar to tty_unthrottle() but will only attempt unthrottle if
147
+ * @ tty->flow_change is % TTY_UNTHROTTLE_SAFE. Prevents an accidental unthrottle
148
+ * due to race conditions when unthrottling is conditional on factors evaluated
149
+ * prior to unthrottling.
156
150
*
157
- * Returns true if tty is unthrottled (or was already unthrottled)
151
+ * Returns: % true if @ tty is unthrottled (or was already unthrottled)
158
152
*/
159
153
bool tty_unthrottle_safe (struct tty_struct * tty )
160
154
{
@@ -176,14 +170,14 @@ bool tty_unthrottle_safe(struct tty_struct *tty)
176
170
}
177
171
178
172
/**
179
- * tty_wait_until_sent - wait for I/O to finish
180
- * @tty: tty we are waiting for
181
- * @timeout: how long we will wait
173
+ * tty_wait_until_sent - wait for I/O to finish
174
+ * @tty: tty we are waiting for
175
+ * @timeout: how long we will wait
182
176
*
183
- * Wait for characters pending in a tty driver to hit the wire, or
184
- * for a timeout to occur (eg due to flow control)
177
+ * Wait for characters pending in a tty driver to hit the wire, or for a
178
+ * timeout to occur (eg due to flow control).
185
179
*
186
- * Locking: none
180
+ * Locking: none
187
181
*/
188
182
189
183
void tty_wait_until_sent (struct tty_struct * tty , long timeout )
@@ -229,16 +223,15 @@ static void unset_locked_termios(struct tty_struct *tty, const struct ktermios *
229
223
}
230
224
231
225
/**
232
- * tty_termios_copy_hw - copy hardware settings
233
- * @new: New termios
234
- * @old: Old termios
226
+ * tty_termios_copy_hw - copy hardware settings
227
+ * @new: new termios
228
+ * @old: old termios
235
229
*
236
- * Propagate the hardware specific terminal setting bits from
237
- * the old termios structure to the new one. This is used in cases
238
- * where the hardware does not support reconfiguration or as a helper
239
- * in some cases where only minimal reconfiguration is supported
230
+ * Propagate the hardware specific terminal setting bits from the @old termios
231
+ * structure to the @ new one. This is used in cases where the hardware does not
232
+ * support reconfiguration or as a helper in some cases where only minimal
233
+ * reconfiguration is supported.
240
234
*/
241
-
242
235
void tty_termios_copy_hw (struct ktermios * new , const struct ktermios * old )
243
236
{
244
237
/* The bits a dumb device handles in software. Smart devices need
@@ -251,14 +244,15 @@ void tty_termios_copy_hw(struct ktermios *new, const struct ktermios *old)
251
244
EXPORT_SYMBOL (tty_termios_copy_hw );
252
245
253
246
/**
254
- * tty_termios_hw_change - check for setting change
255
- * @a: termios
256
- * @b: termios to compare
247
+ * tty_termios_hw_change - check for setting change
248
+ * @a: termios
249
+ * @b: termios to compare
257
250
*
258
- * Check if any of the bits that affect a dumb device have changed
259
- * between the two termios structures, or a speed change is needed.
251
+ * Check if any of the bits that affect a dumb device have changed between the
252
+ * two termios structures, or a speed change is needed.
253
+ *
254
+ * Returns: %true if change is needed
260
255
*/
261
-
262
256
bool tty_termios_hw_change (const struct ktermios * a , const struct ktermios * b )
263
257
{
264
258
if (a -> c_ispeed != b -> c_ispeed || a -> c_ospeed != b -> c_ospeed )
@@ -270,11 +264,10 @@ bool tty_termios_hw_change(const struct ktermios *a, const struct ktermios *b)
270
264
EXPORT_SYMBOL (tty_termios_hw_change );
271
265
272
266
/**
273
- * tty_get_char_size - get size of a character
274
- * @cflag: termios cflag value
267
+ * tty_get_char_size - get size of a character
268
+ * @cflag: termios cflag value
275
269
*
276
- * Get the size (in bits) of a character depending on @cflag's %CSIZE
277
- * setting.
270
+ * Returns: size (in bits) of a character depending on @cflag's %CSIZE setting
278
271
*/
279
272
unsigned char tty_get_char_size (unsigned int cflag )
280
273
{
@@ -293,13 +286,14 @@ unsigned char tty_get_char_size(unsigned int cflag)
293
286
EXPORT_SYMBOL_GPL (tty_get_char_size );
294
287
295
288
/**
296
- * tty_get_frame_size - get size of a frame
297
- * @cflag: termios cflag value
289
+ * tty_get_frame_size - get size of a frame
290
+ * @cflag: termios cflag value
298
291
*
299
- * Get the size (in bits) of a frame depending on @cflag's %CSIZE, %CSTOPB,
300
- * and %PARENB setting. The result is a sum of character size, start and
301
- * stop bits -- one bit each -- second stop bit (if set), and parity bit
302
- * (if set).
292
+ * Get the size (in bits) of a frame depending on @cflag's %CSIZE, %CSTOPB, and
293
+ * %PARENB setting. The result is a sum of character size, start and stop bits
294
+ * -- one bit each -- second stop bit (if set), and parity bit (if set).
295
+ *
296
+ * Returns: size (in bits) of a frame depending on @cflag's setting.
303
297
*/
304
298
unsigned char tty_get_frame_size (unsigned int cflag )
305
299
{
@@ -317,16 +311,15 @@ unsigned char tty_get_frame_size(unsigned int cflag)
317
311
EXPORT_SYMBOL_GPL (tty_get_frame_size );
318
312
319
313
/**
320
- * tty_set_termios - update termios values
321
- * @tty: tty to update
322
- * @new_termios: desired new value
314
+ * tty_set_termios - update termios values
315
+ * @tty: tty to update
316
+ * @new_termios: desired new value
323
317
*
324
- * Perform updates to the termios values set on this terminal.
325
- * A master pty's termios should never be set.
318
+ * Perform updates to the termios values set on this @tty. A master pty's
319
+ * termios should never be set.
326
320
*
327
- * Locking: termios_rwsem
321
+ * Locking: &tty_struct-> termios_rwsem
328
322
*/
329
-
330
323
int tty_set_termios (struct tty_struct * tty , struct ktermios * new_termios )
331
324
{
332
325
struct ktermios old_termios ;
@@ -439,18 +432,19 @@ __weak int kernel_termios_to_user_termios(struct termios __user *u,
439
432
#endif /* TCGETS2 */
440
433
441
434
/**
442
- * set_termios - set termios values for a tty
443
- * @tty: terminal device
444
- * @arg: user data
445
- * @opt: option information
435
+ * set_termios - set termios values for a tty
436
+ * @tty: terminal device
437
+ * @arg: user data
438
+ * @opt: option information
446
439
*
447
- * Helper function to prepare termios data and run necessary other
448
- * functions before using tty_set_termios to do the actual changes.
440
+ * Helper function to prepare termios data and run necessary other functions
441
+ * before using tty_set_termios() to do the actual changes.
449
442
*
450
- * Locking:
451
- * Called functions take ldisc and termios_rwsem locks
443
+ * Locking: called functions take &tty_struct->ldisc_sem and
444
+ * &tty_struct->termios_rwsem locks
445
+ *
446
+ * Returns: 0 on success, an error otherwise
452
447
*/
453
-
454
448
static int set_termios (struct tty_struct * tty , void __user * arg , int opt )
455
449
{
456
450
struct ktermios tmp_termios ;
@@ -622,16 +616,16 @@ static void set_sgflags(struct ktermios *termios, int flags)
622
616
}
623
617
624
618
/**
625
- * set_sgttyb - set legacy terminal values
626
- * @tty: tty structure
627
- * @sgttyb: pointer to old style terminal structure
619
+ * set_sgttyb - set legacy terminal values
620
+ * @tty: tty structure
621
+ * @sgttyb: pointer to old style terminal structure
628
622
*
629
- * Updates a terminal from the legacy BSD style terminal information
630
- * structure.
623
+ * Updates a terminal from the legacy BSD style terminal information structure.
631
624
*
632
- * Locking: termios_rwsem
625
+ * Locking: &tty_struct->termios_rwsem
626
+ *
627
+ * Returns: 0 on success, an error otherwise
633
628
*/
634
-
635
629
static int set_sgttyb (struct tty_struct * tty , struct sgttyb __user * sgttyb )
636
630
{
637
631
int retval ;
@@ -733,14 +727,17 @@ static int set_ltchars(struct tty_struct *tty, struct ltchars __user *ltchars)
733
727
#endif
734
728
735
729
/**
736
- * tty_change_softcar - carrier change ioctl helper
737
- * @tty: tty to update
738
- * @enable: enable/disable CLOCAL
730
+ * tty_change_softcar - carrier change ioctl helper
731
+ * @tty: tty to update
732
+ * @enable: enable/disable % CLOCAL
739
733
*
740
- * Perform a change to the CLOCAL state and call into the driver
741
- * layer to make it visible. All done with the termios rwsem
734
+ * Perform a change to the %CLOCAL state and call into the driver layer to make
735
+ * it visible.
736
+ *
737
+ * Locking: &tty_struct->termios_rwsem.
738
+ *
739
+ * Returns: 0 on success, an error otherwise
742
740
*/
743
-
744
741
static int tty_change_softcar (struct tty_struct * tty , bool enable )
745
742
{
746
743
int ret = 0 ;
@@ -760,16 +757,15 @@ static int tty_change_softcar(struct tty_struct *tty, bool enable)
760
757
}
761
758
762
759
/**
763
- * tty_mode_ioctl - mode related ioctls
764
- * @tty: tty for the ioctl
765
- * @cmd: command
766
- * @arg: ioctl argument
760
+ * tty_mode_ioctl - mode related ioctls
761
+ * @tty: tty for the ioctl
762
+ * @cmd: command
763
+ * @arg: ioctl argument
767
764
*
768
- * Perform non line discipline specific mode control ioctls. This
769
- * is designed to be called by line disciplines to ensure they provide
770
- * consistent mode setting.
765
+ * Perform non- line discipline specific mode control ioctls. This is designed
766
+ * to be called by line disciplines to ensure they provide consistent mode
767
+ * setting.
771
768
*/
772
-
773
769
int tty_mode_ioctl (struct tty_struct * tty , unsigned int cmd , unsigned long arg )
774
770
{
775
771
struct tty_struct * real_tty ;
0 commit comments