diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-03-14 22:27:53 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2015-03-15 03:45:39 -0400 |
commit | 6befc6445ffc6868ee6e6d0e012fc149e88d96db (patch) | |
tree | 5ecf36b60d646665227c393d7e9f11a49ca11e37 /net/bluetooth | |
parent | 96026d057a1fb7da1e314a24e3a1c528321ed45e (diff) |
Bluetooth: Add flags field and setting function for HCI sockets
To filter out certain actions for certain HCI sockets introcuce a flags
field that allows to configure specific settings on individual sockets.
Since the hci_pinfo structure is private in hci_sock.c, provide helper
functions for setting and clearing a given flag.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_sock.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index b614543b4fe3..bf5365c49c9c 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -47,8 +47,19 @@ struct hci_pinfo { | |||
47 | struct hci_filter filter; | 47 | struct hci_filter filter; |
48 | __u32 cmsg_mask; | 48 | __u32 cmsg_mask; |
49 | unsigned short channel; | 49 | unsigned short channel; |
50 | unsigned long flags; | ||
50 | }; | 51 | }; |
51 | 52 | ||
53 | void hci_sock_set_flag(struct sock *sk, int nr) | ||
54 | { | ||
55 | set_bit(nr, &hci_pi(sk)->flags); | ||
56 | } | ||
57 | |||
58 | void hci_sock_clear_flag(struct sock *sk, int nr) | ||
59 | { | ||
60 | clear_bit(nr, &hci_pi(sk)->flags); | ||
61 | } | ||
62 | |||
52 | static inline int hci_test_bit(int nr, const void *addr) | 63 | static inline int hci_test_bit(int nr, const void *addr) |
53 | { | 64 | { |
54 | return *((const __u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31)); | 65 | return *((const __u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31)); |