All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, adobriyan@gmail.com
Subject: [PATCH 08/52] kstrtox: convert fs/nfs/
Date: Sat,  5 Feb 2011 16:20:11 +0200	[thread overview]
Message-ID: <1296915654-7458-8-git-send-email-adobriyan@gmail.com> (raw)
In-Reply-To: <1296915654-7458-1-git-send-email-adobriyan@gmail.com>


Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 fs/nfs/callback.c |    8 +++--
 fs/nfs/idmap.c    |   12 +++------
 fs/nfs/internal.h |    8 +++---
 fs/nfs/super.c    |   73 ++++++++++++++++++++++++-----------------------------
 4 files changed, 46 insertions(+), 55 deletions(-)

diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index e3d2942..0c8b5d8 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -44,13 +44,15 @@ unsigned short nfs_callback_tcpport6;
 
 static int param_set_portnr(const char *val, const struct kernel_param *kp)
 {
-	unsigned long num;
+	unsigned int num;
 	int ret;
 
 	if (!val)
 		return -EINVAL;
-	ret = strict_strtoul(val, 0, &num);
-	if (ret == -EINVAL || num > NFS_CALLBACK_MAXPORTNR)
+	ret = kstrtouint(val, 0, &num);
+	if (ret < 0)
+		return ret;
+	if (num > NFS_CALLBACK_MAXPORTNR)
 		return -EINVAL;
 	*((unsigned int *)kp->arg) = num;
 	return 0;
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 1869688..714def8 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -205,17 +205,13 @@ static int nfs_idmap_lookup_id(const char *name, size_t namelen,
 				const char *type, __u32 *id)
 {
 	char id_str[NFS_UINT_MAXLEN];
-	long id_long;
 	ssize_t data_size;
-	int ret = 0;
+	int ret;
 
 	data_size = nfs_idmap_request_key(name, namelen, type, id_str, NFS_UINT_MAXLEN);
-	if (data_size <= 0) {
-		ret = -EINVAL;
-	} else {
-		ret = strict_strtol(id_str, 10, &id_long);
-		*id = (__u32)id_long;
-	}
+	ret = -EINVAL;
+	if (data_size > 0)
+		ret = kstrtou32(id_str, 10, id);
 	return ret;
 }
 
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index cf9fdbd..6415783 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -73,11 +73,11 @@ struct nfs_clone_mount {
  */
 struct nfs_parsed_mount_data {
 	int			flags;
-	int			rsize, wsize;
-	int			timeo, retrans;
-	int			acregmin, acregmax,
+	unsigned int		rsize, wsize;
+	unsigned int		timeo, retrans;
+	unsigned int		acregmin, acregmax,
 				acdirmin, acdirmax;
-	int			namlen;
+	unsigned int		namlen;
 	unsigned int		options;
 	unsigned int		bsize;
 	unsigned int		auth_flavor_len;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index b68c860..1902bd4 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1015,7 +1015,8 @@ static int nfs_parse_mount_options(char *raw,
 
 	while ((p = strsep(&raw, ",")) != NULL) {
 		substring_t args[MAX_OPT_ARGS];
-		unsigned long option;
+		unsigned int val_uint;
+		u16 val_u16;
 		int token;
 
 		if (!*p)
@@ -1130,154 +1131,146 @@ static int nfs_parse_mount_options(char *raw,
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtou16(string, 10, &val_u16);
 			kfree(string);
-			if (rc != 0 || option > USHRT_MAX)
+			if (rc != 0)
 				goto out_invalid_value;
-			mnt->nfs_server.port = option;
+			mnt->nfs_server.port = val_u16;
 			break;
 		case Opt_rsize:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &mnt->rsize);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			mnt->rsize = option;
 			break;
 		case Opt_wsize:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &mnt->wsize);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			mnt->wsize = option;
 			break;
 		case Opt_bsize:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &mnt->bsize);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			mnt->bsize = option;
 			break;
 		case Opt_timeo:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &val_uint);
 			kfree(string);
-			if (rc != 0 || option == 0)
+			if (rc != 0 || val_uint == 0)
 				goto out_invalid_value;
-			mnt->timeo = option;
+			mnt->timeo = val_uint;
 			break;
 		case Opt_retrans:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &val_uint);
 			kfree(string);
-			if (rc != 0 || option == 0)
+			if (rc != 0 || val_uint == 0)
 				goto out_invalid_value;
-			mnt->retrans = option;
+			mnt->retrans = val_uint;
 			break;
 		case Opt_acregmin:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &mnt->acregmin);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			mnt->acregmin = option;
 			break;
 		case Opt_acregmax:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &mnt->acregmax);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			mnt->acregmax = option;
 			break;
 		case Opt_acdirmin:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &mnt->acdirmin);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			mnt->acdirmin = option;
 			break;
 		case Opt_acdirmax:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &mnt->acdirmax);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			mnt->acdirmax = option;
 			break;
 		case Opt_actimeo:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &val_uint);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
 			mnt->acregmin = mnt->acregmax =
-			mnt->acdirmin = mnt->acdirmax = option;
+			mnt->acdirmin = mnt->acdirmax = val_uint;
 			break;
 		case Opt_namelen:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &mnt->namlen);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			mnt->namlen = option;
 			break;
 		case Opt_mountport:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtou16(string, 10, &val_u16);
 			kfree(string);
-			if (rc != 0 || option > USHRT_MAX)
+			if (rc != 0)
 				goto out_invalid_value;
-			mnt->mount_server.port = option;
+			mnt->mount_server.port = val_u16;
 			break;
 		case Opt_mountvers:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &val_uint);
 			kfree(string);
 			if (rc != 0 ||
-			    option < NFS_MNT_VERSION ||
-			    option > NFS_MNT3_VERSION)
+			    val_uint < NFS_MNT_VERSION ||
+			    val_uint > NFS_MNT3_VERSION)
 				goto out_invalid_value;
-			mnt->mount_server.version = option;
+			mnt->mount_server.version = val_uint;
 			break;
 		case Opt_nfsvers:
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &val_uint);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			switch (option) {
+			switch (val_uint) {
 			case NFS2_VERSION:
 				mnt->flags &= ~NFS_MOUNT_VER3;
 				mnt->version = 2;
@@ -1298,13 +1291,13 @@ static int nfs_parse_mount_options(char *raw,
 			string = match_strdup(args);
 			if (string == NULL)
 				goto out_nomem;
-			rc = strict_strtoul(string, 10, &option);
+			rc = kstrtouint(string, 10, &val_uint);
 			kfree(string);
 			if (rc != 0)
 				goto out_invalid_value;
-			if (option > NFS4_MAX_MINOR_VERSION)
+			if (val_uint > NFS4_MAX_MINOR_VERSION)
 				goto out_invalid_value;
-			mnt->minorversion = option;
+			mnt->minorversion = val_uint;
 			break;
 
 		/*
-- 
1.7.3.4


  parent reply	other threads:[~2011-02-05 14:21 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-05 14:20 [PATCH 01/52] kstrtox: converting strings to integers done (hopefully) right Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 02/52] kstrtox: convert kernel/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 03/52] kstrtox: convert kernel/trace/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 04/52] kstrtox: convert mm/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 05/52] kstrtox: convert block/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 06/52] kstrtox: convert security/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 07/52] kstrtox: convert fs/fuse/ Alexey Dobriyan
2011-02-05 14:20 ` Alexey Dobriyan [this message]
2011-02-05 14:20 ` [PATCH 09/52] kstrtox: convert fs/proc/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 10/52] kstrtox: convert drivers/acpi/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 11/52] kstrtox: convert drivers/ata/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 12/52] kstrtox: convert drivers/base/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 13/52] kstrtox: convert drivers/block/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 14/52] kstrtox: convert drivers/bluetooth/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 15/52] kstrtox: convert drivers/clocksource/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 16/52] kstrtox: convert drivers/edac/ Alexey Dobriyan
2011-02-05 17:34   ` Borislav Petkov
2011-02-06 18:52     ` Alexey Dobriyan
2011-02-07  9:43       ` Borislav Petkov
2011-02-05 14:20 ` [PATCH 17/52] kstrtox: convert drivers/gpio/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 18/52] kstrtox: convert drivers/gpu/drm/nouveau/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 19/52] kstrtox: convert drivers/hid/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 20/52] kstrtox: convert drivers/hwmon/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 21/52] kstrtox: convert drivers/ide/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 22/52] kstrtox: convert drivers/infiniband/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 23/52] kstrtox: convert drivers/input/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 24/52] kstrtox: convert drivers/isdn/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 25/52] kstrtox: convert drivers/leds/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 26/52] kstrtox: convert drivers/macintosh/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 27/52] kstrtox: convert drivers/md/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 28/52] kstrtox: convert drivers/mfd/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 29/52] kstrtox: convert drivers/misc/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 30/52] kstrtox: convert drivers/mmc/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 31/52] kstrtox: convert drivers/net/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 32/52] kstrtox: convert drivers/net/wireless/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 33/52] kstrtox: convert drivers/pci/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 34/52] kstrtox: convert drivers/power/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 35/52] kstrtox: convert drivers/regulator/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 36/52] kstrtox: convert drivers/rtc/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 37/52] kstrtox: convert drivers/scsi/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 38/52] kstrtox: convert drivers/ssb/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 39/52] kstrtox: convert drivers/target/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 40/52] kstrtox: convert drivers/usb/ Alexey Dobriyan
2011-04-14 10:31   ` [40/52] " Michal Nazarewicz
2011-02-05 14:20 ` [PATCH 41/52] kstrtox: convert drivers/video/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 42/52] kstrtox: convert drivers/w1/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 43/52] kstrtox: convert sound/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 44/52] kstrtox: convert net/ Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 45/52] kstrtox: convert arm Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 46/52] kstrtox: convert microblaze Alexey Dobriyan
2011-02-10 13:55   ` Michal Simek
2011-02-05 14:20 ` [PATCH 47/52] kstrtox: convert mips Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 48/52] kstrtox: convert powerpc Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 49/52] kstrtox: convert s390 Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 50/52] kstrtox: convert tile Alexey Dobriyan
2011-02-05 14:20 ` [PATCH 51/52] kstrtox: convert x86 Alexey Dobriyan
2011-02-05 14:33 ` [PATCH 01/52] kstrtox: converting strings to integers done (hopefully) right Geert Uytterhoeven
2011-02-05 14:40   ` Alexey Dobriyan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296915654-7458-8-git-send-email-adobriyan@gmail.com \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.