--- /dev/null
+From: Brian Behlendorf <behlendorf1@llnl.gov>
+Subject: [PATCH] gcc cast
+
+Gcc -Wall warn: 'lacks a cast'
+Gcc -Wall warn: 'comparison between pointer and integer'
+
+Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
(void) printf("%*s%s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n",
indent, "",
prefix,
- indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12),
+ (int)(indent+strlen(prefix)-25-(vs->vs_space ? 0 : 12)),
desc,
vs->vs_space ? 6 : 0, vs->vs_space ? used : "",
vs->vs_space ? 6 : 0, vs->vs_space ? avail : "",
if (sets_nvp)
nvlist_free(sets_nvp);
(void) snprintf(errbuf, sizeof (errbuf),
- dgettext(TEXT_DOMAIN, "Who string is NULL"),
+ dgettext(TEXT_DOMAIN, "Who string is NULL: %s"),
whostr);
return (zfs_error(zhp->zfs_hdl, EZFS_BADWHO, errbuf));
}
localtime_r(&time, &t) == NULL ||
strftime(propbuf, proplen, "%a %b %e %k:%M %Y",
&t) == 0)
- (void) snprintf(propbuf, proplen, "%llu", val);
+ (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t) val);
}
break;
vs->vs_aux), len);
break;
default:
- (void) snprintf(buf, len, "%llu", intval);
+ (void) snprintf(buf, len, "%llu", (u_longlong_t)intval);
}
break;
libzfs_handle_t *hdl = zhp->zpool_hdl;
(void) snprintf(msg, sizeof (msg),
- dgettext(TEXT_DOMAIN, "cannot fault %llu"), guid);
+ dgettext(TEXT_DOMAIN, "cannot fault %llu"), (u_longlong_t)guid);
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
zc.zc_guid = guid;
libzfs_handle_t *hdl = zhp->zpool_hdl;
(void) snprintf(msg, sizeof (msg),
- dgettext(TEXT_DOMAIN, "cannot degrade %llu"), guid);
+ dgettext(TEXT_DOMAIN, "cannot degrade %llu"), (u_longlong_t)guid);
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
zc.zc_guid = guid;
(void) snprintf(msg, sizeof (msg),
dgettext(TEXT_DOMAIN, "cannot clear errors for %llx"),
- guid);
+ (u_longlong_t)guid);
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
zc.zc_guid = guid;
if (dsobj == 0) {
/* special case for the MOS */
- (void) snprintf(pathname, len, "<metadata>:<0x%llx>", obj);
+ (void) snprintf(pathname, len, "<metadata>:<0x%llx>", (longlong_t)obj);
return;
}
ZFS_IOC_DSOBJ_TO_DSNAME, &zc) != 0) {
/* just write out a path of two object numbers */
(void) snprintf(pathname, len, "<0x%llx>:<0x%llx>",
- dsobj, obj);
+ (longlong_t)dsobj, (longlong_t)obj);
return;
}
(void) strlcpy(dsname, zc.zc_value, sizeof (dsname));
dsname, zc.zc_value);
}
} else {
- (void) snprintf(pathname, len, "%s:<0x%llx>", dsname, obj);
+ (void) snprintf(pathname, len, "%s:<0x%llx>", dsname, (longlong_t)obj);
}
free(mntpnt);
}
(void) strncpy(newname, name, baselen);
(void) snprintf(newname+baselen, ZFS_MAXNAMELEN-baselen,
- "recv-%u-%u", getpid(), seq);
+ "recv-%ld-%u", (long) getpid(), seq);
(void) strlcpy(zc.zc_value, newname, sizeof (zc.zc_value));
if (flags.verbose) {
(void) printf("found clone origin %s\n", zc.zc_string);
}
- stream_wantsnewfs = (drrb->drr_fromguid == NULL ||
+ stream_wantsnewfs = (drrb->drr_fromguid == 0 ||
(drrb->drr_flags & DRR_FLAG_CLONE));
if (stream_wantsnewfs) {
u = " KMGTPE"[index];
if (index == 0) {
- (void) snprintf(buf, buflen, "%llu", n);
+ (void) snprintf(buf, buflen, "%llu", (u_longlong_t) n);
} else if ((num & ((1ULL << 10 * index) - 1)) == 0) {
/*
* If this is an even multiple of the base, always display
* without any decimal precision.
*/
- (void) snprintf(buf, buflen, "%llu%c", n, u);
+ (void) snprintf(buf, buflen, "%llu%c", (u_longlong_t) n, u);
} else {
/*
* We want to choose a precision that reflects the best choice
len = 2048;
zc->zc_nvlist_dst_size = len;
if ((zc->zc_nvlist_dst = (uint64_t)(uintptr_t)
- zfs_alloc(hdl, zc->zc_nvlist_dst_size)) == NULL)
+ zfs_alloc(hdl, zc->zc_nvlist_dst_size)) == 0)
return (-1);
return (0);
{
free((void *)(uintptr_t)zc->zc_nvlist_dst);
if ((zc->zc_nvlist_dst = (uint64_t)(uintptr_t)
- zfs_alloc(hdl, zc->zc_nvlist_dst_size))
- == NULL)
+ zfs_alloc(hdl, zc->zc_nvlist_dst_size)) == 0)
return (-1);
return (0);
ASSERT3U(ZAP_LEAF_HASH_NUMENTRIES(l), >, ZAP_LEAF_NUMCHUNKS(l) / 3);
/* The chunks should begin at the end of the hash table */
- ASSERT3P(&ZAP_LEAF_CHUNK(l, 0), ==,
+ ASSERT3P(&ZAP_LEAF_CHUNK(l, 0), ==, (zap_leaf_chunk_t *)
&l->l_phys->l_hash[ZAP_LEAF_HASH_NUMENTRIES(l)]);
/* The chunks should end at the end of the block */
{
char *buf;
- if (zc->zc_history == NULL)
+ if (zc->zc_history == 0)
return (NULL);
buf = kmem_alloc(HIS_MAX_RECORD_LEN, KM_SLEEP);
* which we aren't supposed to do with a DS_MODE_USER
* hold, because it could be inconsistent.
*/
- if (zc->zc_nvlist_dst != NULL &&
+ if (zc->zc_nvlist_dst != 0 &&
!zc->zc_objset_stats.dds_inconsistent &&
dmu_objset_type(os) == DMU_OST_ZFS) {
nvlist_t *nv;
error = spa_prop_get(spa, &nvp);
- if (error == 0 && zc->zc_nvlist_dst != NULL)
+ if (error == 0 && zc->zc_nvlist_dst != 0)
error = put_nvlist(zc, nvp);
else
error = EFAULT;
strchr(zc->zc_name, '%'))
return (EINVAL);
- if (zc->zc_nvlist_src != NULL &&
+ if (zc->zc_nvlist_src != 0 &&
(error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size,
&nvprops)) != 0)
return (error);
*tosnap = '\0';
tosnap++;
- if (zc->zc_nvlist_src != NULL &&
+ if (zc->zc_nvlist_src != 0 &&
(error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size,
&props)) != 0)
return (error);
/* can't upgrade */
(void) printf(gettext("%s: can not be upgraded; "
"the pool version needs to first be upgraded\nto "
- "version %d\n\n"),
+ "version %llu\n\n"),
zfs_get_name(zhp), SPA_VERSION_FUID);
cb->cb_numfailed++;
return (0);
if (version < cb->cb_version) {
char verstr[16];
(void) snprintf(verstr, sizeof (verstr),
- "%llu", cb->cb_version);
+ "%llu", (u_longlong_t)cb->cb_version);
if (cb->cb_lastfs[0] && !same_pool(zhp, cb->cb_lastfs)) {
/*
* If they did "zfs upgrade -a", then we could
ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_FILESYSTEM,
NULL, NULL, upgrade_set_callback, &cb);
(void) printf(gettext("%llu filesystems upgraded\n"),
- cb.cb_numupgraded);
+ (u_longlong_t)cb.cb_numupgraded);
if (cb.cb_numsamegraded) {
(void) printf(gettext("%llu filesystems already at "
"this version\n"),
- cb.cb_numsamegraded);
+ (u_longlong_t)cb.cb_numsamegraded);
}
if (cb.cb_numfailed != 0)
ret = 1;
if (pl->pl_next == NULL && !right_justify)
(void) printf("%s", header);
else if (right_justify)
- (void) printf("%*s", pl->pl_width, header);
+ (void) printf("%*s", (int)pl->pl_width, header);
else
- (void) printf("%-*s", pl->pl_width, header);
+ (void) printf("%-*s", (int)pl->pl_width, header);
}
(void) printf("\n");
if (pl->pl_next == NULL && !right_justify)
(void) printf("%s", header);
else if (right_justify)
- (void) printf("%*s", pl->pl_width, header);
+ (void) printf("%*s", (int)pl->pl_width, header);
else
- (void) printf("%-*s", pl->pl_width, header);
+ (void) printf("%-*s", (int)pl->pl_width, header);
}
(void) printf("\n");
if (cur_version > cbp->cb_version) {
(void) printf(gettext("Pool '%s' is already formatted "
"using more current version '%llu'.\n"),
- zpool_get_name(zhp), cur_version);
+ zpool_get_name(zhp), (u_longlong_t) cur_version);
return (0);
}
if (cur_version == cbp->cb_version) {
continue;
(void) snprintf(internalstr,
sizeof (internalstr),
- "[internal %s txg:%lld] %s",
- hist_event_table[ievent], txg,
+ "[internal %s txg:%llu] %s",
+ hist_event_table[ievent], (u_longlong_t)txg,
pathstr);
cmdstr = internalstr;
}