aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/ubi.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/ubi.h')
-rw-r--r--drivers/mtd/ubi/ubi.h30
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 329663188772..cc010111264f 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -274,6 +274,12 @@ struct ubi_wl_entry;
274 * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or 274 * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or
275 * not 275 * not
276 * @mtd: MTD device descriptor 276 * @mtd: MTD device descriptor
277 *
278 * @peb_buf1: a buffer of PEB size used for different purposes
279 * @peb_buf2: another buffer of PEB size used for different purposes
280 * @buf_mutex: proptects @peb_buf1 and @peb_buf2
281 * @dbg_peb_buf: buffer of PEB size used for debugging
282 * @dbg_buf_mutex: proptects @dbg_peb_buf
277 */ 283 */
278struct ubi_device { 284struct ubi_device {
279 struct cdev cdev; 285 struct cdev cdev;
@@ -343,6 +349,14 @@ struct ubi_device {
343 int vid_hdr_shift; 349 int vid_hdr_shift;
344 int bad_allowed; 350 int bad_allowed;
345 struct mtd_info *mtd; 351 struct mtd_info *mtd;
352
353 void *peb_buf1;
354 void *peb_buf2;
355 struct mutex buf_mutex;
356#ifdef CONFIG_MTD_UBI_DEBUG
357 void *dbg_peb_buf;
358 struct mutex dbg_buf_mutex;
359#endif
346}; 360};
347 361
348extern struct file_operations ubi_cdev_operations; 362extern struct file_operations ubi_cdev_operations;
@@ -409,18 +423,18 @@ void ubi_wl_close(struct ubi_device *ubi);
409/* io.c */ 423/* io.c */
410int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, 424int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset,
411 int len); 425 int len);
412int ubi_io_write(const struct ubi_device *ubi, const void *buf, int pnum, 426int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,
413 int offset, int len); 427 int len);
414int ubi_io_sync_erase(const struct ubi_device *ubi, int pnum, int torture); 428int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int torture);
415int ubi_io_is_bad(const struct ubi_device *ubi, int pnum); 429int ubi_io_is_bad(const struct ubi_device *ubi, int pnum);
416int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum); 430int ubi_io_mark_bad(const struct ubi_device *ubi, int pnum);
417int ubi_io_read_ec_hdr(const struct ubi_device *ubi, int pnum, 431int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
418 struct ubi_ec_hdr *ec_hdr, int verbose); 432 struct ubi_ec_hdr *ec_hdr, int verbose);
419int ubi_io_write_ec_hdr(const struct ubi_device *ubi, int pnum, 433int ubi_io_write_ec_hdr(struct ubi_device *ubi, int pnum,
420 struct ubi_ec_hdr *ec_hdr); 434 struct ubi_ec_hdr *ec_hdr);
421int ubi_io_read_vid_hdr(const struct ubi_device *ubi, int pnum, 435int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
422 struct ubi_vid_hdr *vid_hdr, int verbose); 436 struct ubi_vid_hdr *vid_hdr, int verbose);
423int ubi_io_write_vid_hdr(const struct ubi_device *ubi, int pnum, 437int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum,
424 struct ubi_vid_hdr *vid_hdr); 438 struct ubi_vid_hdr *vid_hdr);
425 439
426/* 440/*
@@ -494,7 +508,7 @@ static inline int ubi_io_read_data(const struct ubi_device *ubi, void *buf,
494 * the beginning of the logical eraseblock, not to the beginning of the 508 * the beginning of the logical eraseblock, not to the beginning of the
495 * physical eraseblock. 509 * physical eraseblock.
496 */ 510 */
497static inline int ubi_io_write_data(const struct ubi_device *ubi, const void *buf, 511static inline int ubi_io_write_data(struct ubi_device *ubi, const void *buf,
498 int pnum, int offset, int len) 512 int pnum, int offset, int len)
499{ 513{
500 ubi_assert(offset >= 0); 514 ubi_assert(offset >= 0);