X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fdpif-linux.c;h=549c7e4463b97f7ca37cf0e68ec5ff6ff8c1106a;hb=2ee6545f2bff7eb27e8c84965e3ff38dfa909bf6;hp=ee4879514e8c5eed7c2896a7032a7b30faedbd17;hpb=18a237816419e6f88ab0383b43d8060914d26a9a;p=sliver-openvswitch.git diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index ee4879514..549c7e446 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -137,7 +137,7 @@ struct dpif_linux { /* Change notification. */ struct sset changed_ports; /* Ports that have changed. */ - struct nln_notifier port_notifier; + struct nln_notifier *port_notifier; bool change_error; /* Queue of unused ports. */ @@ -253,13 +253,12 @@ static int open_dpif(const struct dpif_linux_dp *dp, struct dpif **dpifp) { struct dpif_linux *dpif; - int error; int i; dpif = xmalloc(sizeof *dpif); - error = nln_notifier_register(nln, &dpif->port_notifier, - dpif_linux_port_changed, dpif); - if (error) { + dpif->port_notifier = nln_notifier_create(nln, dpif_linux_port_changed, + dpif); + if (!dpif->port_notifier) { goto error_free; } @@ -286,7 +285,7 @@ open_dpif(const struct dpif_linux_dp *dp, struct dpif **dpifp) error_free: free(dpif); - return error; + return EINVAL; } static void @@ -294,10 +293,7 @@ dpif_linux_close(struct dpif *dpif_) { struct dpif_linux *dpif = dpif_linux_cast(dpif_); - if (nln) { - nln_notifier_unregister(nln, &dpif->port_notifier); - } - + nln_notifier_destroy(dpif->port_notifier); nl_sock_destroy(dpif->mc_sock); sset_destroy(&dpif->changed_ports); free(dpif->lru_bitmap);