Skip to contentSkip to conversation

uapi: linux/blkzoned.h: fix BLKGETZONESZ and BLKGETNRZONES definitions

PATCH Applied Dmitry V. Levin 3 participants 3 messages Dec 16, 2018 – Dec 17, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uapi: linux/blkzoned.h: fix BLKGETZONESZ and BLKGETNRZONES definitions

According to the documentation in include/uapi/asm-generic/ioctl.h, _IOW means userspace is writing and kernel is reading, and _IOR means userspace is reading and kernel is writing.

In case of these two ioctls, kernel is writing and userspace is reading, so they have to be _IOR instead of _IOW.

Fixes 72cd87576d1d8 ("block: Introduce BLKGETZONESZ ioctl")
Fixes 65e4e3eee83d7 ("block: Introduce BLKGETNRZONES ioctl")

---

Since both ioctls were introduced after 4.19,
please make sure they are fixed in 4.20.
Thanks.

 include/uapi/linux/blkzoned.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/blkzoned.h +2 -2
index 8f08ff9bdea0..6fa38d001d84 100644
@@ -141,7 +141,7 @@ struct blk_zone_range {
  */
 #define BLKREPORTZONE	_IOWR(0x12, 130, struct blk_zone_report)
 #define BLKRESETZONE	_IOW(0x12, 131, struct blk_zone_range)
-#define BLKGETZONESZ	_IOW(0x12, 132, __u32)
-#define BLKGETNRZONES	_IOW(0x12, 133, __u32)
+#define BLKGETZONESZ	_IOR(0x12, 132, __u32)
+#define BLKGETNRZONES	_IOR(0x12, 133, __u32)
 
 #endif /* _UAPI_BLKZONED_H */
Signature · 1 line
ldv
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Dmitry V. Levin

According to the documentation in include/uapi/asm-generic/ioctl.h, _IOW means userspace is writing and kernel is reading, and _IOR means userspace is reading and kernel is writing.

In case of these two ioctls, kernel is writing and userspace is reading, so they have to be _IOR instead of _IOW.

Fixes 72cd87576d1d8 ("block: Introduce BLKGETZONESZ ioctl")
Fixes 65e4e3eee83d7 ("block: Introduce BLKGETNRZONES ioctl")

---

Since both ioctls were introduced after 4.19,
please make sure they are fixed in 4.20.
Thanks.

 include/uapi/linux/blkzoned.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/blkzoned.h +0 -0
index 8f08ff9bdea0..6fa38d001d84 100644

include/uapi/linux/blkzoned.h struct blk_zone_range { · line 147

Quoted 9 lines
include/uapi/linux/blkzoned.h +2 -2
@@ -141,7 +141,7 @@ struct blk_zone_range {
  */
 #define BLKREPORTZONE	_IOWR(0x12, 130, struct blk_zone_report)
 #define BLKRESETZONE	_IOW(0x12, 131, struct blk_zone_range)
-#define BLKGETZONESZ	_IOW(0x12, 132, __u32)
-#define BLKGETNRZONES	_IOW(0x12, 133, __u32)
+#define BLKGETZONESZ	_IOR(0x12, 132, __u32)
+#define BLKGETNRZONES	_IOR(0x12, 133, __u32)
 
 #endif /* _UAPI_BLKZONED_H */

Indeed, my bad.

Signature · 2 lines
Damien Le Moal
Western Digital Research
maintainer Applied
#2 lore raw
In reply to Dmitry V. Levin
Quoted 6 lines · Dmitry V. Levin

According to the documentation in include/uapi/asm-generic/ioctl.h, _IOW means userspace is writing and kernel is reading, and _IOR means userspace is reading and kernel is writing.

In case of these two ioctls, kernel is writing and userspace is reading, so they have to be _IOR instead of _IOW.

Applied, thanks.

Signature · 1 line
Jens Axboe