mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-09 15:29:16 +00:00
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>
This commit is contained in:
parent
96026d057a
commit
6befc6445f
@ -335,6 +335,9 @@ out:
|
|||||||
|
|
||||||
int bt_to_errno(__u16 code);
|
int bt_to_errno(__u16 code);
|
||||||
|
|
||||||
|
void hci_sock_set_flag(struct sock *sk, int nr);
|
||||||
|
void hci_sock_clear_flag(struct sock *sk, int nr);
|
||||||
|
|
||||||
int hci_sock_init(void);
|
int hci_sock_init(void);
|
||||||
void hci_sock_cleanup(void);
|
void hci_sock_cleanup(void);
|
||||||
|
|
||||||
|
@ -47,8 +47,19 @@ struct hci_pinfo {
|
|||||||
struct hci_filter filter;
|
struct hci_filter filter;
|
||||||
__u32 cmsg_mask;
|
__u32 cmsg_mask;
|
||||||
unsigned short channel;
|
unsigned short channel;
|
||||||
|
unsigned long flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void hci_sock_set_flag(struct sock *sk, int nr)
|
||||||
|
{
|
||||||
|
set_bit(nr, &hci_pi(sk)->flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hci_sock_clear_flag(struct sock *sk, int nr)
|
||||||
|
{
|
||||||
|
clear_bit(nr, &hci_pi(sk)->flags);
|
||||||
|
}
|
||||||
|
|
||||||
static inline int hci_test_bit(int nr, const void *addr)
|
static inline int hci_test_bit(int nr, const void *addr)
|
||||||
{
|
{
|
||||||
return *((const __u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31));
|
return *((const __u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user