Skip to content

Commit

Permalink
Fix gcc missing parenthesis warnings
Browse files Browse the repository at this point in the history
Gcc -Wall warn: 'missing parenthesis'

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
  • Loading branch information
behlendorf committed Aug 31, 2010
1 parent e75c13c commit c65aa5b
Show file tree
Hide file tree
Showing 30 changed files with 87 additions and 85 deletions.
4 changes: 2 additions & 2 deletions cmd/zfs/zfs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ zfs_do_create(int argc, char **argv)
zfs_prop_t resv_prop;
char *strval;

if (p = strchr(argv[0], '/'))
if ((p = strchr(argv[0], '/')))
*p = '\0';
zpool_handle = zpool_open(g_zfs, argv[0]);
if (p != NULL)
Expand Down Expand Up @@ -4035,7 +4035,7 @@ zfs_do_diff(int argc, char **argv)
if (copy == NULL)
usage(B_FALSE);

if (atp = strchr(copy, '@'))
if ((atp = strchr(copy, '@')))
*atp = '\0';

if ((zhp = zfs_open(g_zfs, copy, ZFS_TYPE_FILESYSTEM)) == NULL)
Expand Down
2 changes: 1 addition & 1 deletion cmd/zpool/zpool_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pool_list_get(int argc, char **argv, zprop_list_t **proplist, int *err)
for (i = 0; i < argc; i++) {
zpool_handle_t *zhp;

if (zhp = zpool_open_canfail(g_zfs, argv[i])) {
if ((zhp = zpool_open_canfail(g_zfs, argv[i]))) {
if (add_pool(zhp, zlp) != 0)
*err = B_TRUE;
} else {
Expand Down
6 changes: 3 additions & 3 deletions lib/libzfs/libzfs_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ libzfs_mnttab_fini(libzfs_handle_t *hdl)
void *cookie = NULL;
mnttab_node_t *mtn;

while (mtn = avl_destroy_nodes(&hdl->libzfs_mnttab_cache, &cookie)) {
while ((mtn = avl_destroy_nodes(&hdl->libzfs_mnttab_cache, &cookie))) {
free(mtn->mtn_mt.mnt_special);
free(mtn->mtn_mt.mnt_mountp);
free(mtn->mtn_mt.mnt_fstype);
Expand Down Expand Up @@ -695,7 +695,7 @@ libzfs_mnttab_remove(libzfs_handle_t *hdl, const char *fsname)
mnttab_node_t *ret;

find.mtn_mt.mnt_special = (char *)fsname;
if (ret = avl_find(&hdl->libzfs_mnttab_cache, (void *)&find, NULL)) {
if ((ret = avl_find(&hdl->libzfs_mnttab_cache, (void *)&find, NULL))) {
avl_remove(&hdl->libzfs_mnttab_cache, ret);
free(ret->mtn_mt.mnt_special);
free(ret->mtn_mt.mnt_mountp);
Expand Down Expand Up @@ -2734,7 +2734,7 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
* up to the prefixlen-long one.
*/
for (cp = target + prefixlen + 1;
cp = strchr(cp, '/'); *cp = '/', cp++) {
(cp = strchr(cp, '/')); *cp = '/', cp++) {
char *logstr;

*cp = '\0';
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs/libzfs_diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ write_inuse_diffs(FILE *fp, differ_info_t *di, dmu_diff_record_t *dr)
int err;

for (o = dr->ddr_first; o <= dr->ddr_last; o++) {
if (err = write_inuse_diffs_one(fp, di, o))
if ((err = write_inuse_diffs_one(fp, di, o)))
return (err);
}
return (0);
Expand Down
4 changes: 2 additions & 2 deletions lib/libzfs/libzfs_sendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,15 +1297,15 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
if (flags.dedup) {
featureflags |= (DMU_BACKUP_FEATURE_DEDUP |
DMU_BACKUP_FEATURE_DEDUPPROPS);
if (err = pipe(pipefd)) {
if ((err = pipe(pipefd))) {
zfs_error_aux(zhp->zfs_hdl, strerror(errno));
return (zfs_error(zhp->zfs_hdl, EZFS_PIPEFAILED,
errbuf));
}
dda.outputfd = outfd;
dda.inputfd = pipefd[1];
dda.dedup_hdl = zhp->zfs_hdl;
if (err = pthread_create(&tid, NULL, cksummer, &dda)) {
if ((err = pthread_create(&tid, NULL, cksummer, &dda))) {
(void) close(pipefd[0]);
(void) close(pipefd[1]);
zfs_error_aux(zhp->zfs_hdl, strerror(errno));
Expand Down
2 changes: 1 addition & 1 deletion module/nvpair/nvpair.c
Original file line number Diff line number Diff line change
Expand Up @@ -2382,7 +2382,7 @@ nvlist_xpack(nvlist_t *nvl, char **bufp, size_t *buflen, int encoding,
*/
nv_priv_init(&nvpriv, nva, 0);

if (err = nvlist_size(nvl, &alloc_size, encoding))
if ((err = nvlist_size(nvl, &alloc_size, encoding)))
return (err);

if ((buf = nv_mem_zalloc(&nvpriv, alloc_size)) == NULL)
Expand Down
7 changes: 4 additions & 3 deletions module/unicode/u8_textprep.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@
#define U8_16BIT_TABLE_INDICATOR (0x8000U)

/* The following are some convenience macros. */
#define U8_PUT_3BYTES_INTO_UTF32(u, b1, b2, b3) \
(u) = ((uint32_t)(b1) & 0x0F) << 12 | ((uint32_t)(b2) & 0x3F) << 6 | \
(uint32_t)(b3) & 0x3F;
#define U8_PUT_3BYTES_INTO_UTF32(u, b1, b2, b3) \
(u) = ((((uint32_t)(b1) & 0x0F) << 12) | \
(((uint32_t)(b2) & 0x3F) << 6) | \
((uint32_t)(b3) & 0x3F));

#define U8_SIMPLE_SWAP(a, b, t) \
(t) = (a); \
Expand Down
4 changes: 2 additions & 2 deletions module/zcommon/zfs_deleg.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ zfs_deleg_verify_nvlist(nvlist_t *nvp)
nvpair_name(perm_name));
if (error)
return (-1);
} while (perm_name = nvlist_next_nvpair(perms, perm_name));
} while (who = nvlist_next_nvpair(nvp, who));
} while ((perm_name = nvlist_next_nvpair(perms, perm_name)));
} while ((who = nvlist_next_nvpair(nvp, who)));
return (0);
}

Expand Down
2 changes: 1 addition & 1 deletion module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3414,7 +3414,7 @@ arc_tempreserve_space(uint64_t reserve, uint64_t txg)
* in order to compress/encrypt/etc the data. We therefor need to
* make sure that there is sufficient available memory for this.
*/
if (error = arc_memory_throttle(reserve, anon_size, txg))
if ((error = arc_memory_throttle(reserve, anon_size, txg)))
return (error);

/*
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/bplist.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ bplist_iterate(bplist_t *bpl, bplist_itor_t *func, void *arg, dmu_tx_t *tx)
bplist_entry_t *bpe;

mutex_enter(&bpl->bpl_lock);
while (bpe = list_head(&bpl->bpl_list)) {
while ((bpe = list_head(&bpl->bpl_list))) {
list_remove(&bpl->bpl_list, bpe);
mutex_exit(&bpl->bpl_lock);
func(arg, &bpe->bpe_blk, tx);
Expand Down
4 changes: 2 additions & 2 deletions module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ dbuf_prefetch(dnode_t *dn, uint64_t blkid)
return;

/* dbuf_find() returns with db_mtx held */
if (db = dbuf_find(dn, 0, blkid)) {
if ((db = dbuf_find(dn, 0, blkid))) {
/*
* This dbuf is already in the cache. We assume that
* it is already CACHED, or else about to be either
Expand Down Expand Up @@ -2395,7 +2395,7 @@ dbuf_sync_list(list_t *list, dmu_tx_t *tx)
{
dbuf_dirty_record_t *dr;

while (dr = list_head(list)) {
while ((dr = list_head(list))) {
if (dr->dr_zio != NULL) {
/*
* If we find an already initialized zio then we
Expand Down
6 changes: 3 additions & 3 deletions module/zfs/dmu_objset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ dmu_objset_sync_dnodes(list_t *list, list_t *newlist, dmu_tx_t *tx)
{
dnode_t *dn;

while (dn = list_head(list)) {
while ((dn = list_head(list))) {
ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT);
ASSERT(dn->dn_dbuf->db_data_pending);
/*
Expand Down Expand Up @@ -1157,7 +1157,7 @@ dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx)
dmu_objset_sync_dnodes(&os->os_dirty_dnodes[txgoff], newlist, tx);

list = &DMU_META_DNODE(os)->dn_dirty_records[txgoff];
while (dr = list_head(list)) {
while ((dr = list_head(list)) != NULL) {
ASSERT(dr->dr_dbuf->db_level == 0);
list_remove(list, dr);
if (dr->dr_zio)
Expand Down Expand Up @@ -1228,7 +1228,7 @@ dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t *tx)

ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os));

while (dn = list_head(list)) {
while ((dn = list_head(list)) != NULL) {
int flags;
ASSERT(!DMU_OBJECT_IS_SPECIAL(dn->dn_object));
ASSERT(dn->dn_phys->dn_type == DMU_OT_NONE ||
Expand Down
5 changes: 3 additions & 2 deletions module/zfs/dmu_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,8 +1201,9 @@ restore_write_byref(struct restorearg *ra, objset_t *os,
ref_os = os;
}

if (err = dmu_buf_hold(ref_os, drrwbr->drr_refobject,
drrwbr->drr_refoffset, FTAG, &dbp, DMU_READ_PREFETCH))
err = dmu_buf_hold(ref_os, drrwbr->drr_refobject,
drrwbr->drr_refoffset, FTAG, &dbp, DMU_READ_PREFETCH);
if (err)
return (err);

tx = dmu_tx_create(os);
Expand Down
6 changes: 3 additions & 3 deletions module/zfs/dmu_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ dmu_tx_commit(dmu_tx_t *tx)

ASSERT(tx->tx_txg != 0);

while (txh = list_head(&tx->tx_holds)) {
while ((txh = list_head(&tx->tx_holds))) {
dnode_t *dn = txh->txh_dnode;

list_remove(&tx->tx_holds, txh);
Expand Down Expand Up @@ -1173,7 +1173,7 @@ dmu_tx_abort(dmu_tx_t *tx)

ASSERT(tx->tx_txg == 0);

while (txh = list_head(&tx->tx_holds)) {
while ((txh = list_head(&tx->tx_holds))) {
dnode_t *dn = txh->txh_dnode;

list_remove(&tx->tx_holds, txh);
Expand Down Expand Up @@ -1227,7 +1227,7 @@ dmu_tx_do_callbacks(list_t *cb_list, int error)
{
dmu_tx_callback_t *dcb;

while (dcb = list_head(cb_list)) {
while ((dcb = list_head(cb_list))) {
list_remove(cb_list, dcb);
dcb->dcb_func(dcb->dcb_data, error);
kmem_free(dcb, sizeof (dmu_tx_callback_t));
Expand Down
2 changes: 1 addition & 1 deletion module/zfs/dmu_zfetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ dmu_zfetch(zfetch_t *zf, uint64_t offset, uint64_t size, int prefetched)
ZFETCHSTAT_BUMP(zfetchstat_hits);
} else {
ZFETCHSTAT_BUMP(zfetchstat_misses);
if (fetched = dmu_zfetch_colinear(zf, &zst)) {
if ((fetched = dmu_zfetch_colinear(zf, &zst))) {
ZFETCHSTAT_BUMP(zfetchstat_colinear_hits);
} else {
ZFETCHSTAT_BUMP(zfetchstat_colinear_misses);
Expand Down
6 changes: 3 additions & 3 deletions module/zfs/dnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,8 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag,
zrl_init(&dnh[i].dnh_zrlock);
dnh[i].dnh_dnode = NULL;
}
if (winner = dmu_buf_set_user(&db->db, children_dnodes, NULL,
dnode_buf_pageout)) {
if ((winner = dmu_buf_set_user(&db->db, children_dnodes, NULL,
dnode_buf_pageout))) {
kmem_free(children_dnodes, sizeof (dnode_children_t) +
(epb - 1) * sizeof (dnode_handle_t));
children_dnodes = winner;
Expand Down Expand Up @@ -1625,7 +1625,7 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx)
int shift = epbs + dn->dn_datablkshift;

first = blkid >> epbs;
if (db = dbuf_hold_level(dn, 1, first, FTAG)) {
if ((db = dbuf_hold_level(dn, 1, first, FTAG))) {
dbuf_will_dirty(db, tx);
dbuf_rele(db, FTAG);
}
Expand Down
4 changes: 2 additions & 2 deletions module/zfs/dnode_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ dnode_undirty_dbufs(list_t *list)
{
dbuf_dirty_record_t *dr;

while (dr = list_head(list)) {
while ((dr = list_head(list))) {
dmu_buf_impl_t *db = dr->dr_dbuf;
uint64_t txg = dr->dr_txg;

Expand Down Expand Up @@ -635,7 +635,7 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx)
}

/* process all the "freed" ranges in the file */
while (rp = avl_last(&dn->dn_ranges[txgoff])) {
while ((rp = avl_last(&dn->dn_ranges[txgoff]))) {
dnode_sync_free_range(dn, rp->fr_blkid, rp->fr_nblks, tx);
/* grab the mutex so we don't race with dnode_block_freed() */
mutex_enter(&dn->dn_mtx);
Expand Down
16 changes: 8 additions & 8 deletions module/zfs/dsl_deleg.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ dsl_deleg_can_allow(char *ddname, nvlist_t *nvp, cred_t *cr)
if ((error = dsl_deleg_access(ddname, ZFS_DELEG_PERM_ALLOW, cr)) != 0)
return (error);

while (whopair = nvlist_next_nvpair(nvp, whopair)) {
while ((whopair = nvlist_next_nvpair(nvp, whopair))) {
nvlist_t *perms;
nvpair_t *permpair = NULL;

VERIFY(nvpair_value_nvlist(whopair, &perms) == 0);

while (permpair = nvlist_next_nvpair(perms, permpair)) {
while ((permpair = nvlist_next_nvpair(perms, permpair))) {
const char *perm = nvpair_name(permpair);

if (strcmp(perm, ZFS_DELEG_PERM_ALLOW) == 0)
Expand Down Expand Up @@ -133,7 +133,7 @@ dsl_deleg_can_unallow(char *ddname, nvlist_t *nvp, cred_t *cr)
(void) snprintf(idstr, sizeof (idstr), "%lld",
(longlong_t)crgetuid(cr));

while (whopair = nvlist_next_nvpair(nvp, whopair)) {
while ((whopair = nvlist_next_nvpair(nvp, whopair))) {
zfs_deleg_who_type_t type = nvpair_name(whopair)[0];

if (type != ZFS_DELEG_USER &&
Expand Down Expand Up @@ -161,7 +161,7 @@ dsl_deleg_set_sync(void *arg1, void *arg2, dmu_tx_t *tx)
DMU_OT_DSL_PERMS, DMU_OT_NONE, 0, tx);
}

while (whopair = nvlist_next_nvpair(nvp, whopair)) {
while ((whopair = nvlist_next_nvpair(nvp, whopair))) {
const char *whokey = nvpair_name(whopair);
nvlist_t *perms;
nvpair_t *permpair = NULL;
Expand All @@ -176,7 +176,7 @@ dsl_deleg_set_sync(void *arg1, void *arg2, dmu_tx_t *tx)
whokey, 8, 1, &jumpobj, tx) == 0);
}

while (permpair = nvlist_next_nvpair(perms, permpair)) {
while ((permpair = nvlist_next_nvpair(perms, permpair))) {
const char *perm = nvpair_name(permpair);
uint64_t n = 0;

Expand All @@ -202,7 +202,7 @@ dsl_deleg_unset_sync(void *arg1, void *arg2, dmu_tx_t *tx)
if (zapobj == 0)
return;

while (whopair = nvlist_next_nvpair(nvp, whopair)) {
while ((whopair = nvlist_next_nvpair(nvp, whopair))) {
const char *whokey = nvpair_name(whopair);
nvlist_t *perms;
nvpair_t *permpair = NULL;
Expand All @@ -224,7 +224,7 @@ dsl_deleg_unset_sync(void *arg1, void *arg2, dmu_tx_t *tx)
if (zap_lookup(mos, zapobj, whokey, 8, 1, &jumpobj) != 0)
continue;

while (permpair = nvlist_next_nvpair(perms, permpair)) {
while ((permpair = nvlist_next_nvpair(perms, permpair))) {
const char *perm = nvpair_name(permpair);
uint64_t n = 0;

Expand Down Expand Up @@ -261,7 +261,7 @@ dsl_deleg_set(const char *ddname, nvlist_t *nvp, boolean_t unset)
return (ENOTSUP);
}

while (whopair = nvlist_next_nvpair(nvp, whopair))
while ((whopair = nvlist_next_nvpair(nvp, whopair)))
blocks_modified++;

error = dsl_sync_task_do(dd->dd_pool, NULL,
Expand Down
6 changes: 3 additions & 3 deletions module/zfs/dsl_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ dsl_dir_tempreserve_clear(void *tr_cookie, dmu_tx_t *tx)
if (tr_cookie == NULL)
return;

while (tr = list_head(tr_list)) {
while ((tr = list_head(tr_list))) {
if (tr->tr_dp) {
dsl_pool_tempreserve_clear(tr->tr_dp, tr->tr_size, tx);
} else if (tr->tr_ds) {
Expand Down Expand Up @@ -1285,8 +1285,8 @@ dsl_dir_rename_check(void *arg1, void *arg2, dmu_tx_t *tx)
if (closest_common_ancestor(dd, ra->newparent) == dd)
return (EINVAL);

if (err = dsl_dir_transfer_possible(dd->dd_parent,
ra->newparent, myspace))
if ((err = dsl_dir_transfer_possible(dd->dd_parent,
ra->newparent, myspace)))
return (err);
}

Expand Down
10 changes: 5 additions & 5 deletions module/zfs/dsl_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
start = gethrtime();

zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
while (ds = txg_list_remove(&dp->dp_dirty_datasets, txg)) {
while ((ds = txg_list_remove(&dp->dp_dirty_datasets, txg))) {
/*
* We must not sync any non-MOS datasets twice, because
* we may have taken a snapshot of them. However, we
Expand Down Expand Up @@ -350,7 +350,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
* whose ds_bp will be rewritten when we do this 2nd sync.
*/
zio = zio_root(dp->dp_spa, NULL, NULL, ZIO_FLAG_MUSTSUCCEED);
while (ds = txg_list_remove(&dp->dp_dirty_datasets, txg)) {
while ((ds = txg_list_remove(&dp->dp_dirty_datasets, txg))) {
ASSERT(list_link_active(&ds->ds_synced_link));
dmu_buf_rele(ds->ds_dbuf, ds);
dsl_dataset_sync(ds, zio, tx);
Expand All @@ -367,7 +367,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
deadlist_enqueue_cb, &ds->ds_deadlist, tx);
}

while (dstg = txg_list_remove(&dp->dp_sync_tasks, txg)) {
while ((dstg = txg_list_remove(&dp->dp_sync_tasks, txg))) {
/*
* No more sync tasks should have been added while we
* were syncing.
Expand All @@ -378,7 +378,7 @@ dsl_pool_sync(dsl_pool_t *dp, uint64_t txg)
DTRACE_PROBE(pool_sync__3task);

start = gethrtime();
while (dd = txg_list_remove(&dp->dp_dirty_dirs, txg))
while ((dd = txg_list_remove(&dp->dp_dirty_dirs, txg)))
dsl_dir_sync(dd, tx);
write_time += gethrtime() - start;

Expand Down Expand Up @@ -448,7 +448,7 @@ dsl_pool_sync_done(dsl_pool_t *dp, uint64_t txg)
dsl_dataset_t *ds;
objset_t *os;

while (ds = list_head(&dp->dp_synced_datasets)) {
while ((ds = list_head(&dp->dp_synced_datasets))) {
list_remove(&dp->dp_synced_datasets, ds);
os = ds->ds_objset;
zil_clean(os->os_zil, txg);
Expand Down
Loading

0 comments on commit c65aa5b

Please sign in to comment.