diff options
author | Tom Tucker <tom@opengridcomputing.com> | 2007-12-30 22:07:36 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2008-02-01 16:42:08 -0500 |
commit | 38a417cc993f4535548e47207f9894e7c27e05e4 (patch) | |
tree | f8035bcf6bc9a4831b152f5556b14cb3b48a72b8 /include/linux/sunrpc | |
parent | d7979ae4a050a45b78af51832475001b68263d2a (diff) |
svc: Add xpo_accept transport function
Previously, the accept logic looked into the socket state to determine
whether to call accept or recv when data-ready was indicated on an endpoint.
Since some transports don't use sockets, this logic now uses a flag
bit (SK_LISTENER) to identify listening endpoints. A transport function
(xpo_accept) allows each transport to define its own accept processing.
A transport's initialization logic is reponsible for setting the
SK_LISTENER bit. I didn't see any way to do this in transport independent
logic since the passive side of a UDP connection doesn't listen and
always recv's.
In the svc_recv function, if the SK_LISTENER bit is set, the transport
xpo_accept function is called to handle accept processing.
Note that all functions are defined even if they don't make sense
for a given transport. For example, accept doesn't mean anything for
UDP. The function is defined anyway and bug checks if called. The
UDP transport should never set the SK_LISTENER bit.
Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Acked-by: Neil Brown <neilb@suse.de>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Greg Banks <gnb@sgi.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r-- | include/linux/sunrpc/svc_xprt.h | 1 | ||||
-rw-r--r-- | include/linux/sunrpc/svcsock.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index 85df97acc2d0..31a44f441fd1 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/sunrpc/svc.h> | 10 | #include <linux/sunrpc/svc.h> |
11 | 11 | ||
12 | struct svc_xprt_ops { | 12 | struct svc_xprt_ops { |
13 | struct svc_xprt *(*xpo_accept)(struct svc_xprt *); | ||
13 | int (*xpo_has_wspace)(struct svc_xprt *); | 14 | int (*xpo_has_wspace)(struct svc_xprt *); |
14 | int (*xpo_recvfrom)(struct svc_rqst *); | 15 | int (*xpo_recvfrom)(struct svc_rqst *); |
15 | void (*xpo_prep_reply_hdr)(struct svc_rqst *); | 16 | void (*xpo_prep_reply_hdr)(struct svc_rqst *); |
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 08e78d0a364f..9882ce0ee33c 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
@@ -36,6 +36,7 @@ struct svc_sock { | |||
36 | #define SK_DEFERRED 8 /* request on sk_deferred */ | 36 | #define SK_DEFERRED 8 /* request on sk_deferred */ |
37 | #define SK_OLD 9 /* used for temp socket aging mark+sweep */ | 37 | #define SK_OLD 9 /* used for temp socket aging mark+sweep */ |
38 | #define SK_DETACHED 10 /* detached from tempsocks list */ | 38 | #define SK_DETACHED 10 /* detached from tempsocks list */ |
39 | #define SK_LISTENER 11 /* listening endpoint */ | ||
39 | 40 | ||
40 | atomic_t sk_reserved; /* space on outq that is reserved */ | 41 | atomic_t sk_reserved; /* space on outq that is reserved */ |
41 | 42 | ||