aboutsummaryrefslogtreecommitdiffstats
path: root/net/rxrpc/proc.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-06-13 07:16:05 -0400
committerDavid Howells <dhowells@redhat.com>2016-06-13 07:16:05 -0400
commit8c3e34a4ff85142ca5dba3f18cbc2061899e2612 (patch)
tree7e8098488c22da71b6a93296b182e29fe797ac3c /net/rxrpc/proc.c
parent99860208bc62d8ebd5c57495b84856506fe075bc (diff)
rxrpc: Rename files matching ar-*.c to git rid of the "ar-" prefix
Rename files matching net/rxrpc/ar-*.c to get rid of the "ar-" prefix. This will aid splitting those files by making easier to come up with new names. Note that the not all files are simply renamed from ar-X.c to X.c. The following exceptions are made: (*) ar-call.c -> call_object.c ar-ack.c -> call_event.c call_object.c is going to contain the core of the call object handling. Call event handling is all going to be in call_event.c. (*) ar-accept.c -> call_accept.c Incoming call handling is going to be here. (*) ar-connection.c -> conn_object.c ar-connevent.c -> conn_event.c The former file is going to have the basic connection object handling, but there will likely be some differentiation between client connections and service connections in additional files later. The latter file will have all the connection-level event handling. (*) ar-local.c -> local_object.c This will have the local endpoint object handling code. The local endpoint event handling code will later be split out into local_event.c. (*) ar-peer.c -> peer_object.c This will have the peer endpoint object handling code. Peer event handling code will be placed in peer_event.c (for the moment, there is none). (*) ar-error.c -> peer_event.c This will become the peer event handling code, though for the moment it's actually driven from the local endpoint's perspective. Note that I haven't renamed ar-transport.c to transport_object.c as the intention is to delete it when the rxrpc_transport struct is excised. The only file that actually has its contents changed is net/rxrpc/Makefile. net/rxrpc/ar-internal.h will need its section marker comments updating, but I'll do that in a separate patch to make it easier for git to follow the history across the rename. I may also want to rename ar-internal.h at some point - but that would mean updating all the #includes and I'd rather do that in a separate step. Signed-off-by: David Howells <dhowells@redhat.com.
Diffstat (limited to 'net/rxrpc/proc.c')
-rw-r--r--net/rxrpc/proc.c192
1 files changed, 192 insertions, 0 deletions
diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c
new file mode 100644
index 000000000000..225163bc658d
--- /dev/null
+++ b/net/rxrpc/proc.c
@@ -0,0 +1,192 @@
1/* /proc/net/ support for AF_RXRPC
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/module.h>
13#include <net/sock.h>
14#include <net/af_rxrpc.h>
15#include "ar-internal.h"
16
17static const char *const rxrpc_conn_states[] = {
18 [RXRPC_CONN_UNUSED] = "Unused ",
19 [RXRPC_CONN_CLIENT] = "Client ",
20 [RXRPC_CONN_SERVER_UNSECURED] = "SvUnsec ",
21 [RXRPC_CONN_SERVER_CHALLENGING] = "SvChall ",
22 [RXRPC_CONN_SERVER] = "SvSecure",
23 [RXRPC_CONN_REMOTELY_ABORTED] = "RmtAbort",
24 [RXRPC_CONN_LOCALLY_ABORTED] = "LocAbort",
25 [RXRPC_CONN_NETWORK_ERROR] = "NetError",
26};
27
28/*
29 * generate a list of extant and dead calls in /proc/net/rxrpc_calls
30 */
31static void *rxrpc_call_seq_start(struct seq_file *seq, loff_t *_pos)
32{
33 read_lock(&rxrpc_call_lock);
34 return seq_list_start_head(&rxrpc_calls, *_pos);
35}
36
37static void *rxrpc_call_seq_next(struct seq_file *seq, void *v, loff_t *pos)
38{
39 return seq_list_next(v, &rxrpc_calls, pos);
40}
41
42static void rxrpc_call_seq_stop(struct seq_file *seq, void *v)
43{
44 read_unlock(&rxrpc_call_lock);
45}
46
47static int rxrpc_call_seq_show(struct seq_file *seq, void *v)
48{
49 struct rxrpc_transport *trans;
50 struct rxrpc_call *call;
51 char lbuff[4 + 4 + 4 + 4 + 5 + 1], rbuff[4 + 4 + 4 + 4 + 5 + 1];
52
53 if (v == &rxrpc_calls) {
54 seq_puts(seq,
55 "Proto Local Remote "
56 " SvID ConnID CallID End Use State Abort "
57 " UserID\n");
58 return 0;
59 }
60
61 call = list_entry(v, struct rxrpc_call, link);
62 trans = call->conn->trans;
63
64 sprintf(lbuff, "%pI4:%u",
65 &trans->local->srx.transport.sin.sin_addr,
66 ntohs(trans->local->srx.transport.sin.sin_port));
67
68 sprintf(rbuff, "%pI4:%u",
69 &trans->peer->srx.transport.sin.sin_addr,
70 ntohs(trans->peer->srx.transport.sin.sin_port));
71
72 seq_printf(seq,
73 "UDP %-22.22s %-22.22s %4x %08x %08x %s %3u"
74 " %-8.8s %08x %lx\n",
75 lbuff,
76 rbuff,
77 call->conn->service_id,
78 call->cid,
79 call->call_id,
80 call->conn->in_clientflag ? "Svc" : "Clt",
81 atomic_read(&call->usage),
82 rxrpc_call_states[call->state],
83 call->remote_abort ?: call->local_abort,
84 call->user_call_ID);
85
86 return 0;
87}
88
89static const struct seq_operations rxrpc_call_seq_ops = {
90 .start = rxrpc_call_seq_start,
91 .next = rxrpc_call_seq_next,
92 .stop = rxrpc_call_seq_stop,
93 .show = rxrpc_call_seq_show,
94};
95
96static int rxrpc_call_seq_open(struct inode *inode, struct file *file)
97{
98 return seq_open(file, &rxrpc_call_seq_ops);
99}
100
101const struct file_operations rxrpc_call_seq_fops = {
102 .owner = THIS_MODULE,
103 .open = rxrpc_call_seq_open,
104 .read = seq_read,
105 .llseek = seq_lseek,
106 .release = seq_release,
107};
108
109/*
110 * generate a list of extant virtual connections in /proc/net/rxrpc_conns
111 */
112static void *rxrpc_connection_seq_start(struct seq_file *seq, loff_t *_pos)
113{
114 read_lock(&rxrpc_connection_lock);
115 return seq_list_start_head(&rxrpc_connections, *_pos);
116}
117
118static void *rxrpc_connection_seq_next(struct seq_file *seq, void *v,
119 loff_t *pos)
120{
121 return seq_list_next(v, &rxrpc_connections, pos);
122}
123
124static void rxrpc_connection_seq_stop(struct seq_file *seq, void *v)
125{
126 read_unlock(&rxrpc_connection_lock);
127}
128
129static int rxrpc_connection_seq_show(struct seq_file *seq, void *v)
130{
131 struct rxrpc_connection *conn;
132 struct rxrpc_transport *trans;
133 char lbuff[4 + 4 + 4 + 4 + 5 + 1], rbuff[4 + 4 + 4 + 4 + 5 + 1];
134
135 if (v == &rxrpc_connections) {
136 seq_puts(seq,
137 "Proto Local Remote "
138 " SvID ConnID Calls End Use State Key "
139 " Serial ISerial\n"
140 );
141 return 0;
142 }
143
144 conn = list_entry(v, struct rxrpc_connection, link);
145 trans = conn->trans;
146
147 sprintf(lbuff, "%pI4:%u",
148 &trans->local->srx.transport.sin.sin_addr,
149 ntohs(trans->local->srx.transport.sin.sin_port));
150
151 sprintf(rbuff, "%pI4:%u",
152 &trans->peer->srx.transport.sin.sin_addr,
153 ntohs(trans->peer->srx.transport.sin.sin_port));
154
155 seq_printf(seq,
156 "UDP %-22.22s %-22.22s %4x %08x %08x %s %3u"
157 " %s %08x %08x %08x\n",
158 lbuff,
159 rbuff,
160 conn->service_id,
161 conn->cid,
162 conn->call_counter,
163 conn->in_clientflag ? "Svc" : "Clt",
164 atomic_read(&conn->usage),
165 rxrpc_conn_states[conn->state],
166 key_serial(conn->key),
167 atomic_read(&conn->serial),
168 atomic_read(&conn->hi_serial));
169
170 return 0;
171}
172
173static const struct seq_operations rxrpc_connection_seq_ops = {
174 .start = rxrpc_connection_seq_start,
175 .next = rxrpc_connection_seq_next,
176 .stop = rxrpc_connection_seq_stop,
177 .show = rxrpc_connection_seq_show,
178};
179
180
181static int rxrpc_connection_seq_open(struct inode *inode, struct file *file)
182{
183 return seq_open(file, &rxrpc_connection_seq_ops);
184}
185
186const struct file_operations rxrpc_connection_seq_fops = {
187 .owner = THIS_MODULE,
188 .open = rxrpc_connection_seq_open,
189 .read = seq_read,
190 .llseek = seq_lseek,
191 .release = seq_release,
192};