nfsd41: define NFSD_DRC_SIZE_SHIFT in set_max_drc
[safe/jmp/linux-2.6] / include / linux / net.h
index 0235d91..4515efa 100644 (file)
 #ifndef _LINUX_NET_H
 #define _LINUX_NET_H
 
-#include <linux/wait.h>
+#include <linux/socket.h>
 #include <asm/socket.h>
 
-struct poll_table_struct;
-struct pipe_inode_info;
-struct inode;
-struct net;
-
-#define NPROTO         34              /* should be enough for now..   */
+#define NPROTO         AF_MAX
 
 #define SYS_SOCKET     1               /* sys_socket(2)                */
 #define SYS_BIND       2               /* sys_bind(2)                  */
@@ -45,6 +40,7 @@ struct net;
 #define SYS_GETSOCKOPT 15              /* sys_getsockopt(2)            */
 #define SYS_SENDMSG    16              /* sys_sendmsg(2)               */
 #define SYS_RECVMSG    17              /* sys_recvmsg(2)               */
+#define SYS_ACCEPT4    18              /* sys_accept4(2)               */
 
 typedef enum {
        SS_FREE = 0,                    /* not allocated                */
@@ -59,6 +55,13 @@ typedef enum {
 #ifdef __KERNEL__
 #include <linux/stringify.h>
 #include <linux/random.h>
+#include <linux/wait.h>
+#include <linux/fcntl.h>       /* For O_CLOEXEC and O_NONBLOCK */
+
+struct poll_table_struct;
+struct pipe_inode_info;
+struct inode;
+struct net;
 
 #define SOCK_ASYNC_NOSPACE     0
 #define SOCK_ASYNC_WAITDATA    1
@@ -93,6 +96,15 @@ enum sock_type {
 };
 
 #define SOCK_MAX (SOCK_PACKET + 1)
+/* Mask which covers at least up to SOCK_MASK-1.  The
+ * remaining bits are used as flags. */
+#define SOCK_TYPE_MASK 0xf
+
+/* Flags for socket, socketpair, accept4 */
+#define SOCK_CLOEXEC   O_CLOEXEC
+#ifndef SOCK_NONBLOCK
+#define SOCK_NONBLOCK  O_NONBLOCK
+#endif
 
 #endif /* ARCH_HAS_SOCKET_TYPES */
 
@@ -105,23 +117,23 @@ enum sock_shutdown_cmd {
 /**
  *  struct socket - general BSD socket
  *  @state: socket state (%SS_CONNECTED, etc)
+ *  @type: socket type (%SOCK_STREAM, etc)
  *  @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc)
  *  @ops: protocol specific socket operations
  *  @fasync_list: Asynchronous wake up list
  *  @file: File back pointer for gc
  *  @sk: internal networking protocol agnostic socket representation
  *  @wait: wait queue for several uses
- *  @type: socket type (%SOCK_STREAM, etc)
  */
 struct socket {
        socket_state            state;
+       short                   type;
        unsigned long           flags;
        const struct proto_ops  *ops;
        struct fasync_struct    *fasync_list;
        struct file             *file;
        struct sock             *sk;
        wait_queue_head_t       wait;
-       short                   type;
 };
 
 struct vm_area_struct;
@@ -186,6 +198,13 @@ struct net_proto_family {
 struct iovec;
 struct kvec;
 
+enum {
+       SOCK_WAKE_IO,
+       SOCK_WAKE_WAITD,
+       SOCK_WAKE_SPACE,
+       SOCK_WAKE_URG,
+};
+
 extern int          sock_wake_async(struct socket *sk, int how, int band);
 extern int          sock_register(const struct net_proto_family *fam);
 extern void         sock_unregister(int family);
@@ -200,7 +219,7 @@ extern int               sock_sendmsg(struct socket *sock, struct msghdr *msg,
                                  size_t len);
 extern int          sock_recvmsg(struct socket *sock, struct msghdr *msg,
                                  size_t size, int flags);
-extern int          sock_map_fd(struct socket *sock);
+extern int          sock_map_fd(struct socket *sock, int flags);
 extern struct socket *sockfd_lookup(int fd, int *err);
 #define                     sockfd_put(sock) fput(sock->file)
 extern int          net_ratelimit(void);
@@ -330,9 +349,7 @@ static const struct proto_ops name##_ops = {                        \
 
 #ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
-extern ctl_table net_table[];
-extern int net_msg_cost;
-extern int net_msg_burst;
+extern struct ratelimit_state net_ratelimit_state;
 #endif
 
 #endif /* __KERNEL__ */