libstoragemgmt/0003-Simc-plugin-Fix-gcc-warning-on-fallthrough-switch.patch
Gris Ge f4910af690 Upgrade to libstoragemgmt 1.4.0
- Add Python3 support.
 - New sub rpm package python3-libstoragemgmt.
 - Add support of lmiwbem(this rpm use pywbem instead).
 - Allow plugin test to be run concurrently.
 - Bug fixes:
    * Fix megaraid plugin for dell PERC.
    * Fix local disk rotation speed query on NVMe disk.
    * Fix lsmcli incorrect try-expect on local disk query.
    * Fix all the gcc compile warnings.
    * Fix the obsolete usage of AC_OUTPUT in configure.ac.
 - Library adds:
    * Query serial of local disk:
        lsm_local_disk_serial_num_get()/lsm.LocalDisk.serial_num_get()
    * Query LED status of local disk:
        lsm_local_disk_led_status_get()/lsm.LocalDisk.led_status_get()
    * Query link speed of local disk:
        lsm_local_disk_link_speed_get()/lsm.LocalDisk.link_speed_get()
2017-02-23 22:25:06 +08:00

84 lines
3.4 KiB
Diff

From fa8e9e94c6d06ac135d4363293b00b1a42ebf5c4 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Thu, 23 Feb 2017 22:06:26 +0800
Subject: [PATCH] Simc plugin: Fix gcc warning on fallthrough switch.
Issue:
GCC(gcc-7.0.1-0.9.fc26.x86_64) is warning on fallthrough switch.
Fix:
Use if and else if check instead.
Misc:
Don't want to mess with GCC and CLANG on this trivial issue by
using GCC extention: `__attribute__((fallthrough))`.
Signed-off-by: Gris Ge <fge@redhat.com>
---
plugin/simc/ops_v1_2.c | 38 ++++++++++++++++++--------------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/plugin/simc/ops_v1_2.c b/plugin/simc/ops_v1_2.c
index 3703161..3bdc2ba 100644
--- a/plugin/simc/ops_v1_2.c
+++ b/plugin/simc/ops_v1_2.c
@@ -63,36 +63,34 @@ int volume_raid_info(lsm_plugin_ptr c, lsm_volume *volume,
_good(_str_to_int(err_msg, lsm_hash_string_get(sim_p, "member_type"),
(int *) &member_type), rc, out);
- switch(member_type) {
- case LSM_POOL_MEMBER_TYPE_POOL:
+ if (member_type == LSM_POOL_MEMBER_TYPE_POOL) {
_good(_str_to_uint64(err_msg, lsm_hash_string_get(sim_p,
"parent_pool_id"),
&sim_p_id), rc, out);
_good(_db_sim_pool_of_sim_id(err_msg, db, sim_p_id, &sim_p), rc, out);
- case LSM_POOL_MEMBER_TYPE_DISK:
- _good(_str_to_int(err_msg, lsm_hash_string_get(sim_p, "raid_type"),
- (int *) raid_type), rc, out);
- _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, "strip_size"),
- strip_size), rc, out);
- *min_io_size = *strip_size;
- _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, "disk_count"),
- disk_count), rc, out);
- _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p,
- "data_disk_count"),
- &data_disk_count), rc, out);
- if ((*raid_type == LSM_VOLUME_RAID_TYPE_RAID1) ||
- (*raid_type == LSM_VOLUME_RAID_TYPE_JBOD))
- *opt_io_size = _BLOCK_SIZE;
- else
- *opt_io_size = *strip_size * data_disk_count;
- break;
- default:
+ } else if (member_type != LSM_POOL_MEMBER_TYPE_DISK) {
rc = LSM_ERR_PLUGIN_BUG;
_lsm_err_msg_set(err_msg, "BUG: Got unknown pool member type %d",
member_type);
goto out;
}
+ _good(_str_to_int(err_msg, lsm_hash_string_get(sim_p, "raid_type"),
+ (int *) raid_type), rc, out);
+ _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, "strip_size"),
+ strip_size), rc, out);
+ *min_io_size = *strip_size;
+ _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, "disk_count"),
+ disk_count), rc, out);
+ _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p,
+ "data_disk_count"),
+ &data_disk_count), rc, out);
+ if ((*raid_type == LSM_VOLUME_RAID_TYPE_RAID1) ||
+ (*raid_type == LSM_VOLUME_RAID_TYPE_JBOD))
+ *opt_io_size = _BLOCK_SIZE;
+ else
+ *opt_io_size = *strip_size * data_disk_count;
+
out:
_db_sql_trans_rollback(db);
if (sim_vol != NULL)
--
1.8.3.1