Hi Jakub, On Tue, Sep 30, 2014 at 2:41 PM, Tyszkowski Jakub <jakub.tyszkowski@xxxxxxxxx> wrote: >>> +struct pdu { >>> + uint8_t *data; >>> + uint16_t size; >> >> >> The size should probably be size_t, or even better use struct iovec >> directly here since it is about the same. > > > I wouldn't go that far and use iovec's here. > > I actually had one patch on top of this set which replaces this struct with > iovec but in the end the only benefit was one struct definition less as > bthost API does not take iovecs: Im working on it already, internally bthost already uses iovec so it makes sense to expose it if we can benefit from it. > void bthost_send_cid(struct bthost *bthost, uint16_t handle, > uint16_t cid, const void *data, uint16_t len) > > And this function is also a reason for 'size' being uint16_t. > > BTW I think 'pdu.data' looks better than 'pdu.iov_base' and we shouldn't > make it look more complicated than it is without the real benefit. Well this is not exactly the point, it might look better but struct iovec is a standard interface so it only make sense to introduce another design if the standard does not attend our needs which does not seems to be the case here. >> >>> +}; >>> + >>> +#define raw_data(args...) ((unsigned char[]) { args }) >>> + >>> +#define raw_pdu(args...) \ >>> + { \ >>> + .data = raw_data(args), \ >>> + .size = sizeof(raw_data(args)), \ >>> + } >>> + >>> +#define null_pdu { .data = NULL } >>> + >>> #define TEST_CASE_BREDR(text, ...) { \ >>> HCIEMU_TYPE_BREDR, \ >>> text, \ >>> -- >>> 1.9.1 >> >> >> >> > > Regards, > Jakub -- Luiz Augusto von Dentz -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html