Fix gcc missing case warnings

Gcc ASSERT() missing cases are impossible

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf 2010-08-26 09:52:41 -07:00
parent 2598c0012d
commit e75c13c353
12 changed files with 51 additions and 1 deletions

View File

@ -233,6 +233,8 @@ calculate_range(const char *dataset, err_type_t type, int level, char *range,
}
switch (type) {
default:
break;
case TYPE_DATA:
break;
@ -347,6 +349,8 @@ translate_record(err_type_t type, const char *object, const char *range,
* MOS objects are treated specially.
*/
switch (type) {
default:
break;
case TYPE_MOS:
record->zi_type = 0;
break;
@ -473,6 +477,8 @@ translate_device(const char *pool, const char *device, err_type_t label_type,
}
switch (label_type) {
default:
break;
case TYPE_LABEL_UBERBLOCK:
record->zi_start = offsetof(vdev_label_t, vl_uberblock[0]);
record->zi_end = record->zi_start + VDEV_UBERBLOCK_RING - 1;

View File

@ -1998,6 +1998,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object, uint64_t offset)
case ZTEST_IO_SETATTR:
(void) ztest_setattr(zd, object);
break;
default:
break;
}
umem_free(data, blocksize);

View File

@ -131,6 +131,8 @@ changelist_prefix(prop_changelist_t *clp)
case ZFS_PROP_SHARESMB:
(void) zfs_unshare_smb(cn->cn_handle, NULL);
break;
default:
break;
}
}
}

View File

@ -72,6 +72,8 @@ zfs_type_to_name(zfs_type_t type)
return (dgettext(TEXT_DOMAIN, "snapshot"));
case ZFS_TYPE_VOLUME:
return (dgettext(TEXT_DOMAIN, "volume"));
default:
break;
}
return (NULL);
@ -180,6 +182,8 @@ zfs_validate_name(libzfs_handle_t *hdl, const char *path, int type,
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"reserved disk name"));
break;
default:
break;
}
}
@ -1015,6 +1019,8 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
"component of '%s' is too long"),
propname);
break;
default:
break;
}
(void) zfs_error(hdl, EZFS_BADPROP, errbuf);
goto error;
@ -1139,6 +1145,8 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
case ZFS_PROP_NORMALIZE:
chosen_normal = (int)intval;
break;
default:
break;
}
/*
@ -1187,6 +1195,8 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
goto error;
}
break;
default:
break;
}
}
}
@ -1674,6 +1684,8 @@ get_numeric_property(zfs_handle_t *zhp, zfs_prop_t prop, zprop_source_t *src,
mntopt_on = MNTOPT_NBMAND;
mntopt_off = MNTOPT_NONBMAND;
break;
default:
break;
}
/*

View File

@ -178,6 +178,8 @@ char *
zpool_state_to_name(vdev_state_t state, vdev_aux_t aux)
{
switch (state) {
default:
break;
case VDEV_STATE_CLOSED:
case VDEV_STATE_OFFLINE:
return (gettext("OFFLINE"));
@ -421,6 +423,8 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
* Perform additional checking for specific properties.
*/
switch (prop) {
default:
break;
case ZPOOL_PROP_VERSION:
if (intval < version || intval > SPA_VERSION) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
@ -730,7 +734,10 @@ zpool_name_valid(libzfs_handle_t *hdl, boolean_t isopen, const char *pool)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"multiple '@' delimiters in name"));
break;
case NAME_ERR_NO_AT:
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"permission set is missing '@'"));
break;
}
}
return (B_FALSE);

View File

@ -1143,6 +1143,8 @@ arc_space_consume(uint64_t space, arc_space_type_t type)
ASSERT(type >= 0 && type < ARC_SPACE_NUMTYPES);
switch (type) {
default:
break;
case ARC_SPACE_DATA:
ARCSTAT_INCR(arcstat_data_size, space);
break;
@ -1167,6 +1169,8 @@ arc_space_return(uint64_t space, arc_space_type_t type)
ASSERT(type >= 0 && type < ARC_SPACE_NUMTYPES);
switch (type) {
default:
break;
case ARC_SPACE_DATA:
ARCSTAT_INCR(arcstat_data_size, -space);
break;

View File

@ -1012,6 +1012,8 @@ backup_byteswap(dmu_replay_record_t *drr)
DO64(drr_end.drr_checksum.zc_word[3]);
DO64(drr_end.drr_toguid);
break;
default:
break;
}
#undef DO64
#undef DO32

View File

@ -413,6 +413,8 @@ dsl_prop_check_prediction(dsl_dir_t *dd, dsl_prop_setarg_t *psa)
case ZFS_PROP_QUOTA:
case ZFS_PROP_RESERVATION:
return;
default:
break;
}
}

View File

@ -398,6 +398,8 @@ sa_attr_op(sa_handle_t *hdl, sa_bulk_attr_t *bulk, int count,
if (error)
return (error);
break;
default:
break;
}
}
return (error);

View File

@ -471,6 +471,9 @@ spa_prop_validate(spa_t *spa, nvlist_t *props)
intval != 0 && intval < ZIO_DEDUPDITTO_MIN)
error = EINVAL;
break;
default:
break;
}
if (error)
@ -1425,6 +1428,8 @@ static int
spa_check_logs(spa_t *spa)
{
switch (spa->spa_log_state) {
default:
break;
case SPA_LOG_MISSING:
/* need to recheck in case slog has been restored */
case SPA_LOG_UNKNOWN:

View File

@ -565,6 +565,8 @@ vdev_inuse(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason,
case VDEV_LABEL_SPARE:
return (spa_has_spare(spa, device_guid));
default:
break;
}
}

View File

@ -483,6 +483,8 @@ zfs_secpolicy_setprop(const char *dsname, zfs_prop_t prop, nvpair_t *propval,
* Check permissions for special properties.
*/
switch (prop) {
default:
break;
case ZFS_PROP_ZONED:
/*
* Disallow setting of 'zoned' from within a local zone.
@ -3380,6 +3382,8 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
return (ENOTSUP);
}
break;
default:
break;
}
return (zfs_secpolicy_setprop(dsname, prop, pair, CRED()));