diff options
author | Ethan Jackson <ethan@nicira.com> | 2011-05-26 14:28:11 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2011-05-31 14:34:38 -0700 |
commit | ac4d3bcb46fa0acd0b63f79449432df28569f74f (patch) | |
tree | 12bf3301160149cf1de1e78d5a7c1d0e6e711cfd /lib/netdev-dummy.c | |
parent | b7585d1dffe140a0271ba52acb72493fe6f518a1 (diff) |
netdev: New Function netdev_change_seq().
This new function will provide a much simpler replacement for
netdev_monitor in the future.
Diffstat (limited to 'lib/netdev-dummy.c')
-rw-r--r-- | lib/netdev-dummy.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index 4094f757..ea1c5fa3 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -40,6 +40,7 @@ struct netdev_dev_dummy { int mtu; struct netdev_stats stats; enum netdev_flags flags; + unsigned int change_seq; }; struct netdev_dummy { @@ -92,6 +93,7 @@ netdev_dummy_create(const struct netdev_class *class, const char *name, netdev_dev->hwaddr[5] = n; netdev_dev->mtu = 1500; netdev_dev->flags = 0; + netdev_dev->change_seq = 1; n++; @@ -250,6 +252,12 @@ netdev_dummy_poll_remove(struct netdev_notifier *notifier_) free(notifier); } + +static unsigned int +netdev_dummy_change_seq(const struct netdev *netdev) +{ + return netdev_dev_dummy_cast(netdev_get_dev(netdev))->change_seq; +} /* Helper functions. */ @@ -258,6 +266,8 @@ netdev_dummy_poll_notify(const struct netdev *netdev) { const char *name = netdev_get_name(netdev); struct list *list = shash_find_data(&netdev_dummy_notifiers, name); + struct netdev_dev_dummy *dev = + netdev_dev_dummy_cast(netdev_get_dev(netdev)); if (list) { struct netdev_dummy_notifier *notifier; @@ -267,6 +277,11 @@ netdev_dummy_poll_notify(const struct netdev *netdev) n->cb(n); } } + + dev->change_seq++; + if (!dev->change_seq) { + dev->change_seq++; + } } static const struct netdev_class dummy_class = { @@ -328,6 +343,7 @@ static const struct netdev_class dummy_class = { netdev_dummy_poll_add, netdev_dummy_poll_remove, + netdev_dummy_change_seq }; void |