net: make the tcp and udp file_operations for the /proc stuff const
the tcp and udp code creates a set of struct file_operations at runtime while it can also be done at compile time, with the added benefit of then having these file operations be const. the trickiest part was to get the "THIS_MODULE" reference right; the naive method of declaring a struct in the place of registration would not work for this reason. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
98f41f694f
commit
73cb88ecb9
@@ -1424,13 +1424,19 @@ int udp6_seq_show(struct seq_file *seq, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations udp6_afinfo_seq_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = udp_seq_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = seq_release_net
|
||||
};
|
||||
|
||||
static struct udp_seq_afinfo udp6_seq_afinfo = {
|
||||
.name = "udp6",
|
||||
.family = AF_INET6,
|
||||
.udp_table = &udp_table,
|
||||
.seq_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.seq_fops = &udp6_afinfo_seq_fops,
|
||||
.seq_ops = {
|
||||
.show = udp6_seq_show,
|
||||
},
|
||||
|
Reference in New Issue
Block a user