Correct compilation errors reported by GCC 10/11

New `zfs_type_t` value `ZFS_TYPE_INVALID` is introduced.
Variable initialization is now possible to make GCC happy.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #12167
Closes #13103
This commit is contained in:
Damian Szuberski
2022-02-21 04:20:00 +01:00
committed by GitHub
parent e41013078a
commit 806739f991
8 changed files with 26 additions and 25 deletions
+2 -5
View File
@@ -3972,13 +3972,10 @@ zfs_clone(zfs_handle_t *zhp, const char *target, nvlist_t *props)
/* do the clone */
if (props) {
zfs_type_t type;
zfs_type_t type = ZFS_TYPE_FILESYSTEM;
if (ZFS_IS_VOLUME(zhp)) {
if (ZFS_IS_VOLUME(zhp))
type = ZFS_TYPE_VOLUME;
} else {
type = ZFS_TYPE_FILESYSTEM;
}
if ((props = zfs_valid_proplist(hdl, type, props, zoned,
zhp, zhp->zpool_hdl, B_TRUE, errbuf)) == NULL)
return (-1);
+4 -3
View File
@@ -807,8 +807,9 @@ dump_ioctl(zfs_handle_t *zhp, const char *fromsnap, uint64_t fromsnap_obj,
char errbuf[1024];
int error = errno;
(void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN,
"warning: cannot send '%s'"), zhp->zfs_name);
(void) snprintf(errbuf, sizeof (errbuf), "%s '%s'",
dgettext(TEXT_DOMAIN, "warning: cannot send"),
zhp->zfs_name);
if (debugnv != NULL) {
fnvlist_add_uint64(thisdbg, "error", error);
@@ -4196,7 +4197,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
nvlist_t *rcvprops = NULL; /* props received from the send stream */
nvlist_t *oxprops = NULL; /* override (-o) and exclude (-x) props */
nvlist_t *origprops = NULL; /* original props (if destination exists) */
zfs_type_t type;
zfs_type_t type = ZFS_TYPE_INVALID;
boolean_t toplevel = B_FALSE;
boolean_t zoned = B_FALSE;
boolean_t hastoken = B_FALSE;
+7 -4
View File
@@ -199,7 +199,7 @@ execvpe(const char *name, char * const argv[], char * const envp[])
return (execvPe(name, path, argv, envp));
}
#define ERRBUFLEN 256
#define ERRBUFLEN 1024
static __thread char errbuf[ERRBUFLEN];
@@ -207,10 +207,10 @@ const char *
libzfs_error_init(int error)
{
char *msg = errbuf;
size_t len, msglen = ERRBUFLEN;
size_t msglen = sizeof (errbuf);
if (modfind("zfs") < 0) {
len = snprintf(msg, msglen, dgettext(TEXT_DOMAIN,
size_t len = snprintf(msg, msglen, dgettext(TEXT_DOMAIN,
"Failed to load %s module: "), ZFS_KMOD);
msg += len;
msglen -= len;
@@ -285,7 +285,6 @@ zfs_jail(zfs_handle_t *zhp, int jailid, int attach)
{
libzfs_handle_t *hdl = zhp->zfs_hdl;
zfs_cmd_t zc = {"\0"};
char errbuf[1024];
unsigned long cmd;
int ret;
@@ -314,6 +313,10 @@ zfs_jail(zfs_handle_t *zhp, int jailid, int attach)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"vdevs can not be jailed"));
return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
case ZFS_TYPE_INVALID:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"invalid zfs_type_t: ZFS_TYPE_INVALID"));
return (zfs_error(hdl, EZFS_BADTYPE, errbuf));
case ZFS_TYPE_POOL:
case ZFS_TYPE_FILESYSTEM:
/* OK */
+3
View File
@@ -754,6 +754,9 @@ no_dev:
return (ret);
#else
(void) path;
(void) ds;
(void) wholedisk;
return (ENOENT);
#endif
}