* [PATCH] netlink functions that can be static (trivial)
@ 2004-04-28 17:48 Stephen Hemminger
2004-04-28 19:25 ` David S. Miller
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2004-04-28 17:48 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
Several internal functions and tables in rtnetlink can be static, and
fill functions don't change stat of the net_device.
diff -Nru a/net/core/rtnetlink.c b/net/core/rtnetlink.c
--- a/net/core/rtnetlink.c Wed Apr 28 10:44:47 2004
+++ b/net/core/rtnetlink.c Wed Apr 28 10:44:47 2004
@@ -153,7 +153,8 @@
}
-static int rtnetlink_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
+static int rtnetlink_fill_ifinfo(struct sk_buff *skb,
+ const struct net_device *dev,
int type, u32 pid, u32 seq, u32 change)
{
struct ifinfomsg *r;
@@ -214,11 +215,11 @@
return -1;
}
-int rtnetlink_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
+static int rtnetlink_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
{
int idx;
int s_idx = cb->args[0];
- struct net_device *dev;
+ const struct net_device *dev;
read_lock(&dev_base_lock);
for (dev=dev_base, idx=0; dev; dev = dev->next, idx++) {
@@ -280,7 +281,7 @@
return err;
}
-int rtnetlink_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
+static int rtnetlink_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
{
int idx;
int s_idx = cb->family;
@@ -553,7 +554,7 @@
return NOTIFY_DONE;
}
-struct notifier_block rtnetlink_dev_notifier = {
+static struct notifier_block rtnetlink_dev_notifier = {
.notifier_call = rtnetlink_event,
};
diff -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
--- a/net/netlink/af_netlink.c Wed Apr 28 10:44:47 2004
+++ b/net/netlink/af_netlink.c Wed Apr 28 10:44:47 2004
@@ -809,7 +809,7 @@
return err ? : copied;
}
-void netlink_data_ready(struct sock *sk, int len)
+static void netlink_data_ready(struct sock *sk, int len)
{
struct netlink_opt *nlk = nlk_sk(sk);
@@ -1126,7 +1126,7 @@
return 0;
}
-struct seq_operations netlink_seq_ops = {
+static struct seq_operations netlink_seq_ops = {
.start = netlink_seq_start,
.next = netlink_seq_next,
.stop = netlink_seq_stop,
@@ -1159,7 +1159,7 @@
return notifier_chain_unregister(&netlink_chain, nb);
}
-struct proto_ops netlink_ops = {
+static struct proto_ops netlink_ops = {
.family = PF_NETLINK,
.owner = THIS_MODULE,
.release = netlink_release,
@@ -1180,7 +1180,7 @@
.sendpage = sock_no_sendpage,
};
-struct net_proto_family netlink_family_ops = {
+static struct net_proto_family netlink_family_ops = {
.family = PF_NETLINK,
.create = netlink_create,
.owner = THIS_MODULE, /* for consistency 8) */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netlink functions that can be static (trivial)
2004-04-28 17:48 [PATCH] netlink functions that can be static (trivial) Stephen Hemminger
@ 2004-04-28 19:25 ` David S. Miller
2004-04-28 22:02 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: David S. Miller @ 2004-04-28 19:25 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
On Wed, 28 Apr 2004 10:48:53 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:
> Several internal functions and tables in rtnetlink can be static, and
> fill functions don't change stat of the net_device.
Some problems here...
> -static int rtnetlink_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
> +static int rtnetlink_fill_ifinfo(struct sk_buff *skb,
> + const struct net_device *dev,
It doesn't start as static in my tree, I think you diffed the wrong
revisions in your tree. :-) We export this thing to modules too, how
do you know some external module doesn't actually use this thing? I
know of no users, but...
> - struct net_device *dev;
> + const struct net_device *dev;
This is wrong, a few lines down we assign it here:
> read_lock(&dev_base_lock);
> for (dev=dev_base, idx=0; dev; dev = dev->next, idx++) {
So marking that 'dev' const cannot be right. Or are you marking the
"object pointed to by 'dev'" as const?
The rest of the patch seems fine, just clean these two things up.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netlink functions that can be static (trivial)
2004-04-28 19:25 ` David S. Miller
@ 2004-04-28 22:02 ` Stephen Hemminger
2004-04-28 23:16 ` David S. Miller
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2004-04-28 22:02 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
Actually it is dump_ifinfo that's exported.. here is a fixed patch.
diff -Nru a/net/core/rtnetlink.c b/net/core/rtnetlink.c
--- a/net/core/rtnetlink.c Wed Apr 28 15:00:34 2004
+++ b/net/core/rtnetlink.c Wed Apr 28 15:00:34 2004
@@ -280,7 +280,7 @@
return err;
}
-int rtnetlink_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
+static int rtnetlink_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
{
int idx;
int s_idx = cb->family;
@@ -553,7 +553,7 @@
return NOTIFY_DONE;
}
-struct notifier_block rtnetlink_dev_notifier = {
+static struct notifier_block rtnetlink_dev_notifier = {
.notifier_call = rtnetlink_event,
};
diff -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
--- a/net/netlink/af_netlink.c Wed Apr 28 15:00:34 2004
+++ b/net/netlink/af_netlink.c Wed Apr 28 15:00:34 2004
@@ -809,7 +809,7 @@
return err ? : copied;
}
-void netlink_data_ready(struct sock *sk, int len)
+static void netlink_data_ready(struct sock *sk, int len)
{
struct netlink_opt *nlk = nlk_sk(sk);
@@ -1126,7 +1126,7 @@
return 0;
}
-struct seq_operations netlink_seq_ops = {
+static struct seq_operations netlink_seq_ops = {
.start = netlink_seq_start,
.next = netlink_seq_next,
.stop = netlink_seq_stop,
@@ -1159,7 +1159,7 @@
return notifier_chain_unregister(&netlink_chain, nb);
}
-struct proto_ops netlink_ops = {
+static struct proto_ops netlink_ops = {
.family = PF_NETLINK,
.owner = THIS_MODULE,
.release = netlink_release,
@@ -1180,7 +1180,7 @@
.sendpage = sock_no_sendpage,
};
-struct net_proto_family netlink_family_ops = {
+static struct net_proto_family netlink_family_ops = {
.family = PF_NETLINK,
.create = netlink_create,
.owner = THIS_MODULE, /* for consistency 8) */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netlink functions that can be static (trivial)
2004-04-28 22:02 ` Stephen Hemminger
@ 2004-04-28 23:16 ` David S. Miller
0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-04-28 23:16 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev
On Wed, 28 Apr 2004 15:02:16 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:
> Actually it is dump_ifinfo that's exported.. here is a fixed patch.
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-04-28 23:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-28 17:48 [PATCH] netlink functions that can be static (trivial) Stephen Hemminger
2004-04-28 19:25 ` David S. Miller
2004-04-28 22:02 ` Stephen Hemminger
2004-04-28 23:16 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).