From: Shin'ichiro Kawasaki Date: Thu, 1 Oct 2020 10:15:29 +0000 (+0900) Subject: common/rc: Add _test_dev_max_active_zones() helper function X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e6981bb2d9ceb06b2f310e149346d638ffd62681;p=users%2Fhch%2Fblktests.git common/rc: Add _test_dev_max_active_zones() helper function Linux kernel 5.9 introduced a new sysfs attribute "max_active_zones". It is an attribute of zoned block devices which indicates the limit of zones in open or close status. To refer the attribute from test cases, introduce the helper function _test_dev_max_active_zones(). If the attribute is available, the function returns the attribute value. Otherwise, returns 0 to indicate that the device does not have the limit. Reviewed-by: Johannes Thumshirn Signed-off-by: Shin'ichiro Kawasaki --- diff --git a/common/rc b/common/rc index cdc0150..0589431 100644 --- a/common/rc +++ b/common/rc @@ -272,6 +272,14 @@ _test_dev_is_partition() { [[ -n ${TEST_DEV_PART_SYSFS} ]] } +_test_dev_max_active_zones() { + if [[ -r "${TEST_DEV_SYSFS}/queue/max_active_zones" ]]; then + _test_dev_queue_get max_active_zones + else + echo 0 + fi +} + _require_test_dev_is_partition() { if ! _test_dev_is_partition; then SKIP_REASON="${TEST_DEV} is not a partition device"