diff mbox

[06/21] dm: Some future-proofing by means of compile-time DM_VERSION_MAJOR check

Message ID 20161009132948.GA2910@obsidian (mailing list archive)
State Not Applicable, archived
Delegated to: Mike Snitzer
Headers show

Commit Message

Eugene Syromyatnikov Oct. 9, 2016, 1:29 p.m. UTC
* dm.c: Add check whether DM_VERSION_MAJOR equals to 4, provide empty
dm_ioctl if check fails.
---
 dm.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/dm.c b/dm.c
index ebdfc44..79bb7c7 100644
--- a/dm.c
+++ b/dm.c
@@ -5,6 +5,8 @@ 
 # include <sys/ioctl.h>
 # include <linux/dm-ioctl.h>
 
+# if DM_VERSION_MAJOR == 4
+
 static void
 dm_decode_device(const unsigned int code, const struct dm_ioctl *ioc)
 {
@@ -375,4 +377,13 @@  dm_ioctl(struct tcb *tcp, const unsigned int code, long arg)
 	}
 }
 
-#endif
+# else /* !(DM_VERSION_MAJOR == 4) */
+
+int
+dm_ioctl(struct tcb *tcp, const unsigned int code, long arg)
+{
+	return 0;
+}
+
+# endif /* DM_VERSION_MAJOR == 4 */
+#endif /* HAVE_LINUX_DM_IOCTL_H */