]> git.proxmox.com Git - mirror_zfs.git/commit - cmd/zpool/zpool_main.c
Expose libzutil error info in libpc_handle_t
authorUmer Saleem <usaleem@ixsystems.com>
Mon, 26 Sep 2022 13:40:43 +0000 (18:40 +0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 4 Oct 2022 16:54:35 +0000 (09:54 -0700)
commitd9ac17a57f66bdbd482ab09ab238cb941821e13f
tree1261d407346f84a257ddc4932e8db72fe5b814f6
parentd62bafee9fc38f8b9653c531e1861e83dcba4618
Expose libzutil error info in libpc_handle_t

In libzutil, for zpool_search_import and zpool_find_config, we use
libpc_handle_t internally, which does not maintain error code and it is
not exposed in the interface. Due to this, the error information is not
propagated to the caller. Instead, an error message is printed on
stderr.

This commit adds lpc_error field in libpc_handle_t and exposes it in
the interface, which can be used by the users of libzutil to get the
appropriate error information and handle it accordingly.

Users of the API can also control if they want to print the error
message on stderr.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #13969
cmd/zdb/zdb.c
cmd/zhack.c
cmd/zpool/zpool_main.c
cmd/ztest.c
include/libzutil.h
lib/libzfs/libzfs.abi
lib/libzutil/zutil_import.c
lib/libzutil/zutil_import.h