proc: introduce proc_create_net{,_data}
Variants of proc_create{,_data} that directly take a struct seq_operations and deal with network namespaces in ->open and ->release. All callers of proc_create + seq_open_net converted over, and seq_{open,release}_net are removed entirely. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@@ -1051,8 +1051,8 @@ void __rxrpc_queue_peer_error(struct rxrpc_peer *);
|
||||
/*
|
||||
* proc.c
|
||||
*/
|
||||
extern const struct file_operations rxrpc_call_seq_fops;
|
||||
extern const struct file_operations rxrpc_connection_seq_fops;
|
||||
extern const struct seq_operations rxrpc_call_seq_ops;
|
||||
extern const struct seq_operations rxrpc_connection_seq_ops;
|
||||
|
||||
/*
|
||||
* recvmsg.c
|
||||
|
@@ -97,8 +97,11 @@ static __net_init int rxrpc_init_net(struct net *net)
|
||||
if (!rxnet->proc_net)
|
||||
goto err_proc;
|
||||
|
||||
proc_create("calls", 0444, rxnet->proc_net, &rxrpc_call_seq_fops);
|
||||
proc_create("conns", 0444, rxnet->proc_net, &rxrpc_connection_seq_fops);
|
||||
proc_create_net("calls", 0444, rxnet->proc_net, &rxrpc_call_seq_ops,
|
||||
sizeof(struct seq_net_private));
|
||||
proc_create_net("conns", 0444, rxnet->proc_net,
|
||||
&rxrpc_connection_seq_ops,
|
||||
sizeof(struct seq_net_private));
|
||||
return 0;
|
||||
|
||||
err_proc:
|
||||
|
@@ -115,26 +115,13 @@ static int rxrpc_call_seq_show(struct seq_file *seq, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct seq_operations rxrpc_call_seq_ops = {
|
||||
const struct seq_operations rxrpc_call_seq_ops = {
|
||||
.start = rxrpc_call_seq_start,
|
||||
.next = rxrpc_call_seq_next,
|
||||
.stop = rxrpc_call_seq_stop,
|
||||
.show = rxrpc_call_seq_show,
|
||||
};
|
||||
|
||||
static int rxrpc_call_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open_net(inode, file, &rxrpc_call_seq_ops,
|
||||
sizeof(struct seq_net_private));
|
||||
}
|
||||
|
||||
const struct file_operations rxrpc_call_seq_fops = {
|
||||
.open = rxrpc_call_seq_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
|
||||
/*
|
||||
* generate a list of extant virtual connections in /proc/net/rxrpc_conns
|
||||
*/
|
||||
@@ -207,23 +194,9 @@ print:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct seq_operations rxrpc_connection_seq_ops = {
|
||||
const struct seq_operations rxrpc_connection_seq_ops = {
|
||||
.start = rxrpc_connection_seq_start,
|
||||
.next = rxrpc_connection_seq_next,
|
||||
.stop = rxrpc_connection_seq_stop,
|
||||
.show = rxrpc_connection_seq_show,
|
||||
};
|
||||
|
||||
|
||||
static int rxrpc_connection_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return seq_open_net(inode, file, &rxrpc_connection_seq_ops,
|
||||
sizeof(struct seq_net_private));
|
||||
}
|
||||
|
||||
const struct file_operations rxrpc_connection_seq_fops = {
|
||||
.open = rxrpc_connection_seq_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
|
Reference in New Issue
Block a user