multipathd: minor dmevents polling code cleanups
[multipath-tools/.git] / multipathd / dmevents.c
index 1ef811e..e98a974 100644 (file)
@@ -22,7 +22,9 @@
 #include "structs_vec.h"
 #include "devmapper.h"
 #include "debug.h"
+#include "main.h"
 #include "dmevents.h"
+#include "util.h"
 
 #ifndef DM_DEV_ARM_POLL
 #define DM_DEV_ARM_POLL _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD + 1, struct dm_ioctl)
@@ -121,6 +123,8 @@ static int arm_dm_event_poll(int fd)
        dmi.version[0] = DM_VERSION_MAJOR;
        dmi.version[1] = DM_VERSION_MINOR;
        dmi.version[2] = DM_VERSION_PATCHLEVEL;
+       /* This flag currently does nothing. It simply exists to
+        * duplicate the behavior of libdevmapper */
        dmi.flags = 0x4;
        dmi.data_start = offsetof(struct dm_ioctl, data);
        dmi.data_size = sizeof(dmi);
@@ -188,7 +192,7 @@ fail:
        return -1;
 }
 
-/* You must call update_multipath() after calling this function, to
+/* You must call __setup_multipath() after calling this function, to
  * deal with any events that came in before the device was added */
 int watch_dmevents(char *name)
 {
@@ -211,8 +215,7 @@ int watch_dmevents(char *name)
                return -1;
        }
 
-       strncpy(dev_evt->name, name, WWID_SIZE);
-       dev_evt->name[WWID_SIZE - 1] = 0;
+       strlcpy(dev_evt->name, name, WWID_SIZE);
        dev_evt->evt_nr = event_nr;
        dev_evt->action = EVENT_NOTHING;
 
@@ -347,7 +350,7 @@ static int dmevent_loop (void)
                        remove_map_by_alias(curr_dev.name, waiter->vecs, 1);
                else
                        r = update_multipath(waiter->vecs, curr_dev.name, 1);
-               lock_cleanup_pop(&waiter->vecs->lock);
+               pthread_cleanup_pop(1);
 
                if (r) {
                        condlog(2, "%s: stopped watching dmevents",