diff --git a/libdm/Makefile.in b/libdm/Makefile.in index 2531e2347..d538baf20 100644 --- a/libdm/Makefile.in +++ b/libdm/Makefile.in @@ -17,6 +17,7 @@ TARGETS=$(interface)/libdevmapper.so include ../make.tmpl + install: @interface@/libdevmapper.so $(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) $< \ $(libdir)/libdevmapper.so.$(VERSION) @@ -26,3 +27,18 @@ install: @interface@/libdevmapper.so .PHONY: install + +ifeq ($(interface),ioctl) + +ioctl/libdevmapper.o: ioctl_version + +ioctl_version: ioctl/libdevmapper.c + @echo Checking library version compatible with kernel version in dm-ioctl.h + test "$(VERSION)" = \ + "$(shell $(CC) -E -dM $(INCLUDES) $(CFLAGS) \ + ioctl/libdevmapper.c | \ + awk -F '[ \t\"]+' '/DM_IOCTL_VERSION/ {print $$3}' )" + +.PHONY: ioctl_version + +endif diff --git a/libdm/ioctl/libdevmapper.c b/libdm/ioctl/libdevmapper.c index 059adf44a..4f11ad13c 100644 --- a/libdm/ioctl/libdevmapper.c +++ b/libdm/ioctl/libdevmapper.c @@ -150,6 +150,7 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt) if (!(dmi = malloc(len))) return NULL; + strncpy(dmi->version, DM_IOCTL_VERSION, sizeof(dmi->version)); dmi->data_size = len; strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); dmi->suspend = (dmt->type == DM_DEVICE_SUSPEND) ? 1 : 0;