@@ -109,9 +109,9 @@ struct n_tty_data {
109
109
unsigned char push :1 ;
110
110
111
111
/* shared by producer and consumer */
112
- char read_buf [N_TTY_BUF_SIZE ];
112
+ u8 read_buf [N_TTY_BUF_SIZE ];
113
113
DECLARE_BITMAP (read_flags , N_TTY_BUF_SIZE );
114
- unsigned char echo_buf [N_TTY_BUF_SIZE ];
114
+ u8 echo_buf [N_TTY_BUF_SIZE ];
115
115
116
116
/* consumer-published */
117
117
size_t read_tail ;
@@ -136,23 +136,23 @@ static inline size_t read_cnt(struct n_tty_data *ldata)
136
136
return ldata -> read_head - ldata -> read_tail ;
137
137
}
138
138
139
- static inline unsigned char read_buf (struct n_tty_data * ldata , size_t i )
139
+ static inline u8 read_buf (struct n_tty_data * ldata , size_t i )
140
140
{
141
141
return ldata -> read_buf [MASK (i )];
142
142
}
143
143
144
- static inline unsigned char * read_buf_addr (struct n_tty_data * ldata , size_t i )
144
+ static inline u8 * read_buf_addr (struct n_tty_data * ldata , size_t i )
145
145
{
146
146
return & ldata -> read_buf [MASK (i )];
147
147
}
148
148
149
- static inline unsigned char echo_buf (struct n_tty_data * ldata , size_t i )
149
+ static inline u8 echo_buf (struct n_tty_data * ldata , size_t i )
150
150
{
151
151
smp_rmb (); /* Matches smp_wmb() in add_echo_byte(). */
152
152
return ldata -> echo_buf [MASK (i )];
153
153
}
154
154
155
- static inline unsigned char * echo_buf_addr (struct n_tty_data * ldata , size_t i )
155
+ static inline u8 * echo_buf_addr (struct n_tty_data * ldata , size_t i )
156
156
{
157
157
return & ldata -> echo_buf [MASK (i )];
158
158
}
@@ -303,7 +303,7 @@ static void n_tty_check_unthrottle(struct tty_struct *tty)
303
303
* * n_tty_receive_buf()/producer path:
304
304
* caller holds non-exclusive %termios_rwsem
305
305
*/
306
- static inline void put_tty_queue (unsigned char c , struct n_tty_data * ldata )
306
+ static inline void put_tty_queue (u8 c , struct n_tty_data * ldata )
307
307
{
308
308
* read_buf_addr (ldata , ldata -> read_head ) = c ;
309
309
ldata -> read_head ++ ;
@@ -377,7 +377,7 @@ static void n_tty_flush_buffer(struct tty_struct *tty)
377
377
* character. We use this to correctly compute the on-screen size of the
378
378
* character when printing.
379
379
*/
380
- static inline int is_utf8_continuation (unsigned char c )
380
+ static inline int is_utf8_continuation (u8 c )
381
381
{
382
382
return (c & 0xc0 ) == 0x80 ;
383
383
}
@@ -390,7 +390,7 @@ static inline int is_utf8_continuation(unsigned char c)
390
390
* Returns: true if the utf8 character @c is a multibyte continuation character
391
391
* and the terminal is in unicode mode.
392
392
*/
393
- static inline int is_continuation (unsigned char c , const struct tty_struct * tty )
393
+ static inline int is_continuation (u8 c , const struct tty_struct * tty )
394
394
{
395
395
return I_IUTF8 (tty ) && is_utf8_continuation (c );
396
396
}
@@ -414,7 +414,7 @@ static inline int is_continuation(unsigned char c, const struct tty_struct *tty)
414
414
* Locking: should be called under the %output_lock to protect the column state
415
415
* and space left in the buffer.
416
416
*/
417
- static int do_output_char (unsigned char c , struct tty_struct * tty , int space )
417
+ static int do_output_char (u8 c , struct tty_struct * tty , int space )
418
418
{
419
419
struct n_tty_data * ldata = tty -> disc_data ;
420
420
int spaces ;
@@ -488,7 +488,7 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space)
488
488
* Locking: %output_lock to protect column state and space left (also, this is
489
489
*called from n_tty_write() under the tty layer write lock).
490
490
*/
491
- static int process_output (unsigned char c , struct tty_struct * tty )
491
+ static int process_output (u8 c , struct tty_struct * tty )
492
492
{
493
493
struct n_tty_data * ldata = tty -> disc_data ;
494
494
int space , retval ;
@@ -524,12 +524,12 @@ static int process_output(unsigned char c, struct tty_struct *tty)
524
524
* called from n_tty_write() under the tty layer write lock).
525
525
*/
526
526
static ssize_t process_output_block (struct tty_struct * tty ,
527
- const unsigned char * buf , unsigned int nr )
527
+ const u8 * buf , unsigned int nr )
528
528
{
529
529
struct n_tty_data * ldata = tty -> disc_data ;
530
530
int space ;
531
531
int i ;
532
- const unsigned char * cp ;
532
+ const u8 * cp ;
533
533
534
534
mutex_lock (& ldata -> output_lock );
535
535
@@ -542,7 +542,7 @@ static ssize_t process_output_block(struct tty_struct *tty,
542
542
nr = space ;
543
543
544
544
for (i = 0 , cp = buf ; i < nr ; i ++ , cp ++ ) {
545
- unsigned char c = * cp ;
545
+ u8 c = * cp ;
546
546
547
547
switch (c ) {
548
548
case '\n' :
@@ -609,15 +609,15 @@ static size_t __process_echoes(struct tty_struct *tty)
609
609
struct n_tty_data * ldata = tty -> disc_data ;
610
610
int space , old_space ;
611
611
size_t tail ;
612
- unsigned char c ;
612
+ u8 c ;
613
613
614
614
old_space = space = tty_write_room (tty );
615
615
616
616
tail = ldata -> echo_tail ;
617
617
while (MASK (ldata -> echo_commit ) != MASK (tail )) {
618
618
c = echo_buf (ldata , tail );
619
619
if (c == ECHO_OP_START ) {
620
- unsigned char op ;
620
+ u8 op ;
621
621
bool space_left = true;
622
622
623
623
/*
@@ -818,7 +818,7 @@ static void flush_echoes(struct tty_struct *tty)
818
818
*
819
819
* Add a character or operation byte to the echo buffer.
820
820
*/
821
- static inline void add_echo_byte (unsigned char c , struct n_tty_data * ldata )
821
+ static inline void add_echo_byte (u8 c , struct n_tty_data * ldata )
822
822
{
823
823
* echo_buf_addr (ldata , ldata -> echo_head ) = c ;
824
824
smp_wmb (); /* Matches smp_rmb() in echo_buf(). */
@@ -889,7 +889,7 @@ static void echo_erase_tab(unsigned int num_chars, int after_tab,
889
889
*
890
890
* This variant does not treat control characters specially.
891
891
*/
892
- static void echo_char_raw (unsigned char c , struct n_tty_data * ldata )
892
+ static void echo_char_raw (u8 c , struct n_tty_data * ldata )
893
893
{
894
894
if (c == ECHO_OP_START ) {
895
895
add_echo_byte (ECHO_OP_START , ldata );
@@ -910,7 +910,7 @@ static void echo_char_raw(unsigned char c, struct n_tty_data *ldata)
910
910
* This variant tags control characters to be echoed as "^X" (where X is the
911
911
* letter representing the control char).
912
912
*/
913
- static void echo_char (unsigned char c , const struct tty_struct * tty )
913
+ static void echo_char (u8 c , const struct tty_struct * tty )
914
914
{
915
915
struct n_tty_data * ldata = tty -> disc_data ;
916
916
@@ -948,7 +948,7 @@ static inline void finish_erasing(struct n_tty_data *ldata)
948
948
* Locking: n_tty_receive_buf()/producer path:
949
949
* caller holds non-exclusive %termios_rwsem
950
950
*/
951
- static void eraser (unsigned char c , const struct tty_struct * tty )
951
+ static void eraser (u8 c , const struct tty_struct * tty )
952
952
{
953
953
struct n_tty_data * ldata = tty -> disc_data ;
954
954
enum { ERASE , WERASE , KILL } kill_type ;
@@ -1188,7 +1188,7 @@ static void n_tty_receive_overrun(const struct tty_struct *tty)
1188
1188
* caller holds non-exclusive %termios_rwsem
1189
1189
*/
1190
1190
static void n_tty_receive_parity_error (const struct tty_struct * tty ,
1191
- unsigned char c )
1191
+ u8 c )
1192
1192
{
1193
1193
struct n_tty_data * ldata = tty -> disc_data ;
1194
1194
@@ -1206,7 +1206,7 @@ static void n_tty_receive_parity_error(const struct tty_struct *tty,
1206
1206
}
1207
1207
1208
1208
static void
1209
- n_tty_receive_signal_char (struct tty_struct * tty , int signal , unsigned char c )
1209
+ n_tty_receive_signal_char (struct tty_struct * tty , int signal , u8 c )
1210
1210
{
1211
1211
isig (signal , tty );
1212
1212
if (I_IXON (tty ))
@@ -1218,7 +1218,7 @@ n_tty_receive_signal_char(struct tty_struct *tty, int signal, unsigned char c)
1218
1218
process_echoes (tty );
1219
1219
}
1220
1220
1221
- static bool n_tty_is_char_flow_ctrl (struct tty_struct * tty , unsigned char c )
1221
+ static bool n_tty_is_char_flow_ctrl (struct tty_struct * tty , u8 c )
1222
1222
{
1223
1223
return c == START_CHAR (tty ) || c == STOP_CHAR (tty );
1224
1224
}
@@ -1238,7 +1238,7 @@ static bool n_tty_is_char_flow_ctrl(struct tty_struct *tty, unsigned char c)
1238
1238
* Returns true if @c is consumed as flow-control character, the character
1239
1239
* must not be treated as normal character.
1240
1240
*/
1241
- static bool n_tty_receive_char_flow_ctrl (struct tty_struct * tty , unsigned char c ,
1241
+ static bool n_tty_receive_char_flow_ctrl (struct tty_struct * tty , u8 c ,
1242
1242
bool lookahead_done )
1243
1243
{
1244
1244
if (!n_tty_is_char_flow_ctrl (tty , c ))
@@ -1354,7 +1354,7 @@ static bool n_tty_receive_char_canon(struct tty_struct *tty, u8 c)
1354
1354
return false;
1355
1355
}
1356
1356
1357
- static void n_tty_receive_char_special (struct tty_struct * tty , unsigned char c ,
1357
+ static void n_tty_receive_char_special (struct tty_struct * tty , u8 c ,
1358
1358
bool lookahead_done )
1359
1359
{
1360
1360
struct n_tty_data * ldata = tty -> disc_data ;
@@ -1423,7 +1423,7 @@ static void n_tty_receive_char_special(struct tty_struct *tty, unsigned char c,
1423
1423
* caller holds non-exclusive %termios_rwsem
1424
1424
* publishes canon_head if canonical mode is active
1425
1425
*/
1426
- static void n_tty_receive_char (struct tty_struct * tty , unsigned char c )
1426
+ static void n_tty_receive_char (struct tty_struct * tty , u8 c )
1427
1427
{
1428
1428
struct n_tty_data * ldata = tty -> disc_data ;
1429
1429
@@ -1445,7 +1445,7 @@ static void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
1445
1445
put_tty_queue (c , ldata );
1446
1446
}
1447
1447
1448
- static void n_tty_receive_char_closing (struct tty_struct * tty , unsigned char c ,
1448
+ static void n_tty_receive_char_closing (struct tty_struct * tty , u8 c ,
1449
1449
bool lookahead_done )
1450
1450
{
1451
1451
if (I_ISTRIP (tty ))
@@ -1465,7 +1465,7 @@ static void n_tty_receive_char_closing(struct tty_struct *tty, unsigned char c,
1465
1465
}
1466
1466
1467
1467
static void
1468
- n_tty_receive_char_flagged (struct tty_struct * tty , unsigned char c , char flag )
1468
+ n_tty_receive_char_flagged (struct tty_struct * tty , u8 c , u8 flag )
1469
1469
{
1470
1470
switch (flag ) {
1471
1471
case TTY_BREAK :
@@ -1479,13 +1479,13 @@ n_tty_receive_char_flagged(struct tty_struct *tty, unsigned char c, char flag)
1479
1479
n_tty_receive_overrun (tty );
1480
1480
break ;
1481
1481
default :
1482
- tty_err (tty , "unknown flag %d \n" , flag );
1482
+ tty_err (tty , "unknown flag %u \n" , flag );
1483
1483
break ;
1484
1484
}
1485
1485
}
1486
1486
1487
1487
static void
1488
- n_tty_receive_char_lnext (struct tty_struct * tty , unsigned char c , char flag )
1488
+ n_tty_receive_char_lnext (struct tty_struct * tty , u8 c , u8 flag )
1489
1489
{
1490
1490
struct n_tty_data * ldata = tty -> disc_data ;
1491
1491
@@ -1505,7 +1505,7 @@ static void n_tty_lookahead_flow_ctrl(struct tty_struct *tty, const u8 *cp,
1505
1505
const u8 * fp , size_t count )
1506
1506
{
1507
1507
struct n_tty_data * ldata = tty -> disc_data ;
1508
- unsigned char flag = TTY_NORMAL ;
1508
+ u8 flag = TTY_NORMAL ;
1509
1509
1510
1510
ldata -> lookahead_count += count ;
1511
1511
@@ -1562,7 +1562,7 @@ static void
1562
1562
n_tty_receive_buf_closing (struct tty_struct * tty , const u8 * cp , const u8 * fp ,
1563
1563
int count , bool lookahead_done )
1564
1564
{
1565
- char flag = TTY_NORMAL ;
1565
+ u8 flag = TTY_NORMAL ;
1566
1566
1567
1567
while (count -- ) {
1568
1568
if (fp )
@@ -1955,7 +1955,7 @@ static inline int input_available_p(const struct tty_struct *tty, int poll)
1955
1955
* read_tail published
1956
1956
*/
1957
1957
static bool copy_from_read_buf (const struct tty_struct * tty ,
1958
- unsigned char * * kbp ,
1958
+ u8 * * kbp ,
1959
1959
size_t * nr )
1960
1960
1961
1961
{
@@ -1968,7 +1968,7 @@ static bool copy_from_read_buf(const struct tty_struct *tty,
1968
1968
n = min (head - ldata -> read_tail , N_TTY_BUF_SIZE - tail );
1969
1969
n = min (* nr , n );
1970
1970
if (n ) {
1971
- unsigned char * from = read_buf_addr (ldata , tail );
1971
+ u8 * from = read_buf_addr (ldata , tail );
1972
1972
memcpy (* kbp , from , n );
1973
1973
is_eof = n == 1 && * from == EOF_CHAR (tty );
1974
1974
tty_audit_add_data (tty , from , n );
@@ -2010,7 +2010,7 @@ static bool copy_from_read_buf(const struct tty_struct *tty,
2010
2010
* read_tail published
2011
2011
*/
2012
2012
static bool canon_copy_from_read_buf (const struct tty_struct * tty ,
2013
- unsigned char * * kbp ,
2013
+ u8 * * kbp ,
2014
2014
size_t * nr )
2015
2015
{
2016
2016
struct n_tty_data * ldata = tty -> disc_data ;
@@ -2229,7 +2229,7 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file, u8 *kbuf,
2229
2229
while (nr ) {
2230
2230
/* First test for status change. */
2231
2231
if (packet && tty -> link -> ctrl .pktstatus ) {
2232
- unsigned char cs ;
2232
+ u8 cs ;
2233
2233
if (kb != kbuf )
2234
2234
break ;
2235
2235
spin_lock_irq (& tty -> link -> ctrl .lock );
0 commit comments