[LTP] [PATCH v8 0/4] Improve ioctl02.c

Marius Kittler mkittler@suse.de
Wed Oct 25 13:08:31 CEST 2023


I implemented again the changes requested for the first and last
patch.

That means I removed quite a few comments; I totally agree that
this code was over-commented. I kept a few comments (mainly in the
prepare function for the struct) because some struct members are
over-abbreviated (e.g. `c_cc`) so the comments actually do help
understanding the code. Some comments were also stating the
intention of the code which also seemed not completely useless.

I dropped the intermediate patch to use just termios.

In the last patch I decided to use the double-assignment
suggestion after all because the fields in termios are consistently
wider than the fields in termio so when just swapping the
assignment order this should be fine (there can never be a lossy
conversion). I also decided to make the loop a macro as well
because at this point we might as well go all-in with the macros.

Btw, you're sure you don't want to give C++ a try at some point :-)
(Just mentioning this because I really would have liked using C++
templates in this case and with C++ you can really pick what you
like and keep everything else in the usual C-style.)

Marius Kittler (4):
  Refactor ioctl02.c to use the new test API
  Make checks for termio flags more strict
  Remove disabled code in ioctl02.c
  Extend ioctl02 to test termio and termios

 testcases/kernel/syscalls/ioctl/ioctl02.c | 551 +++++++---------------
 1 file changed, 171 insertions(+), 380 deletions(-)

-- 
2.42.0



More information about the ltp mailing list