mtd: Fix compile warning
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-2.6.38 / 065-rootfs_split.patch
1 Index: linux-2.6.38-rc6/drivers/mtd/Kconfig
2 ===================================================================
3 --- linux-2.6.38-rc6.orig/drivers/mtd/Kconfig 2011-02-28 16:14:12.668466637 +0100
4 +++ linux-2.6.38-rc6/drivers/mtd/Kconfig 2011-02-28 16:26:55.463734599 +0100
5 @@ -55,6 +55,16 @@ config MTD_PARTITIONS
6
7 if MTD_PARTITIONS
8
9 +config MTD_ROOTFS_ROOT_DEV
10 + bool "Automatically set 'rootfs' partition to be root filesystem"
11 + depends on MTD_PARTITIONS
12 + default y
13 +
14 +config MTD_ROOTFS_SPLIT
15 + bool "Automatically split 'rootfs' partition for squashfs"
16 + depends on MTD_PARTITIONS
17 + default y
18 +
19 config MTD_REDBOOT_PARTS
20 tristate "RedBoot partition table parsing"
21 ---help---
22 Index: linux-2.6.38-rc6/drivers/mtd/mtdpart.c
23 ===================================================================
24 --- linux-2.6.38-rc6.orig/drivers/mtd/mtdpart.c 2011-02-28 16:14:12.686466221 +0100
25 +++ linux-2.6.38-rc6/drivers/mtd/mtdpart.c 2011-02-28 16:28:41.399156164 +0100
26 @@ -29,6 +29,8 @@
27 #include <linux/kmod.h>
28 #include <linux/mtd/mtd.h>
29 #include <linux/mtd/partitions.h>
30 +#include <linux/root_dev.h>
31 +#include <linux/magic.h>
32 #include <linux/err.h>
33
34 /* Our partition linked list */
35 @@ -48,7 +50,7 @@ struct mtd_part {
36 * the pointer to that structure with this macro.
37 */
38 #define PART(x) ((struct mtd_part *)(x))
39 -
40 +#define IS_PART(mtd) (mtd->read == part_read)
41
42 /*
43 * MTD methods which simply translate the effective address and pass through
44 @@ -636,6 +638,153 @@ int mtd_del_partition(struct mtd_info *m
45 }
46 EXPORT_SYMBOL_GPL(mtd_del_partition);
47
48 +#ifdef CONFIG_MTD_ROOTFS_SPLIT
49 +#define ROOTFS_SPLIT_NAME "rootfs_data"
50 +#define ROOTFS_REMOVED_NAME "<removed>"
51 +
52 +struct squashfs_super_block {
53 + __le32 s_magic;
54 + __le32 pad0[9];
55 + __le64 bytes_used;
56 +};
57 +
58 +
59 +static int split_squashfs(struct mtd_info *master, int offset, int *split_offset)
60 +{
61 + struct squashfs_super_block sb;
62 + int len, ret;
63 +
64 + ret = master->read(master, offset, sizeof(sb), &len, (void *) &sb);
65 + if (ret || (len != sizeof(sb))) {
66 + printk(KERN_ALERT "split_squashfs: error occured while reading "
67 + "from \"%s\"\n", master->name);
68 + return -EINVAL;
69 + }
70 +
71 + if (SQUASHFS_MAGIC != le32_to_cpu(sb.s_magic) ) {
72 + printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n",
73 + master->name);
74 + *split_offset = 0;
75 + return 0;
76 + }
77 +
78 + if (le64_to_cpu((sb.bytes_used)) <= 0) {
79 + printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n",
80 + master->name);
81 + *split_offset = 0;
82 + return 0;
83 + }
84 +
85 + len = (u32) le64_to_cpu(sb.bytes_used);
86 + len += (offset & 0x000fffff);
87 + len += (master->erasesize - 1);
88 + len &= ~(master->erasesize - 1);
89 + len -= (offset & 0x000fffff);
90 + *split_offset = offset + len;
91 +
92 + return 0;
93 +}
94 +
95 +static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, const struct mtd_partition *part)
96 +{
97 + struct mtd_partition *dpart;
98 + struct mtd_part *slave = NULL;
99 + int ret, split_offset = 0;
100 +
101 + ret = split_squashfs(master, part->offset, &split_offset);
102 + if (ret)
103 + return ret;
104 +
105 + if (split_offset <= 0)
106 + return 0;
107 +
108 + dpart = kmalloc(sizeof(*part)+sizeof(ROOTFS_SPLIT_NAME)+1, GFP_KERNEL);
109 + if (dpart == NULL) {
110 + printk(KERN_INFO "split_squashfs: no memory for partition \"%s\"\n",
111 + ROOTFS_SPLIT_NAME);
112 + return -ENOMEM;
113 + }
114 +
115 + memcpy(dpart, part, sizeof(*part));
116 + dpart->name = (unsigned char *)&dpart[1];
117 + strcpy(dpart->name, ROOTFS_SPLIT_NAME);
118 +
119 + dpart->size -= split_offset - dpart->offset;
120 + dpart->offset = split_offset;
121 +
122 + if (dpart == NULL)
123 + return 1;
124 +
125 + printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%llX, len=%llX \n",
126 + ROOTFS_SPLIT_NAME, dpart->offset, dpart->size);
127 +
128 + slave = allocate_partition(master, dpart, 0, split_offset);
129 + if (IS_ERR(slave))
130 + return PTR_ERR(slave);
131 + mutex_lock(&mtd_partitions_mutex);
132 + list_add(&slave->list, &mtd_partitions);
133 + mutex_unlock(&mtd_partitions_mutex);
134 +
135 + add_mtd_device(&slave->mtd);
136 +
137 + rpart->split = &slave->mtd;
138 +
139 + return 0;
140 +}
141 +
142 +static int refresh_rootfs_split(struct mtd_info *mtd)
143 +{
144 + struct mtd_partition tpart;
145 + struct mtd_part *part;
146 + char *name;
147 + //int index = 0;
148 + int offset, size;
149 + int ret;
150 +
151 + part = PART(mtd);
152 +
153 + /* check for the new squashfs offset first */
154 + ret = split_squashfs(part->master, part->offset, &offset);
155 + if (ret)
156 + return ret;
157 +
158 + if ((offset > 0) && !mtd->split) {
159 + printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name);
160 + /* if we don't have a rootfs split partition, create a new one */
161 + tpart.name = (char *) mtd->name;
162 + tpart.size = mtd->size;
163 + tpart.offset = part->offset;
164 +
165 + return split_rootfs_data(part->master, &part->mtd, &tpart);
166 + } else if ((offset > 0) && mtd->split) {
167 + /* update the offsets of the existing partition */
168 + size = mtd->size + part->offset - offset;
169 +
170 + part = PART(mtd->split);
171 + part->offset = offset;
172 + part->mtd.size = size;
173 + printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n",
174 + __func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"),
175 + (u32) part->offset, (u32) part->mtd.size);
176 + name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL);
177 + strcpy(name, ROOTFS_SPLIT_NAME);
178 + part->mtd.name = name;
179 + } else if ((offset <= 0) && mtd->split) {
180 + printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name);
181 +
182 + /* mark existing partition as removed */
183 + part = PART(mtd->split);
184 + name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL);
185 + strcpy(name, ROOTFS_REMOVED_NAME);
186 + part->mtd.name = name;
187 + part->offset = 0;
188 + part->mtd.size = 0;
189 + }
190 +
191 + return 0;
192 +}
193 +#endif /* CONFIG_MTD_ROOTFS_SPLIT */
194 +
195 /*
196 * This function, given a master MTD object and a partition table, creates
197 * and registers slave MTD objects which are bound to the master according to
198 @@ -652,6 +801,9 @@ int add_mtd_partitions(struct mtd_info *
199 struct mtd_part *slave;
200 uint64_t cur_offset = 0;
201 int i;
202 +#ifdef CONFIG_MTD_ROOTFS_SPLIT
203 + int ret;
204 +#endif
205
206 printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
207
208 @@ -666,6 +818,21 @@ int add_mtd_partitions(struct mtd_info *
209
210 add_mtd_device(&slave->mtd);
211
212 + if (!strcmp(parts[i].name, "rootfs")) {
213 +#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
214 + if (ROOT_DEV == 0) {
215 + printk(KERN_NOTICE "mtd: partition \"rootfs\" "
216 + "set to be root filesystem\n");
217 + ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index);
218 + }
219 +#endif
220 +#ifdef CONFIG_MTD_ROOTFS_SPLIT
221 + ret = split_rootfs_data(master, &slave->mtd, &parts[i]);
222 + /* if (ret == 0)
223 + * j++; */
224 +#endif
225 + }
226 +
227 cur_offset = slave->offset + slave->mtd.size;
228 }
229
230 @@ -673,6 +840,32 @@ int add_mtd_partitions(struct mtd_info *
231 }
232 EXPORT_SYMBOL(add_mtd_partitions);
233
234 +int refresh_mtd_partitions(struct mtd_info *mtd)
235 +{
236 + int ret = 0;
237 +
238 + if (IS_PART(mtd)) {
239 + struct mtd_part *part;
240 + struct mtd_info *master;
241 +
242 + part = PART(mtd);
243 + master = part->master;
244 + if (master->refresh_device)
245 + ret = master->refresh_device(master);
246 + }
247 +
248 + if (!ret && mtd->refresh_device)
249 + ret = mtd->refresh_device(mtd);
250 +
251 +#ifdef CONFIG_MTD_ROOTFS_SPLIT
252 + if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs"))
253 + refresh_rootfs_split(mtd);
254 +#endif
255 +
256 + return 0;
257 +}
258 +EXPORT_SYMBOL_GPL(refresh_mtd_partitions);
259 +
260 static DEFINE_SPINLOCK(part_parser_lock);
261 static LIST_HEAD(part_parsers);
262
263 Index: linux-2.6.38-rc6/drivers/mtd/devices/block2mtd.c
264 ===================================================================
265 --- linux-2.6.38-rc6.orig/drivers/mtd/devices/block2mtd.c 2011-02-28 16:15:07.477184360 +0100
266 +++ linux-2.6.38-rc6/drivers/mtd/devices/block2mtd.c 2011-02-28 16:26:55.919727057 +0100
267 @@ -30,6 +30,8 @@ struct block2mtd_dev {
268 struct block_device *blkdev;
269 struct mtd_info mtd;
270 struct mutex write_mutex;
271 + rwlock_t bdev_mutex;
272 + char devname[0];
273 };
274
275
276 @@ -82,6 +84,12 @@ static int block2mtd_erase(struct mtd_in
277 size_t len = instr->len;
278 int err;
279
280 + read_lock(&dev->bdev_mutex);
281 + if (!dev->blkdev) {
282 + err = -EINVAL;
283 + goto done;
284 + }
285 +
286 instr->state = MTD_ERASING;
287 mutex_lock(&dev->write_mutex);
288 err = _block2mtd_erase(dev, from, len);
289 @@ -93,6 +101,10 @@ static int block2mtd_erase(struct mtd_in
290 instr->state = MTD_ERASE_DONE;
291
292 mtd_erase_callback(instr);
293 +
294 +done:
295 + read_unlock(&dev->bdev_mutex);
296 +
297 return err;
298 }
299
300 @@ -104,10 +116,14 @@ static int block2mtd_read(struct mtd_inf
301 struct page *page;
302 int index = from >> PAGE_SHIFT;
303 int offset = from & (PAGE_SIZE-1);
304 - int cpylen;
305 + int cpylen, err = 0;
306 +
307 + read_lock(&dev->bdev_mutex);
308 + if (!dev->blkdev || (from > mtd->size)) {
309 + err = -EINVAL;
310 + goto done;
311 + }
312
313 - if (from > mtd->size)
314 - return -EINVAL;
315 if (from + len > mtd->size)
316 len = mtd->size - from;
317
318 @@ -122,10 +138,14 @@ static int block2mtd_read(struct mtd_inf
319 len = len - cpylen;
320
321 page = page_read(dev->blkdev->bd_inode->i_mapping, index);
322 - if (!page)
323 - return -ENOMEM;
324 - if (IS_ERR(page))
325 - return PTR_ERR(page);
326 + if (!page) {
327 + err = -ENOMEM;
328 + goto done;
329 + }
330 + if (IS_ERR(page)) {
331 + err = PTR_ERR(page);
332 + goto done;
333 + }
334
335 memcpy(buf, page_address(page) + offset, cpylen);
336 page_cache_release(page);
337 @@ -136,7 +156,10 @@ static int block2mtd_read(struct mtd_inf
338 offset = 0;
339 index++;
340 }
341 - return 0;
342 +
343 +done:
344 + read_unlock(&dev->bdev_mutex);
345 + return err;
346 }
347
348
349 @@ -188,12 +211,22 @@ static int block2mtd_write(struct mtd_in
350 size_t *retlen, const u_char *buf)
351 {
352 struct block2mtd_dev *dev = mtd->priv;
353 - int err;
354 + int err = 0;
355 +
356 + read_lock(&dev->bdev_mutex);
357 + if (!dev->blkdev) {
358 + err = -EINVAL;
359 + goto done;
360 + }
361
362 if (!len)
363 - return 0;
364 - if (to >= mtd->size)
365 - return -ENOSPC;
366 + goto done;
367 +
368 + if (to >= mtd->size) {
369 + err = -ENOSPC;
370 + goto done;
371 + }
372 +
373 if (to + len > mtd->size)
374 len = mtd->size - to;
375
376 @@ -202,6 +235,9 @@ static int block2mtd_write(struct mtd_in
377 mutex_unlock(&dev->write_mutex);
378 if (err > 0)
379 err = 0;
380 +
381 +done:
382 + read_unlock(&dev->bdev_mutex);
383 return err;
384 }
385
386 @@ -210,33 +246,109 @@ static int block2mtd_write(struct mtd_in
387 static void block2mtd_sync(struct mtd_info *mtd)
388 {
389 struct block2mtd_dev *dev = mtd->priv;
390 + read_lock(&dev->bdev_mutex);
391 + if (dev->blkdev)
392 sync_blockdev(dev->blkdev);
393 + read_unlock(&dev->bdev_mutex);
394 +
395 return;
396 }
397
398
399 +static int _open_bdev(struct block2mtd_dev *dev)
400 +{
401 + const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
402 + struct block_device *bdev;
403 +
404 + /* Get a handle on the device */
405 + bdev = blkdev_get_by_path(dev->devname, mode, dev);
406 +#ifndef MODULE
407 + if (IS_ERR(bdev)) {
408 +
409 + /* We might not have rootfs mounted at this point. Try
410 + to resolve the device name by other means. */
411 +
412 + dev_t devt = name_to_dev_t(dev->devname);
413 + if (devt)
414 + bdev = blkdev_get_by_dev(devt, mode, dev);
415 + }
416 +#endif
417 +
418 + if (IS_ERR(bdev)) {
419 + ERROR("error: cannot open device %s", dev->devname);
420 + return 1;
421 + }
422 + dev->blkdev = bdev;
423 +
424 + if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
425 + ERROR("attempting to use an MTD device as a block device");
426 + return 1;
427 + }
428 +
429 + return 0;
430 +}
431 +
432 +static void _close_bdev(struct block2mtd_dev *dev)
433 +{
434 + struct block_device *bdev;
435 +
436 + if (!dev->blkdev)
437 + return;
438 +
439 + bdev = dev->blkdev;
440 + invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, 0, -1);
441 + blkdev_put(dev->blkdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
442 + dev->blkdev = NULL;
443 +}
444 +
445 static void block2mtd_free_device(struct block2mtd_dev *dev)
446 {
447 if (!dev)
448 return;
449
450 kfree(dev->mtd.name);
451 -
452 - if (dev->blkdev) {
453 - invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping,
454 - 0, -1);
455 - blkdev_put(dev->blkdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
456 - }
457 -
458 + _close_bdev(dev);
459 kfree(dev);
460 }
461
462
463 -/* FIXME: ensure that mtd->size % erase_size == 0 */
464 -static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname)
465 +static int block2mtd_refresh(struct mtd_info *mtd)
466 {
467 - const fmode_t mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
468 + struct block2mtd_dev *dev = mtd->priv;
469 struct block_device *bdev;
470 + dev_t devt;
471 + int err = 0;
472 +
473 + /* no other mtd function can run at this point */
474 + write_lock(&dev->bdev_mutex);
475 +
476 + /* get the device number for the whole disk */
477 + devt = MKDEV(MAJOR(dev->blkdev->bd_dev), 0);
478 +
479 + /* close the old block device */
480 + _close_bdev(dev);
481 +
482 + /* open the whole disk, issue a partition rescan, then */
483 + bdev = blkdev_get_by_dev(devt, FMODE_WRITE | FMODE_READ);
484 + if (!bdev || !bdev->bd_disk)
485 + err = -EINVAL;
486 +#ifndef CONFIG_MTD_BLOCK2MTD_MODULE
487 + else
488 + err = rescan_partitions(bdev->bd_disk, bdev);
489 +#endif
490 + if (bdev)
491 + blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL);
492 +
493 + /* try to open the partition block device again */
494 + _open_bdev(dev);
495 + write_unlock(&dev->bdev_mutex);
496 +
497 + return err;
498 +}
499 +
500 +/* FIXME: ensure that mtd->size % erase_size == 0 */
501 +static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname)
502 +{
503 struct block2mtd_dev *dev;
504 struct mtd_partition *part;
505 char *name;
506 @@ -244,36 +356,17 @@ static struct block2mtd_dev *add_device(
507 if (!devname)
508 return NULL;
509
510 - dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL);
511 + dev = kzalloc(sizeof(struct block2mtd_dev) + strlen(devname) + 1, GFP_KERNEL);
512 if (!dev)
513 return NULL;
514
515 - /* Get a handle on the device */
516 - bdev = blkdev_get_by_path(devname, mode, dev);
517 -#ifndef MODULE
518 - if (IS_ERR(bdev)) {
519 -
520 - /* We might not have rootfs mounted at this point. Try
521 - to resolve the device name by other means. */
522 + strcpy(dev->devname, devname);
523
524 - dev_t devt = name_to_dev_t(devname);
525 - if (devt)
526 - bdev = blkdev_get_by_dev(devt, mode, dev);
527 - }
528 -#endif
529 -
530 - if (IS_ERR(bdev)) {
531 - ERROR("error: cannot open device %s", devname);
532 + if (_open_bdev(dev))
533 goto devinit_err;
534 - }
535 - dev->blkdev = bdev;
536 -
537 - if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
538 - ERROR("attempting to use an MTD device as a block device");
539 - goto devinit_err;
540 - }
541
542 mutex_init(&dev->write_mutex);
543 + rwlock_init(&dev->bdev_mutex);
544
545 /* Setup the MTD structure */
546 /* make the name contain the block device in */
547 @@ -298,6 +391,7 @@ static struct block2mtd_dev *add_device(
548 dev->mtd.read = block2mtd_read;
549 dev->mtd.priv = dev;
550 dev->mtd.owner = THIS_MODULE;
551 + dev->mtd.refresh_device = block2mtd_refresh;
552
553 part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
554 part->name = dev->mtd.name;
555 Index: linux-2.6.38-rc6/drivers/mtd/mtdchar.c
556 ===================================================================
557 --- linux-2.6.38-rc6.orig/drivers/mtd/mtdchar.c 2011-02-28 16:14:12.652467007 +0100
558 +++ linux-2.6.38-rc6/drivers/mtd/mtdchar.c 2011-02-28 16:15:07.503183744 +0100
559 @@ -841,6 +841,13 @@ static int mtd_ioctl(struct file *file,
560 file->f_pos = 0;
561 break;
562 }
563 +#ifdef CONFIG_MTD_PARTITIONS
564 + case MTDREFRESH:
565 + {
566 + ret = refresh_mtd_partitions(mtd);
567 + break;
568 + }
569 +#endif
570
571 case OTPGETREGIONCOUNT:
572 case OTPGETREGIONINFO:
573 Index: linux-2.6.38-rc6/include/linux/mtd/mtd.h
574 ===================================================================
575 --- linux-2.6.38-rc6.orig/include/linux/mtd/mtd.h 2011-02-28 16:14:12.613467908 +0100
576 +++ linux-2.6.38-rc6/include/linux/mtd/mtd.h 2011-02-28 16:26:51.223804561 +0100
577 @@ -125,6 +125,7 @@ struct nand_ecclayout {
578 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE];
579 };
580
581 +struct mtd_info;
582 struct mtd_info {
583 u_char type;
584 uint32_t flags;
585 @@ -277,6 +278,9 @@ struct mtd_info {
586 struct device dev;
587 int usecount;
588
589 + int (*refresh_device)(struct mtd_info *mtd);
590 + struct mtd_info *split;
591 +
592 /* If the driver is something smart, like UBI, it may need to maintain
593 * its own reference counting. The below functions are only for driver.
594 * The driver may register its callbacks. These callbacks are not
595 Index: linux-2.6.38-rc6/include/linux/mtd/partitions.h
596 ===================================================================
597 --- linux-2.6.38-rc6.orig/include/linux/mtd/partitions.h 2011-02-28 16:14:12.635467400 +0100
598 +++ linux-2.6.38-rc6/include/linux/mtd/partitions.h 2011-02-28 16:26:55.382735938 +0100
599 @@ -34,12 +34,14 @@
600 * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK).
601 */
602
603 +struct mtd_partition;
604 struct mtd_partition {
605 char *name; /* identifier string */
606 uint64_t size; /* partition size */
607 uint64_t offset; /* offset within the master MTD space */
608 uint32_t mask_flags; /* master MTD flags to mask out for this partition */
609 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */
610 + int (*refresh_partition)(struct mtd_info *);
611 };
612
613 #define MTDPART_OFS_NXTBLK (-2)
614 @@ -51,6 +53,7 @@ struct mtd_info;
615
616 int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
617 int del_mtd_partitions(struct mtd_info *);
618 +int refresh_mtd_partitions(struct mtd_info *);
619
620 /*
621 * Functions dealing with the various ways of partitioning the space
622 Index: linux-2.6.38-rc6/include/mtd/mtd-abi.h
623 ===================================================================
624 --- linux-2.6.38-rc6.orig/include/mtd/mtd-abi.h 2011-02-28 16:14:12.596468301 +0100
625 +++ linux-2.6.38-rc6/include/mtd/mtd-abi.h 2011-02-28 16:15:07.505183696 +0100
626 @@ -127,6 +127,7 @@ struct otp_info {
627 #define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
628 #define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
629 #define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
630 +#define MTDREFRESH _IO('M', 23)
631
632 /*
633 * Obsolete legacy interface. Keep it in order not to break userspace