summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@gmail.com>2017-04-05 15:06:24 -0400
committerJes Sorensen <Jes.Sorensen@gmail.com>2017-04-05 15:06:24 -0400
commit700483a22340f2f25a761acd08e6db87e92d90e9 (patch)
tree57f2028d937be51fdf9ebc42d04582614e75440c /util.c
parentf5c924f441cedce2a13c48b12be35250560ee575 (diff)
downloadmdadm-700483a22340f2f25a761acd08e6db87e92d90e9.tar.gz
util/set_array_info: Simplify code since md_get_version returns a constant
md_get_version() always returns (0 * 1000) + (90 * 100) + 3, so no point in calling it. Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Diffstat (limited to 'util.c')
-rw-r--r--util.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/util.c b/util.c
index 56daee3..afeb6a5 100644
--- a/util.c
+++ b/util.c
@@ -1858,22 +1858,19 @@ int set_array_info(int mdfd, struct supertype *st, struct mdinfo *info)
* This varies between externally managed arrays
* and older kernels
*/
- int vers = md_get_version(mdfd);
+ mdu_array_info_t inf;
int rv;
#ifndef MDASSEMBLE
if (st->ss->external)
- rv = sysfs_set_array(info, vers);
- else
+ return sysfs_set_array(info, 9003);
#endif
- if ((vers % 100) >= 1) { /* can use different versions */
- mdu_array_info_t inf;
- memset(&inf, 0, sizeof(inf));
- inf.major_version = info->array.major_version;
- inf.minor_version = info->array.minor_version;
- rv = md_set_array_info(mdfd, &inf);
- } else
- rv = md_set_array_info(mdfd, NULL);
+
+ memset(&inf, 0, sizeof(inf));
+ inf.major_version = info->array.major_version;
+ inf.minor_version = info->array.minor_version;
+ rv = md_set_array_info(mdfd, &inf);
+
return rv;
}