On 22.03.2023 18:59:04, Oliver Hartkopp wrote: .> > > I've been thinking about some sendfile() implementation too. But this again > > > would bloat the code and would not solve the rx side. > > > > I'm not talking about sendfile. Have a look at j1939's > > j1939_sk_send_loop(); > > > > | https://elixir.bootlin.com/linux/v6.2/source/net/can/j1939/socket.c#L1114 > > > > This does not work for isotp like this as you have to handle different block > sizes in the flow control message. Let this be a task for future us. :) > > > > what about: ARRAY_SIZE(so->rx.sbuf) > > > > > > > > > > Looks good. I was just unsure which macro to use ;-) > > > > You can also use sizeof(so->rx.sbuf). > > > > ARRAY_SIZE would cause a compile error if you convert so->rx.sbuf to a > > pointer to dynamically allocated mem, while sizeof() still compiles. > > so->rx.sbuf is always a static buffer. Yes, in the current code. I was showing the difference between ARRAY_SIZE() and sizeof(). ARRAY_SIZE has a bit of type checking, while sizeof() doesn't - this becomes important once you change the code. > Only so->rx.buf can point to either so->rx.sbuf or to a dynamically > allocated memory. > > But when sizeof() is always safe it would take this for the v3 patch. Use ARRAY_SIZE(). regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Attachment:
signature.asc
Description: PGP signature