perl-path-tiny: bump to version 0.061
[buildroot-gz.git] / package / kobs-ng / kobs-ng-0001-fix-mtd-defines.patch
blob3ffba7166d118fd3c2a1ceaaf232803ba78e8ab6
1 Newer kernel headers renamed mtd mode defines and no longer support
2 MEMSETOOBSEL. Allow code to work with both older and newer kernel
3 versions.
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
11 @@ -852,8 +852,11 @@
12 mp = &md->part[i];
14 if (mp->fd != -1) {
15 +/* Newer kernels dropped MEMSETOOBSEL */
16 +#ifdef MEMSETOOBSEL
17 (void)ioctl(mp->fd, MEMSETOOBSEL,
18 &mp->old_oobinfo);
19 +#endif
20 close(mp->fd);
23 @@ -896,6 +899,8 @@
24 continue;
27 +/* Newer kernels dropped MEMSETOOBSEL */
28 +#ifdef MEMSETOOBSEL
29 if (r == -ENOTTY) {
30 r = ioctl(mp->fd, MEMSETOOBSEL, &mp->old_oobinfo);
31 if (r != 0) {
32 @@ -904,6 +909,7 @@
34 mp->oobinfochanged = 0;
36 +#endif
37 } else {
38 r = ioctl(mp->fd, MTDFILEMODE, (void *)MTD_MODE_RAW);
39 if (r != 0 && r != -ENOTTY) {
40 @@ -911,6 +917,8 @@
41 continue;
44 +/* Newer kernels dropped MEMSETOOBSEL */
45 +#ifdef MEMSETOOBSEL
46 if (r == -ENOTTY) {
47 r = ioctl(mp->fd, MEMSETOOBSEL, &none_oobinfo);
48 if (r != 0) {
49 @@ -920,6 +928,7 @@
50 mp->oobinfochanged = 1;
51 } else
52 mp->oobinfochanged = 2;
53 +#endif
56 mp->ecc = ecc;
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
60 @@ -31,6 +31,13 @@
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
69 +#endif
71 //------------------------------------------------------------------------------
72 // Re-definitions of true and false, because the standard ones aren't good
73 // enough?