[PATCH] xfs: stop using simple_strtoul()
Jeff Liu
jeff.liu at oracle.com
Sat Jan 5 21:50:08 CST 2013
Hello,
This small patch convert xfs_parseargs() and suffix_strtoul() to
use kstrtoint() instead of simple_strtoul() which is deprecated.
Thanks,
-Jeff
Signed-off-by: Jie Liu <jeff.liu at oracle.com>
---
fs/xfs/xfs_super.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 26a09bd..f73235f 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -137,12 +137,14 @@ static const match_table_t tokens = {
{Opt_err, NULL}
};
-
-STATIC unsigned long
-suffix_strtoul(char *s, char **endp, unsigned int base)
+STATIC int
+suffix_kstrtoint(
+ char *s,
+ unsigned int base)
{
- int last, shift_left_factor = 0;
- char *value = s;
+ char *value = s;
+ int shift_left_factor = 0;
+ int last, res;
last = strlen(value) - 1;
if (value[last] == 'K' || value[last] == 'k') {
@@ -158,7 +160,8 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
value[last] = '\0';
}
- return simple_strtoul((const char *)s, endp, base) << shift_left_factor;
+ kstrtoint(s, base, &res);
+ return res << shift_left_factor;
}
/*
@@ -174,7 +177,7 @@ xfs_parseargs(
char *options)
{
struct super_block *sb = mp->m_super;
- char *this_char, *value, *eov;
+ char *this_char, *value;
int dsunit = 0;
int dswidth = 0;
int iosize = 0;
@@ -230,14 +233,14 @@ xfs_parseargs(
this_char);
return EINVAL;
}
- mp->m_logbufs = simple_strtoul(value, &eov, 10);
+ kstrtoint(value, 10, &mp->m_logbufs);
} else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
if (!value || !*value) {
xfs_warn(mp, "%s option requires an argument",
this_char);
return EINVAL;
}
- mp->m_logbsize = suffix_strtoul(value, &eov, 10);
+ mp->m_logbsize = suffix_kstrtoint(value, 10);
} else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
if (!value || !*value) {
xfs_warn(mp, "%s option requires an argument",
@@ -266,7 +269,7 @@ xfs_parseargs(
this_char);
return EINVAL;
}
- iosize = simple_strtoul(value, &eov, 10);
+ kstrtoint(value, 10, &iosize);
iosizelog = ffs(iosize) - 1;
} else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
if (!value || !*value) {
@@ -274,7 +277,7 @@ xfs_parseargs(
this_char);
return EINVAL;
}
- iosize = suffix_strtoul(value, &eov, 10);
+ iosize = suffix_kstrtoint(value, 10);
iosizelog = ffs(iosize) - 1;
} else if (!strcmp(this_char, MNTOPT_GRPID) ||
!strcmp(this_char, MNTOPT_BSDGROUPS)) {
@@ -296,14 +299,14 @@ xfs_parseargs(
this_char);
return EINVAL;
}
- dsunit = simple_strtoul(value, &eov, 10);
+ kstrtoint(value, 10, &dsunit);
} else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
if (!value || !*value) {
xfs_warn(mp, "%s option requires an argument",
this_char);
return EINVAL;
}
- dswidth = simple_strtoul(value, &eov, 10);
+ kstrtoint(value, 10, &dswidth);
} else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
--
1.7.9.5
More information about the xfs
mailing list