]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
SUNRPC: Eliminate xprt_create_proto and rpc_create_client
authorChuck Lever <chuck.lever@oracle.com>
Wed, 23 Aug 2006 00:06:21 +0000 (20:06 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 23 Sep 2006 03:24:51 +0000 (23:24 -0400)
The two function call API for creating a new RPC client is now obsolete.
Remove it.

Also, remove an unnecessary check to see whether the caller is capable of
using privileged network services.  The kernel RPC client always uses a
privileged ephemeral port by default; callers are responsible for checking
the authority of users to make use of any RPC service, or for specifying
that a nonprivileged port is acceptable.

Test plan:
Repeated runs of Connectathon locking suite.  Check network trace to ensure
correctness of NLM requests and replies.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
include/linux/sunrpc/clnt.h
include/linux/sunrpc/xprt.h
net/sunrpc/clnt.c
net/sunrpc/sunrpc_syms.c
net/sunrpc/xprt.c
net/sunrpc/xprtsock.c

index 7817ba82f1b2eee1533b07f72e63d367dd248fa5..f6d1d646ce05c1039437ff7af52155df9afbe353 100644 (file)
@@ -91,13 +91,6 @@ struct rpc_procinfo {
 
 #ifdef __KERNEL__
 
-struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname,
-                               struct rpc_program *info,
-                               u32 version, rpc_authflavor_t authflavor);
-struct rpc_clnt *rpc_new_client(struct rpc_xprt *xprt, char *servname,
-                               struct rpc_program *info,
-                               u32 version, rpc_authflavor_t authflavor);
-
 struct rpc_create_args {
        int                     protocol;
        struct sockaddr         *address;
index bc80fcfdd892fd5c5325c9c16ae7faa2bc635ddd..de4efea7c856da3e8de838ee504684f3e26b81f2 100644 (file)
@@ -231,7 +231,6 @@ struct rpc_xprt {
 /*
  * Transport operations used by ULPs
  */
-struct rpc_xprt *      xprt_create_proto(int proto, struct sockaddr_in *addr, struct rpc_timeout *to);
 void                   xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr);
 
 /*
index dbb93bdf6cc9827721768d5006d43e6ed6e8e6dd..428704dd5b3ea3175b4573a92b9e861cb3db630b 100644 (file)
@@ -97,17 +97,7 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name)
        }
 }
 
-/*
- * Create an RPC client
- * FIXME: This should also take a flags argument (as in task->tk_flags).
- * It's called (among others) from pmap_create_client, which may in
- * turn be called by an async task. In this case, rpciod should not be
- * made to sleep too long.
- */
-struct rpc_clnt *
-rpc_new_client(struct rpc_xprt *xprt, char *servname,
-                 struct rpc_program *program, u32 vers,
-                 rpc_authflavor_t flavor)
+static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, struct rpc_program *program, u32 vers, rpc_authflavor_t flavor)
 {
        struct rpc_version      *version;
        struct rpc_clnt         *clnt = NULL;
@@ -253,36 +243,6 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
 }
 EXPORT_SYMBOL(rpc_create);
 
-/**
- * Create an RPC client
- * @xprt - pointer to xprt struct
- * @servname - name of server
- * @info - rpc_program
- * @version - rpc_program version
- * @authflavor - rpc_auth flavour to use
- *
- * Creates an RPC client structure, then pings the server in order to
- * determine if it is up, and if it supports this program and version.
- *
- * This function should never be called by asynchronous tasks such as
- * the portmapper.
- */
-struct rpc_clnt *rpc_create_client(struct rpc_xprt *xprt, char *servname,
-               struct rpc_program *info, u32 version, rpc_authflavor_t authflavor)
-{
-       struct rpc_clnt *clnt;
-       int err;
-       
-       clnt = rpc_new_client(xprt, servname, info, version, authflavor);
-       if (IS_ERR(clnt))
-               return clnt;
-       err = rpc_ping(clnt, RPC_TASK_SOFT|RPC_TASK_NOINTR);
-       if (err == 0)
-               return clnt;
-       rpc_shutdown_client(clnt);
-       return ERR_PTR(err);
-}
-
 /*
  * This function clones the RPC client structure. It allows us to share the
  * same transport while varying parameters such as the authentication
index f38f939ce95fffd12aaabb4aeed3580cf2be7c9a..26c0531d7e253739d5e0a7b9f38225ac0e311da6 100644 (file)
@@ -36,8 +36,6 @@ EXPORT_SYMBOL(rpc_wake_up_status);
 EXPORT_SYMBOL(rpc_release_task);
 
 /* RPC client functions */
-EXPORT_SYMBOL(rpc_create_client);
-EXPORT_SYMBOL(rpc_new_client);
 EXPORT_SYMBOL(rpc_clone_client);
 EXPORT_SYMBOL(rpc_bind_new_program);
 EXPORT_SYMBOL(rpc_destroy_client);
@@ -57,7 +55,6 @@ EXPORT_SYMBOL(rpc_queue_upcall);
 EXPORT_SYMBOL(rpc_mkpipe);
 
 /* Client transport */
-EXPORT_SYMBOL(xprt_create_proto);
 EXPORT_SYMBOL(xprt_set_timeout);
 
 /* Client credential cache */
index 17f56cfe24127b47f2aabd943b03f2e25f647537..e4f64fb58ff27bc246930c142586c2e4d535b278 100644 (file)
@@ -962,85 +962,6 @@ struct rpc_xprt *xprt_create_transport(int proto, struct sockaddr *ap, size_t si
        return xprt;
 }
 
-static struct rpc_xprt *xprt_setup(int proto, struct sockaddr_in *ap, struct rpc_timeout *to)
-{
-       int result;
-       struct rpc_xprt *xprt;
-       struct rpc_rqst *req;
-
-       if ((xprt = kzalloc(sizeof(struct rpc_xprt), GFP_KERNEL)) == NULL)
-               return ERR_PTR(-ENOMEM);
-
-       memcpy(&xprt->addr, ap, sizeof(*ap));
-       xprt->addrlen = sizeof(*ap);
-
-       switch (proto) {
-       case IPPROTO_UDP:
-               result = xs_setup_udp(xprt, to);
-               break;
-       case IPPROTO_TCP:
-               result = xs_setup_tcp(xprt, to);
-               break;
-       default:
-               printk(KERN_ERR "RPC: unrecognized transport protocol: %d\n",
-                               proto);
-               result = -EIO;
-               break;
-       }
-       if (result) {
-               kfree(xprt);
-               return ERR_PTR(result);
-       }
-
-       spin_lock_init(&xprt->transport_lock);
-       spin_lock_init(&xprt->reserve_lock);
-
-       INIT_LIST_HEAD(&xprt->free);
-       INIT_LIST_HEAD(&xprt->recv);
-       INIT_WORK(&xprt->task_cleanup, xprt_autoclose, xprt);
-       init_timer(&xprt->timer);
-       xprt->timer.function = xprt_init_autodisconnect;
-       xprt->timer.data = (unsigned long) xprt;
-       xprt->last_used = jiffies;
-       xprt->cwnd = RPC_INITCWND;
-
-       rpc_init_wait_queue(&xprt->binding, "xprt_binding");
-       rpc_init_wait_queue(&xprt->pending, "xprt_pending");
-       rpc_init_wait_queue(&xprt->sending, "xprt_sending");
-       rpc_init_wait_queue(&xprt->resend, "xprt_resend");
-       rpc_init_priority_wait_queue(&xprt->backlog, "xprt_backlog");
-
-       /* initialize free list */
-       for (req = &xprt->slot[xprt->max_reqs-1]; req >= &xprt->slot[0]; req--)
-               list_add(&req->rq_list, &xprt->free);
-
-       xprt_init_xid(xprt);
-
-       dprintk("RPC:      created transport %p with %u slots\n", xprt,
-                       xprt->max_reqs);
-       
-       return xprt;
-}
-
-/**
- * xprt_create_proto - create an RPC client transport
- * @proto: requested transport protocol
- * @sap: remote peer's address
- * @to: timeout parameters for new transport
- *
- */
-struct rpc_xprt *xprt_create_proto(int proto, struct sockaddr_in *sap, struct rpc_timeout *to)
-{
-       struct rpc_xprt *xprt;
-
-       xprt = xprt_setup(proto, sap, to);
-       if (IS_ERR(xprt))
-               dprintk("RPC:      xprt_create_proto failed\n");
-       else
-               dprintk("RPC:      xprt_create_proto created xprt %p\n", xprt);
-       return xprt;
-}
-
 /**
  * xprt_destroy - destroy an RPC transport, killing off all requests.
  * @xprt: transport to destroy
index 17179aa4c2071eabcd53794d911bbea8bed6f856..0b84fab68d7e971168254058bbeb4d45a06698c2 100644 (file)
@@ -1376,7 +1376,6 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
 
        xprt->prot = IPPROTO_UDP;
        xprt->tsh_size = 0;
-       xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;
        /* XXX: header size can vary due to auth type, IPv6, etc. */
        xprt->max_payload = (1U << 16) - (MAX_HEADER << 3);
 
@@ -1423,7 +1422,6 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to)
 
        xprt->prot = IPPROTO_TCP;
        xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32);
-       xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;
        xprt->max_payload = RPC_MAX_FRAGMENT_SIZE;
 
        INIT_WORK(&xprt->connect_worker, xs_tcp_connect_worker, xprt);