Skip to contentSkip to conversation

block: make the new blkzoned UAPI constants discoverable

PATCH Applied Christoph Hellwig 4 participants 4 messages Jan 21 – Jan 22

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

PATCH 1/1 block: make the new blkzoned UAPI constants discoverable

The Linux 6.19 merge window added the new BLKREPORTZONESV2 ioctl, and with it the new BLK_ZONE_REP_CACHED and BLK_ZONE_COND_ACTIVE constants.

The two constants are defined as part of enums, which makes it very painful for userspace to discover if they are present in the installed system headers.

Use the #define to the same name trick to make them trivially discoverable using CPP directives.

Fixes 0bf0e2e46668 ("block: track zone conditions")
Fixes b30ffcdc0c15 ("block: introduce BLKREPORTZONESV2 ioctl")
---
 include/uapi/linux/blkzoned.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/uapi/linux/blkzoned.h +4 -2
index e33f02703350..663836120966 100644
@@ -81,7 +81,8 @@ enum blk_zone_cond {
 	BLK_ZONE_COND_FULL	= 0xE,
 	BLK_ZONE_COND_OFFLINE	= 0xF,
 
-	BLK_ZONE_COND_ACTIVE	= 0xFF,
+	BLK_ZONE_COND_ACTIVE	= 0xFF, /* added in Linux 6.19 */
+#define BLK_ZONE_COND_ACTIVE	BLK_ZONE_COND_ACTIVE
 };
 
 /**
@@ -100,7 +101,8 @@ enum blk_zone_report_flags {
 	BLK_ZONE_REP_CAPACITY	= (1U << 0),
 
 	/* Input flags */
-	BLK_ZONE_REP_CACHED	= (1U << 31),
+	BLK_ZONE_REP_CACHED	= (1U << 31), /* added in Linux 6.19 */
+#define BLK_ZONE_REP_CACHED	BLK_ZONE_REP_CACHED
 };
 
 /**
Signature · 1 line
2.47.3
maintainer Applied
#2 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig

The Linux 6.19 merge window added the new BLKREPORTZONESV2 ioctl, and with it the new BLK_ZONE_REP_CACHED and BLK_ZONE_COND_ACTIVE constants.

The two constants are defined as part of enums, which makes it very painful for userspace to discover if they are present in the installed system headers.

[...]

Applied, thanks!

[1/1] block: make the new blkzoned UAPI constants discoverable

      commit: f5f2bad67a45cd1ef6f5b727da104694a81b3666

Best regards,

Signature · 1 line
Jens Axboe
maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig

The Linux 6.19 merge window added the new BLKREPORTZONESV2 ioctl, and with it the new BLK_ZONE_REP_CACHED and BLK_ZONE_COND_ACTIVE constants.

The two constants are defined as part of enums, which makes it very painful for userspace to discover if they are present in the installed system headers.

Quoted 7 lines

Use the #define to the same name trick to make them trivially discoverable using CPP directives.

Fixes 0bf0e2e46668 ("block: track zone conditions")
Fixes b30ffcdc0c15 ("block: introduce BLKREPORTZONESV2 ioctl")
Signature · 2 lines
Damien Le Moal
Western Digital Research