1 Newer kernel headers renamed mtd mode defines and no longer support
2 MEMSETOOBSEL. Allow code to work with both older and newer kernel
5 Signed-off-by: Paul B. Henson <henson@acm.org>
6 Signed-off-by: Sergey Alyoshin <alyoshin.s@gmail.com>
8 diff -u -r kobs-ng-3.0.35-4.0.0-orig/src/mtd.c kobs-ng-3.0.35-4.0.0/src/mtd.c
9 --- kobs-ng-3.0.35-4.0.0-orig/src/mtd.c 2012-12-17 22:37:40.000000000 -0800
10 +++ kobs-ng-3.0.35-4.0.0/src/mtd.c 2013-07-28 19:39:59.000000000 -0700
15 +/* Newer kernels dropped MEMSETOOBSEL */
17 (void)ioctl(mp->fd, MEMSETOOBSEL,
27 +/* Newer kernels dropped MEMSETOOBSEL */
30 r = ioctl(mp->fd, MEMSETOOBSEL, &mp->old_oobinfo);
34 mp->oobinfochanged = 0;
38 r = ioctl(mp->fd, MTDFILEMODE, (void *)MTD_MODE_RAW);
39 if (r != 0 && r != -ENOTTY) {
44 +/* Newer kernels dropped MEMSETOOBSEL */
47 r = ioctl(mp->fd, MEMSETOOBSEL, &none_oobinfo);
50 mp->oobinfochanged = 1;
52 mp->oobinfochanged = 2;
57 diff -u -r kobs-ng-3.0.35-4.0.0-orig/src/mtd.h kobs-ng-3.0.35-4.0.0/src/mtd.h
58 --- kobs-ng-3.0.35-4.0.0-orig/src/mtd.h 2012-12-17 22:37:40.000000000 -0800
59 +++ kobs-ng-3.0.35-4.0.0/src/mtd.h 2013-07-28 19:33:57.000000000 -0700
61 #include "BootControlBlocks.h"
62 #include "rom_nand_hamming_code_ecc.h"
64 +// Newer kernel headers renamed define
65 +#include <linux/version.h>
66 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
67 +# define MTD_MODE_NORMAL MTD_FILE_MODE_NORMAL
68 +# define MTD_MODE_RAW MTD_FILE_MODE_RAW
71 //------------------------------------------------------------------------------
72 // Re-definitions of true and false, because the standard ones aren't good