diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-16 14:18:40 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:30 -0400 |
commit | 188fef11db219f13f32d055ba59985e7d1a349fe (patch) | |
tree | b64754962315934c1fa33fca16eabffeb901425a /net/sunrpc/clnt.c | |
parent | f61534dfd38f895b203e2aadaba04f21a992ca8c (diff) |
SUNRPC: Move rpc_register_client and friends into net/sunrpc/clnt.c
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index fe838e996ee3..4f39ab1b04d6 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -44,6 +44,12 @@ | |||
44 | dprintk("RPC: %5u %s (status %d)\n", t->tk_pid, \ | 44 | dprintk("RPC: %5u %s (status %d)\n", t->tk_pid, \ |
45 | __FUNCTION__, t->tk_status) | 45 | __FUNCTION__, t->tk_status) |
46 | 46 | ||
47 | /* | ||
48 | * All RPC clients are linked into this list | ||
49 | */ | ||
50 | static LIST_HEAD(all_clients); | ||
51 | static DEFINE_SPINLOCK(rpc_client_lock); | ||
52 | |||
47 | static DECLARE_WAIT_QUEUE_HEAD(destroy_wait); | 53 | static DECLARE_WAIT_QUEUE_HEAD(destroy_wait); |
48 | 54 | ||
49 | 55 | ||
@@ -66,6 +72,19 @@ static void call_connect_status(struct rpc_task *task); | |||
66 | static __be32 * call_header(struct rpc_task *task); | 72 | static __be32 * call_header(struct rpc_task *task); |
67 | static __be32 * call_verify(struct rpc_task *task); | 73 | static __be32 * call_verify(struct rpc_task *task); |
68 | 74 | ||
75 | static void rpc_register_client(struct rpc_clnt *clnt) | ||
76 | { | ||
77 | spin_lock(&rpc_client_lock); | ||
78 | list_add(&clnt->cl_clients, &all_clients); | ||
79 | spin_unlock(&rpc_client_lock); | ||
80 | } | ||
81 | |||
82 | static void rpc_unregister_client(struct rpc_clnt *clnt) | ||
83 | { | ||
84 | spin_lock(&rpc_client_lock); | ||
85 | list_del(&clnt->cl_clients); | ||
86 | spin_unlock(&rpc_client_lock); | ||
87 | } | ||
69 | 88 | ||
70 | static int | 89 | static int |
71 | rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) | 90 | rpc_setup_pipedir(struct rpc_clnt *clnt, char *dir_name) |
@@ -1410,3 +1429,41 @@ int rpc_ping(struct rpc_clnt *clnt, int flags) | |||
1410 | put_rpccred(msg.rpc_cred); | 1429 | put_rpccred(msg.rpc_cred); |
1411 | return err; | 1430 | return err; |
1412 | } | 1431 | } |
1432 | |||
1433 | #ifdef RPC_DEBUG | ||
1434 | void rpc_show_tasks(void) | ||
1435 | { | ||
1436 | struct rpc_clnt *clnt; | ||
1437 | struct rpc_task *t; | ||
1438 | |||
1439 | spin_lock(&rpc_client_lock); | ||
1440 | if (list_empty(&all_clients)) | ||
1441 | goto out; | ||
1442 | printk("-pid- proc flgs status -client- -prog- --rqstp- -timeout " | ||
1443 | "-rpcwait -action- ---ops--\n"); | ||
1444 | list_for_each_entry(clnt, &all_clients, cl_clients) { | ||
1445 | if (list_empty(&clnt->cl_tasks)) | ||
1446 | continue; | ||
1447 | spin_lock(&clnt->cl_lock); | ||
1448 | list_for_each_entry(t, &clnt->cl_tasks, tk_task) { | ||
1449 | const char *rpc_waitq = "none"; | ||
1450 | |||
1451 | if (RPC_IS_QUEUED(t)) | ||
1452 | rpc_waitq = rpc_qname(t->u.tk_wait.rpc_waitq); | ||
1453 | |||
1454 | printk("%5u %04d %04x %6d %8p %6d %8p %8ld %8s %8p %8p\n", | ||
1455 | t->tk_pid, | ||
1456 | (t->tk_msg.rpc_proc ? t->tk_msg.rpc_proc->p_proc : -1), | ||
1457 | t->tk_flags, t->tk_status, | ||
1458 | t->tk_client, | ||
1459 | (t->tk_client ? t->tk_client->cl_prog : 0), | ||
1460 | t->tk_rqstp, t->tk_timeout, | ||
1461 | rpc_waitq, | ||
1462 | t->tk_action, t->tk_ops); | ||
1463 | } | ||
1464 | spin_unlock(&clnt->cl_lock); | ||
1465 | } | ||
1466 | out: | ||
1467 | spin_unlock(&rpc_client_lock); | ||
1468 | } | ||
1469 | #endif | ||