nandwrite: cope with old headers which have no MTD_FILE_MODE_RAW
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 14 Jan 2018 12:43:31 +0000 (13:43 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 14 Jan 2018 12:43:31 +0000 (13:43 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/nandwrite.c

index 72f028ed322157623d2123b720eda881d7c2033b..29c800612467057dd6fd603fa4336e82c2b07517 100644 (file)
 #include "libbb.h"
 #include <mtd/mtd-user.h>
 
+/* Old headers call it MTD_MODE_RAW.
+ * FIXME: In kernel headers, MTD_FILE_MODE_RAW is not a define,
+ * it's an enum. How I can test for existence of an enum?
+ */
+#if !defined(MTD_FILE_MODE_RAW)
+# define MTD_FILE_MODE_RAW 3
+#endif
+
+
 #define IS_NANDDUMP  (ENABLE_NANDDUMP && (!ENABLE_NANDWRITE || (applet_name[4] == 'd')))
 #define IS_NANDWRITE (ENABLE_NANDWRITE && (!ENABLE_NANDDUMP || (applet_name[4] != 'd')))