Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux...
[firefly-linux-kernel-4.4.55.git] / include / net / sock.h
index dcde2d9268cd109319f4631eba8b5b6c1af1d92e..04bc0b30e9e9067320eaeb7c43d1def462771e6d 100644 (file)
@@ -56,6 +56,8 @@
 #include <linux/memcontrol.h>
 #include <linux/res_counter.h>
 #include <linux/static_key.h>
+#include <linux/aio.h>
+#include <linux/sched.h>
 
 #include <linux/filter.h>
 #include <linux/rculist_nulls.h>
@@ -69,7 +71,7 @@ struct cgroup;
 struct cgroup_subsys;
 #ifdef CONFIG_NET
 int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss);
-void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss);
+void mem_cgroup_sockets_destroy(struct cgroup *cgrp);
 #else
 static inline
 int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
@@ -77,7 +79,7 @@ int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss)
        return 0;
 }
 static inline
-void mem_cgroup_sockets_destroy(struct cgroup *cgrp, struct cgroup_subsys *ss)
+void mem_cgroup_sockets_destroy(struct cgroup *cgrp)
 {
 }
 #endif
@@ -357,6 +359,7 @@ struct sock {
        struct page             *sk_sndmsg_page;
        struct sk_buff          *sk_send_head;
        __u32                   sk_sndmsg_off;
+       __s32                   sk_peek_off;
        int                     sk_write_pending;
 #ifdef CONFIG_SECURITY
        void                    *sk_security;
@@ -373,6 +376,30 @@ struct sock {
        void                    (*sk_destruct)(struct sock *sk);
 };
 
+static inline int sk_peek_offset(struct sock *sk, int flags)
+{
+       if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0))
+               return sk->sk_peek_off;
+       else
+               return 0;
+}
+
+static inline void sk_peek_offset_bwd(struct sock *sk, int val)
+{
+       if (sk->sk_peek_off >= 0) {
+               if (sk->sk_peek_off >= val)
+                       sk->sk_peek_off -= val;
+               else
+                       sk->sk_peek_off = 0;
+       }
+}
+
+static inline void sk_peek_offset_fwd(struct sock *sk, int val)
+{
+       if (sk->sk_peek_off >= 0)
+               sk->sk_peek_off += val;
+}
+
 /*
  * Hashed lists helper routines
  */
@@ -590,6 +617,10 @@ enum sock_flags {
        SOCK_RXQ_OVFL,
        SOCK_ZEROCOPY, /* buffers from userspace */
        SOCK_WIFI_STATUS, /* push wifi status to userspace */
+       SOCK_NOFCS, /* Tell NIC not to do the Ethernet FCS.
+                    * Will use last 4 bytes of packet sent from
+                    * user-space instead.
+                    */
 };
 
 static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -871,8 +902,7 @@ struct proto {
         */
        int                     (*init_cgroup)(struct cgroup *cgrp,
                                               struct cgroup_subsys *ss);
-       void                    (*destroy_cgroup)(struct cgroup *cgrp,
-                                                 struct cgroup_subsys *ss);
+       void                    (*destroy_cgroup)(struct cgroup *cgrp);
        struct cg_proto         *(*proto_cgroup)(struct mem_cgroup *memcg);
 #endif
 };