diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 14:51:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 14:51:26 -0400 |
commit | 4d429480352c63db2228489f0db9fd381cdc3c9c (patch) | |
tree | 96a3bc976735ef01d5d5e42353ae1dd795d34370 | |
parent | eb08d8ff476ad39a149e1044c7d3fd742a168864 (diff) | |
parent | ab50ff684707031ed4bad2fdd313208ae392e5bb (diff) |
Merge branch 'linux-next' of git://git.infradead.org/ubi-2.6
* 'linux-next' of git://git.infradead.org/ubi-2.6:
UBI: switch to dynamic printks
UBI: turn some macros into static inline
UBI: improve checking in debugging prints
UBI: fix typo in a message
UBI: fix minor stylistic issues
UBI: use __packed instead of __attribute__((packed))
UBI: cleanup comments around volume properties
UBI: re-name set volume properties ioctl
UBI: make the control character device non-seekable
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 14 | ||||
-rw-r--r-- | drivers/mtd/ubi/debug.c | 21 | ||||
-rw-r--r-- | drivers/mtd/ubi/debug.h | 161 | ||||
-rw-r--r-- | drivers/mtd/ubi/io.c | 6 | ||||
-rw-r--r-- | drivers/mtd/ubi/scan.c | 2 | ||||
-rw-r--r-- | drivers/mtd/ubi/ubi-media.h | 6 | ||||
-rw-r--r-- | drivers/mtd/ubi/ubi.h | 4 | ||||
-rw-r--r-- | drivers/mtd/ubi/wl.c | 3 | ||||
-rw-r--r-- | include/linux/mtd/ubi.h | 4 | ||||
-rw-r--r-- | include/mtd/ubi-user.h | 40 |
10 files changed, 132 insertions, 129 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index af9fb0ff8210..191f3bb3c41a 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c | |||
@@ -115,7 +115,7 @@ static int vol_cdev_open(struct inode *inode, struct file *file) | |||
115 | mode = UBI_READONLY; | 115 | mode = UBI_READONLY; |
116 | 116 | ||
117 | dbg_gen("open device %d, volume %d, mode %d", | 117 | dbg_gen("open device %d, volume %d, mode %d", |
118 | ubi_num, vol_id, mode); | 118 | ubi_num, vol_id, mode); |
119 | 119 | ||
120 | desc = ubi_open_volume(ubi_num, vol_id, mode); | 120 | desc = ubi_open_volume(ubi_num, vol_id, mode); |
121 | if (IS_ERR(desc)) | 121 | if (IS_ERR(desc)) |
@@ -158,7 +158,7 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin) | |||
158 | loff_t new_offset; | 158 | loff_t new_offset; |
159 | 159 | ||
160 | if (vol->updating) { | 160 | if (vol->updating) { |
161 | /* Update is in progress, seeking is prohibited */ | 161 | /* Update is in progress, seeking is prohibited */ |
162 | dbg_err("updating"); | 162 | dbg_err("updating"); |
163 | return -EBUSY; | 163 | return -EBUSY; |
164 | } | 164 | } |
@@ -561,18 +561,18 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, | |||
561 | } | 561 | } |
562 | 562 | ||
563 | /* Set volume property command */ | 563 | /* Set volume property command */ |
564 | case UBI_IOCSETPROP: | 564 | case UBI_IOCSETVOLPROP: |
565 | { | 565 | { |
566 | struct ubi_set_prop_req req; | 566 | struct ubi_set_vol_prop_req req; |
567 | 567 | ||
568 | err = copy_from_user(&req, argp, | 568 | err = copy_from_user(&req, argp, |
569 | sizeof(struct ubi_set_prop_req)); | 569 | sizeof(struct ubi_set_vol_prop_req)); |
570 | if (err) { | 570 | if (err) { |
571 | err = -EFAULT; | 571 | err = -EFAULT; |
572 | break; | 572 | break; |
573 | } | 573 | } |
574 | switch (req.property) { | 574 | switch (req.property) { |
575 | case UBI_PROP_DIRECT_WRITE: | 575 | case UBI_VOL_PROP_DIRECT_WRITE: |
576 | mutex_lock(&ubi->device_mutex); | 576 | mutex_lock(&ubi->device_mutex); |
577 | desc->vol->direct_writes = !!req.value; | 577 | desc->vol->direct_writes = !!req.value; |
578 | mutex_unlock(&ubi->device_mutex); | 578 | mutex_unlock(&ubi->device_mutex); |
@@ -1100,5 +1100,5 @@ const struct file_operations ubi_ctrl_cdev_operations = { | |||
1100 | .owner = THIS_MODULE, | 1100 | .owner = THIS_MODULE, |
1101 | .unlocked_ioctl = ctrl_cdev_ioctl, | 1101 | .unlocked_ioctl = ctrl_cdev_ioctl, |
1102 | .compat_ioctl = ctrl_cdev_compat_ioctl, | 1102 | .compat_ioctl = ctrl_cdev_compat_ioctl, |
1103 | .llseek = noop_llseek, | 1103 | .llseek = no_llseek, |
1104 | }; | 1104 | }; |
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index d4d07e5f138f..2224cbe41ddf 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -30,15 +30,12 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
32 | 32 | ||
33 | unsigned int ubi_msg_flags; | ||
34 | unsigned int ubi_chk_flags; | 33 | unsigned int ubi_chk_flags; |
35 | unsigned int ubi_tst_flags; | 34 | unsigned int ubi_tst_flags; |
36 | 35 | ||
37 | module_param_named(debug_msgs, ubi_msg_flags, uint, S_IRUGO | S_IWUSR); | ||
38 | module_param_named(debug_chks, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); | 36 | module_param_named(debug_chks, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); |
39 | module_param_named(debug_tsts, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); | 37 | module_param_named(debug_tsts, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); |
40 | 38 | ||
41 | MODULE_PARM_DESC(debug_msgs, "Debug message type flags"); | ||
42 | MODULE_PARM_DESC(debug_chks, "Debug check flags"); | 39 | MODULE_PARM_DESC(debug_chks, "Debug check flags"); |
43 | MODULE_PARM_DESC(debug_tsts, "Debug special test flags"); | 40 | MODULE_PARM_DESC(debug_tsts, "Debug special test flags"); |
44 | 41 | ||
@@ -75,15 +72,15 @@ void ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr) | |||
75 | { | 72 | { |
76 | printk(KERN_DEBUG "Volume identifier header dump:\n"); | 73 | printk(KERN_DEBUG "Volume identifier header dump:\n"); |
77 | printk(KERN_DEBUG "\tmagic %08x\n", be32_to_cpu(vid_hdr->magic)); | 74 | printk(KERN_DEBUG "\tmagic %08x\n", be32_to_cpu(vid_hdr->magic)); |
78 | printk(KERN_DEBUG "\tversion %d\n", (int)vid_hdr->version); | 75 | printk(KERN_DEBUG "\tversion %d\n", (int)vid_hdr->version); |
79 | printk(KERN_DEBUG "\tvol_type %d\n", (int)vid_hdr->vol_type); | 76 | printk(KERN_DEBUG "\tvol_type %d\n", (int)vid_hdr->vol_type); |
80 | printk(KERN_DEBUG "\tcopy_flag %d\n", (int)vid_hdr->copy_flag); | 77 | printk(KERN_DEBUG "\tcopy_flag %d\n", (int)vid_hdr->copy_flag); |
81 | printk(KERN_DEBUG "\tcompat %d\n", (int)vid_hdr->compat); | 78 | printk(KERN_DEBUG "\tcompat %d\n", (int)vid_hdr->compat); |
82 | printk(KERN_DEBUG "\tvol_id %d\n", be32_to_cpu(vid_hdr->vol_id)); | 79 | printk(KERN_DEBUG "\tvol_id %d\n", be32_to_cpu(vid_hdr->vol_id)); |
83 | printk(KERN_DEBUG "\tlnum %d\n", be32_to_cpu(vid_hdr->lnum)); | 80 | printk(KERN_DEBUG "\tlnum %d\n", be32_to_cpu(vid_hdr->lnum)); |
84 | printk(KERN_DEBUG "\tdata_size %d\n", be32_to_cpu(vid_hdr->data_size)); | 81 | printk(KERN_DEBUG "\tdata_size %d\n", be32_to_cpu(vid_hdr->data_size)); |
85 | printk(KERN_DEBUG "\tused_ebs %d\n", be32_to_cpu(vid_hdr->used_ebs)); | 82 | printk(KERN_DEBUG "\tused_ebs %d\n", be32_to_cpu(vid_hdr->used_ebs)); |
86 | printk(KERN_DEBUG "\tdata_pad %d\n", be32_to_cpu(vid_hdr->data_pad)); | 83 | printk(KERN_DEBUG "\tdata_pad %d\n", be32_to_cpu(vid_hdr->data_pad)); |
87 | printk(KERN_DEBUG "\tsqnum %llu\n", | 84 | printk(KERN_DEBUG "\tsqnum %llu\n", |
88 | (unsigned long long)be64_to_cpu(vid_hdr->sqnum)); | 85 | (unsigned long long)be64_to_cpu(vid_hdr->sqnum)); |
89 | printk(KERN_DEBUG "\thdr_crc %08x\n", be32_to_cpu(vid_hdr->hdr_crc)); | 86 | printk(KERN_DEBUG "\thdr_crc %08x\n", be32_to_cpu(vid_hdr->hdr_crc)); |
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 0b0c2888c656..3f1a09c5c438 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
@@ -21,11 +21,17 @@ | |||
21 | #ifndef __UBI_DEBUG_H__ | 21 | #ifndef __UBI_DEBUG_H__ |
22 | #define __UBI_DEBUG_H__ | 22 | #define __UBI_DEBUG_H__ |
23 | 23 | ||
24 | struct ubi_ec_hdr; | ||
25 | struct ubi_vid_hdr; | ||
26 | struct ubi_volume; | ||
27 | struct ubi_vtbl_record; | ||
28 | struct ubi_scan_volume; | ||
29 | struct ubi_scan_leb; | ||
30 | struct ubi_mkvol_req; | ||
31 | |||
24 | #ifdef CONFIG_MTD_UBI_DEBUG | 32 | #ifdef CONFIG_MTD_UBI_DEBUG |
25 | #include <linux/random.h> | 33 | #include <linux/random.h> |
26 | 34 | ||
27 | #define dbg_err(fmt, ...) ubi_err(fmt, ##__VA_ARGS__) | ||
28 | |||
29 | #define ubi_assert(expr) do { \ | 35 | #define ubi_assert(expr) do { \ |
30 | if (unlikely(!(expr))) { \ | 36 | if (unlikely(!(expr))) { \ |
31 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ | 37 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ |
@@ -34,24 +40,28 @@ | |||
34 | } \ | 40 | } \ |
35 | } while (0) | 41 | } while (0) |
36 | 42 | ||
37 | #define dbg_msg(fmt, ...) \ | 43 | #define dbg_err(fmt, ...) ubi_err(fmt, ##__VA_ARGS__) |
38 | printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \ | ||
39 | current->pid, __func__, ##__VA_ARGS__) | ||
40 | |||
41 | #define dbg_do_msg(typ, fmt, ...) do { \ | ||
42 | if (ubi_msg_flags & typ) \ | ||
43 | dbg_msg(fmt, ##__VA_ARGS__); \ | ||
44 | } while (0) | ||
45 | 44 | ||
46 | #define ubi_dbg_dump_stack() dump_stack() | 45 | #define ubi_dbg_dump_stack() dump_stack() |
47 | 46 | ||
48 | struct ubi_ec_hdr; | 47 | #define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) \ |
49 | struct ubi_vid_hdr; | 48 | print_hex_dump(l, ps, pt, r, g, b, len, a) |
50 | struct ubi_volume; | 49 | |
51 | struct ubi_vtbl_record; | 50 | #define ubi_dbg_msg(type, fmt, ...) \ |
52 | struct ubi_scan_volume; | 51 | pr_debug("UBI DBG " type ": " fmt "\n", ##__VA_ARGS__) |
53 | struct ubi_scan_leb; | 52 | |
54 | struct ubi_mkvol_req; | 53 | /* Just a debugging messages not related to any specific UBI subsystem */ |
54 | #define dbg_msg(fmt, ...) ubi_dbg_msg("msg", fmt, ##__VA_ARGS__) | ||
55 | /* General debugging messages */ | ||
56 | #define dbg_gen(fmt, ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__) | ||
57 | /* Messages from the eraseblock association sub-system */ | ||
58 | #define dbg_eba(fmt, ...) ubi_dbg_msg("eba", fmt, ##__VA_ARGS__) | ||
59 | /* Messages from the wear-leveling sub-system */ | ||
60 | #define dbg_wl(fmt, ...) ubi_dbg_msg("wl", fmt, ##__VA_ARGS__) | ||
61 | /* Messages from the input/output sub-system */ | ||
62 | #define dbg_io(fmt, ...) ubi_dbg_msg("io", fmt, ##__VA_ARGS__) | ||
63 | /* Initialization and build messages */ | ||
64 | #define dbg_bld(fmt, ...) ubi_dbg_msg("bld", fmt, ##__VA_ARGS__) | ||
55 | 65 | ||
56 | void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr); | 66 | void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr); |
57 | void ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); | 67 | void ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); |
@@ -62,43 +72,6 @@ void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type); | |||
62 | void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); | 72 | void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); |
63 | void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); | 73 | void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); |
64 | 74 | ||
65 | extern unsigned int ubi_msg_flags; | ||
66 | |||
67 | /* | ||
68 | * Debugging message type flags (must match msg_type_names in debug.c). | ||
69 | * | ||
70 | * UBI_MSG_GEN: general messages | ||
71 | * UBI_MSG_EBA: journal messages | ||
72 | * UBI_MSG_WL: mount messages | ||
73 | * UBI_MSG_IO: commit messages | ||
74 | * UBI_MSG_BLD: LEB find messages | ||
75 | */ | ||
76 | enum { | ||
77 | UBI_MSG_GEN = 0x1, | ||
78 | UBI_MSG_EBA = 0x2, | ||
79 | UBI_MSG_WL = 0x4, | ||
80 | UBI_MSG_IO = 0x8, | ||
81 | UBI_MSG_BLD = 0x10, | ||
82 | }; | ||
83 | |||
84 | #define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) \ | ||
85 | print_hex_dump(l, ps, pt, r, g, b, len, a) | ||
86 | |||
87 | /* General debugging messages */ | ||
88 | #define dbg_gen(fmt, ...) dbg_do_msg(UBI_MSG_GEN, fmt, ##__VA_ARGS__) | ||
89 | |||
90 | /* Messages from the eraseblock association sub-system */ | ||
91 | #define dbg_eba(fmt, ...) dbg_do_msg(UBI_MSG_EBA, fmt, ##__VA_ARGS__) | ||
92 | |||
93 | /* Messages from the wear-leveling sub-system */ | ||
94 | #define dbg_wl(fmt, ...) dbg_do_msg(UBI_MSG_WL, fmt, ##__VA_ARGS__) | ||
95 | |||
96 | /* Messages from the input/output sub-system */ | ||
97 | #define dbg_io(fmt, ...) dbg_do_msg(UBI_MSG_IO, fmt, ##__VA_ARGS__) | ||
98 | |||
99 | /* Initialization and build messages */ | ||
100 | #define dbg_bld(fmt, ...) dbg_do_msg(UBI_MSG_BLD, fmt, ##__VA_ARGS__) | ||
101 | |||
102 | extern unsigned int ubi_chk_flags; | 75 | extern unsigned int ubi_chk_flags; |
103 | 76 | ||
104 | /* | 77 | /* |
@@ -184,31 +157,61 @@ static inline int ubi_dbg_is_erase_failure(void) | |||
184 | 157 | ||
185 | #else | 158 | #else |
186 | 159 | ||
187 | #define ubi_assert(expr) ({}) | 160 | /* Use "if (0)" to make compiler check arguments even if debugging is off */ |
188 | #define dbg_err(fmt, ...) ({}) | 161 | #define ubi_assert(expr) do { \ |
189 | #define dbg_msg(fmt, ...) ({}) | 162 | if (0) { \ |
190 | #define dbg_gen(fmt, ...) ({}) | 163 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ |
191 | #define dbg_eba(fmt, ...) ({}) | 164 | __func__, __LINE__, current->pid); \ |
192 | #define dbg_wl(fmt, ...) ({}) | 165 | } \ |
193 | #define dbg_io(fmt, ...) ({}) | 166 | } while (0) |
194 | #define dbg_bld(fmt, ...) ({}) | 167 | |
195 | #define ubi_dbg_dump_stack() ({}) | 168 | #define dbg_err(fmt, ...) do { \ |
196 | #define ubi_dbg_dump_ec_hdr(ec_hdr) ({}) | 169 | if (0) \ |
197 | #define ubi_dbg_dump_vid_hdr(vid_hdr) ({}) | 170 | ubi_err(fmt, ##__VA_ARGS__); \ |
198 | #define ubi_dbg_dump_vol_info(vol) ({}) | 171 | } while (0) |
199 | #define ubi_dbg_dump_vtbl_record(r, idx) ({}) | 172 | |
200 | #define ubi_dbg_dump_sv(sv) ({}) | 173 | #define ubi_dbg_msg(fmt, ...) do { \ |
201 | #define ubi_dbg_dump_seb(seb, type) ({}) | 174 | if (0) \ |
202 | #define ubi_dbg_dump_mkvol_req(req) ({}) | 175 | pr_debug(fmt "\n", ##__VA_ARGS__); \ |
203 | #define ubi_dbg_dump_flash(ubi, pnum, offset, len) ({}) | 176 | } while (0) |
204 | #define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) ({}) | 177 | |
205 | 178 | #define dbg_msg(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) | |
206 | #define ubi_dbg_is_bgt_disabled() 0 | 179 | #define dbg_gen(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
207 | #define ubi_dbg_is_bitflip() 0 | 180 | #define dbg_eba(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
208 | #define ubi_dbg_is_write_failure() 0 | 181 | #define dbg_wl(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
209 | #define ubi_dbg_is_erase_failure() 0 | 182 | #define dbg_io(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
210 | #define ubi_dbg_check_all_ff(ubi, pnum, offset, len) 0 | 183 | #define dbg_bld(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
211 | #define ubi_dbg_check_write(ubi, buf, pnum, offset, len) 0 | 184 | |
185 | static inline void ubi_dbg_dump_stack(void) { return; } | ||
186 | static inline void | ||
187 | ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr) { return; } | ||
188 | static inline void | ||
189 | ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr) { return; } | ||
190 | static inline void | ||
191 | ubi_dbg_dump_vol_info(const struct ubi_volume *vol) { return; } | ||
192 | static inline void | ||
193 | ubi_dbg_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx) { return; } | ||
194 | static inline void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv) { return; } | ||
195 | static inline void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, | ||
196 | int type) { return; } | ||
197 | static inline void | ||
198 | ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req) { return; } | ||
199 | static inline void ubi_dbg_dump_flash(struct ubi_device *ubi, | ||
200 | int pnum, int offset, int len) { return; } | ||
201 | static inline void | ||
202 | ubi_dbg_print_hex_dump(const char *l, const char *ps, int pt, int r, | ||
203 | int g, const void *b, size_t len, bool a) { return; } | ||
204 | |||
205 | static inline int ubi_dbg_is_bgt_disabled(void) { return 0; } | ||
206 | static inline int ubi_dbg_is_bitflip(void) { return 0; } | ||
207 | static inline int ubi_dbg_is_write_failure(void) { return 0; } | ||
208 | static inline int ubi_dbg_is_erase_failure(void) { return 0; } | ||
209 | static inline int ubi_dbg_check_all_ff(struct ubi_device *ubi, | ||
210 | int pnum, int offset, | ||
211 | int len) { return 0; } | ||
212 | static inline int ubi_dbg_check_write(struct ubi_device *ubi, | ||
213 | const void *buf, int pnum, | ||
214 | int offset, int len) { return 0; } | ||
212 | 215 | ||
213 | #endif /* !CONFIG_MTD_UBI_DEBUG */ | 216 | #endif /* !CONFIG_MTD_UBI_DEBUG */ |
214 | #endif /* !__UBI_DEBUG_H__ */ | 217 | #endif /* !__UBI_DEBUG_H__ */ |
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index e347cc4388ed..8c1b1c7bc4a7 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -189,8 +189,8 @@ retry: | |||
189 | } | 189 | } |
190 | 190 | ||
191 | if (retries++ < UBI_IO_RETRIES) { | 191 | if (retries++ < UBI_IO_RETRIES) { |
192 | dbg_io("error %d%s while reading %d bytes from PEB %d:%d," | 192 | dbg_io("error %d%s while reading %d bytes from PEB " |
193 | " read only %zd bytes, retry", | 193 | "%d:%d, read only %zd bytes, retry", |
194 | err, errstr, len, pnum, offset, read); | 194 | err, errstr, len, pnum, offset, read); |
195 | yield(); | 195 | yield(); |
196 | goto retry; | 196 | goto retry; |
@@ -465,7 +465,7 @@ static int torture_peb(struct ubi_device *ubi, int pnum) | |||
465 | } | 465 | } |
466 | 466 | ||
467 | err = patt_count; | 467 | err = patt_count; |
468 | ubi_msg("PEB %d passed torture test, do not mark it a bad", pnum); | 468 | ubi_msg("PEB %d passed torture test, do not mark it as bad", pnum); |
469 | 469 | ||
470 | out: | 470 | out: |
471 | mutex_unlock(&ubi->buf_mutex); | 471 | mutex_unlock(&ubi->buf_mutex); |
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index d2d12ab7def4..2135a53732ff 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
@@ -1103,7 +1103,7 @@ static int check_what_we_have(struct ubi_device *ubi, struct ubi_scan_info *si) | |||
1103 | * otherwise, only print a warning. | 1103 | * otherwise, only print a warning. |
1104 | */ | 1104 | */ |
1105 | if (si->corr_peb_count >= max_corr) { | 1105 | if (si->corr_peb_count >= max_corr) { |
1106 | ubi_err("too many corrupted PEBs, refusing this device"); | 1106 | ubi_err("too many corrupted PEBs, refusing"); |
1107 | return -EINVAL; | 1107 | return -EINVAL; |
1108 | } | 1108 | } |
1109 | } | 1109 | } |
diff --git a/drivers/mtd/ubi/ubi-media.h b/drivers/mtd/ubi/ubi-media.h index 503ea9b27309..6fb8ec2174a5 100644 --- a/drivers/mtd/ubi/ubi-media.h +++ b/drivers/mtd/ubi/ubi-media.h | |||
@@ -164,7 +164,7 @@ struct ubi_ec_hdr { | |||
164 | __be32 image_seq; | 164 | __be32 image_seq; |
165 | __u8 padding2[32]; | 165 | __u8 padding2[32]; |
166 | __be32 hdr_crc; | 166 | __be32 hdr_crc; |
167 | } __attribute__ ((packed)); | 167 | } __packed; |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * struct ubi_vid_hdr - on-flash UBI volume identifier header. | 170 | * struct ubi_vid_hdr - on-flash UBI volume identifier header. |
@@ -292,7 +292,7 @@ struct ubi_vid_hdr { | |||
292 | __be64 sqnum; | 292 | __be64 sqnum; |
293 | __u8 padding3[12]; | 293 | __u8 padding3[12]; |
294 | __be32 hdr_crc; | 294 | __be32 hdr_crc; |
295 | } __attribute__ ((packed)); | 295 | } __packed; |
296 | 296 | ||
297 | /* Internal UBI volumes count */ | 297 | /* Internal UBI volumes count */ |
298 | #define UBI_INT_VOL_COUNT 1 | 298 | #define UBI_INT_VOL_COUNT 1 |
@@ -373,6 +373,6 @@ struct ubi_vtbl_record { | |||
373 | __u8 flags; | 373 | __u8 flags; |
374 | __u8 padding[23]; | 374 | __u8 padding[23]; |
375 | __be32 crc; | 375 | __be32 crc; |
376 | } __attribute__ ((packed)); | 376 | } __packed; |
377 | 377 | ||
378 | #endif /* !__UBI_MEDIA_H__ */ | 378 | #endif /* !__UBI_MEDIA_H__ */ |
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index f1be8b79663c..c6c22295898e 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -341,8 +341,8 @@ struct ubi_wl_entry; | |||
341 | * protected from the wear-leveling worker) | 341 | * protected from the wear-leveling worker) |
342 | * @pq_head: protection queue head | 342 | * @pq_head: protection queue head |
343 | * @wl_lock: protects the @used, @free, @pq, @pq_head, @lookuptbl, @move_from, | 343 | * @wl_lock: protects the @used, @free, @pq, @pq_head, @lookuptbl, @move_from, |
344 | * @move_to, @move_to_put @erase_pending, @wl_scheduled, @works, | 344 | * @move_to, @move_to_put @erase_pending, @wl_scheduled, @works, |
345 | * @erroneous, and @erroneous_peb_count fields | 345 | * @erroneous, and @erroneous_peb_count fields |
346 | * @move_mutex: serializes eraseblock moves | 346 | * @move_mutex: serializes eraseblock moves |
347 | * @work_sem: synchronizes the WL worker with use tasks | 347 | * @work_sem: synchronizes the WL worker with use tasks |
348 | * @wl_scheduled: non-zero if the wear-leveling was scheduled | 348 | * @wl_scheduled: non-zero if the wear-leveling was scheduled |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index b4cf57db2556..ff2c4956eeff 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -1570,7 +1570,8 @@ void ubi_wl_close(struct ubi_device *ubi) | |||
1570 | * @ec: the erase counter to check | 1570 | * @ec: the erase counter to check |
1571 | * | 1571 | * |
1572 | * This function returns zero if the erase counter of physical eraseblock @pnum | 1572 | * This function returns zero if the erase counter of physical eraseblock @pnum |
1573 | * is equivalent to @ec, and a negative error code if not or if an error occurred. | 1573 | * is equivalent to @ec, and a negative error code if not or if an error |
1574 | * occurred. | ||
1574 | */ | 1575 | */ |
1575 | static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec) | 1576 | static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec) |
1576 | { | 1577 | { |
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index 84854edf4436..15da0e99f48a 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #ifndef __LINUX_UBI_H__ | 21 | #ifndef __LINUX_UBI_H__ |
22 | #define __LINUX_UBI_H__ | 22 | #define __LINUX_UBI_H__ |
23 | 23 | ||
24 | #include <asm/ioctl.h> | 24 | #include <linux/ioctl.h> |
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <mtd/ubi-user.h> | 26 | #include <mtd/ubi-user.h> |
27 | 27 | ||
@@ -87,7 +87,7 @@ enum { | |||
87 | * physical eraseblock size and on how much bytes UBI headers consume. But | 87 | * physical eraseblock size and on how much bytes UBI headers consume. But |
88 | * because of the volume alignment (@alignment), the usable size of logical | 88 | * because of the volume alignment (@alignment), the usable size of logical |
89 | * eraseblocks if a volume may be less. The following equation is true: | 89 | * eraseblocks if a volume may be less. The following equation is true: |
90 | * @usable_leb_size = LEB size - (LEB size mod @alignment), | 90 | * @usable_leb_size = LEB size - (LEB size mod @alignment), |
91 | * where LEB size is the logical eraseblock size defined by the UBI device. | 91 | * where LEB size is the logical eraseblock size defined by the UBI device. |
92 | * | 92 | * |
93 | * The alignment is multiple to the minimal flash input/output unit size or %1 | 93 | * The alignment is multiple to the minimal flash input/output unit size or %1 |
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h index c0d47ad4b103..3c4109777aff 100644 --- a/include/mtd/ubi-user.h +++ b/include/mtd/ubi-user.h | |||
@@ -131,7 +131,7 @@ | |||
131 | * ~~~~~~~~~~~~~~~~~~~~~~~~~ | 131 | * ~~~~~~~~~~~~~~~~~~~~~~~~~ |
132 | * | 132 | * |
133 | * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be | 133 | * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be |
134 | * used. A pointer to a &struct ubi_set_prop_req object is expected to be | 134 | * used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be |
135 | * passed. The object describes which property should be set, and to which value | 135 | * passed. The object describes which property should be set, and to which value |
136 | * it should be set. | 136 | * it should be set. |
137 | */ | 137 | */ |
@@ -186,7 +186,8 @@ | |||
186 | /* Check if LEB is mapped command */ | 186 | /* Check if LEB is mapped command */ |
187 | #define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32) | 187 | #define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32) |
188 | /* Set an UBI volume property */ | 188 | /* Set an UBI volume property */ |
189 | #define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req) | 189 | #define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \ |
190 | struct ubi_set_vol_prop_req) | ||
190 | 191 | ||
191 | /* Maximum MTD device name length supported by UBI */ | 192 | /* Maximum MTD device name length supported by UBI */ |
192 | #define MAX_UBI_MTD_NAME_LEN 127 | 193 | #define MAX_UBI_MTD_NAME_LEN 127 |
@@ -223,13 +224,14 @@ enum { | |||
223 | }; | 224 | }; |
224 | 225 | ||
225 | /* | 226 | /* |
226 | * UBI set property ioctl constants | 227 | * UBI set volume property ioctl constants. |
227 | * | 228 | * |
228 | * @UBI_PROP_DIRECT_WRITE: allow / disallow user to directly write and | 229 | * @UBI_VOL_PROP_DIRECT_WRITE: allow (any non-zero value) or disallow (value 0) |
229 | * erase individual eraseblocks on dynamic volumes | 230 | * user to directly write and erase individual |
231 | * eraseblocks on dynamic volumes | ||
230 | */ | 232 | */ |
231 | enum { | 233 | enum { |
232 | UBI_PROP_DIRECT_WRITE = 1, | 234 | UBI_VOL_PROP_DIRECT_WRITE = 1, |
233 | }; | 235 | }; |
234 | 236 | ||
235 | /** | 237 | /** |
@@ -308,7 +310,7 @@ struct ubi_mkvol_req { | |||
308 | __s16 name_len; | 310 | __s16 name_len; |
309 | __s8 padding2[4]; | 311 | __s8 padding2[4]; |
310 | char name[UBI_MAX_VOLUME_NAME + 1]; | 312 | char name[UBI_MAX_VOLUME_NAME + 1]; |
311 | } __attribute__ ((packed)); | 313 | } __packed; |
312 | 314 | ||
313 | /** | 315 | /** |
314 | * struct ubi_rsvol_req - a data structure used in volume re-size requests. | 316 | * struct ubi_rsvol_req - a data structure used in volume re-size requests. |
@@ -324,7 +326,7 @@ struct ubi_mkvol_req { | |||
324 | struct ubi_rsvol_req { | 326 | struct ubi_rsvol_req { |
325 | __s64 bytes; | 327 | __s64 bytes; |
326 | __s32 vol_id; | 328 | __s32 vol_id; |
327 | } __attribute__ ((packed)); | 329 | } __packed; |
328 | 330 | ||
329 | /** | 331 | /** |
330 | * struct ubi_rnvol_req - volumes re-name request. | 332 | * struct ubi_rnvol_req - volumes re-name request. |
@@ -366,7 +368,7 @@ struct ubi_rnvol_req { | |||
366 | __s8 padding2[2]; | 368 | __s8 padding2[2]; |
367 | char name[UBI_MAX_VOLUME_NAME + 1]; | 369 | char name[UBI_MAX_VOLUME_NAME + 1]; |
368 | } ents[UBI_MAX_RNVOL]; | 370 | } ents[UBI_MAX_RNVOL]; |
369 | } __attribute__ ((packed)); | 371 | } __packed; |
370 | 372 | ||
371 | /** | 373 | /** |
372 | * struct ubi_leb_change_req - a data structure used in atomic LEB change | 374 | * struct ubi_leb_change_req - a data structure used in atomic LEB change |
@@ -381,7 +383,7 @@ struct ubi_leb_change_req { | |||
381 | __s32 bytes; | 383 | __s32 bytes; |
382 | __s8 dtype; | 384 | __s8 dtype; |
383 | __s8 padding[7]; | 385 | __s8 padding[7]; |
384 | } __attribute__ ((packed)); | 386 | } __packed; |
385 | 387 | ||
386 | /** | 388 | /** |
387 | * struct ubi_map_req - a data structure used in map LEB requests. | 389 | * struct ubi_map_req - a data structure used in map LEB requests. |
@@ -393,20 +395,20 @@ struct ubi_map_req { | |||
393 | __s32 lnum; | 395 | __s32 lnum; |
394 | __s8 dtype; | 396 | __s8 dtype; |
395 | __s8 padding[3]; | 397 | __s8 padding[3]; |
396 | } __attribute__ ((packed)); | 398 | } __packed; |
397 | 399 | ||
398 | 400 | ||
399 | /** | 401 | /** |
400 | * struct ubi_set_prop_req - a data structure used to set an ubi volume | 402 | * struct ubi_set_vol_prop_req - a data structure used to set an UBI volume |
401 | * property. | 403 | * property. |
402 | * @property: property to set (%UBI_PROP_DIRECT_WRITE) | 404 | * @property: property to set (%UBI_VOL_PROP_DIRECT_WRITE) |
403 | * @padding: reserved for future, not used, has to be zeroed | 405 | * @padding: reserved for future, not used, has to be zeroed |
404 | * @value: value to set | 406 | * @value: value to set |
405 | */ | 407 | */ |
406 | struct ubi_set_prop_req { | 408 | struct ubi_set_vol_prop_req { |
407 | __u8 property; | 409 | __u8 property; |
408 | __u8 padding[7]; | 410 | __u8 padding[7]; |
409 | __u64 value; | 411 | __u64 value; |
410 | } __attribute__ ((packed)); | 412 | } __packed; |
411 | 413 | ||
412 | #endif /* __UBI_USER_H__ */ | 414 | #endif /* __UBI_USER_H__ */ |