diff options
author | Richard Weinberger <richard@nod.at> | 2014-11-24 22:30:09 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-01-28 15:57:04 +0100 |
commit | fafdd2bf2638157670f28462b641150d16dbaeca (patch) | |
tree | 717b6e07e8018eec9e6ac3e5ead6dedffbf4799c /drivers/mtd/ubi/cdev.c | |
parent | 346be9bc802ddbaf7ce2ad35145d1ddfba376594 (diff) |
UBI: Implement UBI_METAONLY
UBI_METAONLY is a new open mode for UBI volumes, it indicates
that only meta data is being changed.
Meta data in terms of UBI volumes means data which is stored in the
UBI volume table but not on the volume itself.
While it does not interfere with UBI_READONLY and UBI_READWRITE
it is not allowed to use UBI_METAONLY together with UBI_EXCLUSIVE.
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: Andrew Murray <amurray@embedded-bits.co.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
Tested-by: Guido MartÃnez <guido@vanguardiasur.com.ar>
Reviewed-by: Guido MartÃnez <guido@vanguardiasur.com.ar>
Tested-by: Christoph Fritz <chf.fritz@googlemail.com>
Tested-by: Andrew Murray <amurray@embedded-bits.co.uk>
Diffstat (limited to 'drivers/mtd/ubi/cdev.c')
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 3410ea8109f8..f5c715c32dcd 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -61,13 +61,13 @@ static int get_exclusive(struct ubi_device *ubi, struct ubi_volume_desc *desc) struct ubi_volume *vol = desc->vol; spin_lock(&vol->ubi->volumes_lock); - users = vol->readers + vol->writers + vol->exclusive; + users = vol->readers + vol->writers + vol->exclusive + vol->metaonly; ubi_assert(users > 0); if (users > 1) { ubi_err(ubi, "%d users for volume %d", users, vol->vol_id); err = -EBUSY; } else { - vol->readers = vol->writers = 0; + vol->readers = vol->writers = vol->metaonly = 0; vol->exclusive = 1; err = desc->mode; desc->mode = UBI_EXCLUSIVE; @@ -87,13 +87,15 @@ static void revoke_exclusive(struct ubi_volume_desc *desc, int mode) struct ubi_volume *vol = desc->vol; spin_lock(&vol->ubi->volumes_lock); - ubi_assert(vol->readers == 0 && vol->writers == 0); + ubi_assert(vol->readers == 0 && vol->writers == 0 && vol->metaonly == 0); ubi_assert(vol->exclusive == 1 && desc->mode == UBI_EXCLUSIVE); vol->exclusive = 0; if (mode == UBI_READONLY) vol->readers = 1; else if (mode == UBI_READWRITE) vol->writers = 1; + else if (mode == UBI_METAONLY) + vol->metaonly = 1; else vol->exclusive = 1; spin_unlock(&vol->ubi->volumes_lock); |