On 24.03.23 18:29, Marc Kleine-Budde wrote:
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. :)
Let's see if there would be really a use-case that would justify an
additional complexity.
So far I don't see the need for that.
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.
ACK
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().
Done. Sent a V3 patch a minute ago.
Many thanks,
Oliver