Fix gcc cast warnings

Gcc -Wall warn: 'lacks a cast'
Gcc -Wall warn: 'comparison between pointer and integer'

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf
2010-08-26 09:52:39 -07:00
parent d6320ddb78
commit b8864a233c
16 changed files with 90 additions and 77 deletions
+2 -2
View File
@@ -874,8 +874,8 @@ dump_history(spa_t *spa)
(void) snprintf(internalstr,
sizeof (internalstr),
"[internal %s txg:%lld] %s",
zfs_history_event_names[ievent], txg,
intstr);
zfs_history_event_names[ievent],
(longlong_t)txg, intstr);
cmd = internalstr;
}
tsec = time;
+8 -8
View File
@@ -1682,7 +1682,7 @@ upgrade_set_callback(zfs_handle_t *zhp, void *data)
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
@@ -1720,7 +1720,7 @@ zfs_do_upgrade(int argc, char **argv)
boolean_t showversions = B_FALSE;
int ret;
upgrade_cbdata_t cb = { 0 };
char c;
signed char c;
int flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
/* check options */
@@ -1789,11 +1789,11 @@ zfs_do_upgrade(int argc, char **argv)
ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_FILESYSTEM,
NULL, NULL, 0, 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;
@@ -1957,9 +1957,9 @@ print_header(zprop_list_t *pl)
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");
@@ -2550,7 +2550,7 @@ zfs_do_set(int argc, char **argv)
usage(B_FALSE);
}
ret = zfs_for_each(argc - 2, argv + 2, NULL,
ret = zfs_for_each(argc - 2, argv + 2, 0,
ZFS_TYPE_DATASET, NULL, NULL, 0, set_callback, &cb);
return (ret);
@@ -2567,7 +2567,7 @@ zfs_do_snapshot(int argc, char **argv)
{
boolean_t recursive = B_FALSE;
int ret;
char c;
signed char c;
nvlist_t *props;
if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0)
+5 -5
View File
@@ -2438,9 +2438,9 @@ print_header(zprop_list_t *pl)
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");
@@ -3906,7 +3906,7 @@ upgrade_one(zpool_handle_t *zhp, void *data)
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) {
@@ -4147,8 +4147,8 @@ get_history_one(zpool_handle_t *zhp, void *data)
continue;
(void) snprintf(internalstr,
sizeof (internalstr),
"[internal %s txg:%lld] %s",
zfs_history_event_names[ievent], txg,
"[internal %s txg:%llu] %s",
zfs_history_event_names[ievent], (u_longlong_t)txg,
pathstr);
cmdstr = internalstr;
}
+22 -12
View File
@@ -2022,7 +2022,7 @@ ztest_od_init(ztest_od_t *od, uint64_t id, char *tag, uint64_t index,
od->od_gen = 0;
(void) snprintf(od->od_name, sizeof (od->od_name), "%s(%lld)[%llu]",
tag, (int64_t)id, index);
tag, (longlong_t)id, (u_longlong_t)index);
}
/*
@@ -3042,11 +3042,16 @@ ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
char snap3name[MAXNAMELEN];
int error;
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id);
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id);
(void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id);
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu",
osname, (u_longlong_t)id);
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu",
osname, (u_longlong_t)id);
(void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu",
clone1name, (u_longlong_t)id);
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu",
osname, (u_longlong_t)id);
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu",
clone1name, (u_longlong_t)id);
error = dmu_objset_destroy(clone2name, B_FALSE);
if (error && error != ENOENT)
@@ -3086,11 +3091,16 @@ ztest_dsl_dataset_promote_busy(ztest_ds_t *zd, uint64_t id)
ztest_dsl_dataset_cleanup(osname, id);
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu", osname, id);
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu", osname, id);
(void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu", clone1name, id);
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu", osname, id);
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu", clone1name, id);
(void) snprintf(snap1name, MAXNAMELEN, "%s@s1_%llu",
osname, (u_longlong_t)id);
(void) snprintf(clone1name, MAXNAMELEN, "%s/c1_%llu",
osname, (u_longlong_t)id);
(void) snprintf(snap2name, MAXNAMELEN, "%s@s2_%llu",
clone1name, (u_longlong_t)id);
(void) snprintf(clone2name, MAXNAMELEN, "%s/c2_%llu",
osname, (u_longlong_t)id);
(void) snprintf(snap3name, MAXNAMELEN, "%s@s3_%llu",
clone1name, (u_longlong_t)id);
error = dmu_objset_snapshot(osname, strchr(snap1name, '@')+1,
NULL, NULL, B_FALSE, B_FALSE, -1);
@@ -3912,7 +3922,7 @@ ztest_fzap(ztest_ds_t *zd, uint64_t id)
int error;
(void) snprintf(name, sizeof (name), "fzap-%llu-%llu",
id, value);
(u_longlong_t)id, (u_longlong_t)value);
tx = dmu_tx_create(os);
dmu_tx_hold_zap(tx, object, B_TRUE, name);