Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[safe/jmp/linux-2.6] / include / linux / netlink.h
index e638256..ab5d312 100644 (file)
@@ -103,6 +103,8 @@ struct nlmsgerr
 #define NETLINK_ADD_MEMBERSHIP 1
 #define NETLINK_DROP_MEMBERSHIP        2
 #define NETLINK_PKTINFO                3
+#define NETLINK_BROADCAST_ERROR        4
+#define NETLINK_NO_ENOBUFS     5
 
 struct nl_pktinfo
 {
@@ -166,6 +168,7 @@ struct netlink_skb_parms
        __u32                   dst_group;
        kernel_cap_t            eff_cap;
        __u32                   loginuid;       /* Login (audit) uid */
+       __u32                   sessionid;      /* Session id (audit) */
        __u32                   sid;            /* SELinux security id */
 };
 
@@ -173,12 +176,18 @@ struct netlink_skb_parms
 #define NETLINK_CREDS(skb)     (&NETLINK_CB((skb)).creds)
 
 
+extern void netlink_table_grab(void);
+extern void netlink_table_ungrab(void);
+
 extern struct sock *netlink_kernel_create(struct net *net,
                                          int unit,unsigned int groups,
-                                         void (*input)(struct sock *sk, int len),
+                                         void (*input)(struct sk_buff *skb),
                                          struct mutex *cb_mutex,
                                          struct module *module);
+extern void netlink_kernel_release(struct sock *sk);
+extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
 extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
+extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group);
 extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
 extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
 extern int netlink_has_listeners(struct sock *sk, unsigned int group);
@@ -191,10 +200,10 @@ extern int netlink_unregister_notifier(struct notifier_block *nb);
 
 /* finegrained unicast helpers: */
 struct sock *netlink_getsockbyfilp(struct file *filp);
-int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
-               long timeo, struct sock *ssk);
+int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
+                     long *timeo, struct sock *ssk);
 void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
-int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
+int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
 
 /*
  *     skb should fit one page. This choice is good for headerless malloc.
@@ -213,12 +222,13 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
 
 struct netlink_callback
 {
-       struct sk_buff  *skb;
-       struct nlmsghdr *nlh;
-       int             (*dump)(struct sk_buff * skb, struct netlink_callback *cb);
-       int             (*done)(struct netlink_callback *cb);
-       int             family;
-       long            args[5];
+       struct sk_buff          *skb;
+       const struct nlmsghdr   *nlh;
+       int                     (*dump)(struct sk_buff * skb,
+                                       struct netlink_callback *cb);
+       int                     (*done)(struct netlink_callback *cb);
+       int                     family;
+       long                    args[6];
 };
 
 struct netlink_notify
@@ -240,12 +250,13 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
        nlh->nlmsg_flags = flags;
        nlh->nlmsg_pid = pid;
        nlh->nlmsg_seq = seq;
-       memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
+       if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
+               memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
        return nlh;
 }
 
 #define NLMSG_NEW(skb, pid, seq, type, len, flags) \
-({     if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \
+({     if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \
                goto nlmsg_failure; \
        __nlmsg_put(skb, pid, seq, type, len, flags); })
 
@@ -253,7 +264,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
        NLMSG_NEW(skb, pid, seq, type, len, 0)
 
 extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
-                             struct nlmsghdr *nlh,
+                             const struct nlmsghdr *nlh,
                              int (*dump)(struct sk_buff *skb, struct netlink_callback*),
                              int (*done)(struct netlink_callback*));