Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273512
b: refs/heads/master
c: 73cb88e
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and David S. Miller committed Nov 1, 2011
1 parent d6e0636 commit d76b27c
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 98f41f694f46085fda475cdee8cc0b6d2c5e6f1f
refs/heads/master: 73cb88ecb950ee67906d02354f781ea293bcf895
10 changes: 6 additions & 4 deletions trunk/include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1403,11 +1403,13 @@ enum tcp_seq_states {
TCP_SEQ_STATE_TIME_WAIT,
};

int tcp_seq_open(struct inode *inode, struct file *file);

struct tcp_seq_afinfo {
char *name;
sa_family_t family;
struct file_operations seq_fops;
struct seq_operations seq_ops;
char *name;
sa_family_t family;
const struct file_operations *seq_fops;
struct seq_operations seq_ops;
};

struct tcp_iter_state {
Expand Down
12 changes: 7 additions & 5 deletions trunk/include/net/udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,14 @@ extern struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *sadd
#endif

/* /proc */
int udp_seq_open(struct inode *inode, struct file *file);

struct udp_seq_afinfo {
char *name;
sa_family_t family;
struct udp_table *udp_table;
struct file_operations seq_fops;
struct seq_operations seq_ops;
char *name;
sa_family_t family;
struct udp_table *udp_table;
const struct file_operations *seq_fops;
struct seq_operations seq_ops;
};

struct udp_iter_state {
Expand Down
22 changes: 12 additions & 10 deletions trunk/net/ipv4/tcp_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -2339,7 +2339,7 @@ static void tcp_seq_stop(struct seq_file *seq, void *v)
}
}

static int tcp_seq_open(struct inode *inode, struct file *file)
int tcp_seq_open(struct inode *inode, struct file *file)
{
struct tcp_seq_afinfo *afinfo = PDE(inode)->data;
struct tcp_iter_state *s;
Expand All @@ -2355,23 +2355,19 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
s->last_pos = 0;
return 0;
}
EXPORT_SYMBOL(tcp_seq_open);

int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
{
int rc = 0;
struct proc_dir_entry *p;

afinfo->seq_fops.open = tcp_seq_open;
afinfo->seq_fops.read = seq_read;
afinfo->seq_fops.llseek = seq_lseek;
afinfo->seq_fops.release = seq_release_net;

afinfo->seq_ops.start = tcp_seq_start;
afinfo->seq_ops.next = tcp_seq_next;
afinfo->seq_ops.stop = tcp_seq_stop;

p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
&afinfo->seq_fops, afinfo);
afinfo->seq_fops, afinfo);
if (!p)
rc = -ENOMEM;
return rc;
Expand Down Expand Up @@ -2520,12 +2516,18 @@ static int tcp4_seq_show(struct seq_file *seq, void *v)
return 0;
}

static const struct file_operations tcp_afinfo_seq_fops = {
.owner = THIS_MODULE,
.open = tcp_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_net
};

static struct tcp_seq_afinfo tcp4_seq_afinfo = {
.name = "tcp",
.family = AF_INET,
.seq_fops = {
.owner = THIS_MODULE,
},
.seq_fops = &tcp_afinfo_seq_fops,
.seq_ops = {
.show = tcp4_seq_show,
},
Expand Down
22 changes: 12 additions & 10 deletions trunk/net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2037,7 +2037,7 @@ static void udp_seq_stop(struct seq_file *seq, void *v)
spin_unlock_bh(&state->udp_table->hash[state->bucket].lock);
}

static int udp_seq_open(struct inode *inode, struct file *file)
int udp_seq_open(struct inode *inode, struct file *file)
{
struct udp_seq_afinfo *afinfo = PDE(inode)->data;
struct udp_iter_state *s;
Expand All @@ -2053,24 +2053,20 @@ static int udp_seq_open(struct inode *inode, struct file *file)
s->udp_table = afinfo->udp_table;
return err;
}
EXPORT_SYMBOL(udp_seq_open);

/* ------------------------------------------------------------------------ */
int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
{
struct proc_dir_entry *p;
int rc = 0;

afinfo->seq_fops.open = udp_seq_open;
afinfo->seq_fops.read = seq_read;
afinfo->seq_fops.llseek = seq_lseek;
afinfo->seq_fops.release = seq_release_net;

afinfo->seq_ops.start = udp_seq_start;
afinfo->seq_ops.next = udp_seq_next;
afinfo->seq_ops.stop = udp_seq_stop;

p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
&afinfo->seq_fops, afinfo);
afinfo->seq_fops, afinfo);
if (!p)
rc = -ENOMEM;
return rc;
Expand Down Expand Up @@ -2120,14 +2116,20 @@ int udp4_seq_show(struct seq_file *seq, void *v)
return 0;
}

static const struct file_operations udp_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 udp4_seq_afinfo = {
.name = "udp",
.family = AF_INET,
.udp_table = &udp_table,
.seq_fops = {
.owner = THIS_MODULE,
},
.seq_fops = &udp_afinfo_seq_fops,
.seq_ops = {
.show = udp4_seq_show,
},
Expand Down
13 changes: 10 additions & 3 deletions trunk/net/ipv4/udplite.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,20 @@ static struct inet_protosw udplite4_protosw = {
};

#ifdef CONFIG_PROC_FS

static const struct file_operations udplite_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 udplite4_seq_afinfo = {
.name = "udplite",
.family = AF_INET,
.udp_table = &udplite_table,
.seq_fops = {
.owner = THIS_MODULE,
},
.seq_fops = &udplite_afinfo_seq_fops,
.seq_ops = {
.show = udp4_seq_show,
},
Expand Down
12 changes: 9 additions & 3 deletions trunk/net/ipv6/tcp_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -2161,12 +2161,18 @@ static int tcp6_seq_show(struct seq_file *seq, void *v)
return 0;
}

static const struct file_operations tcp6_afinfo_seq_fops = {
.owner = THIS_MODULE,
.open = tcp_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_net
};

static struct tcp_seq_afinfo tcp6_seq_afinfo = {
.name = "tcp6",
.family = AF_INET6,
.seq_fops = {
.owner = THIS_MODULE,
},
.seq_fops = &tcp6_afinfo_seq_fops,
.seq_ops = {
.show = tcp6_seq_show,
},
Expand Down
12 changes: 9 additions & 3 deletions trunk/net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
13 changes: 10 additions & 3 deletions trunk/net/ipv6/udplite.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,20 @@ void udplitev6_exit(void)
}

#ifdef CONFIG_PROC_FS

static const struct file_operations udplite6_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 udplite6_seq_afinfo = {
.name = "udplite6",
.family = AF_INET6,
.udp_table = &udplite_table,
.seq_fops = {
.owner = THIS_MODULE,
},
.seq_fops = &udplite6_afinfo_seq_fops,
.seq_ops = {
.show = udp6_seq_show,
},
Expand Down

0 comments on commit d76b27c

Please sign in to comment.