whitespace

Maksim Yevmenkin maksim.yevmenkin at savvis.net
Tue Mar 7 13:59:27 PST 2006


Iain Hibbert wrote:

>>of course. i will take patches from anybody (as long as it conforms to
>>style(9)) :) why do you even ask? :)
> 
> Hey, maybe you are some kind of dragon? :)
> 
> I just read this document though, and it seems that whitespace changes
> alone are not encouraged..  however, I got rid of them already in my
> porting, will see what other changes can be fed back..

sounds good

> In other news, some of what I said a few weeks ago is changed now, I put
> psm and channel into the sockaddr as it does look better than using
> setsockopt() for that. However, it still looks slightly different:
> 
> struct sockaddr_bt {
> 	uint8_t		bt_len;
> 	sa_family_t	bt_family;
> 	bdaddr_t	bt_bdaddr;
> 	uint16_t	bt_psm;
> 	uint8_t		bt_channel;
> };
> 
> ..because I am still using a single sockaddr type for all bluetooth family
> sockets. Protocols that dont use fields just ignore them, but if necessary
> for compatibility a #define can easily be used.

hmm.... i wonder if we can play "union { }" games here. basically, have

struct sockaddr_bt {
  	uint8_t		bt_len;
  	sa_family_t	bt_family;

	union {
	  uint8_t	_placeholder[32];

	  struct {
	  }		_hci;

	  struct {
	  }		_l2cap;

	  struct {
	  }		_rfcomm;
	}		bt_addr;
};

then add appropriate #define's for shortcut access to the union fields. 
i can then change freebsd code to use single 'struct sockaddr_bt' as well.

thanks,
max


More information about the freebsd-bluetooth mailing list