[sheepdog] [PATCH] sbd: use kstrtoul() instead of strict_strtoul()
Cc: hujianyang Signed-off-by: Hitoshi Mitake --- sbd/sheep_block_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbd/sheep_block_device.c b/sbd/sheep_block_device.c index eaee932..d82ff43 100644 --- a/sbd/sheep_block_device.c +++ b/sbd/sheep_block_device.c @@ -290,7 +290,7 @@ static ssize_t sbd_remove(struct bus_type *bus, const char *buf, unsigned long ul; int target_id, ret; - ret = strict_strtoul(buf, 10, &ul); + ret = kstrtoul(buf, 10, &ul); if (ret) return ret; -- 1.9.1 -- sheepdog mailing list sheepdog@lists.wpkg.org https://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [sheepdog] [PATCH] sbd: use kstrtoul() instead of strict_strtoul()
At Tue, 20 Jan 2015 11:46:32 +0900, Hitoshi Mitake wrote: > > Cc: hujianyang > Signed-off-by: Hitoshi Mitake > --- > sbd/sheep_block_device.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Dropping it. The version information should be described about the interfaces. Thanks, Hitoshi > > diff --git a/sbd/sheep_block_device.c b/sbd/sheep_block_device.c > index eaee932..d82ff43 100644 > --- a/sbd/sheep_block_device.c > +++ b/sbd/sheep_block_device.c > @@ -290,7 +290,7 @@ static ssize_t sbd_remove(struct bus_type *bus, const > char *buf, > unsigned long ul; > int target_id, ret; > > - ret = strict_strtoul(buf, 10, &ul); > + ret = kstrtoul(buf, 10, &ul); > if (ret) > return ret; > > -- > 1.9.1 > -- sheepdog mailing list sheepdog@lists.wpkg.org https://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [sheepdog] [PATCH] sbd: use kstrtoul() instead of strict_strtoul()
On 2015/1/20 11:01, Hitoshi Mitake wrote: > At Tue, 20 Jan 2015 11:46:32 +0900, > Hitoshi Mitake wrote: >> >> Cc: hujianyang >> Signed-off-by: Hitoshi Mitake >> --- >> sbd/sheep_block_device.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > Dropping it. The version information should be described about the interfaces. > > Thanks, > Hitoshi > Seems *kstrtoul* is introduce into mainline since commit 33ee3b2e2: commit 33ee3b2e2eb9b4b6c64dcf9ed66e2ac3124e748c Author: Alexey Dobriyan Date: Tue Mar 22 16:34:40 2011 -0700 kstrto*: converting strings to integers done (hopefully) right An old kernel maybe not support this interface, but I don't like the module code is written as: #ifdef KERNEL_VERSION<(x,x,x) ... #else ... #endif What's your opinion? Add Cc Alexey Dobriyan >> >> diff --git a/sbd/sheep_block_device.c b/sbd/sheep_block_device.c >> index eaee932..d82ff43 100644 >> --- a/sbd/sheep_block_device.c >> +++ b/sbd/sheep_block_device.c >> @@ -290,7 +290,7 @@ static ssize_t sbd_remove(struct bus_type *bus, const >> char *buf, >> unsigned long ul; >> int target_id, ret; >> >> -ret = strict_strtoul(buf, 10, &ul); >> +ret = kstrtoul(buf, 10, &ul); >> if (ret) >> return ret; >> >> -- >> 1.9.1 >> > > -- sheepdog mailing list sheepdog@lists.wpkg.org https://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [sheepdog] [PATCH] sbd: use kstrtoul() instead of strict_strtoul()
At Tue, 20 Jan 2015 11:44:53 +0800, hujianyang wrote: > > On 2015/1/20 11:01, Hitoshi Mitake wrote: > > At Tue, 20 Jan 2015 11:46:32 +0900, > > Hitoshi Mitake wrote: > >> > >> Cc: hujianyang > >> Signed-off-by: Hitoshi Mitake > >> --- > >> sbd/sheep_block_device.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > > > > Dropping it. The version information should be described about the > > interfaces. > > > > Thanks, > > Hitoshi > > > > Seems *kstrtoul* is introduce into mainline since commit 33ee3b2e2: > > commit 33ee3b2e2eb9b4b6c64dcf9ed66e2ac3124e748c > Author: Alexey Dobriyan > Date: Tue Mar 22 16:34:40 2011 -0700 > > kstrto*: converting strings to integers done (hopefully) right > > An old kernel maybe not support this interface, but I don't like > the module code is written as: > > #ifdef KERNEL_VERSION<(x,x,x) > ... > #else > ... > #endif > > What's your opinion? Seems many components of the linux kernel are using kstrto* interface. It would be reasonable simply replacing strict_strtoul() with it. So I applied the patch. Thanks, Hitoshi > > Add Cc Alexey Dobriyan > > >> > >> diff --git a/sbd/sheep_block_device.c b/sbd/sheep_block_device.c > >> index eaee932..d82ff43 100644 > >> --- a/sbd/sheep_block_device.c > >> +++ b/sbd/sheep_block_device.c > >> @@ -290,7 +290,7 @@ static ssize_t sbd_remove(struct bus_type *bus, const > >> char *buf, > >>unsigned long ul; > >>int target_id, ret; > >> > >> - ret = strict_strtoul(buf, 10, &ul); > >> + ret = kstrtoul(buf, 10, &ul); > >>if (ret) > >>return ret; > >> > >> -- > >> 1.9.1 > >> > > > > > > -- sheepdog mailing list sheepdog@lists.wpkg.org https://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [sheepdog] [PATCH] sbd: use kstrtoul() instead of strict_strtoul()
On Tue, Jan 20, 2015 at 11:46:32AM +0900, Hitoshi Mitake wrote: > Cc: hujianyang > Signed-off-by: Hitoshi Mitake > --- > sbd/sheep_block_device.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sbd/sheep_block_device.c b/sbd/sheep_block_device.c > index eaee932..d82ff43 100644 > --- a/sbd/sheep_block_device.c > +++ b/sbd/sheep_block_device.c > @@ -290,7 +290,7 @@ static ssize_t sbd_remove(struct bus_type *bus, const > char *buf, > unsigned long ul; > int target_id, ret; > > - ret = strict_strtoul(buf, 10, &ul); > + ret = kstrtoul(buf, 10, &ul); > if (ret) > return ret; I need to warn you of that: As far as I can remember, old kernel don't support kstrtoul such as famouse 2.6.32. For compability issue, I chose strict_strtoul instead. In other words, this patch will break SBD with old kernel, shipped on many distributions such as centos 6. As as general practice for kernel module, we'd better use old function. Actually the later kernel just macro strict_strtoul as kstrtoul(). Thanks Yuan -- sheepdog mailing list sheepdog@lists.wpkg.org https://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [sheepdog] [PATCH] sbd: use kstrtoul() instead of strict_strtoul()
On Tue, Jan 20, 2015 at 11:44:53AM +0800, hujianyang wrote: > On 2015/1/20 11:01, Hitoshi Mitake wrote: > > At Tue, 20 Jan 2015 11:46:32 +0900, > > Hitoshi Mitake wrote: > >> > >> Cc: hujianyang > >> Signed-off-by: Hitoshi Mitake > >> --- > >> sbd/sheep_block_device.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > > > > Dropping it. The version information should be described about the > > interfaces. > > > > Thanks, > > Hitoshi > > > > Seems *kstrtoul* is introduce into mainline since commit 33ee3b2e2: > > commit 33ee3b2e2eb9b4b6c64dcf9ed66e2ac3124e748c > Author: Alexey Dobriyan > Date: Tue Mar 22 16:34:40 2011 -0700 > > kstrto*: converting strings to integers done (hopefully) right > > An old kernel maybe not support this interface, but I don't like > the module code is written as: > > #ifdef KERNEL_VERSION<(x,x,x) > ... > #else > ... > #endif > > What's your opinion? This is the suggested method to work around backcompatiblity issue in order to support different kernels (both old and new) IMHO. If there is BETTER one, I'd be pleased to see it. Thanks Yuan -- sheepdog mailing list sheepdog@lists.wpkg.org https://lists.wpkg.org/mailman/listinfo/sheepdog
Re: [sheepdog] [PATCH] sbd: use kstrtoul() instead of strict_strtoul()
At Sat, 31 Jan 2015 16:47:19 +0800, Liu Yuan wrote: > > On Tue, Jan 20, 2015 at 11:46:32AM +0900, Hitoshi Mitake wrote: > > Cc: hujianyang > > Signed-off-by: Hitoshi Mitake > > --- > > sbd/sheep_block_device.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/sbd/sheep_block_device.c b/sbd/sheep_block_device.c > > index eaee932..d82ff43 100644 > > --- a/sbd/sheep_block_device.c > > +++ b/sbd/sheep_block_device.c > > @@ -290,7 +290,7 @@ static ssize_t sbd_remove(struct bus_type *bus, const > > char *buf, > > unsigned long ul; > > int target_id, ret; > > > > - ret = strict_strtoul(buf, 10, &ul); > > + ret = kstrtoul(buf, 10, &ul); > > if (ret) > > return ret; > > I need to warn you of that: > > As far as I can remember, old kernel don't support kstrtoul such as famouse > 2.6.32. For compability issue, I chose strict_strtoul instead. In other words, > this patch will break SBD with old kernel, shipped on many distributions such > as centos 6. > > As as general practice for kernel module, we'd better use old function. > Actually > the later kernel just macro strict_strtoul as kstrtoul(). > > Thanks > Yuan > -- > sheepdog mailing list > sheepdog@lists.wpkg.org > https://lists.wpkg.org/mailman/listinfo/sheepdog OK, I revert this one. Thanks, Hitoshi -- sheepdog mailing list sheepdog@lists.wpkg.org https://lists.wpkg.org/mailman/listinfo/sheepdog