Lines Matching refs:opts
3020 struct fsg_opts *opts; in fsg_bind() local
3029 opts = fsg_opts_from_func_inst(f->fi); in fsg_bind()
3030 if (!opts->no_configfs) { in fsg_bind()
3150 static ssize_t fsg_lun_opts_file_show(struct fsg_lun_opts *opts, char *page) in fsg_lun_opts_file_show() argument
3154 fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent); in fsg_lun_opts_file_show()
3156 return fsg_show_file(opts->lun, &fsg_opts->common->filesem, page); in fsg_lun_opts_file_show()
3159 static ssize_t fsg_lun_opts_file_store(struct fsg_lun_opts *opts, in fsg_lun_opts_file_store() argument
3164 fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent); in fsg_lun_opts_file_store()
3166 return fsg_store_file(opts->lun, &fsg_opts->common->filesem, page, len); in fsg_lun_opts_file_store()
3173 static ssize_t fsg_lun_opts_ro_show(struct fsg_lun_opts *opts, char *page) in fsg_lun_opts_ro_show() argument
3175 return fsg_show_ro(opts->lun, page); in fsg_lun_opts_ro_show()
3178 static ssize_t fsg_lun_opts_ro_store(struct fsg_lun_opts *opts, in fsg_lun_opts_ro_store() argument
3183 fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent); in fsg_lun_opts_ro_store()
3185 return fsg_store_ro(opts->lun, &fsg_opts->common->filesem, page, len); in fsg_lun_opts_ro_store()
3192 static ssize_t fsg_lun_opts_removable_show(struct fsg_lun_opts *opts, in fsg_lun_opts_removable_show() argument
3195 return fsg_show_removable(opts->lun, page); in fsg_lun_opts_removable_show()
3198 static ssize_t fsg_lun_opts_removable_store(struct fsg_lun_opts *opts, in fsg_lun_opts_removable_store() argument
3201 return fsg_store_removable(opts->lun, page, len); in fsg_lun_opts_removable_store()
3209 static ssize_t fsg_lun_opts_cdrom_show(struct fsg_lun_opts *opts, char *page) in fsg_lun_opts_cdrom_show() argument
3211 return fsg_show_cdrom(opts->lun, page); in fsg_lun_opts_cdrom_show()
3214 static ssize_t fsg_lun_opts_cdrom_store(struct fsg_lun_opts *opts, in fsg_lun_opts_cdrom_store() argument
3219 fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent); in fsg_lun_opts_cdrom_store()
3221 return fsg_store_cdrom(opts->lun, &fsg_opts->common->filesem, page, in fsg_lun_opts_cdrom_store()
3229 static ssize_t fsg_lun_opts_nofua_show(struct fsg_lun_opts *opts, char *page) in fsg_lun_opts_nofua_show() argument
3231 return fsg_show_nofua(opts->lun, page); in fsg_lun_opts_nofua_show()
3234 static ssize_t fsg_lun_opts_nofua_store(struct fsg_lun_opts *opts, in fsg_lun_opts_nofua_store() argument
3237 return fsg_store_nofua(opts->lun, page, len); in fsg_lun_opts_nofua_store()
3262 struct fsg_lun_opts *opts; in fsg_lun_make() local
3290 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in fsg_lun_make()
3291 if (!opts) { in fsg_lun_make()
3302 kfree(opts); in fsg_lun_make()
3305 opts->lun = fsg_opts->common->luns[num]; in fsg_lun_make()
3306 opts->lun_id = num; in fsg_lun_make()
3309 config_group_init_type_name(&opts->group, name, &fsg_lun_type); in fsg_lun_make()
3311 return &opts->group; in fsg_lun_make()
3346 struct fsg_opts *opts = to_fsg_opts(item); in fsg_attr_release() local
3348 usb_put_function_instance(&opts->func_inst); in fsg_attr_release()
3357 static ssize_t fsg_opts_stall_show(struct fsg_opts *opts, char *page) in fsg_opts_stall_show() argument
3361 mutex_lock(&opts->lock); in fsg_opts_stall_show()
3362 result = sprintf(page, "%d", opts->common->can_stall); in fsg_opts_stall_show()
3363 mutex_unlock(&opts->lock); in fsg_opts_stall_show()
3368 static ssize_t fsg_opts_stall_store(struct fsg_opts *opts, const char *page, in fsg_opts_stall_store() argument
3374 mutex_lock(&opts->lock); in fsg_opts_stall_store()
3376 if (opts->refcnt) { in fsg_opts_stall_store()
3377 mutex_unlock(&opts->lock); in fsg_opts_stall_store()
3383 opts->common->can_stall = stall; in fsg_opts_stall_store()
3387 mutex_unlock(&opts->lock); in fsg_opts_stall_store()
3397 static ssize_t fsg_opts_num_buffers_show(struct fsg_opts *opts, char *page) in fsg_opts_num_buffers_show() argument
3401 mutex_lock(&opts->lock); in fsg_opts_num_buffers_show()
3402 result = sprintf(page, "%d", opts->common->fsg_num_buffers); in fsg_opts_num_buffers_show()
3403 mutex_unlock(&opts->lock); in fsg_opts_num_buffers_show()
3408 static ssize_t fsg_opts_num_buffers_store(struct fsg_opts *opts, in fsg_opts_num_buffers_store() argument
3414 mutex_lock(&opts->lock); in fsg_opts_num_buffers_store()
3415 if (opts->refcnt) { in fsg_opts_num_buffers_store()
3427 fsg_common_set_num_buffers(opts->common, num); in fsg_opts_num_buffers_store()
3431 mutex_unlock(&opts->lock); in fsg_opts_num_buffers_store()
3464 struct fsg_opts *opts; in fsg_free_inst() local
3466 opts = fsg_opts_from_func_inst(fi); in fsg_free_inst()
3467 fsg_common_put(opts->common); in fsg_free_inst()
3468 kfree(opts); in fsg_free_inst()
3473 struct fsg_opts *opts; in fsg_alloc_inst() local
3477 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in fsg_alloc_inst()
3478 if (!opts) in fsg_alloc_inst()
3480 mutex_init(&opts->lock); in fsg_alloc_inst()
3481 opts->func_inst.free_func_inst = fsg_free_inst; in fsg_alloc_inst()
3482 opts->common = fsg_common_setup(opts->common); in fsg_alloc_inst()
3483 if (IS_ERR(opts->common)) { in fsg_alloc_inst()
3484 rc = PTR_ERR(opts->common); in fsg_alloc_inst()
3488 rc = fsg_common_set_num_buffers(opts->common, in fsg_alloc_inst()
3497 rc = fsg_common_create_lun(opts->common, &config, 0, "lun.0", in fsg_alloc_inst()
3498 (const char **)&opts->func_inst.group.cg_item.ci_name); in fsg_alloc_inst()
3502 opts->lun0.lun = opts->common->luns[0]; in fsg_alloc_inst()
3503 opts->lun0.lun_id = 0; in fsg_alloc_inst()
3504 config_group_init_type_name(&opts->lun0.group, "lun.0", &fsg_lun_type); in fsg_alloc_inst()
3505 opts->default_groups[0] = &opts->lun0.group; in fsg_alloc_inst()
3506 opts->func_inst.group.default_groups = opts->default_groups; in fsg_alloc_inst()
3508 config_group_init_type_name(&opts->func_inst.group, "", &fsg_func_type); in fsg_alloc_inst()
3510 return &opts->func_inst; in fsg_alloc_inst()
3513 fsg_common_free_buffers(opts->common); in fsg_alloc_inst()
3515 kfree(opts); in fsg_alloc_inst()
3522 struct fsg_opts *opts; in fsg_free() local
3525 opts = container_of(f->fi, struct fsg_opts, func_inst); in fsg_free()
3527 mutex_lock(&opts->lock); in fsg_free()
3528 opts->refcnt--; in fsg_free()
3529 mutex_unlock(&opts->lock); in fsg_free()
3536 struct fsg_opts *opts = fsg_opts_from_func_inst(fi); in fsg_alloc() local
3537 struct fsg_common *common = opts->common; in fsg_alloc()
3544 mutex_lock(&opts->lock); in fsg_alloc()
3545 opts->refcnt++; in fsg_alloc()
3546 mutex_unlock(&opts->lock); in fsg_alloc()