lbs_cmd_with_response() buffer sizes

David Woodhouse dwmw2 at infradead.org
Sat Dec 15 11:47:00 EST 2007


I thought we did the helper macro with sizeof() for
lbs_cmd_with_response() just so that all the callers didn't have to set
cmd->hdr.size manually for themselves. Now I realise they _do_, because
that's the returned size. It's only the size of the command to be _sent_
which is inferred with sizeof().

I'm a bit dubious about that interface -- maybe we want to make the
length an explicit argument to lbs_cmd_with_response()?

Also, I think we have them the wrong way round. Most of the time,
sizeof() is going to give you the total size of the object that the
compiler knows about -- which is suitable for the _response_ size,
although the packet you send may be smaller. So if we're going to
explicitly specify one or the other, it should be the _outgoing_ size we
specify. I'll poke at it later; in the middle of the core command
queueing stuff now.

Not entirely convinced whether I want to set a flag in the cmdnode which
makes it get automatically freed, or whether I want the callback to have
to do it. I'll probably do the latter for now and we can consider
changing it later. Easier to move in that direction.

-- 
dwmw2




More information about the libertas-dev mailing list