Skip to content

Commit

Permalink
sbd: fix strict_strtoul for newer kernels
Browse files Browse the repository at this point in the history
strict_strtoul() was just a redefinition of kstrtoul() for a long
time. From kernel version of 3.18, strict_strtoul() will not be
defined at all. A compile time kernel version check is needed to
decide which function or macro can be used for a specific version of
kernel.

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
  • Loading branch information
vtolstov authored and mitake committed Oct 9, 2015
1 parent 9c65142 commit a8a7d11
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sbd/sheep_block_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,11 @@ static ssize_t sbd_remove(struct bus_type *bus, const char *buf,
struct sbd_device *dev;
unsigned long ul;
int target_id, ret;

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
ret = strict_strtoul(buf, 10, &ul);
#else
ret = kstrtoul(buf, 10, &ul);
#endif
if (ret)
return ret;

Expand Down

0 comments on commit a8a7d11

Please sign in to comment.