David S. Miller wrote:
> This probably has nothing to do with why the patch doesn't
> work for you, but the transformation of "incoming" to a "u8"
> from an "int" is not fully correct, because hci_sock.c
> does this:
> 
>       put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), 
> &bt_cb(skb)->incoming);
> 

These things always scare me, why do folk litter code with sly knowledge
of the size of struct members that may and do change?

Why don't people do:

put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(bt_cb(skb)->incoming),
&bt_cb(skb)->incoming);

Or even better, use a macro to capture the semantics

#define put_struct_msg(msg, S, H, ITEM) \
 put_cmsg((msg),(S),(H),sizeof(ITEM),&(ITEM))

then do:
put_struct_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, bt_cb(skb)->incoming);


It is true that macros can be over-used to create a meta-language and
uber-api, but this case saves no end of trouble, surely it is what
macros are for?

Sam
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to