X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Frtnetlink-link.c;h=dbdf724ba30ad1abd4a7abcaa269699ecc2aef23;hb=a6d214f0055dc773750295a5db7cc5ca14bc5ce7;hp=09ba954ed92cb6aa7e5d69bfd9b6a14fad85ad9a;hpb=ac4d3bcb46fa0acd0b63f79449432df28569f74f;p=openvswitch diff --git a/lib/rtnetlink-link.c b/lib/rtnetlink-link.c index 09ba954e..dbdf724b 100644 --- a/lib/rtnetlink-link.c +++ b/lib/rtnetlink-link.c @@ -23,10 +23,10 @@ #include #include "netlink.h" +#include "netlink-notifier.h" #include "ofpbuf.h" -#include "rtnetlink.h" -static struct rtnetlink *rtn = NULL; +static struct nln *nln = NULL; static struct rtnetlink_link_change rtn_change; /* Parses a rtnetlink message 'buf' into 'change'. If 'buf' is unparseable, @@ -71,6 +71,12 @@ rtnetlink_link_parse(struct ofpbuf *buf, return parsed; } +static bool +rtnetlink_link_parse_cb(struct ofpbuf *buf, void *change) +{ + return rtnetlink_link_parse(buf, change); +} + /* Registers 'cb' to be called with auxiliary data 'aux' with network device * change notifications. The notifier is stored in 'notifier', which the * caller must not modify or free. @@ -81,25 +87,23 @@ rtnetlink_link_parse(struct ofpbuf *buf, * * Returns 0 if successful, otherwise a positive errno value. */ int -rtnetlink_link_notifier_register(struct rtnetlink_notifier *notifier, +rtnetlink_link_notifier_register(struct nln_notifier *notifier, rtnetlink_link_notify_func *cb, void *aux) { - rtnetlink_parse_func *pf = (rtnetlink_parse_func *) rtnetlink_link_parse; - rtnetlink_notify_func *nf = (rtnetlink_notify_func *) cb; - - if (!rtn) { - rtn = rtnetlink_create(RTNLGRP_LINK, pf, &rtn_change); + if (!nln) { + nln = nln_create(NETLINK_ROUTE, RTNLGRP_LINK, rtnetlink_link_parse_cb, + &rtn_change); } - return rtnetlink_notifier_register(rtn, notifier, nf, aux); + return nln_notifier_register(nln, notifier, (nln_notify_func *) cb, aux); } /* Cancels notification on 'notifier', which must have previously been * registered with rtnetlink_link_notifier_register(). */ void -rtnetlink_link_notifier_unregister(struct rtnetlink_notifier *notifier) +rtnetlink_link_notifier_unregister(struct nln_notifier *notifier) { - rtnetlink_notifier_unregister(rtn, notifier); + nln_notifier_unregister(nln, notifier); } /* Calls all of the registered notifiers, passing along any as-yet-unreported @@ -107,8 +111,8 @@ rtnetlink_link_notifier_unregister(struct rtnetlink_notifier *notifier) void rtnetlink_link_notifier_run(void) { - if (rtn) { - rtnetlink_notifier_run(rtn); + if (nln) { + nln_notifier_run(nln); } } @@ -117,7 +121,7 @@ rtnetlink_link_notifier_run(void) void rtnetlink_link_notifier_wait(void) { - if (rtn) { - rtnetlink_notifier_wait(rtn); + if (nln) { + nln_notifier_wait(nln); } }