mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-21 12:41:26 +00:00
[PATCH 1/2] scst_sysfs: Make it easier to add new target sysfs attributes
This patch does not change any functionality. Signed-off-by: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5248 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1185,11 +1185,6 @@ static void scst_tgt_release(struct kobject *kobj)
|
||||
return;
|
||||
}
|
||||
|
||||
static struct kobj_type tgt_ktype = {
|
||||
.sysfs_ops = &scst_sysfs_ops,
|
||||
.release = scst_tgt_release,
|
||||
};
|
||||
|
||||
static int __scst_process_luns_mgmt_store(char *buffer,
|
||||
struct scst_tgt *tgt, struct scst_acg *acg, bool tgt_kobj)
|
||||
{
|
||||
@@ -2405,6 +2400,21 @@ out:
|
||||
}
|
||||
EXPORT_SYMBOL(scst_create_tgt_attr);
|
||||
|
||||
static struct attribute *scst_tgt_attrs[] = {
|
||||
&scst_rel_tgt_id.attr,
|
||||
&scst_tgt_comment.attr,
|
||||
&scst_tgt_addr_method.attr,
|
||||
&scst_tgt_io_grouping_type.attr,
|
||||
&scst_tgt_cpu_mask.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct kobj_type tgt_ktype = {
|
||||
.sysfs_ops = &scst_sysfs_ops,
|
||||
.release = scst_tgt_release,
|
||||
.default_attrs = scst_tgt_attrs,
|
||||
};
|
||||
|
||||
/*
|
||||
* Supposed to be called under scst_mutex. In case of error will drop,
|
||||
* then reacquire it.
|
||||
@@ -2468,45 +2478,6 @@ int scst_tgt_sysfs_create(struct scst_tgt *tgt)
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
res = sysfs_create_file(&tgt->tgt_kobj,
|
||||
&scst_rel_tgt_id.attr);
|
||||
if (res != 0) {
|
||||
PRINT_ERROR("Can't add attribute %s for tgt %s",
|
||||
scst_rel_tgt_id.attr.name, tgt->tgt_name);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
res = sysfs_create_file(&tgt->tgt_kobj,
|
||||
&scst_tgt_comment.attr);
|
||||
if (res != 0) {
|
||||
PRINT_ERROR("Can't add attribute %s for tgt %s",
|
||||
scst_tgt_comment.attr.name, tgt->tgt_name);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
res = sysfs_create_file(&tgt->tgt_kobj,
|
||||
&scst_tgt_addr_method.attr);
|
||||
if (res != 0) {
|
||||
PRINT_ERROR("Can't add attribute %s for tgt %s",
|
||||
scst_tgt_addr_method.attr.name, tgt->tgt_name);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
res = sysfs_create_file(&tgt->tgt_kobj,
|
||||
&scst_tgt_io_grouping_type.attr);
|
||||
if (res != 0) {
|
||||
PRINT_ERROR("Can't add attribute %s for tgt %s",
|
||||
scst_tgt_io_grouping_type.attr.name, tgt->tgt_name);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
res = sysfs_create_file(&tgt->tgt_kobj, &scst_tgt_cpu_mask.attr);
|
||||
if (res != 0) {
|
||||
PRINT_ERROR("Can't add attribute %s for tgt %s",
|
||||
scst_tgt_cpu_mask.attr.name, tgt->tgt_name);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
if (tgt->tgtt->tgt_attrs) {
|
||||
res = sysfs_create_files(&tgt->tgt_kobj, tgt->tgtt->tgt_attrs);
|
||||
if (res != 0) {
|
||||
|
||||
Reference in New Issue
Block a user