From 766fb95ba06e1bbf531d30dc05e21b2d4a0e8dd2 Mon Sep 17 00:00:00 2001 From: Sidney Amani Date: Tue, 27 Jan 2009 10:11:46 +0100 Subject: UBI: allow direct user-space I/O Introduce a new ioctl UBI_IOCSETPROP to set properties on a volume. Also add the first property: UBI_PROP_DIRECT_WRITE, this property is used to set the ability to use direct writes in userspace Signed-off-by: Sidney Amani Signed-off-by: Corentin Chary Signed-off-by: Artem Bityutskiy --- include/mtd/ubi-user.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'include') diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h index 82113e160a2c..296efae3525e 100644 --- a/include/mtd/ubi-user.h +++ b/include/mtd/ubi-user.h @@ -124,6 +124,14 @@ * To check if a logical eraseblock is mapped to a physical eraseblock, the * %UBI_IOCEBISMAP ioctl command should be used. It returns %0 if the LEB is * not mapped, and %1 if it is mapped. + * + * Set an UBI volume property + * ~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be + * used. A pointer to a &struct ubi_set_prop_req object is expected to be + * passed. The object describes which property should be set, and to which value + * it should be set. */ /* @@ -175,6 +183,8 @@ #define UBI_IOCEBUNMAP _IOW(UBI_VOL_IOC_MAGIC, 4, int32_t) /* Check if LEB is mapped command */ #define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, int32_t) +/* Set an UBI volume property */ +#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req) /* Maximum MTD device name length supported by UBI */ #define MAX_UBI_MTD_NAME_LEN 127 @@ -210,6 +220,16 @@ enum { UBI_STATIC_VOLUME = 4, }; +/* + * UBI set property ioctl constants + * + * @UBI_PROP_DIRECT_WRITE: allow / disallow user to directly write and + * erase individual eraseblocks on dynamic volumes + */ +enum { + UBI_PROP_DIRECT_WRITE = 1, +}; + /** * struct ubi_attach_req - attach MTD device request. * @ubi_num: UBI device number to create @@ -373,4 +393,18 @@ struct ubi_map_req { int8_t padding[3]; } __attribute__ ((packed)); + +/** + * struct ubi_set_prop_req - a data structure used to set an ubi volume + * property. + * @property: property to set (%UBI_PROP_DIRECT_WRITE) + * @padding: reserved for future, not used, has to be zeroed + * @value: value to set + */ +struct ubi_set_prop_req { + uint8_t property; + uint8_t padding[7]; + uint64_t value; +} __attribute__ ((packed)); + #endif /* __UBI_USER_H__ */ -- cgit v1.2.3-59-g8ed1b