}
static struct configfs_item_operations fsg_lun_item_ops = {
- .release = fsg_lun_attr_release,
- .show_attribute = fsg_lun_opts_attr_show,
- .store_attribute = fsg_lun_opts_attr_store,
+ .release = fsg_lun_attr_release,
+ .show_attribute = fsg_lun_opts_attr_show,
+ .store_attribute = fsg_lun_opts_attr_store,
};
static ssize_t fsg_lun_opts_file_show(struct fsg_lun_opts *opts, char *page)
.ct_owner = THIS_MODULE,
};
-#define MAX_NAME_LEN 40
-
static struct config_group *fsg_lun_make(struct config_group *group,
const char *name)
{
fsg_opts = to_fsg_opts(&group->cg_item);
if (num >= FSG_MAX_LUNS)
- return ERR_PTR(-ENODEV);
+ return ERR_PTR(-ERANGE);
+
mutex_lock(&fsg_opts->lock);
if (fsg_opts->refcnt || fsg_opts->common->luns[num]) {
ret = -EBUSY;
memset(&config, 0, sizeof(config));
config.removable = true;
-
ret = fsg_common_create_lun(fsg_opts->common, &config, num, name,
(const char **)&group->cg_item.ci_name);
if (ret) {
}
static struct configfs_item_operations fsg_item_ops = {
- .release = fsg_attr_release,
- .show_attribute = fsg_opts_attr_show,
- .store_attribute = fsg_opts_attr_store,
+ .release = fsg_attr_release,
+ .show_attribute = fsg_opts_attr_show,
+ .store_attribute = fsg_opts_attr_store,
};
static ssize_t fsg_opts_stall_show(struct fsg_opts *opts, char *page)
size_t len)
{
int ret;
- u8 num;
+ bool stall;
mutex_lock(&opts->lock);
+
if (opts->refcnt) {
- ret = -EBUSY;
- goto end;
+ mutex_unlock(&opts->lock);
+ return -EBUSY;
}
- ret = kstrtou8(page, 0, &num);
- if (ret)
- goto end;
- opts->common->can_stall = num != 0;
- ret = len;
+ ret = strtobool(page, &stall);
+ if (!ret) {
+ opts->common->can_stall = stall;
+ ret = len;
+ }
-end:
mutex_unlock(&opts->lock);
+
return ret;
}