|
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14 |
|
| #
f812af36 |
| 17-Mar-2025 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: move more_to_be_read to the end of n_tty_read()
n_tty_read() contains "we need more data" handling deep in that function. And there is also a label (more_to_be_read) as we handle this si
tty: n_tty: move more_to_be_read to the end of n_tty_read()
n_tty_read() contains "we need more data" handling deep in that function. And there is also a label (more_to_be_read) as we handle this situation from two places.
It makes more sense to have all "return"s accumulated at the end of functions. And "goto" from multiple places there. Therefore, do this with the "more_to_be_read" label in n_tty_read().
After this and the previous changes, n_tty_read() is now much more easier to follow.
Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
40315ce5 |
| 17-Mar-2025 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: extract n_tty_wait_for_input()
n_tty_read() is a very long function doing too much of different stuff. Extract the "wait for input" to a separate function: n_tty_wait_for_input(). It ret
tty: n_tty: extract n_tty_wait_for_input()
n_tty_read() is a very long function doing too much of different stuff. Extract the "wait for input" to a separate function: n_tty_wait_for_input(). It returns an error (< 0), no input (0), or has potential input (1).
Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
aa1ebc9c |
| 17-Mar-2025 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: extract n_tty_continue_cookie() from n_tty_read()
n_tty_read() is a very long function doing too much of different stuff. Extract the "cookie" (continuation read) handling to a separate
tty: n_tty: extract n_tty_continue_cookie() from n_tty_read()
n_tty_read() is a very long function doing too much of different stuff. Extract the "cookie" (continuation read) handling to a separate function: n_tty_continue_cookie().
Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
67e781f5 |
| 17-Mar-2025 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: drop n_tty_trace()
This n_tty_trace() is an always disabled debugging macro. It comes from commit 32f13521ca68 ("n_tty: Line copy to user buffer in canonical mode").
Drop it as it is de
tty: n_tty: drop n_tty_trace()
This n_tty_trace() is an always disabled debugging macro. It comes from commit 32f13521ca68 ("n_tty: Line copy to user buffer in canonical mode").
Drop it as it is dead for over a decade.
Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
e287d646 |
| 17-Mar-2025 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: clean up process_output_block()
* Use guard(mutex), which results in: - the function can return directly when "space == 0". - "i" can now be "unsigned" as it is no longer abused to h
tty: n_tty: clean up process_output_block()
* Use guard(mutex), which results in: - the function can return directly when "space == 0". - "i" can now be "unsigned" as it is no longer abused to hold a retval from tty->ops->write(). Note the compared-to "nr" is already "unsigned". * The end label is now dubbed "do_write" as that is what happens there. Unlike the uncertain "break_out" name.
Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
fdfa49a8 |
| 17-Mar-2025 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: simplify process_output()
Using guard(mutex), the function can be written in a much more efficient way.
Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel
tty: n_tty: simplify process_output()
Using guard(mutex), the function can be written in a much more efficient way.
Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
d97aa066 |
| 17-Mar-2025 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: use uint for space returned by tty_write_room()
tty_write_room() returns an "unsigned int". So in case some insane driver (like my tty test driver) returns (legitimate) UINT_MAX from its
tty: n_tty: use uint for space returned by tty_write_room()
tty_write_room() returns an "unsigned int". So in case some insane driver (like my tty test driver) returns (legitimate) UINT_MAX from its tty_operations::write_room(), n_tty is confused on several places.
For example, in process_output_block(), the result of tty_write_room() is stored into (signed) "int". So this UINT_MAX suddenly becomes -1. And that is extended to ssize_t and returned from process_output_block(). This causes a write() to such a node to receive -EPERM (which is -1).
Fix that by using proper "unsigned int" and proper "== 0" test. And return 0 constant directly in that "if", so that it is immediately clear what is returned ("space" equals to 0 at that point).
Similarly for process_output() and __process_echoes().
Note this does not fix any in-tree driver as of now.
If you want "Fixes: something", it would be commit 03b3b1a2405c ("tty: make tty_operations::write_room return uint"). I intentionally do not mark this patch by a real tag below.
Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
d2e38e71 |
| 17-Mar-2025 |
Jiri Slaby (SUSE) <[email protected]> |
tty: move N_TTY_BUF_SIZE to n_tty
"N_TTY_BUF_SIZE" is private to n_tty and shall not be exposed to the world. Definitely not in tty.h somewhere in the middle of "struct tty_struct".
This is a remna
tty: move N_TTY_BUF_SIZE to n_tty
"N_TTY_BUF_SIZE" is private to n_tty and shall not be exposed to the world. Definitely not in tty.h somewhere in the middle of "struct tty_struct".
This is a remnant of moving "read_flags" to "struct n_tty_data" in commit 3fe780b379fa ("TTY: move ldisc data from tty_struct: bitmaps"). But some cleanup was needed first (in previous patches).
Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3, v6.10-rc2, v6.10-rc1 |
|
| #
b19ab7ee |
| 14-May-2024 |
Ilpo Järvinen <[email protected]> |
tty: n_tty: Fix buffer offsets when lookahead is used
When lookahead has "consumed" some characters (la_count > 0), n_tty_receive_buf_standard() and n_tty_receive_buf_closing() for characters beyond
tty: n_tty: Fix buffer offsets when lookahead is used
When lookahead has "consumed" some characters (la_count > 0), n_tty_receive_buf_standard() and n_tty_receive_buf_closing() for characters beyond the la_count are given wrong cp/fp offsets which leads to duplicating and losing some characters.
If la_count > 0, correct buffer pointers and make count consistent too (the latter is not strictly necessary to fix the issue but seems more logical to adjust all variables immediately to keep state consistent).
Reported-by: Vadym Krevs <[email protected]> Fixes: 6bb6fa6908eb ("tty: Implement lookahead to process XON/XOFF timely") Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218834 Tested-by: Vadym Krevs <[email protected]> Cc: [email protected] Signed-off-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6, v6.7-rc5, v6.7-rc4, v6.7-rc3, v6.7-rc2, v6.7-rc1, v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5, v6.6-rc4, v6.6-rc3 |
|
| #
5b4f9cf3 |
| 19-Sep-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: invert return values of tty_{,un}throttle_safe()
If tty_{,un}throttle_safe() returned true on success (similar to *_trylock()), it would make the conditions in callers more obvious. So perform
tty: invert return values of tty_{,un}throttle_safe()
If tty_{,un}throttle_safe() returned true on success (similar to *_trylock()), it would make the conditions in callers more obvious. So perform the switch to these inverted values (and fix the callers).
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
043c8a7c |
| 19-Sep-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: use do-while in n_tty_check_{,un}throttle()
This change gets rid of the complicated exit from the loops. It can be done much easier using do-while loops.
Signed-off-by: "Jiri Slaby (SUS
tty: n_tty: use do-while in n_tty_check_{,un}throttle()
This change gets rid of the complicated exit from the loops. It can be done much easier using do-while loops.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
c2b0fb9f |
| 19-Sep-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: invert the condition in copy_from_read_buf()
Make "no numbers available" a fast quit from the function. And do the heavy work outside the 'if'. This makes the code more understandable an
tty: n_tty: invert the condition in copy_from_read_buf()
Make "no numbers available" a fast quit from the function. And do the heavy work outside the 'if'. This makes the code more understandable and conforming to the common kernel coding style.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
72369f2d |
| 19-Sep-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: use min3() in copy_from_read_buf()
n is a minimum of: * available chars in the ring buffer * available chars in the ring buffer till the end of the ring buffer * requested number (*nr)
tty: n_tty: use min3() in copy_from_read_buf()
n is a minimum of: * available chars in the ring buffer * available chars in the ring buffer till the end of the ring buffer * requested number (*nr)
We can use min3() for that instead of two min()s.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
1e619477 |
| 19-Sep-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: rename and retype 'retval' in n_tty_ioctl()
The value stored to the current 'retval' is number of characters. It is both obtained and put to user as unsigned. So make its type unsigned.
tty: n_tty: rename and retype 'retval' in n_tty_ioctl()
The value stored to the current 'retval' is number of characters. It is both obtained and put to user as unsigned. So make its type unsigned. And provided it's not a "return value" per se, rename it to 'num'.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
4a2ad266 |
| 19-Sep-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: use 'retval' instead of 'c'
In n_tty_read(), there is a separate int variable 'c' and is used only to hold an int value returned from job_control(). There is also a 'retval' variable typ
tty: n_tty: use 'retval' instead of 'c'
In n_tty_read(), there is a separate int variable 'c' and is used only to hold an int value returned from job_control(). There is also a 'retval' variable typed ssize_t. So drop this single occurrence of 'c' and reuse 'retval' which is used on all other places to hold the value returned from n_tty_read().
Note that 'retval' needs not be initialized now. Drop that.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
|
Revision tags: v6.6-rc2, v6.6-rc1, v6.5 |
|
| #
a84853c5 |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: deduplicate copy code in n_tty_receive_buf_real_raw()
The code is duplicated to perform the copy twice -- to handle buffer wrap-around. Instead of the duplication, roll this into the loo
tty: n_tty: deduplicate copy code in n_tty_receive_buf_real_raw()
The code is duplicated to perform the copy twice -- to handle buffer wrap-around. Instead of the duplication, roll this into the loop.
(And add some blank lines around to have the code a bit more readable.)
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
2aa91851 |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: extract ECHO_OP processing to a separate function
__process_echoes() contains ECHO_OPs processing. It is stuffed in a while loop and the whole function is barely readable. Separate it to
tty: n_tty: extract ECHO_OP processing to a separate function
__process_echoes() contains ECHO_OPs processing. It is stuffed in a while loop and the whole function is barely readable. Separate it to a new function: n_tty_process_echo_ops().
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
e30364c7 |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: unify counts to size_t
Some count types are already 'size_t' for a long time. Some were switched to 'size_t' recently. Unify the rest with those now.
This allows for some min_t()s to be
tty: n_tty: unify counts to size_t
Some count types are already 'size_t' for a long time. Some were switched to 'size_t' recently. Unify the rest with those now.
This allows for some min_t()s to become min()s. And make one min() an explicit min_t() as we are comparing signed 'room' to unsigned 'count'.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
b9b96b20 |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: use u8 for chars and flags
Unify with the tty layer and use u8 for both chars and flags.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/202308
tty: n_tty: use u8 for chars and flags
Unify with the tty layer and use u8 for both chars and flags.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
d88c3c26 |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: simplify chars_in_buffer()
The 'if' in chars_in_buffer() is misleadingly inverted. And since the only difference is the head used for computation, cache the head using ternary operator.
tty: n_tty: simplify chars_in_buffer()
The 'if' in chars_in_buffer() is misleadingly inverted. And since the only difference is the head used for computation, cache the head using ternary operator. And use that in return directly.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
046b44ab |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: remove unsigned char casts from character constants
We compile with -funsigned-char, so all character constants are already unsigned chars. Therefore, remove superfluous casts.
Signed-o
tty: n_tty: remove unsigned char casts from character constants
We compile with -funsigned-char, so all character constants are already unsigned chars. Therefore, remove superfluous casts.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
00830407 |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: move newline handling to a separate function
Currently, n_tty handles the newline in a label in n_tty_receive_char_canon(). That is invoked from two more places. Split this code to a sep
tty: n_tty: move newline handling to a separate function
Currently, n_tty handles the newline in a label in n_tty_receive_char_canon(). That is invoked from two more places. Split this code to a separate function and avoid the label in this case.
This makes the code flow more understandable.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
102dc8aa |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: move canon handling to a separate function
n_tty_receive_char_special() is already complicated enough. Split the canon handling to a separate function: n_tty_receive_char_canon().
Signe
tty: n_tty: move canon handling to a separate function
n_tty_receive_char_special() is already complicated enough. Split the canon handling to a separate function: n_tty_receive_char_canon().
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
819287f0 |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: use MASK() for masking out size bits
In n_tty, there is already a macro to mask out top bits from ring buffer counters. It is MASK() added some time ago. So use it more in the code to ma
tty: n_tty: use MASK() for masking out size bits
In n_tty, there is already a macro to mask out top bits from ring buffer counters. It is MASK() added some time ago. So use it more in the code to make it more readable.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|
| #
c3b2b26f |
| 27-Aug-2023 |
Jiri Slaby (SUSE) <[email protected]> |
tty: n_tty: make n_tty_data::num_overrun unsigned
n_tty_data::num_overrun is unlikely to overflow in a second. But make it explicitly unsigned to avoid printing negative values.
Signed-off-by: "Jir
tty: n_tty: make n_tty_data::num_overrun unsigned
n_tty_data::num_overrun is unlikely to overflow in a second. But make it explicitly unsigned to avoid printing negative values.
Signed-off-by: "Jiri Slaby (SUSE)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
show more ...
|