nbd-proxy: listen for udev change event before running start hook

Currently, we run the start state-change hook as soon as the nbd session
has been established. However, at that point the nbd device isn't
connected, as we haven't processed any read/write operations on the
block device.

This change defers running the start script until we know that the
device is initialised - when we see a udev change event occur. To do
this, we establish a udev monitor.

Once we see that state change, we run the state change hooks and shut
down the udev monitor.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
diff --git a/configure.ac b/configure.ac
index ace06b4..4ff9874 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,7 @@
 AC_CHECK_FUNCS(splice)
 
 PKG_CHECK_MODULES(JSON, [json-c])
+PKG_CHECK_MODULES(UDEV, [libudev])
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT