Patchwork UBI: Make UBI_IOCVOLCRBLK take a parameter for future usage

login
register
mail settings
Submitter Ezequiel Garcia
Date March 5, 2014, 2:16 p.m.
Message ID <1394028974-27570-1-git-send-email-ezequiel.garcia@free-electrons.com>
Download mbox | patch
Permalink /patch/326787/
State Accepted
Headers show

Comments

Ezequiel Garcia - March 5, 2014, 2:16 p.m.
In order to allow a future ioctl parameter, such as a creation flag,
we change the UBI_IOCVOLCRBLK so it accepts a struct ubi_blkcreate_req.
For the time being the structure is not in use, but fully reserved.

This ABI change is still possible and harmless, because the ioctl has just
been introduced and there's no userspace program which uses it.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 include/uapi/mtd/ubi-user.h | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
Artem Bityutskiy - March 6, 2014, 10:10 a.m.
On Wed, 2014-03-05 at 11:16 -0300, Ezequiel Garcia wrote:
> In order to allow a future ioctl parameter, such as a creation flag,
> we change the UBI_IOCVOLCRBLK so it accepts a struct ubi_blkcreate_req.
> For the time being the structure is not in use, but fully reserved.
> 
> This ABI change is still possible and harmless, because the ioctl has just
> been introduced and there's no userspace program which uses it.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Pushed to linux-ubifs.git, thank you!
Ezequiel Garcia - March 14, 2014, 1:51 p.m.
On Mar 06, Artem Bityutskiy wrote:
> On Wed, 2014-03-05 at 11:16 -0300, Ezequiel Garcia wrote:
> > In order to allow a future ioctl parameter, such as a creation flag,
> > we change the UBI_IOCVOLCRBLK so it accepts a struct ubi_blkcreate_req.
> > For the time being the structure is not in use, but fully reserved.
> > 
> > This ABI change is still possible and harmless, because the ioctl has just
> > been introduced and there's no userspace program which uses it.
> > 
> > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> 
> Pushed to linux-ubifs.git, thank you!
> 

Artem: Would you mind pushing this to the linux-next branch as well?
It's an important ABI change, so I'd rather see it on v3.15.

(you plan to push all this for v3.15, right?)

FWIW, I'm preparing the userspace tool now.
Artem Bityutskiy - March 14, 2014, 2:20 p.m.
On Fri, 2014-03-14 at 10:51 -0300, Ezequiel Garcia wrote:
> Artem: Would you mind pushing this to the linux-next branch as well?
> It's an important ABI change, so I'd rather see it on v3.15.

Done.

> (you plan to push all this for v3.15, right?)

Yes.

Thanks!

Patch

diff --git a/include/uapi/mtd/ubi-user.h b/include/uapi/mtd/ubi-user.h
index 9c885e2..1927b0d 100644
--- a/include/uapi/mtd/ubi-user.h
+++ b/include/uapi/mtd/ubi-user.h
@@ -138,9 +138,12 @@ 
  * Block devices on UBI volumes
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
- * To create or remove a R/O block device on top of an UBI volume the
- * %UBI_IOCVOLCRBLK and %UBI_IOCVOLRMBLK ioctl commands should be used,
- * respectively. These commands take no arguments.
+ * To create a R/O block device on top of an UBI volume the %UBI_IOCVOLCRBLK
+ * should be used. A pointer to a &struct ubi_blkcreate_req object is expected
+ * to be passed, which is not used and reserved for future usage.
+ *
+ * Conversely, to remove a block device the %UBI_IOCVOLRMBLK should be used,
+ * which takes no arguments.
  */
 
 /*
@@ -199,7 +202,7 @@ 
 #define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \
 			       struct ubi_set_vol_prop_req)
 /* Create a R/O block device on top of an UBI volume */
-#define UBI_IOCVOLCRBLK _IO(UBI_VOL_IOC_MAGIC, 7)
+#define UBI_IOCVOLCRBLK _IOW(UBI_VOL_IOC_MAGIC, 7, struct ubi_blkcreate_req)
 /* Remove the R/O block device */
 #define UBI_IOCVOLRMBLK _IO(UBI_VOL_IOC_MAGIC, 8)
 
@@ -431,4 +434,12 @@  struct ubi_set_vol_prop_req {
 	__u64 value;
 }  __packed;
 
+/**
+ * struct ubi_blkcreate_req - a data structure used in block creation requests.
+ * @padding: reserved for future, not used, has to be zeroed
+ */
+struct ubi_blkcreate_req {
+	__s8  padding[128];
+}  __packed;
+
 #endif /* __UBI_USER_H__ */