aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/ubi.h
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-13 14:47:47 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-24 06:34:46 -0400
commitf40ac9cdf6991287f19bdafe9b0752ee40137908 (patch)
treea49120d5be3729feaa40880962f29e3679c1800e /drivers/mtd/ubi/ubi.h
parentc8566350a3229ca505b84313c65d1403b4d0cbfc (diff)
UBI: implement multiple volumes rename
Quite useful ioctl which allows to make atomic system upgrades. The idea belongs to Richard Titmuss <richard_titmuss@logitech.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/ubi.h')
-rw-r--r--drivers/mtd/ubi/ubi.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 1fc32c863b78..274c67916b34 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -131,6 +131,27 @@ struct ubi_ltree_entry {
131 struct rw_semaphore mutex; 131 struct rw_semaphore mutex;
132}; 132};
133 133
134/**
135 * struct ubi_rename_entry - volume re-name description data structure.
136 * @new_name_len: new volume name length
137 * @new_name: new volume name
138 * @remove: if not zero, this volume should be removed, not re-named
139 * @desc: descriptor of the volume
140 * @list: links re-name entries into a list
141 *
142 * This data structure is utilized in the multiple volume re-name code. Namely,
143 * UBI first creates a list of &struct ubi_rename_entry objects from the
144 * &struct ubi_rnvol_req request object, and then utilizes this list to do all
145 * the job.
146 */
147struct ubi_rename_entry {
148 int new_name_len;
149 char new_name[UBI_VOL_NAME_MAX + 1];
150 int remove;
151 struct ubi_volume_desc *desc;
152 struct list_head list;
153};
154
134struct ubi_volume_desc; 155struct ubi_volume_desc;
135 156
136/** 157/**
@@ -206,7 +227,7 @@ struct ubi_volume {
206 int alignment; 227 int alignment;
207 int data_pad; 228 int data_pad;
208 int name_len; 229 int name_len;
209 char name[UBI_VOL_NAME_MAX+1]; 230 char name[UBI_VOL_NAME_MAX + 1];
210 231
211 int upd_ebs; 232 int upd_ebs;
212 int ch_lnum; 233 int ch_lnum;
@@ -272,7 +293,7 @@ struct ubi_wl_entry;
272 * @vtbl_size: size of the volume table in bytes 293 * @vtbl_size: size of the volume table in bytes
273 * @vtbl: in-RAM volume table copy 294 * @vtbl: in-RAM volume table copy
274 * @volumes_mutex: protects on-flash volume table and serializes volume 295 * @volumes_mutex: protects on-flash volume table and serializes volume
275 * changes, like creation, deletion, update, resize 296 * changes, like creation, deletion, update, re-size and re-name
276 * 297 *
277 * @max_ec: current highest erase counter value 298 * @max_ec: current highest erase counter value
278 * @mean_ec: current mean erase counter value 299 * @mean_ec: current mean erase counter value
@@ -330,6 +351,8 @@ struct ubi_wl_entry;
330 * @peb_buf1: a buffer of PEB size used for different purposes 351 * @peb_buf1: a buffer of PEB size used for different purposes
331 * @peb_buf2: another buffer of PEB size used for different purposes 352 * @peb_buf2: another buffer of PEB size used for different purposes
332 * @buf_mutex: proptects @peb_buf1 and @peb_buf2 353 * @buf_mutex: proptects @peb_buf1 and @peb_buf2
354 * @ckvol_mutex: serializes static volume checking when opening
355 * @mult_mutex: serializes operations on multiple volumes, like re-nameing
333 * @dbg_peb_buf: buffer of PEB size used for debugging 356 * @dbg_peb_buf: buffer of PEB size used for debugging
334 * @dbg_buf_mutex: proptects @dbg_peb_buf 357 * @dbg_buf_mutex: proptects @dbg_peb_buf
335 */ 358 */
@@ -410,6 +433,7 @@ struct ubi_device {
410 void *peb_buf2; 433 void *peb_buf2;
411 struct mutex buf_mutex; 434 struct mutex buf_mutex;
412 struct mutex ckvol_mutex; 435 struct mutex ckvol_mutex;
436 struct mutex mult_mutex;
413#ifdef CONFIG_MTD_UBI_DEBUG 437#ifdef CONFIG_MTD_UBI_DEBUG
414 void *dbg_peb_buf; 438 void *dbg_peb_buf;
415 struct mutex dbg_buf_mutex; 439 struct mutex dbg_buf_mutex;
@@ -426,12 +450,15 @@ extern struct mutex ubi_devices_mutex;
426/* vtbl.c */ 450/* vtbl.c */
427int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, 451int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
428 struct ubi_vtbl_record *vtbl_rec); 452 struct ubi_vtbl_record *vtbl_rec);
453int ubi_vtbl_rename_volumes(struct ubi_device *ubi,
454 struct list_head *rename_list);
429int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_scan_info *si); 455int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_scan_info *si);
430 456
431/* vmt.c */ 457/* vmt.c */
432int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req); 458int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req);
433int ubi_remove_volume(struct ubi_volume_desc *desc); 459int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl);
434int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs); 460int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs);
461int ubi_rename_volumes(struct ubi_device *ubi, struct list_head *rename_list);
435int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol); 462int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol);
436void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol); 463void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol);
437 464