scst, scst_local: Remove strict_strto*() calls

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6641 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2015-11-09 21:30:36 +00:00
parent f4bd4294a5
commit fecfbad5b7
5 changed files with 6 additions and 94 deletions

View File

@@ -1298,11 +1298,7 @@ static int __vdev_load_mode_pages(struct scst_vdisk_dev *virt_dev, char *params)
if (scst_get_next_lexem(&param)[0] != '\0')
goto out_too_many;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(pp, 0, &val);
#else
res = strict_strtoul(pp, 0, &val);
#endif
if (res != 0)
goto out_strtoul_failed;
@@ -7884,11 +7880,7 @@ static int vdev_parse_add_dev_params(struct scst_vdisk_dev *virt_dev,
continue;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoull(pp, 0, &val);
#else
res = strict_strtoull(pp, 0, &val);
#endif
if (res != 0) {
PRINT_ERROR("strtoull() for %s failed: %d (device %s)",
pp, res, virt_dev->name);
@@ -8831,7 +8823,7 @@ static ssize_t vdisk_sysfs_expl_alua_store(struct kobject *kobj,
dev = container_of(kobj, struct scst_device, dev_kobj);
virt_dev = dev->dh_priv;
sprintf(ch, "%.*s", min_t(int, sizeof(ch) - 1, count), buf);
res = kstrtoul(ch, NULL, &expl_alua);
res = kstrtoul(ch, 0, &expl_alua);
if (res < 0)
goto out;
@@ -8921,11 +8913,7 @@ static ssize_t vdev_sysfs_rz_store(struct kobject *kobj,
char ch[16];
sprintf(ch, "%.*s", min_t(int, sizeof(ch) - 1, count), buf);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtol(ch, 0, &read_zero);
#else
res = strict_strtol(ch, 0, &read_zero);
#endif
if (res)
goto out;
res = -EINVAL;
@@ -9140,11 +9128,7 @@ static int vdev_sysfs_process_cluster_mode_store(
* have been dropped before invoking .detach().
*/
virt_dev = dev->dh_priv;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtol(work->buf, 0, &clm);
#else
res = strict_strtol(work->buf, 0, &clm);
#endif
if (res)
goto unlock;
res = -EINVAL;

View File

@@ -3425,11 +3425,7 @@ static ssize_t scst_cm_allow_not_conn_copy_store(struct kobject *kobj,
TRACE_ENTRY();
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(buffer, 0, &val);
#else
res = strict_strtoul(buffer, 0, &val);
#endif
if (res != 0) {
PRINT_ERROR("strtoul() for %s failed: %zd", buffer, res);
goto out;

View File

@@ -14021,11 +14021,7 @@ int scst_restore_global_mode_pages(struct scst_device *dev, char *params,
if (scst_get_next_lexem(&param)[0] != '\0')
goto out_too_many;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(pp, 0, &val);
#else
res = strict_strtoul(pp, 0, &val);
#endif
if (res != 0)
goto out_strtoul_failed;

View File

@@ -272,11 +272,7 @@ static int scst_write_trace(const char *buf, size_t length,
}
break;
case SCST_TRACE_ACTION_VALUE:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(p, 0, &level);
#else
res = strict_strtoul(p, 0, &level);
#endif
if (res != 0) {
PRINT_ERROR("Invalid trace value \"%s\"", p);
res = -EINVAL;
@@ -1333,11 +1329,7 @@ static int __scst_process_luns_mgmt_store(char *buffer,
bool dev_replaced = false;
e = scst_get_next_lexem(&pp);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(e, 0, &virt_lun);
#else
res = strict_strtoul(e, 0, &virt_lun);
#endif
if (res != 0) {
PRINT_ERROR("Valid LUN required for dev %s (res %d)", p, res);
goto out_unlock;
@@ -1378,13 +1370,9 @@ static int __scst_process_luns_mgmt_store(char *buffer,
goto out_unlock;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(pp, 0, &val);
#else
res = strict_strtoul(pp, 0, &val);
#endif
if (res != 0) {
PRINT_ERROR("strict_strtoul() for %s failed: %d "
PRINT_ERROR("kstrtoul() for %s failed: %d "
"(device %s)", pp, res, dev->virt_name);
goto out_unlock;
}
@@ -1451,11 +1439,7 @@ static int __scst_process_luns_mgmt_store(char *buffer,
}
case SCST_LUN_ACTION_DEL:
p = scst_get_next_lexem(&pp);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(p, 0, &virt_lun);
#else
res = strict_strtoul(p, 0, &virt_lun);
#endif
if (res != 0)
goto out_unlock;
@@ -1767,11 +1751,7 @@ static ssize_t __scst_acg_io_grouping_type_store(struct scst_acg *acg,
min_t(int, strlen(SCST_IO_GROUPING_NEVER_STR), count)) == 0)
io_grouping_type = SCST_IO_GROUPING_NEVER;
else {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtol(buf, 0, &io_grouping_type);
#else
res = strict_strtol(buf, 0, &io_grouping_type);
#endif
if ((res != 0) || (io_grouping_type <= 0)) {
PRINT_ERROR("Unknown or not allowed I/O grouping type "
"%s", buf);
@@ -2477,11 +2457,7 @@ static ssize_t scst_rel_tgt_id_store(struct kobject *kobj,
tgt = container_of(kobj, struct scst_tgt, tgt_kobj);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(buf, 0, &rel_tgt_id);
#else
res = strict_strtoul(buf, 0, &rel_tgt_id);
#endif
if (res != 0) {
PRINT_ERROR("%s", "Wrong rel_tgt_id");
res = -EINVAL;
@@ -3347,13 +3323,9 @@ static ssize_t scst_dev_sysfs_threads_num_store(struct kobject *kobj,
dev = container_of(kobj, struct scst_device, dev_kobj);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtol(buf, 0, &newtn);
#else
res = strict_strtol(buf, 0, &newtn);
#endif
if (res != 0) {
PRINT_ERROR("strict_strtol() for %s failed: %d ", buf, res);
PRINT_ERROR("kstrtol() for %s failed: %d ", buf, res);
goto out;
}
if (newtn < 0) {
@@ -3908,11 +3880,7 @@ static ssize_t scst_dev_sysfs_dif_static_app_tag_store(struct kobject *kobj,
dev = container_of(kobj, struct scst_device, dev_kobj);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoull(buf, 0, &val);
#else
res = strict_strtoull(buf, 0, &val);
#endif
if (res != 0) {
PRINT_ERROR("strtoul() for %s failed: %d (device %s)",
buf, res, dev->virt_name);
@@ -6311,11 +6279,7 @@ static ssize_t scst_tg_tgt_rel_tgt_id_store(struct kobject *kobj,
TRACE_ENTRY();
tg_tgt = container_of(kobj, struct scst_tg_tgt, kobj);
snprintf(ch, sizeof(ch), "%.*s", min_t(int, count, sizeof(ch)-1), buf);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(ch, 0, &rel_tgt_id);
#else
res = strict_strtoul(ch, 0, &rel_tgt_id);
#endif
if (res)
goto out;
res = -EINVAL;
@@ -6405,11 +6369,7 @@ static ssize_t scst_tg_group_id_store(struct kobject *kobj,
TRACE_ENTRY();
tg = container_of(kobj, struct scst_target_group, kobj);
snprintf(ch, sizeof(ch), "%.*s", min_t(int, count, sizeof(ch)-1), buf);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(ch, 0, &group_id);
#else
res = strict_strtoul(ch, 0, &group_id);
#endif
if (res)
goto out;
res = -EINVAL;
@@ -6447,11 +6407,7 @@ static int scst_tg_preferred_store_work_fn(struct scst_sysfs_work_item *w)
TRACE_ENTRY();
cmd = w->buf;
tg = container_of(w->kobj, struct scst_target_group, kobj);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(cmd, 0, &preferred);
#else
res = strict_strtoul(cmd, 0, &preferred);
#endif
if (res)
goto out;
res = -EINVAL;
@@ -6985,13 +6941,9 @@ static ssize_t scst_threads_store(struct kobject *kobj,
TRACE_ENTRY();
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtol(buf, 0, &newtn);
#else
res = strict_strtol(buf, 0, &newtn);
#endif
if (res != 0) {
PRINT_ERROR("strict_strtol() for %s failed: %d ", buf, res);
PRINT_ERROR("kstrtol() for %s failed: %d ", buf, res);
goto out;
}
if (newtn <= 0) {
@@ -7041,13 +6993,9 @@ static ssize_t scst_setup_id_store(struct kobject *kobj,
TRACE_ENTRY();
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(buf, 0, &val);
#else
res = strict_strtoul(buf, 0, &val);
#endif
if (res != 0) {
PRINT_ERROR("strict_strtoul() for %s failed: %d ", buf, res);
PRINT_ERROR("kstrtoul() for %s failed: %d ", buf, res);
goto out;
}
@@ -7088,13 +7036,9 @@ static ssize_t scst_max_tasklet_cmd_store(struct kobject *kobj,
TRACE_ENTRY();
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(buf, 0, &val);
#else
res = strict_strtoul(buf, 0, &val);
#endif
if (res != 0) {
PRINT_ERROR("strict_strtoul() for %s failed: %d ", buf, res);
PRINT_ERROR("kstrtoul() for %s failed: %d ", buf, res);
goto out;
}

View File

@@ -446,11 +446,7 @@ static ssize_t scst_local_scsi_transport_version_store(struct kobject *kobj,
if (!tgt)
goto out_up;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(buffer, 0, &val);
#else
res = strict_strtoul(buffer, 0, &val);
#endif
if (res != 0) {
PRINT_ERROR("strtoul() for %s failed: %zd", buffer, res);
goto out_up;
@@ -516,11 +512,7 @@ static ssize_t scst_local_phys_transport_version_store(struct kobject *kobj,
if (!tgt)
goto out_up;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
res = kstrtoul(buffer, 0, &val);
#else
res = strict_strtoul(buffer, 0, &val);
#endif
if (res != 0) {
PRINT_ERROR("strtoul() for %s failed: %zd", buffer, res);
goto out_up;