aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/ubi.h
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-17 10:37:26 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-12-26 12:15:17 -0500
commite73f4459d969bb266f03dd4cbe21bdba8cb2732c (patch)
tree5af7655da65f2c33f6ea4efdfaa8b0e0670d6aea /drivers/mtd/ubi/ubi.h
parent9f961b57568960a150cc9781c52824c9093a0514 (diff)
UBI: add UBI devices reference counting
This is one more step on the way to "removable" UBI devices. It adds reference counting for UBI devices. Every time a volume on this device is opened - the device's refcount is increased. It is also increased if someone is reading any sysfs file of this UBI device or of one of its volumes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/ubi.h')
-rw-r--r--drivers/mtd/ubi/ubi.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 21c028366fd..91fde0e8ff5 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -245,6 +245,7 @@ struct ubi_wl_entry;
245 * @beb_rsvd_level, @bad_peb_count, @good_peb_count, @vol_count, 245 * @beb_rsvd_level, @bad_peb_count, @good_peb_count, @vol_count,
246 * @vol->readers, @vol->writers, @vol->exclusive, 246 * @vol->readers, @vol->writers, @vol->exclusive,
247 * @vol->ref_count, @vol->mapping and @vol->eba_tbl. 247 * @vol->ref_count, @vol->mapping and @vol->eba_tbl.
248 * @ref_count: count of references on the UBI device
248 * 249 *
249 * @rsvd_pebs: count of reserved physical eraseblocks 250 * @rsvd_pebs: count of reserved physical eraseblocks
250 * @avail_pebs: count of available physical eraseblocks 251 * @avail_pebs: count of available physical eraseblocks
@@ -325,6 +326,7 @@ struct ubi_device {
325 int vol_count; 326 int vol_count;
326 struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT]; 327 struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT];
327 spinlock_t volumes_lock; 328 spinlock_t volumes_lock;
329 int ref_count;
328 330
329 int rsvd_pebs; 331 int rsvd_pebs;
330 int avail_pebs; 332 int avail_pebs;
@@ -401,7 +403,6 @@ extern struct kmem_cache *ubi_wl_entry_slab;
401extern struct file_operations ubi_ctrl_cdev_operations; 403extern struct file_operations ubi_ctrl_cdev_operations;
402extern struct file_operations ubi_cdev_operations; 404extern struct file_operations ubi_cdev_operations;
403extern struct file_operations ubi_vol_cdev_operations; 405extern struct file_operations ubi_vol_cdev_operations;
404extern struct ubi_device *ubi_devices[];
405extern struct class *ubi_class; 406extern struct class *ubi_class;
406 407
407/* vtbl.c */ 408/* vtbl.c */
@@ -479,6 +480,12 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
479int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum, 480int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum,
480 struct ubi_vid_hdr *vid_hdr); 481 struct ubi_vid_hdr *vid_hdr);
481 482
483/* build.c */
484struct ubi_device *ubi_get_device(int ubi_num);
485void ubi_put_device(struct ubi_device *ubi);
486struct ubi_device *ubi_get_by_major(int major);
487int ubi_major2num(int major);
488
482/* 489/*
483 * ubi_rb_for_each_entry - walk an RB-tree. 490 * ubi_rb_for_each_entry - walk an RB-tree.
484 * @rb: a pointer to type 'struct rb_node' to to use as a loop counter 491 * @rb: a pointer to type 'struct rb_node' to to use as a loop counter