[NETLINK]: af_netlink.c checkpatch cleanups
Fix large number of checkpatch errors. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2fcb45b6b8
commit
6ac552fdc6
@ -156,7 +156,7 @@ static void netlink_sock_destruct(struct sock *sk)
|
|||||||
skb_queue_purge(&sk->sk_receive_queue);
|
skb_queue_purge(&sk->sk_receive_queue);
|
||||||
|
|
||||||
if (!sock_flag(sk, SOCK_DEAD)) {
|
if (!sock_flag(sk, SOCK_DEAD)) {
|
||||||
printk("Freeing alive netlink socket %p\n", sk);
|
printk(KERN_ERR "Freeing alive netlink socket %p\n", sk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BUG_TRAP(!atomic_read(&sk->sk_rmem_alloc));
|
BUG_TRAP(!atomic_read(&sk->sk_rmem_alloc));
|
||||||
@ -164,8 +164,8 @@ static void netlink_sock_destruct(struct sock *sk)
|
|||||||
BUG_TRAP(!nlk_sk(sk)->groups);
|
BUG_TRAP(!nlk_sk(sk)->groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on SMP.
|
/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on
|
||||||
* Look, when several writers sleep and reader wakes them up, all but one
|
* SMP. Look, when several writers sleep and reader wakes them up, all but one
|
||||||
* immediately hit write lock and grab all the cpus. Exclusive sleep solves
|
* immediately hit write lock and grab all the cpus. Exclusive sleep solves
|
||||||
* this, _but_ remember, it adds useless work on UP machines.
|
* this, _but_ remember, it adds useless work on UP machines.
|
||||||
*/
|
*/
|
||||||
@ -192,13 +192,13 @@ static void netlink_table_grab(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ void netlink_table_ungrab(void)
|
static inline void netlink_table_ungrab(void)
|
||||||
{
|
{
|
||||||
write_unlock_irq(&nl_table_lock);
|
write_unlock_irq(&nl_table_lock);
|
||||||
wake_up(&nl_table_wait);
|
wake_up(&nl_table_wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ void
|
static inline void
|
||||||
netlink_lock_table(void)
|
netlink_lock_table(void)
|
||||||
{
|
{
|
||||||
/* read_lock() synchronizes us to netlink_table_grab */
|
/* read_lock() synchronizes us to netlink_table_grab */
|
||||||
@ -208,14 +208,15 @@ netlink_lock_table(void)
|
|||||||
read_unlock(&nl_table_lock);
|
read_unlock(&nl_table_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ void
|
static inline void
|
||||||
netlink_unlock_table(void)
|
netlink_unlock_table(void)
|
||||||
{
|
{
|
||||||
if (atomic_dec_and_test(&nl_table_users))
|
if (atomic_dec_and_test(&nl_table_users))
|
||||||
wake_up(&nl_table_wait);
|
wake_up(&nl_table_wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ struct sock *netlink_lookup(struct net *net, int protocol, u32 pid)
|
static inline struct sock *netlink_lookup(struct net *net, int protocol,
|
||||||
|
u32 pid)
|
||||||
{
|
{
|
||||||
struct nl_pid_hash *hash = &nl_table[protocol].hash;
|
struct nl_pid_hash *hash = &nl_table[protocol].hash;
|
||||||
struct hlist_head *head;
|
struct hlist_head *head;
|
||||||
@ -445,7 +446,8 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol)
|
|||||||
cb_mutex = nl_table[protocol].cb_mutex;
|
cb_mutex = nl_table[protocol].cb_mutex;
|
||||||
netlink_unlock_table();
|
netlink_unlock_table();
|
||||||
|
|
||||||
if ((err = __netlink_create(net, sock, cb_mutex, protocol)) < 0)
|
err = __netlink_create(net, sock, cb_mutex, protocol);
|
||||||
|
if (err < 0)
|
||||||
goto out_module;
|
goto out_module;
|
||||||
|
|
||||||
nlk = nlk_sk(sock->sk);
|
nlk = nlk_sk(sock->sk);
|
||||||
@ -600,7 +602,8 @@ static int netlink_realloc_groups(struct sock *sk)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
|
static int netlink_bind(struct socket *sock, struct sockaddr *addr,
|
||||||
|
int addr_len)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct net *net = sk->sk_net;
|
struct net *net = sk->sk_net;
|
||||||
@ -678,7 +681,8 @@ static int netlink_connect(struct socket *sock, struct sockaddr *addr,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int netlink_getname(struct socket *sock, struct sockaddr *addr, int *addr_len, int peer)
|
static int netlink_getname(struct socket *sock, struct sockaddr *addr,
|
||||||
|
int *addr_len, int peer)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct netlink_sock *nlk = nlk_sk(sk);
|
struct netlink_sock *nlk = nlk_sk(sk);
|
||||||
@ -885,6 +889,7 @@ retry:
|
|||||||
|
|
||||||
return netlink_sendskb(sk, skb);
|
return netlink_sendskb(sk, skb);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(netlink_unicast);
|
||||||
|
|
||||||
int netlink_has_listeners(struct sock *sk, unsigned int group)
|
int netlink_has_listeners(struct sock *sk, unsigned int group)
|
||||||
{
|
{
|
||||||
@ -905,7 +910,8 @@ int netlink_has_listeners(struct sock *sk, unsigned int group)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(netlink_has_listeners);
|
EXPORT_SYMBOL_GPL(netlink_has_listeners);
|
||||||
|
|
||||||
static __inline__ int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
|
static inline int netlink_broadcast_deliver(struct sock *sk,
|
||||||
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct netlink_sock *nlk = nlk_sk(sk);
|
struct netlink_sock *nlk = nlk_sk(sk);
|
||||||
|
|
||||||
@ -1026,6 +1032,7 @@ int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid,
|
|||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
return -ESRCH;
|
return -ESRCH;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(netlink_broadcast);
|
||||||
|
|
||||||
struct netlink_set_err_data {
|
struct netlink_set_err_data {
|
||||||
struct sock *exclude_sk;
|
struct sock *exclude_sk;
|
||||||
@ -1390,6 +1397,7 @@ out_sock_release:
|
|||||||
sock_release(sock);
|
sock_release(sock);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(netlink_kernel_create);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* netlink_change_ngroups - change number of multicast groups
|
* netlink_change_ngroups - change number of multicast groups
|
||||||
@ -1461,6 +1469,7 @@ void netlink_set_nonroot(int protocol, unsigned int flags)
|
|||||||
if ((unsigned int)protocol < MAX_LINKS)
|
if ((unsigned int)protocol < MAX_LINKS)
|
||||||
nl_table[protocol].nl_nonroot = flags;
|
nl_table[protocol].nl_nonroot = flags;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(netlink_set_nonroot);
|
||||||
|
|
||||||
static void netlink_destroy_callback(struct netlink_callback *cb)
|
static void netlink_destroy_callback(struct netlink_callback *cb)
|
||||||
{
|
{
|
||||||
@ -1529,7 +1538,8 @@ errout:
|
|||||||
|
|
||||||
int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
|
int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
|
||||||
struct nlmsghdr *nlh,
|
struct nlmsghdr *nlh,
|
||||||
int (*dump)(struct sk_buff *skb, struct netlink_callback*),
|
int (*dump)(struct sk_buff *skb,
|
||||||
|
struct netlink_callback *),
|
||||||
int (*done)(struct netlink_callback *))
|
int (*done)(struct netlink_callback *))
|
||||||
{
|
{
|
||||||
struct netlink_callback *cb;
|
struct netlink_callback *cb;
|
||||||
@ -1571,6 +1581,7 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
|
|||||||
*/
|
*/
|
||||||
return -EINTR;
|
return -EINTR;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(netlink_dump_start);
|
||||||
|
|
||||||
void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
|
void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
|
||||||
{
|
{
|
||||||
@ -1605,6 +1616,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
|
|||||||
memcpy(&errmsg->msg, nlh, err ? nlh->nlmsg_len : sizeof(*nlh));
|
memcpy(&errmsg->msg, nlh, err ? nlh->nlmsg_len : sizeof(*nlh));
|
||||||
netlink_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).pid, MSG_DONTWAIT);
|
netlink_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).pid, MSG_DONTWAIT);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(netlink_ack);
|
||||||
|
|
||||||
int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
|
int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
|
||||||
struct nlmsghdr *))
|
struct nlmsghdr *))
|
||||||
@ -1646,6 +1658,7 @@ skip:
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(netlink_rcv_skb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nlmsg_notify - send a notification netlink message
|
* nlmsg_notify - send a notification netlink message
|
||||||
@ -1678,6 +1691,7 @@ int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 pid,
|
|||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(nlmsg_notify);
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
struct nl_seq_iter {
|
struct nl_seq_iter {
|
||||||
@ -1820,11 +1834,13 @@ int netlink_register_notifier(struct notifier_block *nb)
|
|||||||
{
|
{
|
||||||
return atomic_notifier_chain_register(&netlink_chain, nb);
|
return atomic_notifier_chain_register(&netlink_chain, nb);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(netlink_register_notifier);
|
||||||
|
|
||||||
int netlink_unregister_notifier(struct notifier_block *nb)
|
int netlink_unregister_notifier(struct notifier_block *nb)
|
||||||
{
|
{
|
||||||
return atomic_notifier_chain_unregister(&netlink_chain, nb);
|
return atomic_notifier_chain_unregister(&netlink_chain, nb);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(netlink_unregister_notifier);
|
||||||
|
|
||||||
static const struct proto_ops netlink_ops = {
|
static const struct proto_ops netlink_ops = {
|
||||||
.family = PF_NETLINK,
|
.family = PF_NETLINK,
|
||||||
@ -1929,14 +1945,3 @@ panic:
|
|||||||
}
|
}
|
||||||
|
|
||||||
core_initcall(netlink_proto_init);
|
core_initcall(netlink_proto_init);
|
||||||
|
|
||||||
EXPORT_SYMBOL(netlink_ack);
|
|
||||||
EXPORT_SYMBOL(netlink_rcv_skb);
|
|
||||||
EXPORT_SYMBOL(netlink_broadcast);
|
|
||||||
EXPORT_SYMBOL(netlink_dump_start);
|
|
||||||
EXPORT_SYMBOL(netlink_kernel_create);
|
|
||||||
EXPORT_SYMBOL(netlink_register_notifier);
|
|
||||||
EXPORT_SYMBOL(netlink_set_nonroot);
|
|
||||||
EXPORT_SYMBOL(netlink_unicast);
|
|
||||||
EXPORT_SYMBOL(netlink_unregister_notifier);
|
|
||||||
EXPORT_SYMBOL(nlmsg_notify);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user