From f1568304e07a890c77337553fcfae7c51cba6990 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Wed, 2 Jan 2002 19:01:09 +0000 Subject: [PATCH] o Allow the definition of read-only devices (ioctl interface only) (Joe) o Add version number to ioctl structure with error on kernel/library mismatch --- libdm/Makefile.in | 16 ++++++++++++++++ libdm/ioctl/libdevmapper.c | 1 + 2 files changed, 17 insertions(+) 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; -- 2.43.5