Add blkzonecmd and blkreport ZAC/ZBC drives
Subsystems (2)
PATCH 1/1 Add blkzonecmd and blkreport ZAC/ZBC drives
This patch adds:
- blkreset to issue Reset (Write Pointer) zone commands
- blkreport to retrieve drive zone information
--- .gitignore | 2 + configure.ac | 14 ++ include/strutils.h | 1 + lib/strutils.c | 8 +- sys-utils/Makemodule.am | 17 ++ sys-utils/blkreport.8 | 69 +++++++ sys-utils/blkreport.c | 470 ++++++++++++++++++++++++++++++++++++++++++++++++ sys-utils/blkreset.8 | 63 +++++++ sys-utils/blkreset.c | 295 ++++++++++++++++++++++++++++++ 9 files changed, 937 insertions(+), 2 deletions(-) create mode 100644 sys-utils/blkreport.8 create mode 100644 sys-utils/blkreport.c create mode 100644 sys-utils/blkreset.8 create mode 100644 sys-utils/blkreset.c
.gitignore +2 -0
@@ -62,6 +62,8 @@ update.log /addpart /agetty /blkdiscard +/blkreport +/blkreset /blkid /blockdev /cal
configure.ac +14 -0
@@ -275,6 +275,12 @@ AC_CHECK_HEADERS([security/pam_misc.h], #endif ]) +AC_CHECK_HEADERS([linux/blkzoned.h], [], [], [ +#ifdef HAVE_BLKZONED_H +#include <linux/blkzoned.h> +#endif +]) + AC_CHECK_HEADERS([security/openpam.h], [], [], [ #ifdef HAVE_SECURITY_PAM_APPL_H #include <security/pam_appl.h>
@@ -1533,6 +1539,14 @@ UL_BUILD_INIT([blkdiscard], [check]) UL_REQUIRES_LINUX([blkdiscard]) AM_CONDITIONAL([BUILD_BLKDISCARD], [test "x$build_blkdiscard" = xyes]) +UL_BUILD_INIT([blkreport], [check]) +UL_REQUIRES_LINUX([blkreport]) +AM_CONDITIONAL([BUILD_BLKREPORT], [test "x$build_blkreport" = xyes]) + +UL_BUILD_INIT([blkreset], [check]) +UL_REQUIRES_LINUX([blkreset]) +AM_CONDITIONAL([BUILD_BLKZONECMD], [test "x$build_blkreset" = xyes]) + UL_BUILD_INIT([ldattach], [check]) UL_REQUIRES_LINUX([ldattach]) AM_CONDITIONAL([BUILD_LDATTACH], [test "x$build_ldattach" = xyes])
include/strutils.h +1 -0
@@ -27,6 +27,7 @@ extern uint32_t strtou32_or_err(const char *str, const char *errmesg);extern int64_t strtos64_or_err (const char *str,const char *errmesg);extern uint64_t strtou64_or_err (const char *str,const char *errmesg); +extern uint64_t strtou64_base_or_err (int base,const char *str,const char *errmesg);extern double strtod_or_err (const char *str,const char *errmesg);
lib/strutils.c +6 -2
@@ -329,7 +329,7 @@ err:errx (STRTOXX_EXIT_CODE ,"%s: '%s'" , errmesg, str); } -uint64_t strtou64_or_err (const char *str,const char *errmesg) +uint64_t strtou64_base_or_err (int base,const char *str,const char *errmesg) {uintmax_t num;char *end =NULL ;
@@ -337,7 +337,7 @@ uint64_t strtou64_or_err(const char *str, const char *errmesg) errno =0 ;if (str ==NULL || *str =='\0' ) goto err; - num =strtoumax (str, &end,10 ); + num =strtoumax (str, &end, base);if (errno || str == end || (end && *end)) goto err;
@@ -350,6 +350,10 @@ err:errx (STRTOXX_EXIT_CODE ,"%s: '%s'" , errmesg, str); } +uint64_t strtou64_or_err (const char *str,const char *errmesg) +{ +return strtou64_base_or_err (10 , str, errmesg); +}double strtod_or_err (const char *str,const char *errmesg) {
sys-utils/Makemodule.am +17 -0
@@ -111,6 +111,23 @@ blkdiscard_SOURCES = sys-utils/blkdiscard.c lib/monotonic.c blkdiscard_LDADD = $(LDADD) libcommon.la $(REALTIME_LIBS) endif +if BUILD_BLKREPORT +sbin_PROGRAMS += blkreport +dist_man_MANS += sys-utils/blkreport.8 +blkreport_SOURCES = sys-utils/blkreport.c +blkreport_LDADD = $(LDADD) libcommon.la $(REALTIME_LIBS) +endif + +if BUILD_BLKZONECMD +sbin_PROGRAMS += blkreset +dist_man_MANS += sys-utils/blkreset.8 +blkreset_SOURCES = sys-utils/blkreset.c +blkreset_LDADD = $(LDADD) libcommon.la $(REALTIME_LIBS) +if HAVE_UDEV +blkreset_LDADD += -ludev +endif +endif + if BUILD_LDATTACH usrsbin_exec_PROGRAMS += ldattach dist_man_MANS += sys-utils/ldattach.8
sys-utils/blkreport.8 new file +69 -0
69 lines not on this page · raw message
sys-utils/blkreport.c new file +470 -0
470 lines not on this page · raw message
sys-utils/blkreset.8 new file +63 -0
63 lines not on this page · raw message
sys-utils/blkreset.c new file +295 -0
295 lines not on this page · raw message
Signature · 1 line
2.10.2
Quoted 6 lines · Shaun Tancheff
This patch adds:
- blkreset to issue Reset (Write Pointer) zone commands
- blkreport to retrieve drive zone informationSigned-off-by Shaun Tancheff <[email protected]>Signed-off-by Shaun Tancheff <[email protected]>
Is this patch perhaps intended for the util-linux project? According to the README file of that project util-linux patches should be sent to [email protected].
Additionally, shouldn't Damien Le Moal have been CC'ed for this patch?
configure.ac AC_CHECK_HEADERS([security/pam_misc.h], · line 282
Quoted 13 lines
configure.ac +5
-0@@ -275,6 +275,12 @@ AC_CHECK_HEADERS([security/pam_misc.h], #endif ]) +AC_CHECK_HEADERS([linux/blkzoned.h], [], [], [ +#ifdef HAVE_BLKZONED_H +#include <linux/blkzoned.h> +#endif +])
What code in configure.ac defines HAVE_BLKZONED_H? Would the following code have been sufficient: AC_CHECK_HEADER([linux/blkzoned.h]) ? See also https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Generic-Headers.html.
Bart.
Quoted 10 lines · Bart Van Assche
Quoted 7 lines · Shaun Tancheff
This patch adds:
- blkreset to issue Reset (Write Pointer) zone commands
- blkreport to retrieve drive zone informationSigned-off-by Shaun Tancheff <[email protected]>Signed-off-by Shaun Tancheff <[email protected]>
Quoted 5 lines
Is this patch perhaps intended for the util-linux project? According to the README file of that project util-linux patches should be sent to [email protected].
Additionally, shouldn't Damien Le Moal have been CC'ed for this patch?
Yes this was supposed to go to util-linux.
Will Cc Damien as well.
Quoted 8 lines
Quoted 8 lines
configure.ac +0
-0@@ -275,6 +275,12 @@ AC_CHECK_HEADERS([security/pam_misc.h], #endif ])
Quoted 10 lines
configure.ac AC_CHECK_HEADERS([security/pam_misc.h], · line 282
Quoted 5 lines
configure.ac +5
-0+AC_CHECK_HEADERS([linux/blkzoned.h], [], [], [ +#ifdef HAVE_BLKZONED_H +#include <linux/blkzoned.h> +#endif +])What code in configure.ac defines
HAVE_BLKZONED_H? Would the following code have been sufficient:AC_CHECK_HEADER([linux/blkzoned.h])? See also
https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Generic-Headers.html.
Thanks for the heads up, my use of check headers here wasn't doing what I thought.
I've fixed it and will post to util-linux.
Thanks!
--Shaun