common/rc: introduce zone check commands
authorNaohiro Aota <naohiro.aota@wdc.com>
Thu, 29 Apr 2021 12:39:26 +0000 (21:39 +0900)
committerEryu Guan <guaneryu@gmail.com>
Sun, 9 May 2021 14:56:40 +0000 (22:56 +0800)
commita6dbebcb19e96049d1e8efaa98b8817bafaad730
treec5497bdb8f91f090d17210ea08af3214d8e6fb83
parente3a972a7524768903d321784ad1a63e621a62a75
common/rc: introduce zone check commands

Introduce some zone related helper functions: _zone_type(),
_require_zoned_device(), and _require_non_zoned_device(). They all
take a device path as an argument.

_zone_type() return the zone type of the device according to the
value returned from "/sys/block/<disk>/queue/zoned". See
Documentation/ABI/testing/sysfs-block for a detail.

_require_zoned_device() checks if the device is zoned. If not, it
skips the current test. _require_non_zoned_device() does the
opposite.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc