]> err.no Git - linux-2.6/blobdiff - include/linux/sunrpc/svcsock.h
[PATCH] knfsd: SUNRPC: Cache remote peer's address in svc_sock
[linux-2.6] / include / linux / sunrpc / svcsock.h
index 17cb834a748c02508511cf9444824b89d8cd738b..cccea0a0feb48e83923cc10df72cd1b26133f244 100644 (file)
@@ -20,6 +20,7 @@ struct svc_sock {
        struct socket *         sk_sock;        /* berkeley socket layer */
        struct sock *           sk_sk;          /* INET layer */
 
+       struct svc_pool *       sk_pool;        /* current pool iff queued */
        struct svc_serv *       sk_server;      /* service for this socket */
        atomic_t                sk_inuse;       /* use count */
        unsigned long           sk_flags;
@@ -34,8 +35,9 @@ struct svc_sock {
 #define        SK_OLD          9                       /* used for temp socket aging mark+sweep */
 #define        SK_DETACHED     10                      /* detached from tempsocks list */
 
-       int                     sk_reserved;    /* space on outq that is reserved */
+       atomic_t                sk_reserved;    /* space on outq that is reserved */
 
+       spinlock_t              sk_defer_lock;  /* protects sk_deferred */
        struct list_head        sk_deferred;    /* deferred requests that need to
                                                 * be revisted */
        struct mutex            sk_mutex;       /* to serialize sending data */
@@ -52,13 +54,19 @@ struct svc_sock {
        int                     sk_reclen;      /* length of record */
        int                     sk_tcplen;      /* current read length */
        time_t                  sk_lastrecv;    /* time of last received request */
+
+       /* cache of various info for TCP sockets */
+       void                    *sk_info_authunix;
+
+       struct sockaddr_storage sk_remote;      /* remote peer's address */
+       int                     sk_remotelen;   /* length of address */
 };
 
 /*
  * Function prototypes.
  */
-int            svc_makesock(struct svc_serv *, int, unsigned short);
-void           svc_delete_socket(struct svc_sock *);
+int            svc_makesock(struct svc_serv *, int, unsigned short, int flags);
+void           svc_close_socket(struct svc_sock *);
 int            svc_recv(struct svc_rqst *, long);
 int            svc_send(struct svc_rqst *);
 void           svc_drop(struct svc_rqst *);
@@ -69,4 +77,11 @@ int          svc_addsock(struct svc_serv *serv,
                            char *name_return,
                            int *proto);
 
+/*
+ * svc_makesock socket characteristics
+ */
+#define SVC_SOCK_DEFAULTS      (0U)
+#define SVC_SOCK_ANONYMOUS     (1U << 0)       /* don't register with pmap */
+#define SVC_SOCK_TEMPORARY     (1U << 1)       /* flag socket as temporary */
+
 #endif /* SUNRPC_SVCSOCK_H */