diff options
21 files changed, 1689 insertions, 3061 deletions
diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py index cda56df9b8a7..7d370c9b1450 100755 --- a/Documentation/target/tcm_mod_builder.py +++ b/Documentation/target/tcm_mod_builder.py | |||
@@ -203,8 +203,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
203 | buf += "#include <scsi/scsi_proto.h>\n\n" | 203 | buf += "#include <scsi/scsi_proto.h>\n\n" |
204 | buf += "#include <target/target_core_base.h>\n" | 204 | buf += "#include <target/target_core_base.h>\n" |
205 | buf += "#include <target/target_core_fabric.h>\n" | 205 | buf += "#include <target/target_core_fabric.h>\n" |
206 | buf += "#include <target/target_core_fabric_configfs.h>\n" | ||
207 | buf += "#include <target/configfs_macros.h>\n\n" | ||
208 | buf += "#include \"" + fabric_mod_name + "_base.h\"\n" | 206 | buf += "#include \"" + fabric_mod_name + "_base.h\"\n" |
209 | buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" | 207 | buf += "#include \"" + fabric_mod_name + "_fabric.h\"\n\n" |
210 | 208 | ||
@@ -283,19 +281,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
283 | buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + ", " + fabric_mod_port + "_wwn);\n" | 281 | buf += " struct " + fabric_mod_name + "_" + fabric_mod_port + ", " + fabric_mod_port + "_wwn);\n" |
284 | buf += " kfree(" + fabric_mod_port + ");\n" | 282 | buf += " kfree(" + fabric_mod_port + ");\n" |
285 | buf += "}\n\n" | 283 | buf += "}\n\n" |
286 | buf += "static ssize_t " + fabric_mod_name + "_wwn_show_attr_version(\n" | ||
287 | buf += " struct target_fabric_configfs *tf,\n" | ||
288 | buf += " char *page)\n" | ||
289 | buf += "{\n" | ||
290 | buf += " return sprintf(page, \"" + fabric_mod_name.upper() + " fabric module %s on %s/%s\"\n" | ||
291 | buf += " \"on \"UTS_RELEASE\"\\n\", " + fabric_mod_name.upper() + "_VERSION, utsname()->sysname,\n" | ||
292 | buf += " utsname()->machine);\n" | ||
293 | buf += "}\n\n" | ||
294 | buf += "TF_WWN_ATTR_RO(" + fabric_mod_name + ", version);\n\n" | ||
295 | buf += "static struct configfs_attribute *" + fabric_mod_name + "_wwn_attrs[] = {\n" | ||
296 | buf += " &" + fabric_mod_name + "_wwn_version.attr,\n" | ||
297 | buf += " NULL,\n" | ||
298 | buf += "};\n\n" | ||
299 | 284 | ||
300 | buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n" | 285 | buf += "static const struct target_core_fabric_ops " + fabric_mod_name + "_ops = {\n" |
301 | buf += " .module = THIS_MODULE,\n" | 286 | buf += " .module = THIS_MODULE,\n" |
@@ -328,8 +313,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): | |||
328 | buf += " .fabric_drop_wwn = " + fabric_mod_name + "_drop_" + fabric_mod_port + ",\n" | 313 | buf += " .fabric_drop_wwn = " + fabric_mod_name + "_drop_" + fabric_mod_port + ",\n" |
329 | buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n" | 314 | buf += " .fabric_make_tpg = " + fabric_mod_name + "_make_tpg,\n" |
330 | buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n" | 315 | buf += " .fabric_drop_tpg = " + fabric_mod_name + "_drop_tpg,\n" |
331 | buf += "\n" | ||
332 | buf += " .tfc_wwn_attrs = " + fabric_mod_name + "_wwn_attrs,\n" | ||
333 | buf += "};\n\n" | 316 | buf += "};\n\n" |
334 | 317 | ||
335 | buf += "static int __init " + fabric_mod_name + "_init(void)\n" | 318 | buf += "static int __init " + fabric_mod_name + "_init(void)\n" |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index f6fe0414139b..231d29cc0419 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -43,9 +43,7 @@ | |||
43 | #include <linux/atomic.h> | 43 | #include <linux/atomic.h> |
44 | #include <scsi/scsi_proto.h> | 44 | #include <scsi/scsi_proto.h> |
45 | #include <scsi/scsi_tcq.h> | 45 | #include <scsi/scsi_tcq.h> |
46 | #include <target/configfs_macros.h> | ||
47 | #include <target/target_core_base.h> | 46 | #include <target/target_core_base.h> |
48 | #include <target/target_core_fabric_configfs.h> | ||
49 | #include <target/target_core_fabric.h> | 47 | #include <target/target_core_fabric.h> |
50 | #include "ib_srpt.h" | 48 | #include "ib_srpt.h" |
51 | 49 | ||
@@ -3545,20 +3543,19 @@ static void srpt_cleanup_nodeacl(struct se_node_acl *se_nacl) | |||
3545 | spin_unlock_irq(&sport->port_acl_lock); | 3543 | spin_unlock_irq(&sport->port_acl_lock); |
3546 | } | 3544 | } |
3547 | 3545 | ||
3548 | static ssize_t srpt_tpg_attrib_show_srp_max_rdma_size( | 3546 | static ssize_t srpt_tpg_attrib_srp_max_rdma_size_show(struct config_item *item, |
3549 | struct se_portal_group *se_tpg, | 3547 | char *page) |
3550 | char *page) | ||
3551 | { | 3548 | { |
3549 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3552 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3550 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3553 | 3551 | ||
3554 | return sprintf(page, "%u\n", sport->port_attrib.srp_max_rdma_size); | 3552 | return sprintf(page, "%u\n", sport->port_attrib.srp_max_rdma_size); |
3555 | } | 3553 | } |
3556 | 3554 | ||
3557 | static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size( | 3555 | static ssize_t srpt_tpg_attrib_srp_max_rdma_size_store(struct config_item *item, |
3558 | struct se_portal_group *se_tpg, | 3556 | const char *page, size_t count) |
3559 | const char *page, | ||
3560 | size_t count) | ||
3561 | { | 3557 | { |
3558 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3562 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3559 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3563 | unsigned long val; | 3560 | unsigned long val; |
3564 | int ret; | 3561 | int ret; |
@@ -3583,22 +3580,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rdma_size( | |||
3583 | return count; | 3580 | return count; |
3584 | } | 3581 | } |
3585 | 3582 | ||
3586 | TF_TPG_ATTRIB_ATTR(srpt, srp_max_rdma_size, S_IRUGO | S_IWUSR); | 3583 | static ssize_t srpt_tpg_attrib_srp_max_rsp_size_show(struct config_item *item, |
3587 | 3584 | char *page) | |
3588 | static ssize_t srpt_tpg_attrib_show_srp_max_rsp_size( | ||
3589 | struct se_portal_group *se_tpg, | ||
3590 | char *page) | ||
3591 | { | 3585 | { |
3586 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3592 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3587 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3593 | 3588 | ||
3594 | return sprintf(page, "%u\n", sport->port_attrib.srp_max_rsp_size); | 3589 | return sprintf(page, "%u\n", sport->port_attrib.srp_max_rsp_size); |
3595 | } | 3590 | } |
3596 | 3591 | ||
3597 | static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size( | 3592 | static ssize_t srpt_tpg_attrib_srp_max_rsp_size_store(struct config_item *item, |
3598 | struct se_portal_group *se_tpg, | 3593 | const char *page, size_t count) |
3599 | const char *page, | ||
3600 | size_t count) | ||
3601 | { | 3594 | { |
3595 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3602 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3596 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3603 | unsigned long val; | 3597 | unsigned long val; |
3604 | int ret; | 3598 | int ret; |
@@ -3623,22 +3617,19 @@ static ssize_t srpt_tpg_attrib_store_srp_max_rsp_size( | |||
3623 | return count; | 3617 | return count; |
3624 | } | 3618 | } |
3625 | 3619 | ||
3626 | TF_TPG_ATTRIB_ATTR(srpt, srp_max_rsp_size, S_IRUGO | S_IWUSR); | 3620 | static ssize_t srpt_tpg_attrib_srp_sq_size_show(struct config_item *item, |
3627 | 3621 | char *page) | |
3628 | static ssize_t srpt_tpg_attrib_show_srp_sq_size( | ||
3629 | struct se_portal_group *se_tpg, | ||
3630 | char *page) | ||
3631 | { | 3622 | { |
3623 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3632 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3624 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3633 | 3625 | ||
3634 | return sprintf(page, "%u\n", sport->port_attrib.srp_sq_size); | 3626 | return sprintf(page, "%u\n", sport->port_attrib.srp_sq_size); |
3635 | } | 3627 | } |
3636 | 3628 | ||
3637 | static ssize_t srpt_tpg_attrib_store_srp_sq_size( | 3629 | static ssize_t srpt_tpg_attrib_srp_sq_size_store(struct config_item *item, |
3638 | struct se_portal_group *se_tpg, | 3630 | const char *page, size_t count) |
3639 | const char *page, | ||
3640 | size_t count) | ||
3641 | { | 3631 | { |
3632 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
3642 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3633 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3643 | unsigned long val; | 3634 | unsigned long val; |
3644 | int ret; | 3635 | int ret; |
@@ -3663,29 +3654,29 @@ static ssize_t srpt_tpg_attrib_store_srp_sq_size( | |||
3663 | return count; | 3654 | return count; |
3664 | } | 3655 | } |
3665 | 3656 | ||
3666 | TF_TPG_ATTRIB_ATTR(srpt, srp_sq_size, S_IRUGO | S_IWUSR); | 3657 | CONFIGFS_ATTR(srpt_tpg_attrib_, srp_max_rdma_size); |
3658 | CONFIGFS_ATTR(srpt_tpg_attrib_, srp_max_rsp_size); | ||
3659 | CONFIGFS_ATTR(srpt_tpg_attrib_, srp_sq_size); | ||
3667 | 3660 | ||
3668 | static struct configfs_attribute *srpt_tpg_attrib_attrs[] = { | 3661 | static struct configfs_attribute *srpt_tpg_attrib_attrs[] = { |
3669 | &srpt_tpg_attrib_srp_max_rdma_size.attr, | 3662 | &srpt_tpg_attrib_attr_srp_max_rdma_size, |
3670 | &srpt_tpg_attrib_srp_max_rsp_size.attr, | 3663 | &srpt_tpg_attrib_attr_srp_max_rsp_size, |
3671 | &srpt_tpg_attrib_srp_sq_size.attr, | 3664 | &srpt_tpg_attrib_attr_srp_sq_size, |
3672 | NULL, | 3665 | NULL, |
3673 | }; | 3666 | }; |
3674 | 3667 | ||
3675 | static ssize_t srpt_tpg_show_enable( | 3668 | static ssize_t srpt_tpg_enable_show(struct config_item *item, char *page) |
3676 | struct se_portal_group *se_tpg, | ||
3677 | char *page) | ||
3678 | { | 3669 | { |
3670 | struct se_portal_group *se_tpg = to_tpg(item); | ||
3679 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3671 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3680 | 3672 | ||
3681 | return snprintf(page, PAGE_SIZE, "%d\n", (sport->enabled) ? 1: 0); | 3673 | return snprintf(page, PAGE_SIZE, "%d\n", (sport->enabled) ? 1: 0); |
3682 | } | 3674 | } |
3683 | 3675 | ||
3684 | static ssize_t srpt_tpg_store_enable( | 3676 | static ssize_t srpt_tpg_enable_store(struct config_item *item, |
3685 | struct se_portal_group *se_tpg, | 3677 | const char *page, size_t count) |
3686 | const char *page, | ||
3687 | size_t count) | ||
3688 | { | 3678 | { |
3679 | struct se_portal_group *se_tpg = to_tpg(item); | ||
3689 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); | 3680 | struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); |
3690 | unsigned long tmp; | 3681 | unsigned long tmp; |
3691 | int ret; | 3682 | int ret; |
@@ -3708,10 +3699,10 @@ static ssize_t srpt_tpg_store_enable( | |||
3708 | return count; | 3699 | return count; |
3709 | } | 3700 | } |
3710 | 3701 | ||
3711 | TF_TPG_BASE_ATTR(srpt, enable, S_IRUGO | S_IWUSR); | 3702 | CONFIGFS_ATTR(srpt_tpg_, enable); |
3712 | 3703 | ||
3713 | static struct configfs_attribute *srpt_tpg_attrs[] = { | 3704 | static struct configfs_attribute *srpt_tpg_attrs[] = { |
3714 | &srpt_tpg_enable.attr, | 3705 | &srpt_tpg_attr_enable, |
3715 | NULL, | 3706 | NULL, |
3716 | }; | 3707 | }; |
3717 | 3708 | ||
@@ -3781,16 +3772,15 @@ static void srpt_drop_tport(struct se_wwn *wwn) | |||
3781 | pr_debug("drop_tport(%s\n", config_item_name(&sport->port_wwn.wwn_group.cg_item)); | 3772 | pr_debug("drop_tport(%s\n", config_item_name(&sport->port_wwn.wwn_group.cg_item)); |
3782 | } | 3773 | } |
3783 | 3774 | ||
3784 | static ssize_t srpt_wwn_show_attr_version(struct target_fabric_configfs *tf, | 3775 | static ssize_t srpt_wwn_version_show(struct config_item *item, char *buf) |
3785 | char *buf) | ||
3786 | { | 3776 | { |
3787 | return scnprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION); | 3777 | return scnprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION); |
3788 | } | 3778 | } |
3789 | 3779 | ||
3790 | TF_WWN_ATTR_RO(srpt, version); | 3780 | CONFIGFS_ATTR_RO(srpt_wwn_, version); |
3791 | 3781 | ||
3792 | static struct configfs_attribute *srpt_wwn_attrs[] = { | 3782 | static struct configfs_attribute *srpt_wwn_attrs[] = { |
3793 | &srpt_wwn_version.attr, | 3783 | &srpt_wwn_attr_version, |
3794 | NULL, | 3784 | NULL, |
3795 | }; | 3785 | }; |
3796 | 3786 | ||
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index ac65cb7b4886..3ba2e9564b9a 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -43,8 +43,6 @@ | |||
43 | #include <scsi/scsi_cmnd.h> | 43 | #include <scsi/scsi_cmnd.h> |
44 | #include <target/target_core_base.h> | 44 | #include <target/target_core_base.h> |
45 | #include <target/target_core_fabric.h> | 45 | #include <target/target_core_fabric.h> |
46 | #include <target/target_core_fabric_configfs.h> | ||
47 | #include <target/configfs_macros.h> | ||
48 | 46 | ||
49 | #include "qla_def.h" | 47 | #include "qla_def.h" |
50 | #include "qla_target.h" | 48 | #include "qla_target.h" |
@@ -729,23 +727,23 @@ static int tcm_qla2xxx_init_nodeacl(struct se_node_acl *se_nacl, | |||
729 | 727 | ||
730 | #define DEF_QLA_TPG_ATTRIB(name) \ | 728 | #define DEF_QLA_TPG_ATTRIB(name) \ |
731 | \ | 729 | \ |
732 | static ssize_t tcm_qla2xxx_tpg_attrib_show_##name( \ | 730 | static ssize_t tcm_qla2xxx_tpg_attrib_##name##_show( \ |
733 | struct se_portal_group *se_tpg, \ | 731 | struct config_item *item, char *page) \ |
734 | char *page) \ | ||
735 | { \ | 732 | { \ |
733 | struct se_portal_group *se_tpg = attrib_to_tpg(item); \ | ||
736 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \ | 734 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \ |
737 | struct tcm_qla2xxx_tpg, se_tpg); \ | 735 | struct tcm_qla2xxx_tpg, se_tpg); \ |
738 | \ | 736 | \ |
739 | return sprintf(page, "%u\n", tpg->tpg_attrib.name); \ | 737 | return sprintf(page, "%u\n", tpg->tpg_attrib.name); \ |
740 | } \ | 738 | } \ |
741 | \ | 739 | \ |
742 | static ssize_t tcm_qla2xxx_tpg_attrib_store_##name( \ | 740 | static ssize_t tcm_qla2xxx_tpg_attrib_##name##_store( \ |
743 | struct se_portal_group *se_tpg, \ | 741 | struct config_item *item, const char *page, size_t count) \ |
744 | const char *page, \ | ||
745 | size_t count) \ | ||
746 | { \ | 742 | { \ |
743 | struct se_portal_group *se_tpg = attrib_to_tpg(item); \ | ||
747 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \ | 744 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, \ |
748 | struct tcm_qla2xxx_tpg, se_tpg); \ | 745 | struct tcm_qla2xxx_tpg, se_tpg); \ |
746 | struct tcm_qla2xxx_tpg_attrib *a = &tpg->tpg_attrib; \ | ||
749 | unsigned long val; \ | 747 | unsigned long val; \ |
750 | int ret; \ | 748 | int ret; \ |
751 | \ | 749 | \ |
@@ -755,81 +753,39 @@ static ssize_t tcm_qla2xxx_tpg_attrib_store_##name( \ | |||
755 | " ret: %d\n", ret); \ | 753 | " ret: %d\n", ret); \ |
756 | return -EINVAL; \ | 754 | return -EINVAL; \ |
757 | } \ | 755 | } \ |
758 | ret = tcm_qla2xxx_set_attrib_##name(tpg, val); \ | ||
759 | \ | ||
760 | return (!ret) ? count : -EINVAL; \ | ||
761 | } | ||
762 | |||
763 | #define DEF_QLA_TPG_ATTR_BOOL(_name) \ | ||
764 | \ | ||
765 | static int tcm_qla2xxx_set_attrib_##_name( \ | ||
766 | struct tcm_qla2xxx_tpg *tpg, \ | ||
767 | unsigned long val) \ | ||
768 | { \ | ||
769 | struct tcm_qla2xxx_tpg_attrib *a = &tpg->tpg_attrib; \ | ||
770 | \ | 756 | \ |
771 | if ((val != 0) && (val != 1)) { \ | 757 | if ((val != 0) && (val != 1)) { \ |
772 | pr_err("Illegal boolean value %lu\n", val); \ | 758 | pr_err("Illegal boolean value %lu\n", val); \ |
773 | return -EINVAL; \ | 759 | return -EINVAL; \ |
774 | } \ | 760 | } \ |
775 | \ | 761 | \ |
776 | a->_name = val; \ | 762 | a->name = val; \ |
777 | return 0; \ | 763 | \ |
778 | } | 764 | return count; \ |
779 | 765 | } \ | |
780 | #define QLA_TPG_ATTR(_name, _mode) \ | 766 | CONFIGFS_ATTR(tcm_qla2xxx_tpg_attrib_, name) |
781 | TF_TPG_ATTRIB_ATTR(tcm_qla2xxx, _name, _mode); | ||
782 | 767 | ||
783 | /* | ||
784 | * Define tcm_qla2xxx_tpg_attrib_s_generate_node_acls | ||
785 | */ | ||
786 | DEF_QLA_TPG_ATTR_BOOL(generate_node_acls); | ||
787 | DEF_QLA_TPG_ATTRIB(generate_node_acls); | 768 | DEF_QLA_TPG_ATTRIB(generate_node_acls); |
788 | QLA_TPG_ATTR(generate_node_acls, S_IRUGO | S_IWUSR); | ||
789 | |||
790 | /* | ||
791 | Define tcm_qla2xxx_attrib_s_cache_dynamic_acls | ||
792 | */ | ||
793 | DEF_QLA_TPG_ATTR_BOOL(cache_dynamic_acls); | ||
794 | DEF_QLA_TPG_ATTRIB(cache_dynamic_acls); | 769 | DEF_QLA_TPG_ATTRIB(cache_dynamic_acls); |
795 | QLA_TPG_ATTR(cache_dynamic_acls, S_IRUGO | S_IWUSR); | ||
796 | |||
797 | /* | ||
798 | * Define tcm_qla2xxx_tpg_attrib_s_demo_mode_write_protect | ||
799 | */ | ||
800 | DEF_QLA_TPG_ATTR_BOOL(demo_mode_write_protect); | ||
801 | DEF_QLA_TPG_ATTRIB(demo_mode_write_protect); | 770 | DEF_QLA_TPG_ATTRIB(demo_mode_write_protect); |
802 | QLA_TPG_ATTR(demo_mode_write_protect, S_IRUGO | S_IWUSR); | ||
803 | |||
804 | /* | ||
805 | * Define tcm_qla2xxx_tpg_attrib_s_prod_mode_write_protect | ||
806 | */ | ||
807 | DEF_QLA_TPG_ATTR_BOOL(prod_mode_write_protect); | ||
808 | DEF_QLA_TPG_ATTRIB(prod_mode_write_protect); | 771 | DEF_QLA_TPG_ATTRIB(prod_mode_write_protect); |
809 | QLA_TPG_ATTR(prod_mode_write_protect, S_IRUGO | S_IWUSR); | ||
810 | |||
811 | /* | ||
812 | * Define tcm_qla2xxx_tpg_attrib_s_demo_mode_login_only | ||
813 | */ | ||
814 | DEF_QLA_TPG_ATTR_BOOL(demo_mode_login_only); | ||
815 | DEF_QLA_TPG_ATTRIB(demo_mode_login_only); | 772 | DEF_QLA_TPG_ATTRIB(demo_mode_login_only); |
816 | QLA_TPG_ATTR(demo_mode_login_only, S_IRUGO | S_IWUSR); | ||
817 | 773 | ||
818 | static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { | 774 | static struct configfs_attribute *tcm_qla2xxx_tpg_attrib_attrs[] = { |
819 | &tcm_qla2xxx_tpg_attrib_generate_node_acls.attr, | 775 | &tcm_qla2xxx_tpg_attrib_attr_generate_node_acls, |
820 | &tcm_qla2xxx_tpg_attrib_cache_dynamic_acls.attr, | 776 | &tcm_qla2xxx_tpg_attrib_attr_cache_dynamic_acls, |
821 | &tcm_qla2xxx_tpg_attrib_demo_mode_write_protect.attr, | 777 | &tcm_qla2xxx_tpg_attrib_attr_demo_mode_write_protect, |
822 | &tcm_qla2xxx_tpg_attrib_prod_mode_write_protect.attr, | 778 | &tcm_qla2xxx_tpg_attrib_attr_prod_mode_write_protect, |
823 | &tcm_qla2xxx_tpg_attrib_demo_mode_login_only.attr, | 779 | &tcm_qla2xxx_tpg_attrib_attr_demo_mode_login_only, |
824 | NULL, | 780 | NULL, |
825 | }; | 781 | }; |
826 | 782 | ||
827 | /* End items for tcm_qla2xxx_tpg_attrib_cit */ | 783 | /* End items for tcm_qla2xxx_tpg_attrib_cit */ |
828 | 784 | ||
829 | static ssize_t tcm_qla2xxx_tpg_show_enable( | 785 | static ssize_t tcm_qla2xxx_tpg_enable_show(struct config_item *item, |
830 | struct se_portal_group *se_tpg, | 786 | char *page) |
831 | char *page) | ||
832 | { | 787 | { |
788 | struct se_portal_group *se_tpg = to_tpg(item); | ||
833 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 789 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
834 | struct tcm_qla2xxx_tpg, se_tpg); | 790 | struct tcm_qla2xxx_tpg, se_tpg); |
835 | 791 | ||
@@ -865,11 +821,10 @@ static void tcm_qla2xxx_undepend_tpg(struct work_struct *work) | |||
865 | complete(&base_tpg->tpg_base_comp); | 821 | complete(&base_tpg->tpg_base_comp); |
866 | } | 822 | } |
867 | 823 | ||
868 | static ssize_t tcm_qla2xxx_tpg_store_enable( | 824 | static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item, |
869 | struct se_portal_group *se_tpg, | 825 | const char *page, size_t count) |
870 | const char *page, | ||
871 | size_t count) | ||
872 | { | 826 | { |
827 | struct se_portal_group *se_tpg = to_tpg(item); | ||
873 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 828 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
874 | struct tcm_qla2xxx_tpg, se_tpg); | 829 | struct tcm_qla2xxx_tpg, se_tpg); |
875 | unsigned long op; | 830 | unsigned long op; |
@@ -909,22 +864,16 @@ static ssize_t tcm_qla2xxx_tpg_store_enable( | |||
909 | return count; | 864 | return count; |
910 | } | 865 | } |
911 | 866 | ||
912 | TF_TPG_BASE_ATTR(tcm_qla2xxx, enable, S_IRUGO | S_IWUSR); | 867 | static ssize_t tcm_qla2xxx_tpg_dynamic_sessions_show(struct config_item *item, |
913 | 868 | char *page) | |
914 | static ssize_t tcm_qla2xxx_tpg_show_dynamic_sessions( | ||
915 | struct se_portal_group *se_tpg, | ||
916 | char *page) | ||
917 | { | 869 | { |
918 | return target_show_dynamic_sessions(se_tpg, page); | 870 | return target_show_dynamic_sessions(to_tpg(item), page); |
919 | } | 871 | } |
920 | 872 | ||
921 | TF_TPG_BASE_ATTR_RO(tcm_qla2xxx, dynamic_sessions); | 873 | static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_store(struct config_item *item, |
922 | 874 | const char *page, size_t count) | |
923 | static ssize_t tcm_qla2xxx_tpg_store_fabric_prot_type( | ||
924 | struct se_portal_group *se_tpg, | ||
925 | const char *page, | ||
926 | size_t count) | ||
927 | { | 875 | { |
876 | struct se_portal_group *se_tpg = to_tpg(item); | ||
928 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 877 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
929 | struct tcm_qla2xxx_tpg, se_tpg); | 878 | struct tcm_qla2xxx_tpg, se_tpg); |
930 | unsigned long val; | 879 | unsigned long val; |
@@ -943,21 +892,24 @@ static ssize_t tcm_qla2xxx_tpg_store_fabric_prot_type( | |||
943 | return count; | 892 | return count; |
944 | } | 893 | } |
945 | 894 | ||
946 | static ssize_t tcm_qla2xxx_tpg_show_fabric_prot_type( | 895 | static ssize_t tcm_qla2xxx_tpg_fabric_prot_type_show(struct config_item *item, |
947 | struct se_portal_group *se_tpg, | 896 | char *page) |
948 | char *page) | ||
949 | { | 897 | { |
898 | struct se_portal_group *se_tpg = to_tpg(item); | ||
950 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 899 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
951 | struct tcm_qla2xxx_tpg, se_tpg); | 900 | struct tcm_qla2xxx_tpg, se_tpg); |
952 | 901 | ||
953 | return sprintf(page, "%d\n", tpg->tpg_attrib.fabric_prot_type); | 902 | return sprintf(page, "%d\n", tpg->tpg_attrib.fabric_prot_type); |
954 | } | 903 | } |
955 | TF_TPG_BASE_ATTR(tcm_qla2xxx, fabric_prot_type, S_IRUGO | S_IWUSR); | 904 | |
905 | CONFIGFS_ATTR_WO(tcm_qla2xxx_tpg_, enable); | ||
906 | CONFIGFS_ATTR_RO(tcm_qla2xxx_tpg_, dynamic_sessions); | ||
907 | CONFIGFS_ATTR(tcm_qla2xxx_tpg_, fabric_prot_type); | ||
956 | 908 | ||
957 | static struct configfs_attribute *tcm_qla2xxx_tpg_attrs[] = { | 909 | static struct configfs_attribute *tcm_qla2xxx_tpg_attrs[] = { |
958 | &tcm_qla2xxx_tpg_enable.attr, | 910 | &tcm_qla2xxx_tpg_attr_enable, |
959 | &tcm_qla2xxx_tpg_dynamic_sessions.attr, | 911 | &tcm_qla2xxx_tpg_attr_dynamic_sessions, |
960 | &tcm_qla2xxx_tpg_fabric_prot_type.attr, | 912 | &tcm_qla2xxx_tpg_attr_fabric_prot_type, |
961 | NULL, | 913 | NULL, |
962 | }; | 914 | }; |
963 | 915 | ||
@@ -1030,18 +982,16 @@ static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg) | |||
1030 | kfree(tpg); | 982 | kfree(tpg); |
1031 | } | 983 | } |
1032 | 984 | ||
1033 | static ssize_t tcm_qla2xxx_npiv_tpg_show_enable( | 985 | static ssize_t tcm_qla2xxx_npiv_tpg_enable_show(struct config_item *item, |
1034 | struct se_portal_group *se_tpg, | 986 | char *page) |
1035 | char *page) | ||
1036 | { | 987 | { |
1037 | return tcm_qla2xxx_tpg_show_enable(se_tpg, page); | 988 | return tcm_qla2xxx_tpg_enable_show(item, page); |
1038 | } | 989 | } |
1039 | 990 | ||
1040 | static ssize_t tcm_qla2xxx_npiv_tpg_store_enable( | 991 | static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item, |
1041 | struct se_portal_group *se_tpg, | 992 | const char *page, size_t count) |
1042 | const char *page, | ||
1043 | size_t count) | ||
1044 | { | 993 | { |
994 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1045 | struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; | 995 | struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; |
1046 | struct tcm_qla2xxx_lport *lport = container_of(se_wwn, | 996 | struct tcm_qla2xxx_lport *lport = container_of(se_wwn, |
1047 | struct tcm_qla2xxx_lport, lport_wwn); | 997 | struct tcm_qla2xxx_lport, lport_wwn); |
@@ -1077,10 +1027,10 @@ static ssize_t tcm_qla2xxx_npiv_tpg_store_enable( | |||
1077 | return count; | 1027 | return count; |
1078 | } | 1028 | } |
1079 | 1029 | ||
1080 | TF_TPG_BASE_ATTR(tcm_qla2xxx_npiv, enable, S_IRUGO | S_IWUSR); | 1030 | CONFIGFS_ATTR(tcm_qla2xxx_npiv_tpg_, enable); |
1081 | 1031 | ||
1082 | static struct configfs_attribute *tcm_qla2xxx_npiv_tpg_attrs[] = { | 1032 | static struct configfs_attribute *tcm_qla2xxx_npiv_tpg_attrs[] = { |
1083 | &tcm_qla2xxx_npiv_tpg_enable.attr, | 1033 | &tcm_qla2xxx_npiv_tpg_attr_enable, |
1084 | NULL, | 1034 | NULL, |
1085 | }; | 1035 | }; |
1086 | 1036 | ||
@@ -1783,9 +1733,8 @@ static void tcm_qla2xxx_npiv_drop_lport(struct se_wwn *wwn) | |||
1783 | } | 1733 | } |
1784 | 1734 | ||
1785 | 1735 | ||
1786 | static ssize_t tcm_qla2xxx_wwn_show_attr_version( | 1736 | static ssize_t tcm_qla2xxx_wwn_version_show(struct config_item *item, |
1787 | struct target_fabric_configfs *tf, | 1737 | char *page) |
1788 | char *page) | ||
1789 | { | 1738 | { |
1790 | return sprintf(page, | 1739 | return sprintf(page, |
1791 | "TCM QLOGIC QLA2XXX NPIV capable fabric module %s on %s/%s on " | 1740 | "TCM QLOGIC QLA2XXX NPIV capable fabric module %s on %s/%s on " |
@@ -1793,10 +1742,10 @@ static ssize_t tcm_qla2xxx_wwn_show_attr_version( | |||
1793 | utsname()->machine); | 1742 | utsname()->machine); |
1794 | } | 1743 | } |
1795 | 1744 | ||
1796 | TF_WWN_ATTR_RO(tcm_qla2xxx, version); | 1745 | CONFIGFS_ATTR_RO(tcm_qla2xxx_wwn_, version); |
1797 | 1746 | ||
1798 | static struct configfs_attribute *tcm_qla2xxx_wwn_attrs[] = { | 1747 | static struct configfs_attribute *tcm_qla2xxx_wwn_attrs[] = { |
1799 | &tcm_qla2xxx_wwn_version.attr, | 1748 | &tcm_qla2xxx_wwn_attr_version, |
1800 | NULL, | 1749 | NULL, |
1801 | }; | 1750 | }; |
1802 | 1751 | ||
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index c7461d770d3a..255204cc43e6 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -23,8 +23,6 @@ | |||
23 | #include <linux/inet.h> | 23 | #include <linux/inet.h> |
24 | #include <target/target_core_base.h> | 24 | #include <target/target_core_base.h> |
25 | #include <target/target_core_fabric.h> | 25 | #include <target/target_core_fabric.h> |
26 | #include <target/target_core_fabric_configfs.h> | ||
27 | #include <target/configfs_macros.h> | ||
28 | #include <target/iscsi/iscsi_transport.h> | 26 | #include <target/iscsi/iscsi_transport.h> |
29 | 27 | ||
30 | #include <target/iscsi/iscsi_target_core.h> | 28 | #include <target/iscsi/iscsi_target_core.h> |
@@ -37,20 +35,17 @@ | |||
37 | #include "iscsi_target.h" | 35 | #include "iscsi_target.h" |
38 | #include <target/iscsi/iscsi_target_stat.h> | 36 | #include <target/iscsi/iscsi_target_stat.h> |
39 | 37 | ||
40 | struct lio_target_configfs_attribute { | ||
41 | struct configfs_attribute attr; | ||
42 | ssize_t (*show)(void *, char *); | ||
43 | ssize_t (*store)(void *, const char *, size_t); | ||
44 | }; | ||
45 | 38 | ||
46 | /* Start items for lio_target_portal_cit */ | 39 | /* Start items for lio_target_portal_cit */ |
47 | 40 | ||
48 | static ssize_t lio_target_np_show_sctp( | 41 | static inline struct iscsi_tpg_np *to_iscsi_tpg_np(struct config_item *item) |
49 | struct se_tpg_np *se_tpg_np, | 42 | { |
50 | char *page) | 43 | return container_of(to_tpg_np(item), struct iscsi_tpg_np, se_tpg_np); |
44 | } | ||
45 | |||
46 | static ssize_t lio_target_np_sctp_show(struct config_item *item, char *page) | ||
51 | { | 47 | { |
52 | struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np, | 48 | struct iscsi_tpg_np *tpg_np = to_iscsi_tpg_np(item); |
53 | struct iscsi_tpg_np, se_tpg_np); | ||
54 | struct iscsi_tpg_np *tpg_np_sctp; | 49 | struct iscsi_tpg_np *tpg_np_sctp; |
55 | ssize_t rb; | 50 | ssize_t rb; |
56 | 51 | ||
@@ -63,15 +58,12 @@ static ssize_t lio_target_np_show_sctp( | |||
63 | return rb; | 58 | return rb; |
64 | } | 59 | } |
65 | 60 | ||
66 | static ssize_t lio_target_np_store_sctp( | 61 | static ssize_t lio_target_np_sctp_store(struct config_item *item, |
67 | struct se_tpg_np *se_tpg_np, | 62 | const char *page, size_t count) |
68 | const char *page, | ||
69 | size_t count) | ||
70 | { | 63 | { |
64 | struct iscsi_tpg_np *tpg_np = to_iscsi_tpg_np(item); | ||
71 | struct iscsi_np *np; | 65 | struct iscsi_np *np; |
72 | struct iscsi_portal_group *tpg; | 66 | struct iscsi_portal_group *tpg; |
73 | struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np, | ||
74 | struct iscsi_tpg_np, se_tpg_np); | ||
75 | struct iscsi_tpg_np *tpg_np_sctp = NULL; | 67 | struct iscsi_tpg_np *tpg_np_sctp = NULL; |
76 | u32 op; | 68 | u32 op; |
77 | int ret; | 69 | int ret; |
@@ -119,14 +111,9 @@ out: | |||
119 | return -EINVAL; | 111 | return -EINVAL; |
120 | } | 112 | } |
121 | 113 | ||
122 | TF_NP_BASE_ATTR(lio_target, sctp, S_IRUGO | S_IWUSR); | 114 | static ssize_t lio_target_np_iser_show(struct config_item *item, char *page) |
123 | |||
124 | static ssize_t lio_target_np_show_iser( | ||
125 | struct se_tpg_np *se_tpg_np, | ||
126 | char *page) | ||
127 | { | 115 | { |
128 | struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np, | 116 | struct iscsi_tpg_np *tpg_np = to_iscsi_tpg_np(item); |
129 | struct iscsi_tpg_np, se_tpg_np); | ||
130 | struct iscsi_tpg_np *tpg_np_iser; | 117 | struct iscsi_tpg_np *tpg_np_iser; |
131 | ssize_t rb; | 118 | ssize_t rb; |
132 | 119 | ||
@@ -139,15 +126,12 @@ static ssize_t lio_target_np_show_iser( | |||
139 | return rb; | 126 | return rb; |
140 | } | 127 | } |
141 | 128 | ||
142 | static ssize_t lio_target_np_store_iser( | 129 | static ssize_t lio_target_np_iser_store(struct config_item *item, |
143 | struct se_tpg_np *se_tpg_np, | 130 | const char *page, size_t count) |
144 | const char *page, | ||
145 | size_t count) | ||
146 | { | 131 | { |
132 | struct iscsi_tpg_np *tpg_np = to_iscsi_tpg_np(item); | ||
147 | struct iscsi_np *np; | 133 | struct iscsi_np *np; |
148 | struct iscsi_portal_group *tpg; | 134 | struct iscsi_portal_group *tpg; |
149 | struct iscsi_tpg_np *tpg_np = container_of(se_tpg_np, | ||
150 | struct iscsi_tpg_np, se_tpg_np); | ||
151 | struct iscsi_tpg_np *tpg_np_iser = NULL; | 135 | struct iscsi_tpg_np *tpg_np_iser = NULL; |
152 | char *endptr; | 136 | char *endptr; |
153 | u32 op; | 137 | u32 op; |
@@ -198,11 +182,12 @@ out: | |||
198 | return rc; | 182 | return rc; |
199 | } | 183 | } |
200 | 184 | ||
201 | TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR); | 185 | CONFIGFS_ATTR(lio_target_np_, sctp); |
186 | CONFIGFS_ATTR(lio_target_np_, iser); | ||
202 | 187 | ||
203 | static struct configfs_attribute *lio_target_portal_attrs[] = { | 188 | static struct configfs_attribute *lio_target_portal_attrs[] = { |
204 | &lio_target_np_sctp.attr, | 189 | &lio_target_np_attr_sctp, |
205 | &lio_target_np_iser.attr, | 190 | &lio_target_np_attr_iser, |
206 | NULL, | 191 | NULL, |
207 | }; | 192 | }; |
208 | 193 | ||
@@ -360,22 +345,21 @@ out: | |||
360 | 345 | ||
361 | /* Start items for lio_target_nacl_attrib_cit */ | 346 | /* Start items for lio_target_nacl_attrib_cit */ |
362 | 347 | ||
363 | #define DEF_NACL_ATTRIB(name) \ | 348 | #define ISCSI_NACL_ATTR(name) \ |
364 | static ssize_t iscsi_nacl_attrib_show_##name( \ | 349 | static ssize_t iscsi_nacl_attrib_##name##_show(struct config_item *item,\ |
365 | struct se_node_acl *se_nacl, \ | 350 | char *page) \ |
366 | char *page) \ | ||
367 | { \ | 351 | { \ |
352 | struct se_node_acl *se_nacl = attrib_to_nacl(item); \ | ||
368 | struct iscsi_node_acl *nacl = container_of(se_nacl, struct iscsi_node_acl, \ | 353 | struct iscsi_node_acl *nacl = container_of(se_nacl, struct iscsi_node_acl, \ |
369 | se_node_acl); \ | 354 | se_node_acl); \ |
370 | \ | 355 | \ |
371 | return sprintf(page, "%u\n", nacl->node_attrib.name); \ | 356 | return sprintf(page, "%u\n", nacl->node_attrib.name); \ |
372 | } \ | 357 | } \ |
373 | \ | 358 | \ |
374 | static ssize_t iscsi_nacl_attrib_store_##name( \ | 359 | static ssize_t iscsi_nacl_attrib_##name##_store(struct config_item *item,\ |
375 | struct se_node_acl *se_nacl, \ | 360 | const char *page, size_t count) \ |
376 | const char *page, \ | ||
377 | size_t count) \ | ||
378 | { \ | 361 | { \ |
362 | struct se_node_acl *se_nacl = attrib_to_nacl(item); \ | ||
379 | struct iscsi_node_acl *nacl = container_of(se_nacl, struct iscsi_node_acl, \ | 363 | struct iscsi_node_acl *nacl = container_of(se_nacl, struct iscsi_node_acl, \ |
380 | se_node_acl); \ | 364 | se_node_acl); \ |
381 | u32 val; \ | 365 | u32 val; \ |
@@ -389,59 +373,28 @@ static ssize_t iscsi_nacl_attrib_store_##name( \ | |||
389 | return ret; \ | 373 | return ret; \ |
390 | \ | 374 | \ |
391 | return count; \ | 375 | return count; \ |
392 | } | 376 | } \ |
377 | \ | ||
378 | CONFIGFS_ATTR(iscsi_nacl_attrib_, name) | ||
393 | 379 | ||
394 | #define NACL_ATTR(_name, _mode) TF_NACL_ATTRIB_ATTR(iscsi, _name, _mode); | 380 | ISCSI_NACL_ATTR(dataout_timeout); |
395 | /* | 381 | ISCSI_NACL_ATTR(dataout_timeout_retries); |
396 | * Define iscsi_node_attrib_s_dataout_timeout | 382 | ISCSI_NACL_ATTR(default_erl); |
397 | */ | 383 | ISCSI_NACL_ATTR(nopin_timeout); |
398 | DEF_NACL_ATTRIB(dataout_timeout); | 384 | ISCSI_NACL_ATTR(nopin_response_timeout); |
399 | NACL_ATTR(dataout_timeout, S_IRUGO | S_IWUSR); | 385 | ISCSI_NACL_ATTR(random_datain_pdu_offsets); |
400 | /* | 386 | ISCSI_NACL_ATTR(random_datain_seq_offsets); |
401 | * Define iscsi_node_attrib_s_dataout_timeout_retries | 387 | ISCSI_NACL_ATTR(random_r2t_offsets); |
402 | */ | ||
403 | DEF_NACL_ATTRIB(dataout_timeout_retries); | ||
404 | NACL_ATTR(dataout_timeout_retries, S_IRUGO | S_IWUSR); | ||
405 | /* | ||
406 | * Define iscsi_node_attrib_s_default_erl | ||
407 | */ | ||
408 | DEF_NACL_ATTRIB(default_erl); | ||
409 | NACL_ATTR(default_erl, S_IRUGO | S_IWUSR); | ||
410 | /* | ||
411 | * Define iscsi_node_attrib_s_nopin_timeout | ||
412 | */ | ||
413 | DEF_NACL_ATTRIB(nopin_timeout); | ||
414 | NACL_ATTR(nopin_timeout, S_IRUGO | S_IWUSR); | ||
415 | /* | ||
416 | * Define iscsi_node_attrib_s_nopin_response_timeout | ||
417 | */ | ||
418 | DEF_NACL_ATTRIB(nopin_response_timeout); | ||
419 | NACL_ATTR(nopin_response_timeout, S_IRUGO | S_IWUSR); | ||
420 | /* | ||
421 | * Define iscsi_node_attrib_s_random_datain_pdu_offsets | ||
422 | */ | ||
423 | DEF_NACL_ATTRIB(random_datain_pdu_offsets); | ||
424 | NACL_ATTR(random_datain_pdu_offsets, S_IRUGO | S_IWUSR); | ||
425 | /* | ||
426 | * Define iscsi_node_attrib_s_random_datain_seq_offsets | ||
427 | */ | ||
428 | DEF_NACL_ATTRIB(random_datain_seq_offsets); | ||
429 | NACL_ATTR(random_datain_seq_offsets, S_IRUGO | S_IWUSR); | ||
430 | /* | ||
431 | * Define iscsi_node_attrib_s_random_r2t_offsets | ||
432 | */ | ||
433 | DEF_NACL_ATTRIB(random_r2t_offsets); | ||
434 | NACL_ATTR(random_r2t_offsets, S_IRUGO | S_IWUSR); | ||
435 | 388 | ||
436 | static struct configfs_attribute *lio_target_nacl_attrib_attrs[] = { | 389 | static struct configfs_attribute *lio_target_nacl_attrib_attrs[] = { |
437 | &iscsi_nacl_attrib_dataout_timeout.attr, | 390 | &iscsi_nacl_attrib_attr_dataout_timeout, |
438 | &iscsi_nacl_attrib_dataout_timeout_retries.attr, | 391 | &iscsi_nacl_attrib_attr_dataout_timeout_retries, |
439 | &iscsi_nacl_attrib_default_erl.attr, | 392 | &iscsi_nacl_attrib_attr_default_erl, |
440 | &iscsi_nacl_attrib_nopin_timeout.attr, | 393 | &iscsi_nacl_attrib_attr_nopin_timeout, |
441 | &iscsi_nacl_attrib_nopin_response_timeout.attr, | 394 | &iscsi_nacl_attrib_attr_nopin_response_timeout, |
442 | &iscsi_nacl_attrib_random_datain_pdu_offsets.attr, | 395 | &iscsi_nacl_attrib_attr_random_datain_pdu_offsets, |
443 | &iscsi_nacl_attrib_random_datain_seq_offsets.attr, | 396 | &iscsi_nacl_attrib_attr_random_datain_seq_offsets, |
444 | &iscsi_nacl_attrib_random_r2t_offsets.attr, | 397 | &iscsi_nacl_attrib_attr_random_r2t_offsets, |
445 | NULL, | 398 | NULL, |
446 | }; | 399 | }; |
447 | 400 | ||
@@ -450,7 +403,7 @@ static struct configfs_attribute *lio_target_nacl_attrib_attrs[] = { | |||
450 | /* Start items for lio_target_nacl_auth_cit */ | 403 | /* Start items for lio_target_nacl_auth_cit */ |
451 | 404 | ||
452 | #define __DEF_NACL_AUTH_STR(prefix, name, flags) \ | 405 | #define __DEF_NACL_AUTH_STR(prefix, name, flags) \ |
453 | static ssize_t __iscsi_##prefix##_show_##name( \ | 406 | static ssize_t __iscsi_##prefix##_##name##_show( \ |
454 | struct iscsi_node_acl *nacl, \ | 407 | struct iscsi_node_acl *nacl, \ |
455 | char *page) \ | 408 | char *page) \ |
456 | { \ | 409 | { \ |
@@ -461,7 +414,7 @@ static ssize_t __iscsi_##prefix##_show_##name( \ | |||
461 | return snprintf(page, PAGE_SIZE, "%s\n", auth->name); \ | 414 | return snprintf(page, PAGE_SIZE, "%s\n", auth->name); \ |
462 | } \ | 415 | } \ |
463 | \ | 416 | \ |
464 | static ssize_t __iscsi_##prefix##_store_##name( \ | 417 | static ssize_t __iscsi_##prefix##_##name##_store( \ |
465 | struct iscsi_node_acl *nacl, \ | 418 | struct iscsi_node_acl *nacl, \ |
466 | const char *page, \ | 419 | const char *page, \ |
467 | size_t count) \ | 420 | size_t count) \ |
@@ -487,8 +440,35 @@ static ssize_t __iscsi_##prefix##_store_##name( \ | |||
487 | return count; \ | 440 | return count; \ |
488 | } | 441 | } |
489 | 442 | ||
443 | #define DEF_NACL_AUTH_STR(name, flags) \ | ||
444 | __DEF_NACL_AUTH_STR(nacl_auth, name, flags) \ | ||
445 | static ssize_t iscsi_nacl_auth_##name##_show(struct config_item *item, \ | ||
446 | char *page) \ | ||
447 | { \ | ||
448 | struct se_node_acl *nacl = auth_to_nacl(item); \ | ||
449 | return __iscsi_nacl_auth_##name##_show(container_of(nacl, \ | ||
450 | struct iscsi_node_acl, se_node_acl), page); \ | ||
451 | } \ | ||
452 | static ssize_t iscsi_nacl_auth_##name##_store(struct config_item *item, \ | ||
453 | const char *page, size_t count) \ | ||
454 | { \ | ||
455 | struct se_node_acl *nacl = auth_to_nacl(item); \ | ||
456 | return __iscsi_nacl_auth_##name##_store(container_of(nacl, \ | ||
457 | struct iscsi_node_acl, se_node_acl), page, count); \ | ||
458 | } \ | ||
459 | \ | ||
460 | CONFIGFS_ATTR(iscsi_nacl_auth_, name) | ||
461 | |||
462 | /* | ||
463 | * One-way authentication userid | ||
464 | */ | ||
465 | DEF_NACL_AUTH_STR(userid, NAF_USERID_SET); | ||
466 | DEF_NACL_AUTH_STR(password, NAF_PASSWORD_SET); | ||
467 | DEF_NACL_AUTH_STR(userid_mutual, NAF_USERID_IN_SET); | ||
468 | DEF_NACL_AUTH_STR(password_mutual, NAF_PASSWORD_IN_SET); | ||
469 | |||
490 | #define __DEF_NACL_AUTH_INT(prefix, name) \ | 470 | #define __DEF_NACL_AUTH_INT(prefix, name) \ |
491 | static ssize_t __iscsi_##prefix##_show_##name( \ | 471 | static ssize_t __iscsi_##prefix##_##name##_show( \ |
492 | struct iscsi_node_acl *nacl, \ | 472 | struct iscsi_node_acl *nacl, \ |
493 | char *page) \ | 473 | char *page) \ |
494 | { \ | 474 | { \ |
@@ -500,69 +480,26 @@ static ssize_t __iscsi_##prefix##_show_##name( \ | |||
500 | return snprintf(page, PAGE_SIZE, "%d\n", auth->name); \ | 480 | return snprintf(page, PAGE_SIZE, "%d\n", auth->name); \ |
501 | } | 481 | } |
502 | 482 | ||
503 | #define DEF_NACL_AUTH_STR(name, flags) \ | ||
504 | __DEF_NACL_AUTH_STR(nacl_auth, name, flags) \ | ||
505 | static ssize_t iscsi_nacl_auth_show_##name( \ | ||
506 | struct se_node_acl *nacl, \ | ||
507 | char *page) \ | ||
508 | { \ | ||
509 | return __iscsi_nacl_auth_show_##name(container_of(nacl, \ | ||
510 | struct iscsi_node_acl, se_node_acl), page); \ | ||
511 | } \ | ||
512 | static ssize_t iscsi_nacl_auth_store_##name( \ | ||
513 | struct se_node_acl *nacl, \ | ||
514 | const char *page, \ | ||
515 | size_t count) \ | ||
516 | { \ | ||
517 | return __iscsi_nacl_auth_store_##name(container_of(nacl, \ | ||
518 | struct iscsi_node_acl, se_node_acl), page, count); \ | ||
519 | } | ||
520 | |||
521 | #define DEF_NACL_AUTH_INT(name) \ | 483 | #define DEF_NACL_AUTH_INT(name) \ |
522 | __DEF_NACL_AUTH_INT(nacl_auth, name) \ | 484 | __DEF_NACL_AUTH_INT(nacl_auth, name) \ |
523 | static ssize_t iscsi_nacl_auth_show_##name( \ | 485 | static ssize_t iscsi_nacl_auth_##name##_show(struct config_item *item, \ |
524 | struct se_node_acl *nacl, \ | 486 | char *page) \ |
525 | char *page) \ | ||
526 | { \ | 487 | { \ |
527 | return __iscsi_nacl_auth_show_##name(container_of(nacl, \ | 488 | struct se_node_acl *nacl = auth_to_nacl(item); \ |
528 | struct iscsi_node_acl, se_node_acl), page); \ | 489 | return __iscsi_nacl_auth_##name##_show(container_of(nacl, \ |
529 | } | 490 | struct iscsi_node_acl, se_node_acl), page); \ |
530 | 491 | } \ | |
531 | #define AUTH_ATTR(_name, _mode) TF_NACL_AUTH_ATTR(iscsi, _name, _mode); | 492 | \ |
532 | #define AUTH_ATTR_RO(_name) TF_NACL_AUTH_ATTR_RO(iscsi, _name); | 493 | CONFIGFS_ATTR_RO(iscsi_nacl_auth_, name) |
533 | 494 | ||
534 | /* | ||
535 | * One-way authentication userid | ||
536 | */ | ||
537 | DEF_NACL_AUTH_STR(userid, NAF_USERID_SET); | ||
538 | AUTH_ATTR(userid, S_IRUGO | S_IWUSR); | ||
539 | /* | ||
540 | * One-way authentication password | ||
541 | */ | ||
542 | DEF_NACL_AUTH_STR(password, NAF_PASSWORD_SET); | ||
543 | AUTH_ATTR(password, S_IRUGO | S_IWUSR); | ||
544 | /* | ||
545 | * Enforce mutual authentication | ||
546 | */ | ||
547 | DEF_NACL_AUTH_INT(authenticate_target); | 495 | DEF_NACL_AUTH_INT(authenticate_target); |
548 | AUTH_ATTR_RO(authenticate_target); | ||
549 | /* | ||
550 | * Mutual authentication userid | ||
551 | */ | ||
552 | DEF_NACL_AUTH_STR(userid_mutual, NAF_USERID_IN_SET); | ||
553 | AUTH_ATTR(userid_mutual, S_IRUGO | S_IWUSR); | ||
554 | /* | ||
555 | * Mutual authentication password | ||
556 | */ | ||
557 | DEF_NACL_AUTH_STR(password_mutual, NAF_PASSWORD_IN_SET); | ||
558 | AUTH_ATTR(password_mutual, S_IRUGO | S_IWUSR); | ||
559 | 496 | ||
560 | static struct configfs_attribute *lio_target_nacl_auth_attrs[] = { | 497 | static struct configfs_attribute *lio_target_nacl_auth_attrs[] = { |
561 | &iscsi_nacl_auth_userid.attr, | 498 | &iscsi_nacl_auth_attr_userid, |
562 | &iscsi_nacl_auth_password.attr, | 499 | &iscsi_nacl_auth_attr_password, |
563 | &iscsi_nacl_auth_authenticate_target.attr, | 500 | &iscsi_nacl_auth_attr_authenticate_target, |
564 | &iscsi_nacl_auth_userid_mutual.attr, | 501 | &iscsi_nacl_auth_attr_userid_mutual, |
565 | &iscsi_nacl_auth_password_mutual.attr, | 502 | &iscsi_nacl_auth_attr_password_mutual, |
566 | NULL, | 503 | NULL, |
567 | }; | 504 | }; |
568 | 505 | ||
@@ -570,11 +507,11 @@ static struct configfs_attribute *lio_target_nacl_auth_attrs[] = { | |||
570 | 507 | ||
571 | /* Start items for lio_target_nacl_param_cit */ | 508 | /* Start items for lio_target_nacl_param_cit */ |
572 | 509 | ||
573 | #define DEF_NACL_PARAM(name) \ | 510 | #define ISCSI_NACL_PARAM(name) \ |
574 | static ssize_t iscsi_nacl_param_show_##name( \ | 511 | static ssize_t iscsi_nacl_param_##name##_show(struct config_item *item, \ |
575 | struct se_node_acl *se_nacl, \ | 512 | char *page) \ |
576 | char *page) \ | ||
577 | { \ | 513 | { \ |
514 | struct se_node_acl *se_nacl = param_to_nacl(item); \ | ||
578 | struct iscsi_session *sess; \ | 515 | struct iscsi_session *sess; \ |
579 | struct se_session *se_sess; \ | 516 | struct se_session *se_sess; \ |
580 | ssize_t rb; \ | 517 | ssize_t rb; \ |
@@ -592,55 +529,34 @@ static ssize_t iscsi_nacl_param_show_##name( \ | |||
592 | spin_unlock_bh(&se_nacl->nacl_sess_lock); \ | 529 | spin_unlock_bh(&se_nacl->nacl_sess_lock); \ |
593 | \ | 530 | \ |
594 | return rb; \ | 531 | return rb; \ |
595 | } | 532 | } \ |
596 | 533 | \ | |
597 | #define NACL_PARAM_ATTR(_name) TF_NACL_PARAM_ATTR_RO(iscsi, _name); | 534 | CONFIGFS_ATTR_RO(iscsi_nacl_param_, name) |
598 | 535 | ||
599 | DEF_NACL_PARAM(MaxConnections); | 536 | ISCSI_NACL_PARAM(MaxConnections); |
600 | NACL_PARAM_ATTR(MaxConnections); | 537 | ISCSI_NACL_PARAM(InitialR2T); |
601 | 538 | ISCSI_NACL_PARAM(ImmediateData); | |
602 | DEF_NACL_PARAM(InitialR2T); | 539 | ISCSI_NACL_PARAM(MaxBurstLength); |
603 | NACL_PARAM_ATTR(InitialR2T); | 540 | ISCSI_NACL_PARAM(FirstBurstLength); |
604 | 541 | ISCSI_NACL_PARAM(DefaultTime2Wait); | |
605 | DEF_NACL_PARAM(ImmediateData); | 542 | ISCSI_NACL_PARAM(DefaultTime2Retain); |
606 | NACL_PARAM_ATTR(ImmediateData); | 543 | ISCSI_NACL_PARAM(MaxOutstandingR2T); |
607 | 544 | ISCSI_NACL_PARAM(DataPDUInOrder); | |
608 | DEF_NACL_PARAM(MaxBurstLength); | 545 | ISCSI_NACL_PARAM(DataSequenceInOrder); |
609 | NACL_PARAM_ATTR(MaxBurstLength); | 546 | ISCSI_NACL_PARAM(ErrorRecoveryLevel); |
610 | |||
611 | DEF_NACL_PARAM(FirstBurstLength); | ||
612 | NACL_PARAM_ATTR(FirstBurstLength); | ||
613 | |||
614 | DEF_NACL_PARAM(DefaultTime2Wait); | ||
615 | NACL_PARAM_ATTR(DefaultTime2Wait); | ||
616 | |||
617 | DEF_NACL_PARAM(DefaultTime2Retain); | ||
618 | NACL_PARAM_ATTR(DefaultTime2Retain); | ||
619 | |||
620 | DEF_NACL_PARAM(MaxOutstandingR2T); | ||
621 | NACL_PARAM_ATTR(MaxOutstandingR2T); | ||
622 | |||
623 | DEF_NACL_PARAM(DataPDUInOrder); | ||
624 | NACL_PARAM_ATTR(DataPDUInOrder); | ||
625 | |||
626 | DEF_NACL_PARAM(DataSequenceInOrder); | ||
627 | NACL_PARAM_ATTR(DataSequenceInOrder); | ||
628 | |||
629 | DEF_NACL_PARAM(ErrorRecoveryLevel); | ||
630 | NACL_PARAM_ATTR(ErrorRecoveryLevel); | ||
631 | 547 | ||
632 | static struct configfs_attribute *lio_target_nacl_param_attrs[] = { | 548 | static struct configfs_attribute *lio_target_nacl_param_attrs[] = { |
633 | &iscsi_nacl_param_MaxConnections.attr, | 549 | &iscsi_nacl_param_attr_MaxConnections, |
634 | &iscsi_nacl_param_InitialR2T.attr, | 550 | &iscsi_nacl_param_attr_InitialR2T, |
635 | &iscsi_nacl_param_ImmediateData.attr, | 551 | &iscsi_nacl_param_attr_ImmediateData, |
636 | &iscsi_nacl_param_MaxBurstLength.attr, | 552 | &iscsi_nacl_param_attr_MaxBurstLength, |
637 | &iscsi_nacl_param_FirstBurstLength.attr, | 553 | &iscsi_nacl_param_attr_FirstBurstLength, |
638 | &iscsi_nacl_param_DefaultTime2Wait.attr, | 554 | &iscsi_nacl_param_attr_DefaultTime2Wait, |
639 | &iscsi_nacl_param_DefaultTime2Retain.attr, | 555 | &iscsi_nacl_param_attr_DefaultTime2Retain, |
640 | &iscsi_nacl_param_MaxOutstandingR2T.attr, | 556 | &iscsi_nacl_param_attr_MaxOutstandingR2T, |
641 | &iscsi_nacl_param_DataPDUInOrder.attr, | 557 | &iscsi_nacl_param_attr_DataPDUInOrder, |
642 | &iscsi_nacl_param_DataSequenceInOrder.attr, | 558 | &iscsi_nacl_param_attr_DataSequenceInOrder, |
643 | &iscsi_nacl_param_ErrorRecoveryLevel.attr, | 559 | &iscsi_nacl_param_attr_ErrorRecoveryLevel, |
644 | NULL, | 560 | NULL, |
645 | }; | 561 | }; |
646 | 562 | ||
@@ -648,10 +564,9 @@ static struct configfs_attribute *lio_target_nacl_param_attrs[] = { | |||
648 | 564 | ||
649 | /* Start items for lio_target_acl_cit */ | 565 | /* Start items for lio_target_acl_cit */ |
650 | 566 | ||
651 | static ssize_t lio_target_nacl_show_info( | 567 | static ssize_t lio_target_nacl_info_show(struct config_item *item, char *page) |
652 | struct se_node_acl *se_nacl, | ||
653 | char *page) | ||
654 | { | 568 | { |
569 | struct se_node_acl *se_nacl = acl_to_nacl(item); | ||
655 | struct iscsi_session *sess; | 570 | struct iscsi_session *sess; |
656 | struct iscsi_conn *conn; | 571 | struct iscsi_conn *conn; |
657 | struct se_session *se_sess; | 572 | struct se_session *se_sess; |
@@ -766,20 +681,16 @@ static ssize_t lio_target_nacl_show_info( | |||
766 | return rb; | 681 | return rb; |
767 | } | 682 | } |
768 | 683 | ||
769 | TF_NACL_BASE_ATTR_RO(lio_target, info); | 684 | static ssize_t lio_target_nacl_cmdsn_depth_show(struct config_item *item, |
770 | 685 | char *page) | |
771 | static ssize_t lio_target_nacl_show_cmdsn_depth( | ||
772 | struct se_node_acl *se_nacl, | ||
773 | char *page) | ||
774 | { | 686 | { |
775 | return sprintf(page, "%u\n", se_nacl->queue_depth); | 687 | return sprintf(page, "%u\n", acl_to_nacl(item)->queue_depth); |
776 | } | 688 | } |
777 | 689 | ||
778 | static ssize_t lio_target_nacl_store_cmdsn_depth( | 690 | static ssize_t lio_target_nacl_cmdsn_depth_store(struct config_item *item, |
779 | struct se_node_acl *se_nacl, | 691 | const char *page, size_t count) |
780 | const char *page, | ||
781 | size_t count) | ||
782 | { | 692 | { |
693 | struct se_node_acl *se_nacl = acl_to_nacl(item); | ||
783 | struct se_portal_group *se_tpg = se_nacl->se_tpg; | 694 | struct se_portal_group *se_tpg = se_nacl->se_tpg; |
784 | struct iscsi_portal_group *tpg = container_of(se_tpg, | 695 | struct iscsi_portal_group *tpg = container_of(se_tpg, |
785 | struct iscsi_portal_group, tpg_se_tpg); | 696 | struct iscsi_portal_group, tpg_se_tpg); |
@@ -829,20 +740,15 @@ static ssize_t lio_target_nacl_store_cmdsn_depth( | |||
829 | return (!ret) ? count : (ssize_t)ret; | 740 | return (!ret) ? count : (ssize_t)ret; |
830 | } | 741 | } |
831 | 742 | ||
832 | TF_NACL_BASE_ATTR(lio_target, cmdsn_depth, S_IRUGO | S_IWUSR); | 743 | static ssize_t lio_target_nacl_tag_show(struct config_item *item, char *page) |
833 | |||
834 | static ssize_t lio_target_nacl_show_tag( | ||
835 | struct se_node_acl *se_nacl, | ||
836 | char *page) | ||
837 | { | 744 | { |
838 | return snprintf(page, PAGE_SIZE, "%s", se_nacl->acl_tag); | 745 | return snprintf(page, PAGE_SIZE, "%s", acl_to_nacl(item)->acl_tag); |
839 | } | 746 | } |
840 | 747 | ||
841 | static ssize_t lio_target_nacl_store_tag( | 748 | static ssize_t lio_target_nacl_tag_store(struct config_item *item, |
842 | struct se_node_acl *se_nacl, | 749 | const char *page, size_t count) |
843 | const char *page, | ||
844 | size_t count) | ||
845 | { | 750 | { |
751 | struct se_node_acl *se_nacl = acl_to_nacl(item); | ||
846 | int ret; | 752 | int ret; |
847 | 753 | ||
848 | ret = core_tpg_set_initiator_node_tag(se_nacl->se_tpg, se_nacl, page); | 754 | ret = core_tpg_set_initiator_node_tag(se_nacl->se_tpg, se_nacl, page); |
@@ -852,12 +758,14 @@ static ssize_t lio_target_nacl_store_tag( | |||
852 | return count; | 758 | return count; |
853 | } | 759 | } |
854 | 760 | ||
855 | TF_NACL_BASE_ATTR(lio_target, tag, S_IRUGO | S_IWUSR); | 761 | CONFIGFS_ATTR_RO(lio_target_nacl_, info); |
762 | CONFIGFS_ATTR(lio_target_nacl_, cmdsn_depth); | ||
763 | CONFIGFS_ATTR(lio_target_nacl_, tag); | ||
856 | 764 | ||
857 | static struct configfs_attribute *lio_target_initiator_attrs[] = { | 765 | static struct configfs_attribute *lio_target_initiator_attrs[] = { |
858 | &lio_target_nacl_info.attr, | 766 | &lio_target_nacl_attr_info, |
859 | &lio_target_nacl_cmdsn_depth.attr, | 767 | &lio_target_nacl_attr_cmdsn_depth, |
860 | &lio_target_nacl_tag.attr, | 768 | &lio_target_nacl_attr_tag, |
861 | NULL, | 769 | NULL, |
862 | }; | 770 | }; |
863 | 771 | ||
@@ -907,10 +815,10 @@ static void lio_target_cleanup_nodeacl( struct se_node_acl *se_nacl) | |||
907 | 815 | ||
908 | #define DEF_TPG_ATTRIB(name) \ | 816 | #define DEF_TPG_ATTRIB(name) \ |
909 | \ | 817 | \ |
910 | static ssize_t iscsi_tpg_attrib_show_##name( \ | 818 | static ssize_t iscsi_tpg_attrib_##name##_show(struct config_item *item, \ |
911 | struct se_portal_group *se_tpg, \ | 819 | char *page) \ |
912 | char *page) \ | ||
913 | { \ | 820 | { \ |
821 | struct se_portal_group *se_tpg = attrib_to_tpg(item); \ | ||
914 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ | 822 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ |
915 | struct iscsi_portal_group, tpg_se_tpg); \ | 823 | struct iscsi_portal_group, tpg_se_tpg); \ |
916 | ssize_t rb; \ | 824 | ssize_t rb; \ |
@@ -923,11 +831,10 @@ static ssize_t iscsi_tpg_attrib_show_##name( \ | |||
923 | return rb; \ | 831 | return rb; \ |
924 | } \ | 832 | } \ |
925 | \ | 833 | \ |
926 | static ssize_t iscsi_tpg_attrib_store_##name( \ | 834 | static ssize_t iscsi_tpg_attrib_##name##_store(struct config_item *item,\ |
927 | struct se_portal_group *se_tpg, \ | 835 | const char *page, size_t count) \ |
928 | const char *page, \ | ||
929 | size_t count) \ | ||
930 | { \ | 836 | { \ |
837 | struct se_portal_group *se_tpg = attrib_to_tpg(item); \ | ||
931 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ | 838 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ |
932 | struct iscsi_portal_group, tpg_se_tpg); \ | 839 | struct iscsi_portal_group, tpg_se_tpg); \ |
933 | u32 val; \ | 840 | u32 val; \ |
@@ -948,90 +855,37 @@ static ssize_t iscsi_tpg_attrib_store_##name( \ | |||
948 | out: \ | 855 | out: \ |
949 | iscsit_put_tpg(tpg); \ | 856 | iscsit_put_tpg(tpg); \ |
950 | return ret; \ | 857 | return ret; \ |
951 | } | 858 | } \ |
952 | 859 | CONFIGFS_ATTR(iscsi_tpg_attrib_, name) | |
953 | #define TPG_ATTR(_name, _mode) TF_TPG_ATTRIB_ATTR(iscsi, _name, _mode); | ||
954 | 860 | ||
955 | /* | ||
956 | * Define iscsi_tpg_attrib_s_authentication | ||
957 | */ | ||
958 | DEF_TPG_ATTRIB(authentication); | 861 | DEF_TPG_ATTRIB(authentication); |
959 | TPG_ATTR(authentication, S_IRUGO | S_IWUSR); | ||
960 | /* | ||
961 | * Define iscsi_tpg_attrib_s_login_timeout | ||
962 | */ | ||
963 | DEF_TPG_ATTRIB(login_timeout); | 862 | DEF_TPG_ATTRIB(login_timeout); |
964 | TPG_ATTR(login_timeout, S_IRUGO | S_IWUSR); | ||
965 | /* | ||
966 | * Define iscsi_tpg_attrib_s_netif_timeout | ||
967 | */ | ||
968 | DEF_TPG_ATTRIB(netif_timeout); | 863 | DEF_TPG_ATTRIB(netif_timeout); |
969 | TPG_ATTR(netif_timeout, S_IRUGO | S_IWUSR); | ||
970 | /* | ||
971 | * Define iscsi_tpg_attrib_s_generate_node_acls | ||
972 | */ | ||
973 | DEF_TPG_ATTRIB(generate_node_acls); | 864 | DEF_TPG_ATTRIB(generate_node_acls); |
974 | TPG_ATTR(generate_node_acls, S_IRUGO | S_IWUSR); | ||
975 | /* | ||
976 | * Define iscsi_tpg_attrib_s_default_cmdsn_depth | ||
977 | */ | ||
978 | DEF_TPG_ATTRIB(default_cmdsn_depth); | 865 | DEF_TPG_ATTRIB(default_cmdsn_depth); |
979 | TPG_ATTR(default_cmdsn_depth, S_IRUGO | S_IWUSR); | ||
980 | /* | ||
981 | Define iscsi_tpg_attrib_s_cache_dynamic_acls | ||
982 | */ | ||
983 | DEF_TPG_ATTRIB(cache_dynamic_acls); | 866 | DEF_TPG_ATTRIB(cache_dynamic_acls); |
984 | TPG_ATTR(cache_dynamic_acls, S_IRUGO | S_IWUSR); | ||
985 | /* | ||
986 | * Define iscsi_tpg_attrib_s_demo_mode_write_protect | ||
987 | */ | ||
988 | DEF_TPG_ATTRIB(demo_mode_write_protect); | 867 | DEF_TPG_ATTRIB(demo_mode_write_protect); |
989 | TPG_ATTR(demo_mode_write_protect, S_IRUGO | S_IWUSR); | ||
990 | /* | ||
991 | * Define iscsi_tpg_attrib_s_prod_mode_write_protect | ||
992 | */ | ||
993 | DEF_TPG_ATTRIB(prod_mode_write_protect); | 868 | DEF_TPG_ATTRIB(prod_mode_write_protect); |
994 | TPG_ATTR(prod_mode_write_protect, S_IRUGO | S_IWUSR); | ||
995 | /* | ||
996 | * Define iscsi_tpg_attrib_s_demo_mode_discovery, | ||
997 | */ | ||
998 | DEF_TPG_ATTRIB(demo_mode_discovery); | 869 | DEF_TPG_ATTRIB(demo_mode_discovery); |
999 | TPG_ATTR(demo_mode_discovery, S_IRUGO | S_IWUSR); | ||
1000 | /* | ||
1001 | * Define iscsi_tpg_attrib_s_default_erl | ||
1002 | */ | ||
1003 | DEF_TPG_ATTRIB(default_erl); | 870 | DEF_TPG_ATTRIB(default_erl); |
1004 | TPG_ATTR(default_erl, S_IRUGO | S_IWUSR); | ||
1005 | /* | ||
1006 | * Define iscsi_tpg_attrib_s_t10_pi | ||
1007 | */ | ||
1008 | DEF_TPG_ATTRIB(t10_pi); | 871 | DEF_TPG_ATTRIB(t10_pi); |
1009 | TPG_ATTR(t10_pi, S_IRUGO | S_IWUSR); | ||
1010 | /* | ||
1011 | * Define iscsi_tpg_attrib_s_fabric_prot_type | ||
1012 | */ | ||
1013 | DEF_TPG_ATTRIB(fabric_prot_type); | 872 | DEF_TPG_ATTRIB(fabric_prot_type); |
1014 | TPG_ATTR(fabric_prot_type, S_IRUGO | S_IWUSR); | ||
1015 | /* | ||
1016 | * Define iscsi_tpg_attrib_s_tpg_enabled_sendtargets | ||
1017 | */ | ||
1018 | DEF_TPG_ATTRIB(tpg_enabled_sendtargets); | 873 | DEF_TPG_ATTRIB(tpg_enabled_sendtargets); |
1019 | TPG_ATTR(tpg_enabled_sendtargets, S_IRUGO | S_IWUSR); | ||
1020 | 874 | ||
1021 | static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = { | 875 | static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = { |
1022 | &iscsi_tpg_attrib_authentication.attr, | 876 | &iscsi_tpg_attrib_attr_authentication, |
1023 | &iscsi_tpg_attrib_login_timeout.attr, | 877 | &iscsi_tpg_attrib_attr_login_timeout, |
1024 | &iscsi_tpg_attrib_netif_timeout.attr, | 878 | &iscsi_tpg_attrib_attr_netif_timeout, |
1025 | &iscsi_tpg_attrib_generate_node_acls.attr, | 879 | &iscsi_tpg_attrib_attr_generate_node_acls, |
1026 | &iscsi_tpg_attrib_default_cmdsn_depth.attr, | 880 | &iscsi_tpg_attrib_attr_default_cmdsn_depth, |
1027 | &iscsi_tpg_attrib_cache_dynamic_acls.attr, | 881 | &iscsi_tpg_attrib_attr_cache_dynamic_acls, |
1028 | &iscsi_tpg_attrib_demo_mode_write_protect.attr, | 882 | &iscsi_tpg_attrib_attr_demo_mode_write_protect, |
1029 | &iscsi_tpg_attrib_prod_mode_write_protect.attr, | 883 | &iscsi_tpg_attrib_attr_prod_mode_write_protect, |
1030 | &iscsi_tpg_attrib_demo_mode_discovery.attr, | 884 | &iscsi_tpg_attrib_attr_demo_mode_discovery, |
1031 | &iscsi_tpg_attrib_default_erl.attr, | 885 | &iscsi_tpg_attrib_attr_default_erl, |
1032 | &iscsi_tpg_attrib_t10_pi.attr, | 886 | &iscsi_tpg_attrib_attr_t10_pi, |
1033 | &iscsi_tpg_attrib_fabric_prot_type.attr, | 887 | &iscsi_tpg_attrib_attr_fabric_prot_type, |
1034 | &iscsi_tpg_attrib_tpg_enabled_sendtargets.attr, | 888 | &iscsi_tpg_attrib_attr_tpg_enabled_sendtargets, |
1035 | NULL, | 889 | NULL, |
1036 | }; | 890 | }; |
1037 | 891 | ||
@@ -1040,9 +894,8 @@ static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = { | |||
1040 | /* Start items for lio_target_tpg_auth_cit */ | 894 | /* Start items for lio_target_tpg_auth_cit */ |
1041 | 895 | ||
1042 | #define __DEF_TPG_AUTH_STR(prefix, name, flags) \ | 896 | #define __DEF_TPG_AUTH_STR(prefix, name, flags) \ |
1043 | static ssize_t __iscsi_##prefix##_show_##name( \ | 897 | static ssize_t __iscsi_##prefix##_##name##_show(struct se_portal_group *se_tpg, \ |
1044 | struct se_portal_group *se_tpg, \ | 898 | char *page) \ |
1045 | char *page) \ | ||
1046 | { \ | 899 | { \ |
1047 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ | 900 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ |
1048 | struct iscsi_portal_group, tpg_se_tpg); \ | 901 | struct iscsi_portal_group, tpg_se_tpg); \ |
@@ -1054,10 +907,8 @@ static ssize_t __iscsi_##prefix##_show_##name( \ | |||
1054 | return snprintf(page, PAGE_SIZE, "%s\n", auth->name); \ | 907 | return snprintf(page, PAGE_SIZE, "%s\n", auth->name); \ |
1055 | } \ | 908 | } \ |
1056 | \ | 909 | \ |
1057 | static ssize_t __iscsi_##prefix##_store_##name( \ | 910 | static ssize_t __iscsi_##prefix##_##name##_store(struct se_portal_group *se_tpg,\ |
1058 | struct se_portal_group *se_tpg, \ | 911 | const char *page, size_t count) \ |
1059 | const char *page, \ | ||
1060 | size_t count) \ | ||
1061 | { \ | 912 | { \ |
1062 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ | 913 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ |
1063 | struct iscsi_portal_group, tpg_se_tpg); \ | 914 | struct iscsi_portal_group, tpg_se_tpg); \ |
@@ -1081,10 +932,31 @@ static ssize_t __iscsi_##prefix##_store_##name( \ | |||
1081 | return count; \ | 932 | return count; \ |
1082 | } | 933 | } |
1083 | 934 | ||
935 | #define DEF_TPG_AUTH_STR(name, flags) \ | ||
936 | __DEF_TPG_AUTH_STR(tpg_auth, name, flags) \ | ||
937 | static ssize_t iscsi_tpg_auth_##name##_show(struct config_item *item, \ | ||
938 | char *page) \ | ||
939 | { \ | ||
940 | return __iscsi_tpg_auth_##name##_show(auth_to_tpg(item), page); \ | ||
941 | } \ | ||
942 | \ | ||
943 | static ssize_t iscsi_tpg_auth_##name##_store(struct config_item *item, \ | ||
944 | const char *page, size_t count) \ | ||
945 | { \ | ||
946 | return __iscsi_tpg_auth_##name##_store(auth_to_tpg(item), page, count); \ | ||
947 | } \ | ||
948 | \ | ||
949 | CONFIGFS_ATTR(iscsi_tpg_auth_, name); | ||
950 | |||
951 | |||
952 | DEF_TPG_AUTH_STR(userid, NAF_USERID_SET); | ||
953 | DEF_TPG_AUTH_STR(password, NAF_PASSWORD_SET); | ||
954 | DEF_TPG_AUTH_STR(userid_mutual, NAF_USERID_IN_SET); | ||
955 | DEF_TPG_AUTH_STR(password_mutual, NAF_PASSWORD_IN_SET); | ||
956 | |||
1084 | #define __DEF_TPG_AUTH_INT(prefix, name) \ | 957 | #define __DEF_TPG_AUTH_INT(prefix, name) \ |
1085 | static ssize_t __iscsi_##prefix##_show_##name( \ | 958 | static ssize_t __iscsi_##prefix##_##name##_show(struct se_portal_group *se_tpg, \ |
1086 | struct se_portal_group *se_tpg, \ | 959 | char *page) \ |
1087 | char *page) \ | ||
1088 | { \ | 960 | { \ |
1089 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ | 961 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ |
1090 | struct iscsi_portal_group, tpg_se_tpg); \ | 962 | struct iscsi_portal_group, tpg_se_tpg); \ |
@@ -1096,67 +968,23 @@ static ssize_t __iscsi_##prefix##_show_##name( \ | |||
1096 | return snprintf(page, PAGE_SIZE, "%d\n", auth->name); \ | 968 | return snprintf(page, PAGE_SIZE, "%d\n", auth->name); \ |
1097 | } | 969 | } |
1098 | 970 | ||
1099 | #define DEF_TPG_AUTH_STR(name, flags) \ | ||
1100 | __DEF_TPG_AUTH_STR(tpg_auth, name, flags) \ | ||
1101 | static ssize_t iscsi_tpg_auth_show_##name( \ | ||
1102 | struct se_portal_group *se_tpg, \ | ||
1103 | char *page) \ | ||
1104 | { \ | ||
1105 | return __iscsi_tpg_auth_show_##name(se_tpg, page); \ | ||
1106 | } \ | ||
1107 | \ | ||
1108 | static ssize_t iscsi_tpg_auth_store_##name( \ | ||
1109 | struct se_portal_group *se_tpg, \ | ||
1110 | const char *page, \ | ||
1111 | size_t count) \ | ||
1112 | { \ | ||
1113 | return __iscsi_tpg_auth_store_##name(se_tpg, page, count); \ | ||
1114 | } | ||
1115 | |||
1116 | #define DEF_TPG_AUTH_INT(name) \ | 971 | #define DEF_TPG_AUTH_INT(name) \ |
1117 | __DEF_TPG_AUTH_INT(tpg_auth, name) \ | 972 | __DEF_TPG_AUTH_INT(tpg_auth, name) \ |
1118 | static ssize_t iscsi_tpg_auth_show_##name( \ | 973 | static ssize_t iscsi_tpg_auth_##name##_show(struct config_item *item, \ |
1119 | struct se_portal_group *se_tpg, \ | 974 | char *page) \ |
1120 | char *page) \ | ||
1121 | { \ | 975 | { \ |
1122 | return __iscsi_tpg_auth_show_##name(se_tpg, page); \ | 976 | return __iscsi_tpg_auth_##name##_show(auth_to_tpg(item), page); \ |
1123 | } | 977 | } \ |
1124 | 978 | CONFIGFS_ATTR_RO(iscsi_tpg_auth_, name); | |
1125 | #define TPG_AUTH_ATTR(_name, _mode) TF_TPG_AUTH_ATTR(iscsi, _name, _mode); | ||
1126 | #define TPG_AUTH_ATTR_RO(_name) TF_TPG_AUTH_ATTR_RO(iscsi, _name); | ||
1127 | 979 | ||
1128 | /* | ||
1129 | * * One-way authentication userid | ||
1130 | * */ | ||
1131 | DEF_TPG_AUTH_STR(userid, NAF_USERID_SET); | ||
1132 | TPG_AUTH_ATTR(userid, S_IRUGO | S_IWUSR); | ||
1133 | /* | ||
1134 | * * One-way authentication password | ||
1135 | * */ | ||
1136 | DEF_TPG_AUTH_STR(password, NAF_PASSWORD_SET); | ||
1137 | TPG_AUTH_ATTR(password, S_IRUGO | S_IWUSR); | ||
1138 | /* | ||
1139 | * * Enforce mutual authentication | ||
1140 | * */ | ||
1141 | DEF_TPG_AUTH_INT(authenticate_target); | 980 | DEF_TPG_AUTH_INT(authenticate_target); |
1142 | TPG_AUTH_ATTR_RO(authenticate_target); | ||
1143 | /* | ||
1144 | * * Mutual authentication userid | ||
1145 | * */ | ||
1146 | DEF_TPG_AUTH_STR(userid_mutual, NAF_USERID_IN_SET); | ||
1147 | TPG_AUTH_ATTR(userid_mutual, S_IRUGO | S_IWUSR); | ||
1148 | /* | ||
1149 | * * Mutual authentication password | ||
1150 | * */ | ||
1151 | DEF_TPG_AUTH_STR(password_mutual, NAF_PASSWORD_IN_SET); | ||
1152 | TPG_AUTH_ATTR(password_mutual, S_IRUGO | S_IWUSR); | ||
1153 | 981 | ||
1154 | static struct configfs_attribute *lio_target_tpg_auth_attrs[] = { | 982 | static struct configfs_attribute *lio_target_tpg_auth_attrs[] = { |
1155 | &iscsi_tpg_auth_userid.attr, | 983 | &iscsi_tpg_auth_attr_userid, |
1156 | &iscsi_tpg_auth_password.attr, | 984 | &iscsi_tpg_auth_attr_password, |
1157 | &iscsi_tpg_auth_authenticate_target.attr, | 985 | &iscsi_tpg_auth_attr_authenticate_target, |
1158 | &iscsi_tpg_auth_userid_mutual.attr, | 986 | &iscsi_tpg_auth_attr_userid_mutual, |
1159 | &iscsi_tpg_auth_password_mutual.attr, | 987 | &iscsi_tpg_auth_attr_password_mutual, |
1160 | NULL, | 988 | NULL, |
1161 | }; | 989 | }; |
1162 | 990 | ||
@@ -1165,10 +993,10 @@ static struct configfs_attribute *lio_target_tpg_auth_attrs[] = { | |||
1165 | /* Start items for lio_target_tpg_param_cit */ | 993 | /* Start items for lio_target_tpg_param_cit */ |
1166 | 994 | ||
1167 | #define DEF_TPG_PARAM(name) \ | 995 | #define DEF_TPG_PARAM(name) \ |
1168 | static ssize_t iscsi_tpg_param_show_##name( \ | 996 | static ssize_t iscsi_tpg_param_##name##_show(struct config_item *item, \ |
1169 | struct se_portal_group *se_tpg, \ | 997 | char *page) \ |
1170 | char *page) \ | ||
1171 | { \ | 998 | { \ |
999 | struct se_portal_group *se_tpg = param_to_tpg(item); \ | ||
1172 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ | 1000 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ |
1173 | struct iscsi_portal_group, tpg_se_tpg); \ | 1001 | struct iscsi_portal_group, tpg_se_tpg); \ |
1174 | struct iscsi_param *param; \ | 1002 | struct iscsi_param *param; \ |
@@ -1188,11 +1016,10 @@ static ssize_t iscsi_tpg_param_show_##name( \ | |||
1188 | iscsit_put_tpg(tpg); \ | 1016 | iscsit_put_tpg(tpg); \ |
1189 | return rb; \ | 1017 | return rb; \ |
1190 | } \ | 1018 | } \ |
1191 | static ssize_t iscsi_tpg_param_store_##name( \ | 1019 | static ssize_t iscsi_tpg_param_##name##_store(struct config_item *item, \ |
1192 | struct se_portal_group *se_tpg, \ | 1020 | const char *page, size_t count) \ |
1193 | const char *page, \ | ||
1194 | size_t count) \ | ||
1195 | { \ | 1021 | { \ |
1022 | struct se_portal_group *se_tpg = param_to_tpg(item); \ | ||
1196 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ | 1023 | struct iscsi_portal_group *tpg = container_of(se_tpg, \ |
1197 | struct iscsi_portal_group, tpg_se_tpg); \ | 1024 | struct iscsi_portal_group, tpg_se_tpg); \ |
1198 | char *buf; \ | 1025 | char *buf; \ |
@@ -1220,96 +1047,54 @@ static ssize_t iscsi_tpg_param_store_##name( \ | |||
1220 | out: \ | 1047 | out: \ |
1221 | kfree(buf); \ | 1048 | kfree(buf); \ |
1222 | iscsit_put_tpg(tpg); \ | 1049 | iscsit_put_tpg(tpg); \ |
1223 | return -EINVAL; \ | 1050 | return -EINVAL; \ |
1224 | } | 1051 | } \ |
1225 | 1052 | CONFIGFS_ATTR(iscsi_tpg_param_, name) | |
1226 | #define TPG_PARAM_ATTR(_name, _mode) TF_TPG_PARAM_ATTR(iscsi, _name, _mode); | ||
1227 | 1053 | ||
1228 | DEF_TPG_PARAM(AuthMethod); | 1054 | DEF_TPG_PARAM(AuthMethod); |
1229 | TPG_PARAM_ATTR(AuthMethod, S_IRUGO | S_IWUSR); | ||
1230 | |||
1231 | DEF_TPG_PARAM(HeaderDigest); | 1055 | DEF_TPG_PARAM(HeaderDigest); |
1232 | TPG_PARAM_ATTR(HeaderDigest, S_IRUGO | S_IWUSR); | ||
1233 | |||
1234 | DEF_TPG_PARAM(DataDigest); | 1056 | DEF_TPG_PARAM(DataDigest); |
1235 | TPG_PARAM_ATTR(DataDigest, S_IRUGO | S_IWUSR); | ||
1236 | |||
1237 | DEF_TPG_PARAM(MaxConnections); | 1057 | DEF_TPG_PARAM(MaxConnections); |
1238 | TPG_PARAM_ATTR(MaxConnections, S_IRUGO | S_IWUSR); | ||
1239 | |||
1240 | DEF_TPG_PARAM(TargetAlias); | 1058 | DEF_TPG_PARAM(TargetAlias); |
1241 | TPG_PARAM_ATTR(TargetAlias, S_IRUGO | S_IWUSR); | ||
1242 | |||
1243 | DEF_TPG_PARAM(InitialR2T); | 1059 | DEF_TPG_PARAM(InitialR2T); |
1244 | TPG_PARAM_ATTR(InitialR2T, S_IRUGO | S_IWUSR); | ||
1245 | |||
1246 | DEF_TPG_PARAM(ImmediateData); | 1060 | DEF_TPG_PARAM(ImmediateData); |
1247 | TPG_PARAM_ATTR(ImmediateData, S_IRUGO | S_IWUSR); | ||
1248 | |||
1249 | DEF_TPG_PARAM(MaxRecvDataSegmentLength); | 1061 | DEF_TPG_PARAM(MaxRecvDataSegmentLength); |
1250 | TPG_PARAM_ATTR(MaxRecvDataSegmentLength, S_IRUGO | S_IWUSR); | ||
1251 | |||
1252 | DEF_TPG_PARAM(MaxXmitDataSegmentLength); | 1062 | DEF_TPG_PARAM(MaxXmitDataSegmentLength); |
1253 | TPG_PARAM_ATTR(MaxXmitDataSegmentLength, S_IRUGO | S_IWUSR); | ||
1254 | |||
1255 | DEF_TPG_PARAM(MaxBurstLength); | 1063 | DEF_TPG_PARAM(MaxBurstLength); |
1256 | TPG_PARAM_ATTR(MaxBurstLength, S_IRUGO | S_IWUSR); | ||
1257 | |||
1258 | DEF_TPG_PARAM(FirstBurstLength); | 1064 | DEF_TPG_PARAM(FirstBurstLength); |
1259 | TPG_PARAM_ATTR(FirstBurstLength, S_IRUGO | S_IWUSR); | ||
1260 | |||
1261 | DEF_TPG_PARAM(DefaultTime2Wait); | 1065 | DEF_TPG_PARAM(DefaultTime2Wait); |
1262 | TPG_PARAM_ATTR(DefaultTime2Wait, S_IRUGO | S_IWUSR); | ||
1263 | |||
1264 | DEF_TPG_PARAM(DefaultTime2Retain); | 1066 | DEF_TPG_PARAM(DefaultTime2Retain); |
1265 | TPG_PARAM_ATTR(DefaultTime2Retain, S_IRUGO | S_IWUSR); | ||
1266 | |||
1267 | DEF_TPG_PARAM(MaxOutstandingR2T); | 1067 | DEF_TPG_PARAM(MaxOutstandingR2T); |
1268 | TPG_PARAM_ATTR(MaxOutstandingR2T, S_IRUGO | S_IWUSR); | ||
1269 | |||
1270 | DEF_TPG_PARAM(DataPDUInOrder); | 1068 | DEF_TPG_PARAM(DataPDUInOrder); |
1271 | TPG_PARAM_ATTR(DataPDUInOrder, S_IRUGO | S_IWUSR); | ||
1272 | |||
1273 | DEF_TPG_PARAM(DataSequenceInOrder); | 1069 | DEF_TPG_PARAM(DataSequenceInOrder); |
1274 | TPG_PARAM_ATTR(DataSequenceInOrder, S_IRUGO | S_IWUSR); | ||
1275 | |||
1276 | DEF_TPG_PARAM(ErrorRecoveryLevel); | 1070 | DEF_TPG_PARAM(ErrorRecoveryLevel); |
1277 | TPG_PARAM_ATTR(ErrorRecoveryLevel, S_IRUGO | S_IWUSR); | ||
1278 | |||
1279 | DEF_TPG_PARAM(IFMarker); | 1071 | DEF_TPG_PARAM(IFMarker); |
1280 | TPG_PARAM_ATTR(IFMarker, S_IRUGO | S_IWUSR); | ||
1281 | |||
1282 | DEF_TPG_PARAM(OFMarker); | 1072 | DEF_TPG_PARAM(OFMarker); |
1283 | TPG_PARAM_ATTR(OFMarker, S_IRUGO | S_IWUSR); | ||
1284 | |||
1285 | DEF_TPG_PARAM(IFMarkInt); | 1073 | DEF_TPG_PARAM(IFMarkInt); |
1286 | TPG_PARAM_ATTR(IFMarkInt, S_IRUGO | S_IWUSR); | ||
1287 | |||
1288 | DEF_TPG_PARAM(OFMarkInt); | 1074 | DEF_TPG_PARAM(OFMarkInt); |
1289 | TPG_PARAM_ATTR(OFMarkInt, S_IRUGO | S_IWUSR); | ||
1290 | 1075 | ||
1291 | static struct configfs_attribute *lio_target_tpg_param_attrs[] = { | 1076 | static struct configfs_attribute *lio_target_tpg_param_attrs[] = { |
1292 | &iscsi_tpg_param_AuthMethod.attr, | 1077 | &iscsi_tpg_param_attr_AuthMethod, |
1293 | &iscsi_tpg_param_HeaderDigest.attr, | 1078 | &iscsi_tpg_param_attr_HeaderDigest, |
1294 | &iscsi_tpg_param_DataDigest.attr, | 1079 | &iscsi_tpg_param_attr_DataDigest, |
1295 | &iscsi_tpg_param_MaxConnections.attr, | 1080 | &iscsi_tpg_param_attr_MaxConnections, |
1296 | &iscsi_tpg_param_TargetAlias.attr, | 1081 | &iscsi_tpg_param_attr_TargetAlias, |
1297 | &iscsi_tpg_param_InitialR2T.attr, | 1082 | &iscsi_tpg_param_attr_InitialR2T, |
1298 | &iscsi_tpg_param_ImmediateData.attr, | 1083 | &iscsi_tpg_param_attr_ImmediateData, |
1299 | &iscsi_tpg_param_MaxRecvDataSegmentLength.attr, | 1084 | &iscsi_tpg_param_attr_MaxRecvDataSegmentLength, |
1300 | &iscsi_tpg_param_MaxXmitDataSegmentLength.attr, | 1085 | &iscsi_tpg_param_attr_MaxXmitDataSegmentLength, |
1301 | &iscsi_tpg_param_MaxBurstLength.attr, | 1086 | &iscsi_tpg_param_attr_MaxBurstLength, |
1302 | &iscsi_tpg_param_FirstBurstLength.attr, | 1087 | &iscsi_tpg_param_attr_FirstBurstLength, |
1303 | &iscsi_tpg_param_DefaultTime2Wait.attr, | 1088 | &iscsi_tpg_param_attr_DefaultTime2Wait, |
1304 | &iscsi_tpg_param_DefaultTime2Retain.attr, | 1089 | &iscsi_tpg_param_attr_DefaultTime2Retain, |
1305 | &iscsi_tpg_param_MaxOutstandingR2T.attr, | 1090 | &iscsi_tpg_param_attr_MaxOutstandingR2T, |
1306 | &iscsi_tpg_param_DataPDUInOrder.attr, | 1091 | &iscsi_tpg_param_attr_DataPDUInOrder, |
1307 | &iscsi_tpg_param_DataSequenceInOrder.attr, | 1092 | &iscsi_tpg_param_attr_DataSequenceInOrder, |
1308 | &iscsi_tpg_param_ErrorRecoveryLevel.attr, | 1093 | &iscsi_tpg_param_attr_ErrorRecoveryLevel, |
1309 | &iscsi_tpg_param_IFMarker.attr, | 1094 | &iscsi_tpg_param_attr_IFMarker, |
1310 | &iscsi_tpg_param_OFMarker.attr, | 1095 | &iscsi_tpg_param_attr_OFMarker, |
1311 | &iscsi_tpg_param_IFMarkInt.attr, | 1096 | &iscsi_tpg_param_attr_IFMarkInt, |
1312 | &iscsi_tpg_param_OFMarkInt.attr, | 1097 | &iscsi_tpg_param_attr_OFMarkInt, |
1313 | NULL, | 1098 | NULL, |
1314 | }; | 1099 | }; |
1315 | 1100 | ||
@@ -1317,10 +1102,9 @@ static struct configfs_attribute *lio_target_tpg_param_attrs[] = { | |||
1317 | 1102 | ||
1318 | /* Start items for lio_target_tpg_cit */ | 1103 | /* Start items for lio_target_tpg_cit */ |
1319 | 1104 | ||
1320 | static ssize_t lio_target_tpg_show_enable( | 1105 | static ssize_t lio_target_tpg_enable_show(struct config_item *item, char *page) |
1321 | struct se_portal_group *se_tpg, | ||
1322 | char *page) | ||
1323 | { | 1106 | { |
1107 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1324 | struct iscsi_portal_group *tpg = container_of(se_tpg, | 1108 | struct iscsi_portal_group *tpg = container_of(se_tpg, |
1325 | struct iscsi_portal_group, tpg_se_tpg); | 1109 | struct iscsi_portal_group, tpg_se_tpg); |
1326 | ssize_t len; | 1110 | ssize_t len; |
@@ -1333,11 +1117,10 @@ static ssize_t lio_target_tpg_show_enable( | |||
1333 | return len; | 1117 | return len; |
1334 | } | 1118 | } |
1335 | 1119 | ||
1336 | static ssize_t lio_target_tpg_store_enable( | 1120 | static ssize_t lio_target_tpg_enable_store(struct config_item *item, |
1337 | struct se_portal_group *se_tpg, | 1121 | const char *page, size_t count) |
1338 | const char *page, | ||
1339 | size_t count) | ||
1340 | { | 1122 | { |
1123 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1341 | struct iscsi_portal_group *tpg = container_of(se_tpg, | 1124 | struct iscsi_portal_group *tpg = container_of(se_tpg, |
1342 | struct iscsi_portal_group, tpg_se_tpg); | 1125 | struct iscsi_portal_group, tpg_se_tpg); |
1343 | u32 op; | 1126 | u32 op; |
@@ -1375,20 +1158,19 @@ out: | |||
1375 | return -EINVAL; | 1158 | return -EINVAL; |
1376 | } | 1159 | } |
1377 | 1160 | ||
1378 | TF_TPG_BASE_ATTR(lio_target, enable, S_IRUGO | S_IWUSR); | ||
1379 | 1161 | ||
1380 | static ssize_t lio_target_tpg_show_dynamic_sessions( | 1162 | static ssize_t lio_target_tpg_dynamic_sessions_show(struct config_item *item, |
1381 | struct se_portal_group *se_tpg, | 1163 | char *page) |
1382 | char *page) | ||
1383 | { | 1164 | { |
1384 | return target_show_dynamic_sessions(se_tpg, page); | 1165 | return target_show_dynamic_sessions(to_tpg(item), page); |
1385 | } | 1166 | } |
1386 | 1167 | ||
1387 | TF_TPG_BASE_ATTR_RO(lio_target, dynamic_sessions); | 1168 | CONFIGFS_ATTR(lio_target_tpg_, enable); |
1169 | CONFIGFS_ATTR_RO(lio_target_tpg_, dynamic_sessions); | ||
1388 | 1170 | ||
1389 | static struct configfs_attribute *lio_target_tpg_attrs[] = { | 1171 | static struct configfs_attribute *lio_target_tpg_attrs[] = { |
1390 | &lio_target_tpg_enable.attr, | 1172 | &lio_target_tpg_attr_enable, |
1391 | &lio_target_tpg_dynamic_sessions.attr, | 1173 | &lio_target_tpg_attr_dynamic_sessions, |
1392 | NULL, | 1174 | NULL, |
1393 | }; | 1175 | }; |
1394 | 1176 | ||
@@ -1463,17 +1245,16 @@ static void lio_target_tiqn_deltpg(struct se_portal_group *se_tpg) | |||
1463 | 1245 | ||
1464 | /* Start LIO-Target TIQN struct contig_item lio_target_cit */ | 1246 | /* Start LIO-Target TIQN struct contig_item lio_target_cit */ |
1465 | 1247 | ||
1466 | static ssize_t lio_target_wwn_show_attr_lio_version( | 1248 | static ssize_t lio_target_wwn_lio_version_show(struct config_item *item, |
1467 | struct target_fabric_configfs *tf, | 1249 | char *page) |
1468 | char *page) | ||
1469 | { | 1250 | { |
1470 | return sprintf(page, "Datera Inc. iSCSI Target "ISCSIT_VERSION"\n"); | 1251 | return sprintf(page, "Datera Inc. iSCSI Target "ISCSIT_VERSION"\n"); |
1471 | } | 1252 | } |
1472 | 1253 | ||
1473 | TF_WWN_ATTR_RO(lio_target, lio_version); | 1254 | CONFIGFS_ATTR_RO(lio_target_wwn_, lio_version); |
1474 | 1255 | ||
1475 | static struct configfs_attribute *lio_target_wwn_attrs[] = { | 1256 | static struct configfs_attribute *lio_target_wwn_attrs[] = { |
1476 | &lio_target_wwn_lio_version.attr, | 1257 | &lio_target_wwn_attr_lio_version, |
1477 | NULL, | 1258 | NULL, |
1478 | }; | 1259 | }; |
1479 | 1260 | ||
@@ -1552,77 +1333,47 @@ static void lio_target_call_coredeltiqn( | |||
1552 | 1333 | ||
1553 | #define DEF_DISC_AUTH_STR(name, flags) \ | 1334 | #define DEF_DISC_AUTH_STR(name, flags) \ |
1554 | __DEF_NACL_AUTH_STR(disc, name, flags) \ | 1335 | __DEF_NACL_AUTH_STR(disc, name, flags) \ |
1555 | static ssize_t iscsi_disc_show_##name( \ | 1336 | static ssize_t iscsi_disc_##name##_show(struct config_item *item, char *page) \ |
1556 | struct target_fabric_configfs *tf, \ | ||
1557 | char *page) \ | ||
1558 | { \ | 1337 | { \ |
1559 | return __iscsi_disc_show_##name(&iscsit_global->discovery_acl, \ | 1338 | return __iscsi_disc_##name##_show(&iscsit_global->discovery_acl,\ |
1560 | page); \ | 1339 | page); \ |
1561 | } \ | 1340 | } \ |
1562 | static ssize_t iscsi_disc_store_##name( \ | 1341 | static ssize_t iscsi_disc_##name##_store(struct config_item *item, \ |
1563 | struct target_fabric_configfs *tf, \ | 1342 | const char *page, size_t count) \ |
1564 | const char *page, \ | ||
1565 | size_t count) \ | ||
1566 | { \ | 1343 | { \ |
1567 | return __iscsi_disc_store_##name(&iscsit_global->discovery_acl, \ | 1344 | return __iscsi_disc_##name##_store(&iscsit_global->discovery_acl, \ |
1568 | page, count); \ | 1345 | page, count); \ |
1569 | } | 1346 | \ |
1347 | } \ | ||
1348 | CONFIGFS_ATTR(iscsi_disc_, name) | ||
1349 | |||
1350 | DEF_DISC_AUTH_STR(userid, NAF_USERID_SET); | ||
1351 | DEF_DISC_AUTH_STR(password, NAF_PASSWORD_SET); | ||
1352 | DEF_DISC_AUTH_STR(userid_mutual, NAF_USERID_IN_SET); | ||
1353 | DEF_DISC_AUTH_STR(password_mutual, NAF_PASSWORD_IN_SET); | ||
1570 | 1354 | ||
1571 | #define DEF_DISC_AUTH_INT(name) \ | 1355 | #define DEF_DISC_AUTH_INT(name) \ |
1572 | __DEF_NACL_AUTH_INT(disc, name) \ | 1356 | __DEF_NACL_AUTH_INT(disc, name) \ |
1573 | static ssize_t iscsi_disc_show_##name( \ | 1357 | static ssize_t iscsi_disc_##name##_show(struct config_item *item, char *page) \ |
1574 | struct target_fabric_configfs *tf, \ | ||
1575 | char *page) \ | ||
1576 | { \ | 1358 | { \ |
1577 | return __iscsi_disc_show_##name(&iscsit_global->discovery_acl, \ | 1359 | return __iscsi_disc_##name##_show(&iscsit_global->discovery_acl, \ |
1578 | page); \ | 1360 | page); \ |
1579 | } | 1361 | } \ |
1580 | 1362 | CONFIGFS_ATTR_RO(iscsi_disc_, name) | |
1581 | #define DISC_AUTH_ATTR(_name, _mode) TF_DISC_ATTR(iscsi, _name, _mode) | ||
1582 | #define DISC_AUTH_ATTR_RO(_name) TF_DISC_ATTR_RO(iscsi, _name) | ||
1583 | 1363 | ||
1584 | /* | ||
1585 | * One-way authentication userid | ||
1586 | */ | ||
1587 | DEF_DISC_AUTH_STR(userid, NAF_USERID_SET); | ||
1588 | DISC_AUTH_ATTR(userid, S_IRUGO | S_IWUSR); | ||
1589 | /* | ||
1590 | * One-way authentication password | ||
1591 | */ | ||
1592 | DEF_DISC_AUTH_STR(password, NAF_PASSWORD_SET); | ||
1593 | DISC_AUTH_ATTR(password, S_IRUGO | S_IWUSR); | ||
1594 | /* | ||
1595 | * Enforce mutual authentication | ||
1596 | */ | ||
1597 | DEF_DISC_AUTH_INT(authenticate_target); | 1364 | DEF_DISC_AUTH_INT(authenticate_target); |
1598 | DISC_AUTH_ATTR_RO(authenticate_target); | ||
1599 | /* | ||
1600 | * Mutual authentication userid | ||
1601 | */ | ||
1602 | DEF_DISC_AUTH_STR(userid_mutual, NAF_USERID_IN_SET); | ||
1603 | DISC_AUTH_ATTR(userid_mutual, S_IRUGO | S_IWUSR); | ||
1604 | /* | ||
1605 | * Mutual authentication password | ||
1606 | */ | ||
1607 | DEF_DISC_AUTH_STR(password_mutual, NAF_PASSWORD_IN_SET); | ||
1608 | DISC_AUTH_ATTR(password_mutual, S_IRUGO | S_IWUSR); | ||
1609 | 1365 | ||
1610 | /* | 1366 | |
1611 | * enforce_discovery_auth | 1367 | static ssize_t iscsi_disc_enforce_discovery_auth_show(struct config_item *item, |
1612 | */ | 1368 | char *page) |
1613 | static ssize_t iscsi_disc_show_enforce_discovery_auth( | ||
1614 | struct target_fabric_configfs *tf, | ||
1615 | char *page) | ||
1616 | { | 1369 | { |
1617 | struct iscsi_node_auth *discovery_auth = &iscsit_global->discovery_acl.node_auth; | 1370 | struct iscsi_node_auth *discovery_auth = &iscsit_global->discovery_acl.node_auth; |
1618 | 1371 | ||
1619 | return sprintf(page, "%d\n", discovery_auth->enforce_discovery_auth); | 1372 | return sprintf(page, "%d\n", discovery_auth->enforce_discovery_auth); |
1620 | } | 1373 | } |
1621 | 1374 | ||
1622 | static ssize_t iscsi_disc_store_enforce_discovery_auth( | 1375 | static ssize_t iscsi_disc_enforce_discovery_auth_store(struct config_item *item, |
1623 | struct target_fabric_configfs *tf, | 1376 | const char *page, size_t count) |
1624 | const char *page, | ||
1625 | size_t count) | ||
1626 | { | 1377 | { |
1627 | struct iscsi_param *param; | 1378 | struct iscsi_param *param; |
1628 | struct iscsi_portal_group *discovery_tpg = iscsit_global->discovery_tpg; | 1379 | struct iscsi_portal_group *discovery_tpg = iscsit_global->discovery_tpg; |
@@ -1677,15 +1428,15 @@ static ssize_t iscsi_disc_store_enforce_discovery_auth( | |||
1677 | return count; | 1428 | return count; |
1678 | } | 1429 | } |
1679 | 1430 | ||
1680 | DISC_AUTH_ATTR(enforce_discovery_auth, S_IRUGO | S_IWUSR); | 1431 | CONFIGFS_ATTR(iscsi_disc_, enforce_discovery_auth); |
1681 | 1432 | ||
1682 | static struct configfs_attribute *lio_target_discovery_auth_attrs[] = { | 1433 | static struct configfs_attribute *lio_target_discovery_auth_attrs[] = { |
1683 | &iscsi_disc_userid.attr, | 1434 | &iscsi_disc_attr_userid, |
1684 | &iscsi_disc_password.attr, | 1435 | &iscsi_disc_attr_password, |
1685 | &iscsi_disc_authenticate_target.attr, | 1436 | &iscsi_disc_attr_authenticate_target, |
1686 | &iscsi_disc_userid_mutual.attr, | 1437 | &iscsi_disc_attr_userid_mutual, |
1687 | &iscsi_disc_password_mutual.attr, | 1438 | &iscsi_disc_attr_password_mutual, |
1688 | &iscsi_disc_enforce_discovery_auth.attr, | 1439 | &iscsi_disc_attr_enforce_discovery_auth, |
1689 | NULL, | 1440 | NULL, |
1690 | }; | 1441 | }; |
1691 | 1442 | ||
diff --git a/drivers/target/iscsi/iscsi_target_stat.c b/drivers/target/iscsi/iscsi_target_stat.c index 9dd94ff0b62c..411cb266a47d 100644 --- a/drivers/target/iscsi/iscsi_target_stat.c +++ b/drivers/target/iscsi/iscsi_target_stat.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/export.h> | 21 | #include <linux/export.h> |
22 | #include <scsi/iscsi_proto.h> | 22 | #include <scsi/iscsi_proto.h> |
23 | #include <target/target_core_base.h> | 23 | #include <target/target_core_base.h> |
24 | #include <target/configfs_macros.h> | ||
25 | 24 | ||
26 | #include <target/iscsi/iscsi_target_core.h> | 25 | #include <target/iscsi/iscsi_target_core.h> |
27 | #include "iscsi_target_parameters.h" | 26 | #include "iscsi_target_parameters.h" |
@@ -50,76 +49,56 @@ | |||
50 | /* | 49 | /* |
51 | * Instance Attributes Table | 50 | * Instance Attributes Table |
52 | */ | 51 | */ |
53 | CONFIGFS_EATTR_STRUCT(iscsi_stat_instance, iscsi_wwn_stat_grps); | 52 | static struct iscsi_tiqn *iscsi_instance_tiqn(struct config_item *item) |
54 | #define ISCSI_STAT_INSTANCE_ATTR(_name, _mode) \ | 53 | { |
55 | static struct iscsi_stat_instance_attribute \ | 54 | struct iscsi_wwn_stat_grps *igrps = container_of(to_config_group(item), |
56 | iscsi_stat_instance_##_name = \ | 55 | struct iscsi_wwn_stat_grps, iscsi_instance_group); |
57 | __CONFIGFS_EATTR(_name, _mode, \ | 56 | return container_of(igrps, struct iscsi_tiqn, tiqn_stat_grps); |
58 | iscsi_stat_instance_show_attr_##_name, \ | 57 | } |
59 | iscsi_stat_instance_store_attr_##_name); | ||
60 | |||
61 | #define ISCSI_STAT_INSTANCE_ATTR_RO(_name) \ | ||
62 | static struct iscsi_stat_instance_attribute \ | ||
63 | iscsi_stat_instance_##_name = \ | ||
64 | __CONFIGFS_EATTR_RO(_name, \ | ||
65 | iscsi_stat_instance_show_attr_##_name); | ||
66 | |||
67 | static ssize_t iscsi_stat_instance_show_attr_inst( | ||
68 | struct iscsi_wwn_stat_grps *igrps, char *page) | ||
69 | { | ||
70 | struct iscsi_tiqn *tiqn = container_of(igrps, | ||
71 | struct iscsi_tiqn, tiqn_stat_grps); | ||
72 | 58 | ||
73 | return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); | 59 | static ssize_t iscsi_stat_instance_inst_show(struct config_item *item, |
60 | char *page) | ||
61 | { | ||
62 | return snprintf(page, PAGE_SIZE, "%u\n", | ||
63 | iscsi_instance_tiqn(item)->tiqn_index); | ||
74 | } | 64 | } |
75 | ISCSI_STAT_INSTANCE_ATTR_RO(inst); | ||
76 | 65 | ||
77 | static ssize_t iscsi_stat_instance_show_attr_min_ver( | 66 | static ssize_t iscsi_stat_instance_min_ver_show(struct config_item *item, |
78 | struct iscsi_wwn_stat_grps *igrps, char *page) | 67 | char *page) |
79 | { | 68 | { |
80 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_DRAFT20_VERSION); | 69 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_DRAFT20_VERSION); |
81 | } | 70 | } |
82 | ISCSI_STAT_INSTANCE_ATTR_RO(min_ver); | ||
83 | 71 | ||
84 | static ssize_t iscsi_stat_instance_show_attr_max_ver( | 72 | static ssize_t iscsi_stat_instance_max_ver_show(struct config_item *item, |
85 | struct iscsi_wwn_stat_grps *igrps, char *page) | 73 | char *page) |
86 | { | 74 | { |
87 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_DRAFT20_VERSION); | 75 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_DRAFT20_VERSION); |
88 | } | 76 | } |
89 | ISCSI_STAT_INSTANCE_ATTR_RO(max_ver); | ||
90 | 77 | ||
91 | static ssize_t iscsi_stat_instance_show_attr_portals( | 78 | static ssize_t iscsi_stat_instance_portals_show(struct config_item *item, |
92 | struct iscsi_wwn_stat_grps *igrps, char *page) | 79 | char *page) |
93 | { | 80 | { |
94 | struct iscsi_tiqn *tiqn = container_of(igrps, | 81 | return snprintf(page, PAGE_SIZE, "%u\n", |
95 | struct iscsi_tiqn, tiqn_stat_grps); | 82 | iscsi_instance_tiqn(item)->tiqn_num_tpg_nps); |
96 | |||
97 | return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_num_tpg_nps); | ||
98 | } | 83 | } |
99 | ISCSI_STAT_INSTANCE_ATTR_RO(portals); | ||
100 | 84 | ||
101 | static ssize_t iscsi_stat_instance_show_attr_nodes( | 85 | static ssize_t iscsi_stat_instance_nodes_show(struct config_item *item, |
102 | struct iscsi_wwn_stat_grps *igrps, char *page) | 86 | char *page) |
103 | { | 87 | { |
104 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_INST_NUM_NODES); | 88 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_INST_NUM_NODES); |
105 | } | 89 | } |
106 | ISCSI_STAT_INSTANCE_ATTR_RO(nodes); | ||
107 | 90 | ||
108 | static ssize_t iscsi_stat_instance_show_attr_sessions( | 91 | static ssize_t iscsi_stat_instance_sessions_show(struct config_item *item, |
109 | struct iscsi_wwn_stat_grps *igrps, char *page) | 92 | char *page) |
110 | { | 93 | { |
111 | struct iscsi_tiqn *tiqn = container_of(igrps, | 94 | return snprintf(page, PAGE_SIZE, "%u\n", |
112 | struct iscsi_tiqn, tiqn_stat_grps); | 95 | iscsi_instance_tiqn(item)->tiqn_nsessions); |
113 | |||
114 | return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_nsessions); | ||
115 | } | 96 | } |
116 | ISCSI_STAT_INSTANCE_ATTR_RO(sessions); | ||
117 | 97 | ||
118 | static ssize_t iscsi_stat_instance_show_attr_fail_sess( | 98 | static ssize_t iscsi_stat_instance_fail_sess_show(struct config_item *item, |
119 | struct iscsi_wwn_stat_grps *igrps, char *page) | 99 | char *page) |
120 | { | 100 | { |
121 | struct iscsi_tiqn *tiqn = container_of(igrps, | 101 | struct iscsi_tiqn *tiqn = iscsi_instance_tiqn(item); |
122 | struct iscsi_tiqn, tiqn_stat_grps); | ||
123 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; | 102 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; |
124 | u32 sess_err_count; | 103 | u32 sess_err_count; |
125 | 104 | ||
@@ -131,88 +110,84 @@ static ssize_t iscsi_stat_instance_show_attr_fail_sess( | |||
131 | 110 | ||
132 | return snprintf(page, PAGE_SIZE, "%u\n", sess_err_count); | 111 | return snprintf(page, PAGE_SIZE, "%u\n", sess_err_count); |
133 | } | 112 | } |
134 | ISCSI_STAT_INSTANCE_ATTR_RO(fail_sess); | ||
135 | 113 | ||
136 | static ssize_t iscsi_stat_instance_show_attr_fail_type( | 114 | static ssize_t iscsi_stat_instance_fail_type_show(struct config_item *item, |
137 | struct iscsi_wwn_stat_grps *igrps, char *page) | 115 | char *page) |
138 | { | 116 | { |
139 | struct iscsi_tiqn *tiqn = container_of(igrps, | 117 | struct iscsi_tiqn *tiqn = iscsi_instance_tiqn(item); |
140 | struct iscsi_tiqn, tiqn_stat_grps); | ||
141 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; | 118 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; |
142 | 119 | ||
143 | return snprintf(page, PAGE_SIZE, "%u\n", | 120 | return snprintf(page, PAGE_SIZE, "%u\n", |
144 | sess_err->last_sess_failure_type); | 121 | sess_err->last_sess_failure_type); |
145 | } | 122 | } |
146 | ISCSI_STAT_INSTANCE_ATTR_RO(fail_type); | ||
147 | 123 | ||
148 | static ssize_t iscsi_stat_instance_show_attr_fail_rem_name( | 124 | static ssize_t iscsi_stat_instance_fail_rem_name_show(struct config_item *item, |
149 | struct iscsi_wwn_stat_grps *igrps, char *page) | 125 | char *page) |
150 | { | 126 | { |
151 | struct iscsi_tiqn *tiqn = container_of(igrps, | 127 | struct iscsi_tiqn *tiqn = iscsi_instance_tiqn(item); |
152 | struct iscsi_tiqn, tiqn_stat_grps); | ||
153 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; | 128 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; |
154 | 129 | ||
155 | return snprintf(page, PAGE_SIZE, "%s\n", | 130 | return snprintf(page, PAGE_SIZE, "%s\n", |
156 | sess_err->last_sess_fail_rem_name[0] ? | 131 | sess_err->last_sess_fail_rem_name[0] ? |
157 | sess_err->last_sess_fail_rem_name : NONE); | 132 | sess_err->last_sess_fail_rem_name : NONE); |
158 | } | 133 | } |
159 | ISCSI_STAT_INSTANCE_ATTR_RO(fail_rem_name); | ||
160 | 134 | ||
161 | static ssize_t iscsi_stat_instance_show_attr_disc_time( | 135 | static ssize_t iscsi_stat_instance_disc_time_show(struct config_item *item, |
162 | struct iscsi_wwn_stat_grps *igrps, char *page) | 136 | char *page) |
163 | { | 137 | { |
164 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_DISCONTINUITY_TIME); | 138 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_DISCONTINUITY_TIME); |
165 | } | 139 | } |
166 | ISCSI_STAT_INSTANCE_ATTR_RO(disc_time); | ||
167 | 140 | ||
168 | static ssize_t iscsi_stat_instance_show_attr_description( | 141 | static ssize_t iscsi_stat_instance_description_show(struct config_item *item, |
169 | struct iscsi_wwn_stat_grps *igrps, char *page) | 142 | char *page) |
170 | { | 143 | { |
171 | return snprintf(page, PAGE_SIZE, "%s\n", ISCSI_INST_DESCR); | 144 | return snprintf(page, PAGE_SIZE, "%s\n", ISCSI_INST_DESCR); |
172 | } | 145 | } |
173 | ISCSI_STAT_INSTANCE_ATTR_RO(description); | ||
174 | 146 | ||
175 | static ssize_t iscsi_stat_instance_show_attr_vendor( | 147 | static ssize_t iscsi_stat_instance_vendor_show(struct config_item *item, |
176 | struct iscsi_wwn_stat_grps *igrps, char *page) | 148 | char *page) |
177 | { | 149 | { |
178 | return snprintf(page, PAGE_SIZE, "Datera, Inc. iSCSI-Target\n"); | 150 | return snprintf(page, PAGE_SIZE, "Datera, Inc. iSCSI-Target\n"); |
179 | } | 151 | } |
180 | ISCSI_STAT_INSTANCE_ATTR_RO(vendor); | ||
181 | 152 | ||
182 | static ssize_t iscsi_stat_instance_show_attr_version( | 153 | static ssize_t iscsi_stat_instance_version_show(struct config_item *item, |
183 | struct iscsi_wwn_stat_grps *igrps, char *page) | 154 | char *page) |
184 | { | 155 | { |
185 | return snprintf(page, PAGE_SIZE, "%s\n", ISCSIT_VERSION); | 156 | return snprintf(page, PAGE_SIZE, "%s\n", ISCSIT_VERSION); |
186 | } | 157 | } |
187 | ISCSI_STAT_INSTANCE_ATTR_RO(version); | ||
188 | 158 | ||
189 | CONFIGFS_EATTR_OPS(iscsi_stat_instance, iscsi_wwn_stat_grps, | 159 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, inst); |
190 | iscsi_instance_group); | 160 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, min_ver); |
161 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, max_ver); | ||
162 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, portals); | ||
163 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, nodes); | ||
164 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, sessions); | ||
165 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, fail_sess); | ||
166 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, fail_type); | ||
167 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, fail_rem_name); | ||
168 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, disc_time); | ||
169 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, description); | ||
170 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, vendor); | ||
171 | CONFIGFS_ATTR_RO(iscsi_stat_instance_, version); | ||
191 | 172 | ||
192 | static struct configfs_attribute *iscsi_stat_instance_attrs[] = { | 173 | static struct configfs_attribute *iscsi_stat_instance_attrs[] = { |
193 | &iscsi_stat_instance_inst.attr, | 174 | &iscsi_stat_instance_attr_inst, |
194 | &iscsi_stat_instance_min_ver.attr, | 175 | &iscsi_stat_instance_attr_min_ver, |
195 | &iscsi_stat_instance_max_ver.attr, | 176 | &iscsi_stat_instance_attr_max_ver, |
196 | &iscsi_stat_instance_portals.attr, | 177 | &iscsi_stat_instance_attr_portals, |
197 | &iscsi_stat_instance_nodes.attr, | 178 | &iscsi_stat_instance_attr_nodes, |
198 | &iscsi_stat_instance_sessions.attr, | 179 | &iscsi_stat_instance_attr_sessions, |
199 | &iscsi_stat_instance_fail_sess.attr, | 180 | &iscsi_stat_instance_attr_fail_sess, |
200 | &iscsi_stat_instance_fail_type.attr, | 181 | &iscsi_stat_instance_attr_fail_type, |
201 | &iscsi_stat_instance_fail_rem_name.attr, | 182 | &iscsi_stat_instance_attr_fail_rem_name, |
202 | &iscsi_stat_instance_disc_time.attr, | 183 | &iscsi_stat_instance_attr_disc_time, |
203 | &iscsi_stat_instance_description.attr, | 184 | &iscsi_stat_instance_attr_description, |
204 | &iscsi_stat_instance_vendor.attr, | 185 | &iscsi_stat_instance_attr_vendor, |
205 | &iscsi_stat_instance_version.attr, | 186 | &iscsi_stat_instance_attr_version, |
206 | NULL, | 187 | NULL, |
207 | }; | 188 | }; |
208 | 189 | ||
209 | static struct configfs_item_operations iscsi_stat_instance_item_ops = { | ||
210 | .show_attribute = iscsi_stat_instance_attr_show, | ||
211 | .store_attribute = iscsi_stat_instance_attr_store, | ||
212 | }; | ||
213 | |||
214 | struct config_item_type iscsi_stat_instance_cit = { | 190 | struct config_item_type iscsi_stat_instance_cit = { |
215 | .ct_item_ops = &iscsi_stat_instance_item_ops, | ||
216 | .ct_attrs = iscsi_stat_instance_attrs, | 191 | .ct_attrs = iscsi_stat_instance_attrs, |
217 | .ct_owner = THIS_MODULE, | 192 | .ct_owner = THIS_MODULE, |
218 | }; | 193 | }; |
@@ -220,81 +195,61 @@ struct config_item_type iscsi_stat_instance_cit = { | |||
220 | /* | 195 | /* |
221 | * Instance Session Failure Stats Table | 196 | * Instance Session Failure Stats Table |
222 | */ | 197 | */ |
223 | CONFIGFS_EATTR_STRUCT(iscsi_stat_sess_err, iscsi_wwn_stat_grps); | 198 | static struct iscsi_tiqn *iscsi_sess_err_tiqn(struct config_item *item) |
224 | #define ISCSI_STAT_SESS_ERR_ATTR(_name, _mode) \ | 199 | { |
225 | static struct iscsi_stat_sess_err_attribute \ | 200 | struct iscsi_wwn_stat_grps *igrps = container_of(to_config_group(item), |
226 | iscsi_stat_sess_err_##_name = \ | 201 | struct iscsi_wwn_stat_grps, iscsi_sess_err_group); |
227 | __CONFIGFS_EATTR(_name, _mode, \ | 202 | return container_of(igrps, struct iscsi_tiqn, tiqn_stat_grps); |
228 | iscsi_stat_sess_err_show_attr_##_name, \ | 203 | } |
229 | iscsi_stat_sess_err_store_attr_##_name); | ||
230 | |||
231 | #define ISCSI_STAT_SESS_ERR_ATTR_RO(_name) \ | ||
232 | static struct iscsi_stat_sess_err_attribute \ | ||
233 | iscsi_stat_sess_err_##_name = \ | ||
234 | __CONFIGFS_EATTR_RO(_name, \ | ||
235 | iscsi_stat_sess_err_show_attr_##_name); | ||
236 | |||
237 | static ssize_t iscsi_stat_sess_err_show_attr_inst( | ||
238 | struct iscsi_wwn_stat_grps *igrps, char *page) | ||
239 | { | ||
240 | struct iscsi_tiqn *tiqn = container_of(igrps, | ||
241 | struct iscsi_tiqn, tiqn_stat_grps); | ||
242 | 204 | ||
243 | return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); | 205 | static ssize_t iscsi_stat_sess_err_inst_show(struct config_item *item, |
206 | char *page) | ||
207 | { | ||
208 | return snprintf(page, PAGE_SIZE, "%u\n", | ||
209 | iscsi_sess_err_tiqn(item)->tiqn_index); | ||
244 | } | 210 | } |
245 | ISCSI_STAT_SESS_ERR_ATTR_RO(inst); | ||
246 | 211 | ||
247 | static ssize_t iscsi_stat_sess_err_show_attr_digest_errors( | 212 | static ssize_t iscsi_stat_sess_err_digest_errors_show(struct config_item *item, |
248 | struct iscsi_wwn_stat_grps *igrps, char *page) | 213 | char *page) |
249 | { | 214 | { |
250 | struct iscsi_tiqn *tiqn = container_of(igrps, | 215 | struct iscsi_tiqn *tiqn = iscsi_sess_err_tiqn(item); |
251 | struct iscsi_tiqn, tiqn_stat_grps); | ||
252 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; | 216 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; |
253 | 217 | ||
254 | return snprintf(page, PAGE_SIZE, "%u\n", sess_err->digest_errors); | 218 | return snprintf(page, PAGE_SIZE, "%u\n", sess_err->digest_errors); |
255 | } | 219 | } |
256 | ISCSI_STAT_SESS_ERR_ATTR_RO(digest_errors); | ||
257 | 220 | ||
258 | static ssize_t iscsi_stat_sess_err_show_attr_cxn_errors( | 221 | static ssize_t iscsi_stat_sess_err_cxn_errors_show(struct config_item *item, |
259 | struct iscsi_wwn_stat_grps *igrps, char *page) | 222 | char *page) |
260 | { | 223 | { |
261 | struct iscsi_tiqn *tiqn = container_of(igrps, | 224 | struct iscsi_tiqn *tiqn = iscsi_sess_err_tiqn(item); |
262 | struct iscsi_tiqn, tiqn_stat_grps); | ||
263 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; | 225 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; |
264 | 226 | ||
265 | return snprintf(page, PAGE_SIZE, "%u\n", sess_err->cxn_timeout_errors); | 227 | return snprintf(page, PAGE_SIZE, "%u\n", sess_err->cxn_timeout_errors); |
266 | } | 228 | } |
267 | ISCSI_STAT_SESS_ERR_ATTR_RO(cxn_errors); | ||
268 | 229 | ||
269 | static ssize_t iscsi_stat_sess_err_show_attr_format_errors( | 230 | static ssize_t iscsi_stat_sess_err_format_errors_show(struct config_item *item, |
270 | struct iscsi_wwn_stat_grps *igrps, char *page) | 231 | char *page) |
271 | { | 232 | { |
272 | struct iscsi_tiqn *tiqn = container_of(igrps, | 233 | struct iscsi_tiqn *tiqn = iscsi_sess_err_tiqn(item); |
273 | struct iscsi_tiqn, tiqn_stat_grps); | ||
274 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; | 234 | struct iscsi_sess_err_stats *sess_err = &tiqn->sess_err_stats; |
275 | 235 | ||
276 | return snprintf(page, PAGE_SIZE, "%u\n", sess_err->pdu_format_errors); | 236 | return snprintf(page, PAGE_SIZE, "%u\n", sess_err->pdu_format_errors); |
277 | } | 237 | } |
278 | ISCSI_STAT_SESS_ERR_ATTR_RO(format_errors); | ||
279 | 238 | ||
280 | CONFIGFS_EATTR_OPS(iscsi_stat_sess_err, iscsi_wwn_stat_grps, | 239 | CONFIGFS_ATTR_RO(iscsi_stat_sess_err_, inst); |
281 | iscsi_sess_err_group); | 240 | CONFIGFS_ATTR_RO(iscsi_stat_sess_err_, digest_errors); |
241 | CONFIGFS_ATTR_RO(iscsi_stat_sess_err_, cxn_errors); | ||
242 | CONFIGFS_ATTR_RO(iscsi_stat_sess_err_, format_errors); | ||
282 | 243 | ||
283 | static struct configfs_attribute *iscsi_stat_sess_err_attrs[] = { | 244 | static struct configfs_attribute *iscsi_stat_sess_err_attrs[] = { |
284 | &iscsi_stat_sess_err_inst.attr, | 245 | &iscsi_stat_sess_err_attr_inst, |
285 | &iscsi_stat_sess_err_digest_errors.attr, | 246 | &iscsi_stat_sess_err_attr_digest_errors, |
286 | &iscsi_stat_sess_err_cxn_errors.attr, | 247 | &iscsi_stat_sess_err_attr_cxn_errors, |
287 | &iscsi_stat_sess_err_format_errors.attr, | 248 | &iscsi_stat_sess_err_attr_format_errors, |
288 | NULL, | 249 | NULL, |
289 | }; | 250 | }; |
290 | 251 | ||
291 | static struct configfs_item_operations iscsi_stat_sess_err_item_ops = { | ||
292 | .show_attribute = iscsi_stat_sess_err_attr_show, | ||
293 | .store_attribute = iscsi_stat_sess_err_attr_store, | ||
294 | }; | ||
295 | |||
296 | struct config_item_type iscsi_stat_sess_err_cit = { | 252 | struct config_item_type iscsi_stat_sess_err_cit = { |
297 | .ct_item_ops = &iscsi_stat_sess_err_item_ops, | ||
298 | .ct_attrs = iscsi_stat_sess_err_attrs, | 253 | .ct_attrs = iscsi_stat_sess_err_attrs, |
299 | .ct_owner = THIS_MODULE, | 254 | .ct_owner = THIS_MODULE, |
300 | }; | 255 | }; |
@@ -302,42 +257,30 @@ struct config_item_type iscsi_stat_sess_err_cit = { | |||
302 | /* | 257 | /* |
303 | * Target Attributes Table | 258 | * Target Attributes Table |
304 | */ | 259 | */ |
305 | CONFIGFS_EATTR_STRUCT(iscsi_stat_tgt_attr, iscsi_wwn_stat_grps); | 260 | static struct iscsi_tiqn *iscsi_tgt_attr_tiqn(struct config_item *item) |
306 | #define ISCSI_STAT_TGT_ATTR(_name, _mode) \ | 261 | { |
307 | static struct iscsi_stat_tgt_attr_attribute \ | 262 | struct iscsi_wwn_stat_grps *igrps = container_of(to_config_group(item), |
308 | iscsi_stat_tgt_attr_##_name = \ | 263 | struct iscsi_wwn_stat_grps, iscsi_tgt_attr_group); |
309 | __CONFIGFS_EATTR(_name, _mode, \ | 264 | return container_of(igrps, struct iscsi_tiqn, tiqn_stat_grps); |
310 | iscsi_stat_tgt-attr_show_attr_##_name, \ | 265 | } |
311 | iscsi_stat_tgt_attr_store_attr_##_name); | ||
312 | |||
313 | #define ISCSI_STAT_TGT_ATTR_RO(_name) \ | ||
314 | static struct iscsi_stat_tgt_attr_attribute \ | ||
315 | iscsi_stat_tgt_attr_##_name = \ | ||
316 | __CONFIGFS_EATTR_RO(_name, \ | ||
317 | iscsi_stat_tgt_attr_show_attr_##_name); | ||
318 | |||
319 | static ssize_t iscsi_stat_tgt_attr_show_attr_inst( | ||
320 | struct iscsi_wwn_stat_grps *igrps, char *page) | ||
321 | { | ||
322 | struct iscsi_tiqn *tiqn = container_of(igrps, | ||
323 | struct iscsi_tiqn, tiqn_stat_grps); | ||
324 | 266 | ||
325 | return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); | 267 | static ssize_t iscsi_stat_tgt_attr_inst_show(struct config_item *item, |
268 | char *page) | ||
269 | { | ||
270 | return snprintf(page, PAGE_SIZE, "%u\n", | ||
271 | iscsi_tgt_attr_tiqn(item)->tiqn_index); | ||
326 | } | 272 | } |
327 | ISCSI_STAT_TGT_ATTR_RO(inst); | ||
328 | 273 | ||
329 | static ssize_t iscsi_stat_tgt_attr_show_attr_indx( | 274 | static ssize_t iscsi_stat_tgt_attr_indx_show(struct config_item *item, |
330 | struct iscsi_wwn_stat_grps *igrps, char *page) | 275 | char *page) |
331 | { | 276 | { |
332 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_NODE_INDEX); | 277 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_NODE_INDEX); |
333 | } | 278 | } |
334 | ISCSI_STAT_TGT_ATTR_RO(indx); | ||
335 | 279 | ||
336 | static ssize_t iscsi_stat_tgt_attr_show_attr_login_fails( | 280 | static ssize_t iscsi_stat_tgt_attr_login_fails_show(struct config_item *item, |
337 | struct iscsi_wwn_stat_grps *igrps, char *page) | 281 | char *page) |
338 | { | 282 | { |
339 | struct iscsi_tiqn *tiqn = container_of(igrps, | 283 | struct iscsi_tiqn *tiqn = iscsi_tgt_attr_tiqn(item); |
340 | struct iscsi_tiqn, tiqn_stat_grps); | ||
341 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 284 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
342 | u32 fail_count; | 285 | u32 fail_count; |
343 | 286 | ||
@@ -349,13 +292,11 @@ static ssize_t iscsi_stat_tgt_attr_show_attr_login_fails( | |||
349 | 292 | ||
350 | return snprintf(page, PAGE_SIZE, "%u\n", fail_count); | 293 | return snprintf(page, PAGE_SIZE, "%u\n", fail_count); |
351 | } | 294 | } |
352 | ISCSI_STAT_TGT_ATTR_RO(login_fails); | ||
353 | 295 | ||
354 | static ssize_t iscsi_stat_tgt_attr_show_attr_last_fail_time( | 296 | static ssize_t iscsi_stat_tgt_attr_last_fail_time_show(struct config_item *item, |
355 | struct iscsi_wwn_stat_grps *igrps, char *page) | 297 | char *page) |
356 | { | 298 | { |
357 | struct iscsi_tiqn *tiqn = container_of(igrps, | 299 | struct iscsi_tiqn *tiqn = iscsi_tgt_attr_tiqn(item); |
358 | struct iscsi_tiqn, tiqn_stat_grps); | ||
359 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 300 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
360 | u32 last_fail_time; | 301 | u32 last_fail_time; |
361 | 302 | ||
@@ -367,13 +308,11 @@ static ssize_t iscsi_stat_tgt_attr_show_attr_last_fail_time( | |||
367 | 308 | ||
368 | return snprintf(page, PAGE_SIZE, "%u\n", last_fail_time); | 309 | return snprintf(page, PAGE_SIZE, "%u\n", last_fail_time); |
369 | } | 310 | } |
370 | ISCSI_STAT_TGT_ATTR_RO(last_fail_time); | ||
371 | 311 | ||
372 | static ssize_t iscsi_stat_tgt_attr_show_attr_last_fail_type( | 312 | static ssize_t iscsi_stat_tgt_attr_last_fail_type_show(struct config_item *item, |
373 | struct iscsi_wwn_stat_grps *igrps, char *page) | 313 | char *page) |
374 | { | 314 | { |
375 | struct iscsi_tiqn *tiqn = container_of(igrps, | 315 | struct iscsi_tiqn *tiqn = iscsi_tgt_attr_tiqn(item); |
376 | struct iscsi_tiqn, tiqn_stat_grps); | ||
377 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 316 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
378 | u32 last_fail_type; | 317 | u32 last_fail_type; |
379 | 318 | ||
@@ -383,13 +322,11 @@ static ssize_t iscsi_stat_tgt_attr_show_attr_last_fail_type( | |||
383 | 322 | ||
384 | return snprintf(page, PAGE_SIZE, "%u\n", last_fail_type); | 323 | return snprintf(page, PAGE_SIZE, "%u\n", last_fail_type); |
385 | } | 324 | } |
386 | ISCSI_STAT_TGT_ATTR_RO(last_fail_type); | ||
387 | 325 | ||
388 | static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_name( | 326 | static ssize_t iscsi_stat_tgt_attr_fail_intr_name_show(struct config_item *item, |
389 | struct iscsi_wwn_stat_grps *igrps, char *page) | 327 | char *page) |
390 | { | 328 | { |
391 | struct iscsi_tiqn *tiqn = container_of(igrps, | 329 | struct iscsi_tiqn *tiqn = iscsi_tgt_attr_tiqn(item); |
392 | struct iscsi_tiqn, tiqn_stat_grps); | ||
393 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 330 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
394 | unsigned char buf[224]; | 331 | unsigned char buf[224]; |
395 | 332 | ||
@@ -400,13 +337,11 @@ static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_name( | |||
400 | 337 | ||
401 | return snprintf(page, PAGE_SIZE, "%s\n", buf); | 338 | return snprintf(page, PAGE_SIZE, "%s\n", buf); |
402 | } | 339 | } |
403 | ISCSI_STAT_TGT_ATTR_RO(fail_intr_name); | ||
404 | 340 | ||
405 | static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_addr_type( | 341 | static ssize_t iscsi_stat_tgt_attr_fail_intr_addr_type_show(struct config_item *item, |
406 | struct iscsi_wwn_stat_grps *igrps, char *page) | 342 | char *page) |
407 | { | 343 | { |
408 | struct iscsi_tiqn *tiqn = container_of(igrps, | 344 | struct iscsi_tiqn *tiqn = iscsi_tgt_attr_tiqn(item); |
409 | struct iscsi_tiqn, tiqn_stat_grps); | ||
410 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 345 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
411 | int ret; | 346 | int ret; |
412 | 347 | ||
@@ -419,13 +354,11 @@ static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_addr_type( | |||
419 | 354 | ||
420 | return ret; | 355 | return ret; |
421 | } | 356 | } |
422 | ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr_type); | ||
423 | 357 | ||
424 | static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_addr( | 358 | static ssize_t iscsi_stat_tgt_attr_fail_intr_addr_show(struct config_item *item, |
425 | struct iscsi_wwn_stat_grps *igrps, char *page) | 359 | char *page) |
426 | { | 360 | { |
427 | struct iscsi_tiqn *tiqn = container_of(igrps, | 361 | struct iscsi_tiqn *tiqn = iscsi_tgt_attr_tiqn(item); |
428 | struct iscsi_tiqn, tiqn_stat_grps); | ||
429 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 362 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
430 | int ret; | 363 | int ret; |
431 | 364 | ||
@@ -435,30 +368,29 @@ static ssize_t iscsi_stat_tgt_attr_show_attr_fail_intr_addr( | |||
435 | 368 | ||
436 | return ret; | 369 | return ret; |
437 | } | 370 | } |
438 | ISCSI_STAT_TGT_ATTR_RO(fail_intr_addr); | ||
439 | 371 | ||
440 | CONFIGFS_EATTR_OPS(iscsi_stat_tgt_attr, iscsi_wwn_stat_grps, | 372 | CONFIGFS_ATTR_RO(iscsi_stat_tgt_attr_, inst); |
441 | iscsi_tgt_attr_group); | 373 | CONFIGFS_ATTR_RO(iscsi_stat_tgt_attr_, indx); |
374 | CONFIGFS_ATTR_RO(iscsi_stat_tgt_attr_, login_fails); | ||
375 | CONFIGFS_ATTR_RO(iscsi_stat_tgt_attr_, last_fail_time); | ||
376 | CONFIGFS_ATTR_RO(iscsi_stat_tgt_attr_, last_fail_type); | ||
377 | CONFIGFS_ATTR_RO(iscsi_stat_tgt_attr_, fail_intr_name); | ||
378 | CONFIGFS_ATTR_RO(iscsi_stat_tgt_attr_, fail_intr_addr_type); | ||
379 | CONFIGFS_ATTR_RO(iscsi_stat_tgt_attr_, fail_intr_addr); | ||
442 | 380 | ||
443 | static struct configfs_attribute *iscsi_stat_tgt_attr_attrs[] = { | 381 | static struct configfs_attribute *iscsi_stat_tgt_attr_attrs[] = { |
444 | &iscsi_stat_tgt_attr_inst.attr, | 382 | &iscsi_stat_tgt_attr_attr_inst, |
445 | &iscsi_stat_tgt_attr_indx.attr, | 383 | &iscsi_stat_tgt_attr_attr_indx, |
446 | &iscsi_stat_tgt_attr_login_fails.attr, | 384 | &iscsi_stat_tgt_attr_attr_login_fails, |
447 | &iscsi_stat_tgt_attr_last_fail_time.attr, | 385 | &iscsi_stat_tgt_attr_attr_last_fail_time, |
448 | &iscsi_stat_tgt_attr_last_fail_type.attr, | 386 | &iscsi_stat_tgt_attr_attr_last_fail_type, |
449 | &iscsi_stat_tgt_attr_fail_intr_name.attr, | 387 | &iscsi_stat_tgt_attr_attr_fail_intr_name, |
450 | &iscsi_stat_tgt_attr_fail_intr_addr_type.attr, | 388 | &iscsi_stat_tgt_attr_attr_fail_intr_addr_type, |
451 | &iscsi_stat_tgt_attr_fail_intr_addr.attr, | 389 | &iscsi_stat_tgt_attr_attr_fail_intr_addr, |
452 | NULL, | 390 | NULL, |
453 | }; | 391 | }; |
454 | 392 | ||
455 | static struct configfs_item_operations iscsi_stat_tgt_attr_item_ops = { | ||
456 | .show_attribute = iscsi_stat_tgt_attr_attr_show, | ||
457 | .store_attribute = iscsi_stat_tgt_attr_attr_store, | ||
458 | }; | ||
459 | |||
460 | struct config_item_type iscsi_stat_tgt_attr_cit = { | 393 | struct config_item_type iscsi_stat_tgt_attr_cit = { |
461 | .ct_item_ops = &iscsi_stat_tgt_attr_item_ops, | ||
462 | .ct_attrs = iscsi_stat_tgt_attr_attrs, | 394 | .ct_attrs = iscsi_stat_tgt_attr_attrs, |
463 | .ct_owner = THIS_MODULE, | 395 | .ct_owner = THIS_MODULE, |
464 | }; | 396 | }; |
@@ -466,42 +398,29 @@ struct config_item_type iscsi_stat_tgt_attr_cit = { | |||
466 | /* | 398 | /* |
467 | * Target Login Stats Table | 399 | * Target Login Stats Table |
468 | */ | 400 | */ |
469 | CONFIGFS_EATTR_STRUCT(iscsi_stat_login, iscsi_wwn_stat_grps); | 401 | static struct iscsi_tiqn *iscsi_login_stat_tiqn(struct config_item *item) |
470 | #define ISCSI_STAT_LOGIN(_name, _mode) \ | 402 | { |
471 | static struct iscsi_stat_login_attribute \ | 403 | struct iscsi_wwn_stat_grps *igrps = container_of(to_config_group(item), |
472 | iscsi_stat_login_##_name = \ | 404 | struct iscsi_wwn_stat_grps, iscsi_login_stats_group); |
473 | __CONFIGFS_EATTR(_name, _mode, \ | 405 | return container_of(igrps, struct iscsi_tiqn, tiqn_stat_grps); |
474 | iscsi_stat_login_show_attr_##_name, \ | 406 | } |
475 | iscsi_stat_login_store_attr_##_name); | ||
476 | |||
477 | #define ISCSI_STAT_LOGIN_RO(_name) \ | ||
478 | static struct iscsi_stat_login_attribute \ | ||
479 | iscsi_stat_login_##_name = \ | ||
480 | __CONFIGFS_EATTR_RO(_name, \ | ||
481 | iscsi_stat_login_show_attr_##_name); | ||
482 | |||
483 | static ssize_t iscsi_stat_login_show_attr_inst( | ||
484 | struct iscsi_wwn_stat_grps *igrps, char *page) | ||
485 | { | ||
486 | struct iscsi_tiqn *tiqn = container_of(igrps, | ||
487 | struct iscsi_tiqn, tiqn_stat_grps); | ||
488 | 407 | ||
489 | return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); | 408 | static ssize_t iscsi_stat_login_inst_show(struct config_item *item, char *page) |
409 | { | ||
410 | return snprintf(page, PAGE_SIZE, "%u\n", | ||
411 | iscsi_login_stat_tiqn(item)->tiqn_index); | ||
490 | } | 412 | } |
491 | ISCSI_STAT_LOGIN_RO(inst); | ||
492 | 413 | ||
493 | static ssize_t iscsi_stat_login_show_attr_indx( | 414 | static ssize_t iscsi_stat_login_indx_show(struct config_item *item, |
494 | struct iscsi_wwn_stat_grps *igrps, char *page) | 415 | char *page) |
495 | { | 416 | { |
496 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_NODE_INDEX); | 417 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_NODE_INDEX); |
497 | } | 418 | } |
498 | ISCSI_STAT_LOGIN_RO(indx); | ||
499 | 419 | ||
500 | static ssize_t iscsi_stat_login_show_attr_accepts( | 420 | static ssize_t iscsi_stat_login_accepts_show(struct config_item *item, |
501 | struct iscsi_wwn_stat_grps *igrps, char *page) | 421 | char *page) |
502 | { | 422 | { |
503 | struct iscsi_tiqn *tiqn = container_of(igrps, | 423 | struct iscsi_tiqn *tiqn = iscsi_login_stat_tiqn(item); |
504 | struct iscsi_tiqn, tiqn_stat_grps); | ||
505 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 424 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
506 | ssize_t ret; | 425 | ssize_t ret; |
507 | 426 | ||
@@ -511,13 +430,11 @@ static ssize_t iscsi_stat_login_show_attr_accepts( | |||
511 | 430 | ||
512 | return ret; | 431 | return ret; |
513 | } | 432 | } |
514 | ISCSI_STAT_LOGIN_RO(accepts); | ||
515 | 433 | ||
516 | static ssize_t iscsi_stat_login_show_attr_other_fails( | 434 | static ssize_t iscsi_stat_login_other_fails_show(struct config_item *item, |
517 | struct iscsi_wwn_stat_grps *igrps, char *page) | 435 | char *page) |
518 | { | 436 | { |
519 | struct iscsi_tiqn *tiqn = container_of(igrps, | 437 | struct iscsi_tiqn *tiqn = iscsi_login_stat_tiqn(item); |
520 | struct iscsi_tiqn, tiqn_stat_grps); | ||
521 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 438 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
522 | ssize_t ret; | 439 | ssize_t ret; |
523 | 440 | ||
@@ -527,13 +444,11 @@ static ssize_t iscsi_stat_login_show_attr_other_fails( | |||
527 | 444 | ||
528 | return ret; | 445 | return ret; |
529 | } | 446 | } |
530 | ISCSI_STAT_LOGIN_RO(other_fails); | ||
531 | 447 | ||
532 | static ssize_t iscsi_stat_login_show_attr_redirects( | 448 | static ssize_t iscsi_stat_login_redirects_show(struct config_item *item, |
533 | struct iscsi_wwn_stat_grps *igrps, char *page) | 449 | char *page) |
534 | { | 450 | { |
535 | struct iscsi_tiqn *tiqn = container_of(igrps, | 451 | struct iscsi_tiqn *tiqn = iscsi_login_stat_tiqn(item); |
536 | struct iscsi_tiqn, tiqn_stat_grps); | ||
537 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 452 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
538 | ssize_t ret; | 453 | ssize_t ret; |
539 | 454 | ||
@@ -543,13 +458,11 @@ static ssize_t iscsi_stat_login_show_attr_redirects( | |||
543 | 458 | ||
544 | return ret; | 459 | return ret; |
545 | } | 460 | } |
546 | ISCSI_STAT_LOGIN_RO(redirects); | ||
547 | 461 | ||
548 | static ssize_t iscsi_stat_login_show_attr_authorize_fails( | 462 | static ssize_t iscsi_stat_login_authorize_fails_show(struct config_item *item, |
549 | struct iscsi_wwn_stat_grps *igrps, char *page) | 463 | char *page) |
550 | { | 464 | { |
551 | struct iscsi_tiqn *tiqn = container_of(igrps, | 465 | struct iscsi_tiqn *tiqn = iscsi_login_stat_tiqn(item); |
552 | struct iscsi_tiqn, tiqn_stat_grps); | ||
553 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 466 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
554 | ssize_t ret; | 467 | ssize_t ret; |
555 | 468 | ||
@@ -559,13 +472,11 @@ static ssize_t iscsi_stat_login_show_attr_authorize_fails( | |||
559 | 472 | ||
560 | return ret; | 473 | return ret; |
561 | } | 474 | } |
562 | ISCSI_STAT_LOGIN_RO(authorize_fails); | ||
563 | 475 | ||
564 | static ssize_t iscsi_stat_login_show_attr_authenticate_fails( | 476 | static ssize_t iscsi_stat_login_authenticate_fails_show( |
565 | struct iscsi_wwn_stat_grps *igrps, char *page) | 477 | struct config_item *item, char *page) |
566 | { | 478 | { |
567 | struct iscsi_tiqn *tiqn = container_of(igrps, | 479 | struct iscsi_tiqn *tiqn = iscsi_login_stat_tiqn(item); |
568 | struct iscsi_tiqn, tiqn_stat_grps); | ||
569 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 480 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
570 | ssize_t ret; | 481 | ssize_t ret; |
571 | 482 | ||
@@ -575,13 +486,11 @@ static ssize_t iscsi_stat_login_show_attr_authenticate_fails( | |||
575 | 486 | ||
576 | return ret; | 487 | return ret; |
577 | } | 488 | } |
578 | ISCSI_STAT_LOGIN_RO(authenticate_fails); | ||
579 | 489 | ||
580 | static ssize_t iscsi_stat_login_show_attr_negotiate_fails( | 490 | static ssize_t iscsi_stat_login_negotiate_fails_show(struct config_item *item, |
581 | struct iscsi_wwn_stat_grps *igrps, char *page) | 491 | char *page) |
582 | { | 492 | { |
583 | struct iscsi_tiqn *tiqn = container_of(igrps, | 493 | struct iscsi_tiqn *tiqn = iscsi_login_stat_tiqn(item); |
584 | struct iscsi_tiqn, tiqn_stat_grps); | ||
585 | struct iscsi_login_stats *lstat = &tiqn->login_stats; | 494 | struct iscsi_login_stats *lstat = &tiqn->login_stats; |
586 | ssize_t ret; | 495 | ssize_t ret; |
587 | 496 | ||
@@ -591,30 +500,29 @@ static ssize_t iscsi_stat_login_show_attr_negotiate_fails( | |||
591 | 500 | ||
592 | return ret; | 501 | return ret; |
593 | } | 502 | } |
594 | ISCSI_STAT_LOGIN_RO(negotiate_fails); | ||
595 | 503 | ||
596 | CONFIGFS_EATTR_OPS(iscsi_stat_login, iscsi_wwn_stat_grps, | 504 | CONFIGFS_ATTR_RO(iscsi_stat_login_, inst); |
597 | iscsi_login_stats_group); | 505 | CONFIGFS_ATTR_RO(iscsi_stat_login_, indx); |
506 | CONFIGFS_ATTR_RO(iscsi_stat_login_, accepts); | ||
507 | CONFIGFS_ATTR_RO(iscsi_stat_login_, other_fails); | ||
508 | CONFIGFS_ATTR_RO(iscsi_stat_login_, redirects); | ||
509 | CONFIGFS_ATTR_RO(iscsi_stat_login_, authorize_fails); | ||
510 | CONFIGFS_ATTR_RO(iscsi_stat_login_, authenticate_fails); | ||
511 | CONFIGFS_ATTR_RO(iscsi_stat_login_, negotiate_fails); | ||
598 | 512 | ||
599 | static struct configfs_attribute *iscsi_stat_login_stats_attrs[] = { | 513 | static struct configfs_attribute *iscsi_stat_login_stats_attrs[] = { |
600 | &iscsi_stat_login_inst.attr, | 514 | &iscsi_stat_login_attr_inst, |
601 | &iscsi_stat_login_indx.attr, | 515 | &iscsi_stat_login_attr_indx, |
602 | &iscsi_stat_login_accepts.attr, | 516 | &iscsi_stat_login_attr_accepts, |
603 | &iscsi_stat_login_other_fails.attr, | 517 | &iscsi_stat_login_attr_other_fails, |
604 | &iscsi_stat_login_redirects.attr, | 518 | &iscsi_stat_login_attr_redirects, |
605 | &iscsi_stat_login_authorize_fails.attr, | 519 | &iscsi_stat_login_attr_authorize_fails, |
606 | &iscsi_stat_login_authenticate_fails.attr, | 520 | &iscsi_stat_login_attr_authenticate_fails, |
607 | &iscsi_stat_login_negotiate_fails.attr, | 521 | &iscsi_stat_login_attr_negotiate_fails, |
608 | NULL, | 522 | NULL, |
609 | }; | 523 | }; |
610 | 524 | ||
611 | static struct configfs_item_operations iscsi_stat_login_stats_item_ops = { | ||
612 | .show_attribute = iscsi_stat_login_attr_show, | ||
613 | .store_attribute = iscsi_stat_login_attr_store, | ||
614 | }; | ||
615 | |||
616 | struct config_item_type iscsi_stat_login_cit = { | 525 | struct config_item_type iscsi_stat_login_cit = { |
617 | .ct_item_ops = &iscsi_stat_login_stats_item_ops, | ||
618 | .ct_attrs = iscsi_stat_login_stats_attrs, | 526 | .ct_attrs = iscsi_stat_login_stats_attrs, |
619 | .ct_owner = THIS_MODULE, | 527 | .ct_owner = THIS_MODULE, |
620 | }; | 528 | }; |
@@ -622,78 +530,56 @@ struct config_item_type iscsi_stat_login_cit = { | |||
622 | /* | 530 | /* |
623 | * Target Logout Stats Table | 531 | * Target Logout Stats Table |
624 | */ | 532 | */ |
625 | 533 | static struct iscsi_tiqn *iscsi_logout_stat_tiqn(struct config_item *item) | |
626 | CONFIGFS_EATTR_STRUCT(iscsi_stat_logout, iscsi_wwn_stat_grps); | ||
627 | #define ISCSI_STAT_LOGOUT(_name, _mode) \ | ||
628 | static struct iscsi_stat_logout_attribute \ | ||
629 | iscsi_stat_logout_##_name = \ | ||
630 | __CONFIGFS_EATTR(_name, _mode, \ | ||
631 | iscsi_stat_logout_show_attr_##_name, \ | ||
632 | iscsi_stat_logout_store_attr_##_name); | ||
633 | |||
634 | #define ISCSI_STAT_LOGOUT_RO(_name) \ | ||
635 | static struct iscsi_stat_logout_attribute \ | ||
636 | iscsi_stat_logout_##_name = \ | ||
637 | __CONFIGFS_EATTR_RO(_name, \ | ||
638 | iscsi_stat_logout_show_attr_##_name); | ||
639 | |||
640 | static ssize_t iscsi_stat_logout_show_attr_inst( | ||
641 | struct iscsi_wwn_stat_grps *igrps, char *page) | ||
642 | { | 534 | { |
643 | struct iscsi_tiqn *tiqn = container_of(igrps, | 535 | struct iscsi_wwn_stat_grps *igrps = container_of(to_config_group(item), |
644 | struct iscsi_tiqn, tiqn_stat_grps); | 536 | struct iscsi_wwn_stat_grps, iscsi_logout_stats_group); |
537 | return container_of(igrps, struct iscsi_tiqn, tiqn_stat_grps); | ||
538 | } | ||
645 | 539 | ||
646 | return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); | 540 | static ssize_t iscsi_stat_logout_inst_show(struct config_item *item, char *page) |
541 | { | ||
542 | return snprintf(page, PAGE_SIZE, "%u\n", | ||
543 | iscsi_logout_stat_tiqn(item)->tiqn_index); | ||
647 | } | 544 | } |
648 | ISCSI_STAT_LOGOUT_RO(inst); | ||
649 | 545 | ||
650 | static ssize_t iscsi_stat_logout_show_attr_indx( | 546 | static ssize_t iscsi_stat_logout_indx_show(struct config_item *item, char *page) |
651 | struct iscsi_wwn_stat_grps *igrps, char *page) | ||
652 | { | 547 | { |
653 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_NODE_INDEX); | 548 | return snprintf(page, PAGE_SIZE, "%u\n", ISCSI_NODE_INDEX); |
654 | } | 549 | } |
655 | ISCSI_STAT_LOGOUT_RO(indx); | ||
656 | 550 | ||
657 | static ssize_t iscsi_stat_logout_show_attr_normal_logouts( | 551 | static ssize_t iscsi_stat_logout_normal_logouts_show(struct config_item *item, |
658 | struct iscsi_wwn_stat_grps *igrps, char *page) | 552 | char *page) |
659 | { | 553 | { |
660 | struct iscsi_tiqn *tiqn = container_of(igrps, | 554 | struct iscsi_tiqn *tiqn = iscsi_logout_stat_tiqn(item); |
661 | struct iscsi_tiqn, tiqn_stat_grps); | ||
662 | struct iscsi_logout_stats *lstats = &tiqn->logout_stats; | 555 | struct iscsi_logout_stats *lstats = &tiqn->logout_stats; |
663 | 556 | ||
664 | return snprintf(page, PAGE_SIZE, "%u\n", lstats->normal_logouts); | 557 | return snprintf(page, PAGE_SIZE, "%u\n", lstats->normal_logouts); |
665 | } | 558 | } |
666 | ISCSI_STAT_LOGOUT_RO(normal_logouts); | ||
667 | 559 | ||
668 | static ssize_t iscsi_stat_logout_show_attr_abnormal_logouts( | 560 | static ssize_t iscsi_stat_logout_abnormal_logouts_show(struct config_item *item, |
669 | struct iscsi_wwn_stat_grps *igrps, char *page) | 561 | char *page) |
670 | { | 562 | { |
671 | struct iscsi_tiqn *tiqn = container_of(igrps, | 563 | struct iscsi_tiqn *tiqn = iscsi_logout_stat_tiqn(item); |
672 | struct iscsi_tiqn, tiqn_stat_grps); | ||
673 | struct iscsi_logout_stats *lstats = &tiqn->logout_stats; | 564 | struct iscsi_logout_stats *lstats = &tiqn->logout_stats; |
674 | 565 | ||
675 | return snprintf(page, PAGE_SIZE, "%u\n", lstats->abnormal_logouts); | 566 | return snprintf(page, PAGE_SIZE, "%u\n", lstats->abnormal_logouts); |
676 | } | 567 | } |
677 | ISCSI_STAT_LOGOUT_RO(abnormal_logouts); | ||
678 | 568 | ||
679 | CONFIGFS_EATTR_OPS(iscsi_stat_logout, iscsi_wwn_stat_grps, | 569 | CONFIGFS_ATTR_RO(iscsi_stat_logout_, inst); |
680 | iscsi_logout_stats_group); | 570 | CONFIGFS_ATTR_RO(iscsi_stat_logout_, indx); |
571 | CONFIGFS_ATTR_RO(iscsi_stat_logout_, normal_logouts); | ||
572 | CONFIGFS_ATTR_RO(iscsi_stat_logout_, abnormal_logouts); | ||
681 | 573 | ||
682 | static struct configfs_attribute *iscsi_stat_logout_stats_attrs[] = { | 574 | static struct configfs_attribute *iscsi_stat_logout_stats_attrs[] = { |
683 | &iscsi_stat_logout_inst.attr, | 575 | &iscsi_stat_logout_attr_inst, |
684 | &iscsi_stat_logout_indx.attr, | 576 | &iscsi_stat_logout_attr_indx, |
685 | &iscsi_stat_logout_normal_logouts.attr, | 577 | &iscsi_stat_logout_attr_normal_logouts, |
686 | &iscsi_stat_logout_abnormal_logouts.attr, | 578 | &iscsi_stat_logout_attr_abnormal_logouts, |
687 | NULL, | 579 | NULL, |
688 | }; | 580 | }; |
689 | 581 | ||
690 | static struct configfs_item_operations iscsi_stat_logout_stats_item_ops = { | ||
691 | .show_attribute = iscsi_stat_logout_attr_show, | ||
692 | .store_attribute = iscsi_stat_logout_attr_store, | ||
693 | }; | ||
694 | |||
695 | struct config_item_type iscsi_stat_logout_cit = { | 582 | struct config_item_type iscsi_stat_logout_cit = { |
696 | .ct_item_ops = &iscsi_stat_logout_stats_item_ops, | ||
697 | .ct_attrs = iscsi_stat_logout_stats_attrs, | 583 | .ct_attrs = iscsi_stat_logout_stats_attrs, |
698 | .ct_owner = THIS_MODULE, | 584 | .ct_owner = THIS_MODULE, |
699 | }; | 585 | }; |
@@ -701,39 +587,26 @@ struct config_item_type iscsi_stat_logout_cit = { | |||
701 | /* | 587 | /* |
702 | * Session Stats Table | 588 | * Session Stats Table |
703 | */ | 589 | */ |
590 | static struct iscsi_node_acl *iscsi_stat_nacl(struct config_item *item) | ||
591 | { | ||
592 | struct iscsi_node_stat_grps *igrps = container_of(to_config_group(item), | ||
593 | struct iscsi_node_stat_grps, iscsi_sess_stats_group); | ||
594 | return container_of(igrps, struct iscsi_node_acl, node_stat_grps); | ||
595 | } | ||
704 | 596 | ||
705 | CONFIGFS_EATTR_STRUCT(iscsi_stat_sess, iscsi_node_stat_grps); | 597 | static ssize_t iscsi_stat_sess_inst_show(struct config_item *item, char *page) |
706 | #define ISCSI_STAT_SESS(_name, _mode) \ | 598 | { |
707 | static struct iscsi_stat_sess_attribute \ | 599 | struct iscsi_node_acl *acl = iscsi_stat_nacl(item); |
708 | iscsi_stat_sess_##_name = \ | ||
709 | __CONFIGFS_EATTR(_name, _mode, \ | ||
710 | iscsi_stat_sess_show_attr_##_name, \ | ||
711 | iscsi_stat_sess_store_attr_##_name); | ||
712 | |||
713 | #define ISCSI_STAT_SESS_RO(_name) \ | ||
714 | static struct iscsi_stat_sess_attribute \ | ||
715 | iscsi_stat_sess_##_name = \ | ||
716 | __CONFIGFS_EATTR_RO(_name, \ | ||
717 | iscsi_stat_sess_show_attr_##_name); | ||
718 | |||
719 | static ssize_t iscsi_stat_sess_show_attr_inst( | ||
720 | struct iscsi_node_stat_grps *igrps, char *page) | ||
721 | { | ||
722 | struct iscsi_node_acl *acl = container_of(igrps, | ||
723 | struct iscsi_node_acl, node_stat_grps); | ||
724 | struct se_wwn *wwn = acl->se_node_acl.se_tpg->se_tpg_wwn; | 600 | struct se_wwn *wwn = acl->se_node_acl.se_tpg->se_tpg_wwn; |
725 | struct iscsi_tiqn *tiqn = container_of(wwn, | 601 | struct iscsi_tiqn *tiqn = container_of(wwn, |
726 | struct iscsi_tiqn, tiqn_wwn); | 602 | struct iscsi_tiqn, tiqn_wwn); |
727 | 603 | ||
728 | return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); | 604 | return snprintf(page, PAGE_SIZE, "%u\n", tiqn->tiqn_index); |
729 | } | 605 | } |
730 | ISCSI_STAT_SESS_RO(inst); | ||
731 | 606 | ||
732 | static ssize_t iscsi_stat_sess_show_attr_node( | 607 | static ssize_t iscsi_stat_sess_node_show(struct config_item *item, char *page) |
733 | struct iscsi_node_stat_grps *igrps, char *page) | ||
734 | { | 608 | { |
735 | struct iscsi_node_acl *acl = container_of(igrps, | 609 | struct iscsi_node_acl *acl = iscsi_stat_nacl(item); |
736 | struct iscsi_node_acl, node_stat_grps); | ||
737 | struct se_node_acl *se_nacl = &acl->se_node_acl; | 610 | struct se_node_acl *se_nacl = &acl->se_node_acl; |
738 | struct iscsi_session *sess; | 611 | struct iscsi_session *sess; |
739 | struct se_session *se_sess; | 612 | struct se_session *se_sess; |
@@ -751,13 +624,10 @@ static ssize_t iscsi_stat_sess_show_attr_node( | |||
751 | 624 | ||
752 | return ret; | 625 | return ret; |
753 | } | 626 | } |
754 | ISCSI_STAT_SESS_RO(node); | ||
755 | 627 | ||
756 | static ssize_t iscsi_stat_sess_show_attr_indx( | 628 | static ssize_t iscsi_stat_sess_indx_show(struct config_item *item, char *page) |
757 | struct iscsi_node_stat_grps *igrps, char *page) | ||
758 | { | 629 | { |
759 | struct iscsi_node_acl *acl = container_of(igrps, | 630 | struct iscsi_node_acl *acl = iscsi_stat_nacl(item); |
760 | struct iscsi_node_acl, node_stat_grps); | ||
761 | struct se_node_acl *se_nacl = &acl->se_node_acl; | 631 | struct se_node_acl *se_nacl = &acl->se_node_acl; |
762 | struct iscsi_session *sess; | 632 | struct iscsi_session *sess; |
763 | struct se_session *se_sess; | 633 | struct se_session *se_sess; |
@@ -775,13 +645,11 @@ static ssize_t iscsi_stat_sess_show_attr_indx( | |||
775 | 645 | ||
776 | return ret; | 646 | return ret; |
777 | } | 647 | } |
778 | ISCSI_STAT_SESS_RO(indx); | ||
779 | 648 | ||
780 | static ssize_t iscsi_stat_sess_show_attr_cmd_pdus( | 649 | static ssize_t iscsi_stat_sess_cmd_pdus_show(struct config_item *item, |
781 | struct iscsi_node_stat_grps *igrps, char *page) | 650 | char *page) |
782 | { | 651 | { |
783 | struct iscsi_node_acl *acl = container_of(igrps, | 652 | struct iscsi_node_acl *acl = iscsi_stat_nacl(item); |
784 | struct iscsi_node_acl, node_stat_grps); | ||
785 | struct se_node_acl *se_nacl = &acl->se_node_acl; | 653 | struct se_node_acl *se_nacl = &acl->se_node_acl; |
786 | struct iscsi_session *sess; | 654 | struct iscsi_session *sess; |
787 | struct se_session *se_sess; | 655 | struct se_session *se_sess; |
@@ -799,13 +667,11 @@ static ssize_t iscsi_stat_sess_show_attr_cmd_pdus( | |||
799 | 667 | ||
800 | return ret; | 668 | return ret; |
801 | } | 669 | } |
802 | ISCSI_STAT_SESS_RO(cmd_pdus); | ||
803 | 670 | ||
804 | static ssize_t iscsi_stat_sess_show_attr_rsp_pdus( | 671 | static ssize_t iscsi_stat_sess_rsp_pdus_show(struct config_item *item, |
805 | struct iscsi_node_stat_grps *igrps, char *page) | 672 | char *page) |
806 | { | 673 | { |
807 | struct iscsi_node_acl *acl = container_of(igrps, | 674 | struct iscsi_node_acl *acl = iscsi_stat_nacl(item); |
808 | struct iscsi_node_acl, node_stat_grps); | ||
809 | struct se_node_acl *se_nacl = &acl->se_node_acl; | 675 | struct se_node_acl *se_nacl = &acl->se_node_acl; |
810 | struct iscsi_session *sess; | 676 | struct iscsi_session *sess; |
811 | struct se_session *se_sess; | 677 | struct se_session *se_sess; |
@@ -823,13 +689,11 @@ static ssize_t iscsi_stat_sess_show_attr_rsp_pdus( | |||
823 | 689 | ||
824 | return ret; | 690 | return ret; |
825 | } | 691 | } |
826 | ISCSI_STAT_SESS_RO(rsp_pdus); | ||
827 | 692 | ||
828 | static ssize_t iscsi_stat_sess_show_attr_txdata_octs( | 693 | static ssize_t iscsi_stat_sess_txdata_octs_show(struct config_item *item, |
829 | struct iscsi_node_stat_grps *igrps, char *page) | 694 | char *page) |
830 | { | 695 | { |
831 | struct iscsi_node_acl *acl = container_of(igrps, | 696 | struct iscsi_node_acl *acl = iscsi_stat_nacl(item); |
832 | struct iscsi_node_acl, node_stat_grps); | ||
833 | struct se_node_acl *se_nacl = &acl->se_node_acl; | 697 | struct se_node_acl *se_nacl = &acl->se_node_acl; |
834 | struct iscsi_session *sess; | 698 | struct iscsi_session *sess; |
835 | struct se_session *se_sess; | 699 | struct se_session *se_sess; |
@@ -847,13 +711,11 @@ static ssize_t iscsi_stat_sess_show_attr_txdata_octs( | |||
847 | 711 | ||
848 | return ret; | 712 | return ret; |
849 | } | 713 | } |
850 | ISCSI_STAT_SESS_RO(txdata_octs); | ||
851 | 714 | ||
852 | static ssize_t iscsi_stat_sess_show_attr_rxdata_octs( | 715 | static ssize_t iscsi_stat_sess_rxdata_octs_show(struct config_item *item, |
853 | struct iscsi_node_stat_grps *igrps, char *page) | 716 | char *page) |
854 | { | 717 | { |
855 | struct iscsi_node_acl *acl = container_of(igrps, | 718 | struct iscsi_node_acl *acl = iscsi_stat_nacl(item); |
856 | struct iscsi_node_acl, node_stat_grps); | ||
857 | struct se_node_acl *se_nacl = &acl->se_node_acl; | 719 | struct se_node_acl *se_nacl = &acl->se_node_acl; |
858 | struct iscsi_session *sess; | 720 | struct iscsi_session *sess; |
859 | struct se_session *se_sess; | 721 | struct se_session *se_sess; |
@@ -871,13 +733,11 @@ static ssize_t iscsi_stat_sess_show_attr_rxdata_octs( | |||
871 | 733 | ||
872 | return ret; | 734 | return ret; |
873 | } | 735 | } |
874 | ISCSI_STAT_SESS_RO(rxdata_octs); | ||
875 | 736 | ||
876 | static ssize_t iscsi_stat_sess_show_attr_conn_digest_errors( | 737 | static ssize_t iscsi_stat_sess_conn_digest_errors_show(struct config_item *item, |
877 | struct iscsi_node_stat_grps *igrps, char *page) | 738 | char *page) |
878 | { | 739 | { |
879 | struct iscsi_node_acl *acl = container_of(igrps, | 740 | struct iscsi_node_acl *acl = iscsi_stat_nacl(item); |
880 | struct iscsi_node_acl, node_stat_grps); | ||
881 | struct se_node_acl *se_nacl = &acl->se_node_acl; | 741 | struct se_node_acl *se_nacl = &acl->se_node_acl; |
882 | struct iscsi_session *sess; | 742 | struct iscsi_session *sess; |
883 | struct se_session *se_sess; | 743 | struct se_session *se_sess; |
@@ -895,13 +755,11 @@ static ssize_t iscsi_stat_sess_show_attr_conn_digest_errors( | |||
895 | 755 | ||
896 | return ret; | 756 | return ret; |
897 | } | 757 | } |
898 | ISCSI_STAT_SESS_RO(conn_digest_errors); | ||
899 | 758 | ||
900 | static ssize_t iscsi_stat_sess_show_attr_conn_timeout_errors( | 759 | static ssize_t iscsi_stat_sess_conn_timeout_errors_show( |
901 | struct iscsi_node_stat_grps *igrps, char *page) | 760 | struct config_item *item, char *page) |
902 | { | 761 | { |
903 | struct iscsi_node_acl *acl = container_of(igrps, | 762 | struct iscsi_node_acl *acl = iscsi_stat_nacl(item); |
904 | struct iscsi_node_acl, node_stat_grps); | ||
905 | struct se_node_acl *se_nacl = &acl->se_node_acl; | 763 | struct se_node_acl *se_nacl = &acl->se_node_acl; |
906 | struct iscsi_session *sess; | 764 | struct iscsi_session *sess; |
907 | struct se_session *se_sess; | 765 | struct se_session *se_sess; |
@@ -919,31 +777,31 @@ static ssize_t iscsi_stat_sess_show_attr_conn_timeout_errors( | |||
919 | 777 | ||
920 | return ret; | 778 | return ret; |
921 | } | 779 | } |
922 | ISCSI_STAT_SESS_RO(conn_timeout_errors); | ||
923 | 780 | ||
924 | CONFIGFS_EATTR_OPS(iscsi_stat_sess, iscsi_node_stat_grps, | 781 | CONFIGFS_ATTR_RO(iscsi_stat_sess_, inst); |
925 | iscsi_sess_stats_group); | 782 | CONFIGFS_ATTR_RO(iscsi_stat_sess_, node); |
783 | CONFIGFS_ATTR_RO(iscsi_stat_sess_, indx); | ||
784 | CONFIGFS_ATTR_RO(iscsi_stat_sess_, cmd_pdus); | ||
785 | CONFIGFS_ATTR_RO(iscsi_stat_sess_, rsp_pdus); | ||
786 | CONFIGFS_ATTR_RO(iscsi_stat_sess_, txdata_octs); | ||
787 | CONFIGFS_ATTR_RO(iscsi_stat_sess_, rxdata_octs); | ||
788 | CONFIGFS_ATTR_RO(iscsi_stat_sess_, conn_digest_errors); | ||
789 | CONFIGFS_ATTR_RO(iscsi_stat_sess_, conn_timeout_errors); | ||
926 | 790 | ||
927 | static struct configfs_attribute *iscsi_stat_sess_stats_attrs[] = { | 791 | static struct configfs_attribute *iscsi_stat_sess_stats_attrs[] = { |
928 | &iscsi_stat_sess_inst.attr, | 792 | &iscsi_stat_sess_attr_inst, |
929 | &iscsi_stat_sess_node.attr, | 793 | &iscsi_stat_sess_attr_node, |
930 | &iscsi_stat_sess_indx.attr, | 794 | &iscsi_stat_sess_attr_indx, |
931 | &iscsi_stat_sess_cmd_pdus.attr, | 795 | &iscsi_stat_sess_attr_cmd_pdus, |
932 | &iscsi_stat_sess_rsp_pdus.attr, | 796 | &iscsi_stat_sess_attr_rsp_pdus, |
933 | &iscsi_stat_sess_txdata_octs.attr, | 797 | &iscsi_stat_sess_attr_txdata_octs, |
934 | &iscsi_stat_sess_rxdata_octs.attr, | 798 | &iscsi_stat_sess_attr_rxdata_octs, |
935 | &iscsi_stat_sess_conn_digest_errors.attr, | 799 | &iscsi_stat_sess_attr_conn_digest_errors, |
936 | &iscsi_stat_sess_conn_timeout_errors.attr, | 800 | &iscsi_stat_sess_attr_conn_timeout_errors, |
937 | NULL, | 801 | NULL, |
938 | }; | 802 | }; |
939 | 803 | ||
940 | static struct configfs_item_operations iscsi_stat_sess_stats_item_ops = { | ||
941 | .show_attribute = iscsi_stat_sess_attr_show, | ||
942 | .store_attribute = iscsi_stat_sess_attr_store, | ||
943 | }; | ||
944 | |||
945 | struct config_item_type iscsi_stat_sess_cit = { | 804 | struct config_item_type iscsi_stat_sess_cit = { |
946 | .ct_item_ops = &iscsi_stat_sess_stats_item_ops, | ||
947 | .ct_attrs = iscsi_stat_sess_stats_attrs, | 805 | .ct_attrs = iscsi_stat_sess_stats_attrs, |
948 | .ct_owner = THIS_MODULE, | 806 | .ct_owner = THIS_MODULE, |
949 | }; | 807 | }; |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 5bc85ffed720..999b6eba52e8 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | #include <target/target_core_base.h> | 35 | #include <target/target_core_base.h> |
36 | #include <target/target_core_fabric.h> | 36 | #include <target/target_core_fabric.h> |
37 | #include <target/target_core_fabric_configfs.h> | ||
38 | 37 | ||
39 | #include "tcm_loop.h" | 38 | #include "tcm_loop.h" |
40 | 39 | ||
@@ -763,21 +762,20 @@ static void tcm_loop_port_unlink( | |||
763 | 762 | ||
764 | /* End items for tcm_loop_port_cit */ | 763 | /* End items for tcm_loop_port_cit */ |
765 | 764 | ||
766 | static ssize_t tcm_loop_tpg_attrib_show_fabric_prot_type( | 765 | static ssize_t tcm_loop_tpg_attrib_fabric_prot_type_show( |
767 | struct se_portal_group *se_tpg, | 766 | struct config_item *item, char *page) |
768 | char *page) | ||
769 | { | 767 | { |
768 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
770 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, | 769 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, |
771 | tl_se_tpg); | 770 | tl_se_tpg); |
772 | 771 | ||
773 | return sprintf(page, "%d\n", tl_tpg->tl_fabric_prot_type); | 772 | return sprintf(page, "%d\n", tl_tpg->tl_fabric_prot_type); |
774 | } | 773 | } |
775 | 774 | ||
776 | static ssize_t tcm_loop_tpg_attrib_store_fabric_prot_type( | 775 | static ssize_t tcm_loop_tpg_attrib_fabric_prot_type_store( |
777 | struct se_portal_group *se_tpg, | 776 | struct config_item *item, const char *page, size_t count) |
778 | const char *page, | ||
779 | size_t count) | ||
780 | { | 777 | { |
778 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
781 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, | 779 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, |
782 | tl_se_tpg); | 780 | tl_se_tpg); |
783 | unsigned long val; | 781 | unsigned long val; |
@@ -796,10 +794,10 @@ static ssize_t tcm_loop_tpg_attrib_store_fabric_prot_type( | |||
796 | return count; | 794 | return count; |
797 | } | 795 | } |
798 | 796 | ||
799 | TF_TPG_ATTRIB_ATTR(tcm_loop, fabric_prot_type, S_IRUGO | S_IWUSR); | 797 | CONFIGFS_ATTR(tcm_loop_tpg_attrib_, fabric_prot_type); |
800 | 798 | ||
801 | static struct configfs_attribute *tcm_loop_tpg_attrib_attrs[] = { | 799 | static struct configfs_attribute *tcm_loop_tpg_attrib_attrs[] = { |
802 | &tcm_loop_tpg_attrib_fabric_prot_type.attr, | 800 | &tcm_loop_tpg_attrib_attr_fabric_prot_type, |
803 | NULL, | 801 | NULL, |
804 | }; | 802 | }; |
805 | 803 | ||
@@ -894,10 +892,9 @@ static int tcm_loop_drop_nexus( | |||
894 | 892 | ||
895 | /* End items for tcm_loop_nexus_cit */ | 893 | /* End items for tcm_loop_nexus_cit */ |
896 | 894 | ||
897 | static ssize_t tcm_loop_tpg_show_nexus( | 895 | static ssize_t tcm_loop_tpg_nexus_show(struct config_item *item, char *page) |
898 | struct se_portal_group *se_tpg, | ||
899 | char *page) | ||
900 | { | 896 | { |
897 | struct se_portal_group *se_tpg = to_tpg(item); | ||
901 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, | 898 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, |
902 | struct tcm_loop_tpg, tl_se_tpg); | 899 | struct tcm_loop_tpg, tl_se_tpg); |
903 | struct tcm_loop_nexus *tl_nexus; | 900 | struct tcm_loop_nexus *tl_nexus; |
@@ -913,11 +910,10 @@ static ssize_t tcm_loop_tpg_show_nexus( | |||
913 | return ret; | 910 | return ret; |
914 | } | 911 | } |
915 | 912 | ||
916 | static ssize_t tcm_loop_tpg_store_nexus( | 913 | static ssize_t tcm_loop_tpg_nexus_store(struct config_item *item, |
917 | struct se_portal_group *se_tpg, | 914 | const char *page, size_t count) |
918 | const char *page, | ||
919 | size_t count) | ||
920 | { | 915 | { |
916 | struct se_portal_group *se_tpg = to_tpg(item); | ||
921 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, | 917 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, |
922 | struct tcm_loop_tpg, tl_se_tpg); | 918 | struct tcm_loop_tpg, tl_se_tpg); |
923 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; | 919 | struct tcm_loop_hba *tl_hba = tl_tpg->tl_hba; |
@@ -992,12 +988,10 @@ check_newline: | |||
992 | return count; | 988 | return count; |
993 | } | 989 | } |
994 | 990 | ||
995 | TF_TPG_BASE_ATTR(tcm_loop, nexus, S_IRUGO | S_IWUSR); | 991 | static ssize_t tcm_loop_tpg_transport_status_show(struct config_item *item, |
996 | 992 | char *page) | |
997 | static ssize_t tcm_loop_tpg_show_transport_status( | ||
998 | struct se_portal_group *se_tpg, | ||
999 | char *page) | ||
1000 | { | 993 | { |
994 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1001 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, | 995 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, |
1002 | struct tcm_loop_tpg, tl_se_tpg); | 996 | struct tcm_loop_tpg, tl_se_tpg); |
1003 | const char *status = NULL; | 997 | const char *status = NULL; |
@@ -1020,11 +1014,10 @@ static ssize_t tcm_loop_tpg_show_transport_status( | |||
1020 | return ret; | 1014 | return ret; |
1021 | } | 1015 | } |
1022 | 1016 | ||
1023 | static ssize_t tcm_loop_tpg_store_transport_status( | 1017 | static ssize_t tcm_loop_tpg_transport_status_store(struct config_item *item, |
1024 | struct se_portal_group *se_tpg, | 1018 | const char *page, size_t count) |
1025 | const char *page, | ||
1026 | size_t count) | ||
1027 | { | 1019 | { |
1020 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1028 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, | 1021 | struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, |
1029 | struct tcm_loop_tpg, tl_se_tpg); | 1022 | struct tcm_loop_tpg, tl_se_tpg); |
1030 | 1023 | ||
@@ -1044,11 +1037,12 @@ static ssize_t tcm_loop_tpg_store_transport_status( | |||
1044 | return -EINVAL; | 1037 | return -EINVAL; |
1045 | } | 1038 | } |
1046 | 1039 | ||
1047 | TF_TPG_BASE_ATTR(tcm_loop, transport_status, S_IRUGO | S_IWUSR); | 1040 | CONFIGFS_ATTR(tcm_loop_tpg_, nexus); |
1041 | CONFIGFS_ATTR(tcm_loop_tpg_, transport_status); | ||
1048 | 1042 | ||
1049 | static struct configfs_attribute *tcm_loop_tpg_attrs[] = { | 1043 | static struct configfs_attribute *tcm_loop_tpg_attrs[] = { |
1050 | &tcm_loop_tpg_nexus.attr, | 1044 | &tcm_loop_tpg_attr_nexus, |
1051 | &tcm_loop_tpg_transport_status.attr, | 1045 | &tcm_loop_tpg_attr_transport_status, |
1052 | NULL, | 1046 | NULL, |
1053 | }; | 1047 | }; |
1054 | 1048 | ||
@@ -1216,17 +1210,15 @@ static void tcm_loop_drop_scsi_hba( | |||
1216 | } | 1210 | } |
1217 | 1211 | ||
1218 | /* Start items for tcm_loop_cit */ | 1212 | /* Start items for tcm_loop_cit */ |
1219 | static ssize_t tcm_loop_wwn_show_attr_version( | 1213 | static ssize_t tcm_loop_wwn_version_show(struct config_item *item, char *page) |
1220 | struct target_fabric_configfs *tf, | ||
1221 | char *page) | ||
1222 | { | 1214 | { |
1223 | return sprintf(page, "TCM Loopback Fabric module %s\n", TCM_LOOP_VERSION); | 1215 | return sprintf(page, "TCM Loopback Fabric module %s\n", TCM_LOOP_VERSION); |
1224 | } | 1216 | } |
1225 | 1217 | ||
1226 | TF_WWN_ATTR_RO(tcm_loop, version); | 1218 | CONFIGFS_ATTR_RO(tcm_loop_wwn_, version); |
1227 | 1219 | ||
1228 | static struct configfs_attribute *tcm_loop_wwn_attrs[] = { | 1220 | static struct configfs_attribute *tcm_loop_wwn_attrs[] = { |
1229 | &tcm_loop_wwn_version.attr, | 1221 | &tcm_loop_wwn_attr_version, |
1230 | NULL, | 1222 | NULL, |
1231 | }; | 1223 | }; |
1232 | 1224 | ||
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 0edf320fb685..35f7d31b29d2 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c | |||
@@ -35,8 +35,6 @@ | |||
35 | #include <target/target_core_base.h> | 35 | #include <target/target_core_base.h> |
36 | #include <target/target_core_backend.h> | 36 | #include <target/target_core_backend.h> |
37 | #include <target/target_core_fabric.h> | 37 | #include <target/target_core_fabric.h> |
38 | #include <target/target_core_fabric_configfs.h> | ||
39 | #include <target/configfs_macros.h> | ||
40 | #include <asm/unaligned.h> | 38 | #include <asm/unaligned.h> |
41 | 39 | ||
42 | #include "sbp_target.h" | 40 | #include "sbp_target.h" |
@@ -2111,24 +2109,21 @@ static void sbp_drop_tport(struct se_wwn *wwn) | |||
2111 | kfree(tport); | 2109 | kfree(tport); |
2112 | } | 2110 | } |
2113 | 2111 | ||
2114 | static ssize_t sbp_wwn_show_attr_version( | 2112 | static ssize_t sbp_wwn_version_show(struct config_item *item, char *page) |
2115 | struct target_fabric_configfs *tf, | ||
2116 | char *page) | ||
2117 | { | 2113 | { |
2118 | return sprintf(page, "FireWire SBP fabric module %s\n", SBP_VERSION); | 2114 | return sprintf(page, "FireWire SBP fabric module %s\n", SBP_VERSION); |
2119 | } | 2115 | } |
2120 | 2116 | ||
2121 | TF_WWN_ATTR_RO(sbp, version); | 2117 | CONFIGFS_ATTR_RO(sbp_wwn_, version); |
2122 | 2118 | ||
2123 | static struct configfs_attribute *sbp_wwn_attrs[] = { | 2119 | static struct configfs_attribute *sbp_wwn_attrs[] = { |
2124 | &sbp_wwn_version.attr, | 2120 | &sbp_wwn_attr_version, |
2125 | NULL, | 2121 | NULL, |
2126 | }; | 2122 | }; |
2127 | 2123 | ||
2128 | static ssize_t sbp_tpg_show_directory_id( | 2124 | static ssize_t sbp_tpg_directory_id_show(struct config_item *item, char *page) |
2129 | struct se_portal_group *se_tpg, | ||
2130 | char *page) | ||
2131 | { | 2125 | { |
2126 | struct se_portal_group *se_tpg = to_tpg(item); | ||
2132 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2127 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2133 | struct sbp_tport *tport = tpg->tport; | 2128 | struct sbp_tport *tport = tpg->tport; |
2134 | 2129 | ||
@@ -2138,11 +2133,10 @@ static ssize_t sbp_tpg_show_directory_id( | |||
2138 | return sprintf(page, "%06x\n", tport->directory_id); | 2133 | return sprintf(page, "%06x\n", tport->directory_id); |
2139 | } | 2134 | } |
2140 | 2135 | ||
2141 | static ssize_t sbp_tpg_store_directory_id( | 2136 | static ssize_t sbp_tpg_directory_id_store(struct config_item *item, |
2142 | struct se_portal_group *se_tpg, | 2137 | const char *page, size_t count) |
2143 | const char *page, | ||
2144 | size_t count) | ||
2145 | { | 2138 | { |
2139 | struct se_portal_group *se_tpg = to_tpg(item); | ||
2146 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2140 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2147 | struct sbp_tport *tport = tpg->tport; | 2141 | struct sbp_tport *tport = tpg->tport; |
2148 | unsigned long val; | 2142 | unsigned long val; |
@@ -2166,20 +2160,18 @@ static ssize_t sbp_tpg_store_directory_id( | |||
2166 | return count; | 2160 | return count; |
2167 | } | 2161 | } |
2168 | 2162 | ||
2169 | static ssize_t sbp_tpg_show_enable( | 2163 | static ssize_t sbp_tpg_enable_show(struct config_item *item, char *page) |
2170 | struct se_portal_group *se_tpg, | ||
2171 | char *page) | ||
2172 | { | 2164 | { |
2165 | struct se_portal_group *se_tpg = to_tpg(item); | ||
2173 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2166 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2174 | struct sbp_tport *tport = tpg->tport; | 2167 | struct sbp_tport *tport = tpg->tport; |
2175 | return sprintf(page, "%d\n", tport->enable); | 2168 | return sprintf(page, "%d\n", tport->enable); |
2176 | } | 2169 | } |
2177 | 2170 | ||
2178 | static ssize_t sbp_tpg_store_enable( | 2171 | static ssize_t sbp_tpg_enable_store(struct config_item *item, |
2179 | struct se_portal_group *se_tpg, | 2172 | const char *page, size_t count) |
2180 | const char *page, | ||
2181 | size_t count) | ||
2182 | { | 2173 | { |
2174 | struct se_portal_group *se_tpg = to_tpg(item); | ||
2183 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2175 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2184 | struct sbp_tport *tport = tpg->tport; | 2176 | struct sbp_tport *tport = tpg->tport; |
2185 | unsigned long val; | 2177 | unsigned long val; |
@@ -2219,29 +2211,28 @@ static ssize_t sbp_tpg_store_enable( | |||
2219 | return count; | 2211 | return count; |
2220 | } | 2212 | } |
2221 | 2213 | ||
2222 | TF_TPG_BASE_ATTR(sbp, directory_id, S_IRUGO | S_IWUSR); | 2214 | CONFIGFS_ATTR(sbp_tpg_, directory_id); |
2223 | TF_TPG_BASE_ATTR(sbp, enable, S_IRUGO | S_IWUSR); | 2215 | CONFIGFS_ATTR(sbp_tpg_, enable); |
2224 | 2216 | ||
2225 | static struct configfs_attribute *sbp_tpg_base_attrs[] = { | 2217 | static struct configfs_attribute *sbp_tpg_base_attrs[] = { |
2226 | &sbp_tpg_directory_id.attr, | 2218 | &sbp_tpg_attr_directory_id, |
2227 | &sbp_tpg_enable.attr, | 2219 | &sbp_tpg_attr_enable, |
2228 | NULL, | 2220 | NULL, |
2229 | }; | 2221 | }; |
2230 | 2222 | ||
2231 | static ssize_t sbp_tpg_attrib_show_mgt_orb_timeout( | 2223 | static ssize_t sbp_tpg_attrib_mgt_orb_timeout_show(struct config_item *item, |
2232 | struct se_portal_group *se_tpg, | ||
2233 | char *page) | 2224 | char *page) |
2234 | { | 2225 | { |
2226 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2235 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2227 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2236 | struct sbp_tport *tport = tpg->tport; | 2228 | struct sbp_tport *tport = tpg->tport; |
2237 | return sprintf(page, "%d\n", tport->mgt_orb_timeout); | 2229 | return sprintf(page, "%d\n", tport->mgt_orb_timeout); |
2238 | } | 2230 | } |
2239 | 2231 | ||
2240 | static ssize_t sbp_tpg_attrib_store_mgt_orb_timeout( | 2232 | static ssize_t sbp_tpg_attrib_mgt_orb_timeout_store(struct config_item *item, |
2241 | struct se_portal_group *se_tpg, | 2233 | const char *page, size_t count) |
2242 | const char *page, | ||
2243 | size_t count) | ||
2244 | { | 2234 | { |
2235 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2245 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2236 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2246 | struct sbp_tport *tport = tpg->tport; | 2237 | struct sbp_tport *tport = tpg->tport; |
2247 | unsigned long val; | 2238 | unsigned long val; |
@@ -2264,20 +2255,19 @@ static ssize_t sbp_tpg_attrib_store_mgt_orb_timeout( | |||
2264 | return count; | 2255 | return count; |
2265 | } | 2256 | } |
2266 | 2257 | ||
2267 | static ssize_t sbp_tpg_attrib_show_max_reconnect_timeout( | 2258 | static ssize_t sbp_tpg_attrib_max_reconnect_timeout_show(struct config_item *item, |
2268 | struct se_portal_group *se_tpg, | ||
2269 | char *page) | 2259 | char *page) |
2270 | { | 2260 | { |
2261 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2271 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2262 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2272 | struct sbp_tport *tport = tpg->tport; | 2263 | struct sbp_tport *tport = tpg->tport; |
2273 | return sprintf(page, "%d\n", tport->max_reconnect_timeout); | 2264 | return sprintf(page, "%d\n", tport->max_reconnect_timeout); |
2274 | } | 2265 | } |
2275 | 2266 | ||
2276 | static ssize_t sbp_tpg_attrib_store_max_reconnect_timeout( | 2267 | static ssize_t sbp_tpg_attrib_max_reconnect_timeout_store(struct config_item *item, |
2277 | struct se_portal_group *se_tpg, | 2268 | const char *page, size_t count) |
2278 | const char *page, | ||
2279 | size_t count) | ||
2280 | { | 2269 | { |
2270 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2281 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2271 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2282 | struct sbp_tport *tport = tpg->tport; | 2272 | struct sbp_tport *tport = tpg->tport; |
2283 | unsigned long val; | 2273 | unsigned long val; |
@@ -2300,20 +2290,19 @@ static ssize_t sbp_tpg_attrib_store_max_reconnect_timeout( | |||
2300 | return count; | 2290 | return count; |
2301 | } | 2291 | } |
2302 | 2292 | ||
2303 | static ssize_t sbp_tpg_attrib_show_max_logins_per_lun( | 2293 | static ssize_t sbp_tpg_attrib_max_logins_per_lun_show(struct config_item *item, |
2304 | struct se_portal_group *se_tpg, | ||
2305 | char *page) | 2294 | char *page) |
2306 | { | 2295 | { |
2296 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2307 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2297 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2308 | struct sbp_tport *tport = tpg->tport; | 2298 | struct sbp_tport *tport = tpg->tport; |
2309 | return sprintf(page, "%d\n", tport->max_logins_per_lun); | 2299 | return sprintf(page, "%d\n", tport->max_logins_per_lun); |
2310 | } | 2300 | } |
2311 | 2301 | ||
2312 | static ssize_t sbp_tpg_attrib_store_max_logins_per_lun( | 2302 | static ssize_t sbp_tpg_attrib_max_logins_per_lun_store(struct config_item *item, |
2313 | struct se_portal_group *se_tpg, | 2303 | const char *page, size_t count) |
2314 | const char *page, | ||
2315 | size_t count) | ||
2316 | { | 2304 | { |
2305 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
2317 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); | 2306 | struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); |
2318 | struct sbp_tport *tport = tpg->tport; | 2307 | struct sbp_tport *tport = tpg->tport; |
2319 | unsigned long val; | 2308 | unsigned long val; |
@@ -2330,14 +2319,14 @@ static ssize_t sbp_tpg_attrib_store_max_logins_per_lun( | |||
2330 | return count; | 2319 | return count; |
2331 | } | 2320 | } |
2332 | 2321 | ||
2333 | TF_TPG_ATTRIB_ATTR(sbp, mgt_orb_timeout, S_IRUGO | S_IWUSR); | 2322 | CONFIGFS_ATTR(sbp_tpg_attrib_, mgt_orb_timeout); |
2334 | TF_TPG_ATTRIB_ATTR(sbp, max_reconnect_timeout, S_IRUGO | S_IWUSR); | 2323 | CONFIGFS_ATTR(sbp_tpg_attrib_, max_reconnect_timeout); |
2335 | TF_TPG_ATTRIB_ATTR(sbp, max_logins_per_lun, S_IRUGO | S_IWUSR); | 2324 | CONFIGFS_ATTR(sbp_tpg_attrib_, max_logins_per_lun); |
2336 | 2325 | ||
2337 | static struct configfs_attribute *sbp_tpg_attrib_attrs[] = { | 2326 | static struct configfs_attribute *sbp_tpg_attrib_attrs[] = { |
2338 | &sbp_tpg_attrib_mgt_orb_timeout.attr, | 2327 | &sbp_tpg_attrib_attr_mgt_orb_timeout, |
2339 | &sbp_tpg_attrib_max_reconnect_timeout.attr, | 2328 | &sbp_tpg_attrib_attr_max_reconnect_timeout, |
2340 | &sbp_tpg_attrib_max_logins_per_lun.attr, | 2329 | &sbp_tpg_attrib_attr_max_logins_per_lun, |
2341 | NULL, | 2330 | NULL, |
2342 | }; | 2331 | }; |
2343 | 2332 | ||
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 860e84046177..b9b9ffde4c7a 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -40,8 +40,6 @@ | |||
40 | #include <target/target_core_base.h> | 40 | #include <target/target_core_base.h> |
41 | #include <target/target_core_backend.h> | 41 | #include <target/target_core_backend.h> |
42 | #include <target/target_core_fabric.h> | 42 | #include <target/target_core_fabric.h> |
43 | #include <target/target_core_fabric_configfs.h> | ||
44 | #include <target/configfs_macros.h> | ||
45 | 43 | ||
46 | #include "target_core_internal.h" | 44 | #include "target_core_internal.h" |
47 | #include "target_core_alua.h" | 45 | #include "target_core_alua.h" |
@@ -78,12 +76,6 @@ extern struct t10_alua_lu_gp *default_lu_gp; | |||
78 | static LIST_HEAD(g_tf_list); | 76 | static LIST_HEAD(g_tf_list); |
79 | static DEFINE_MUTEX(g_tf_lock); | 77 | static DEFINE_MUTEX(g_tf_lock); |
80 | 78 | ||
81 | struct target_core_configfs_attribute { | ||
82 | struct configfs_attribute attr; | ||
83 | ssize_t (*show)(void *, char *); | ||
84 | ssize_t (*store)(void *, const char *, size_t); | ||
85 | }; | ||
86 | |||
87 | static struct config_group target_core_hbagroup; | 79 | static struct config_group target_core_hbagroup; |
88 | static struct config_group alua_group; | 80 | static struct config_group alua_group; |
89 | static struct config_group alua_lu_gps_group; | 81 | static struct config_group alua_lu_gps_group; |
@@ -97,24 +89,15 @@ item_to_hba(struct config_item *item) | |||
97 | /* | 89 | /* |
98 | * Attributes for /sys/kernel/config/target/ | 90 | * Attributes for /sys/kernel/config/target/ |
99 | */ | 91 | */ |
100 | static ssize_t target_core_attr_show(struct config_item *item, | 92 | static ssize_t target_core_item_version_show(struct config_item *item, |
101 | struct configfs_attribute *attr, | 93 | char *page) |
102 | char *page) | ||
103 | { | 94 | { |
104 | return sprintf(page, "Target Engine Core ConfigFS Infrastructure %s" | 95 | return sprintf(page, "Target Engine Core ConfigFS Infrastructure %s" |
105 | " on %s/%s on "UTS_RELEASE"\n", TARGET_CORE_VERSION, | 96 | " on %s/%s on "UTS_RELEASE"\n", TARGET_CORE_VERSION, |
106 | utsname()->sysname, utsname()->machine); | 97 | utsname()->sysname, utsname()->machine); |
107 | } | 98 | } |
108 | 99 | ||
109 | static struct configfs_item_operations target_core_fabric_item_ops = { | 100 | CONFIGFS_ATTR_RO(target_core_item_, version); |
110 | .show_attribute = target_core_attr_show, | ||
111 | }; | ||
112 | |||
113 | static struct configfs_attribute target_core_item_attr_version = { | ||
114 | .ca_owner = THIS_MODULE, | ||
115 | .ca_name = "version", | ||
116 | .ca_mode = S_IRUGO, | ||
117 | }; | ||
118 | 101 | ||
119 | static struct target_fabric_configfs *target_core_get_fabric( | 102 | static struct target_fabric_configfs *target_core_get_fabric( |
120 | const char *name) | 103 | const char *name) |
@@ -273,7 +256,6 @@ static struct configfs_attribute *target_core_fabric_item_attrs[] = { | |||
273 | * Provides Fabrics Groups and Item Attributes for /sys/kernel/config/target/ | 256 | * Provides Fabrics Groups and Item Attributes for /sys/kernel/config/target/ |
274 | */ | 257 | */ |
275 | static struct config_item_type target_core_fabrics_item = { | 258 | static struct config_item_type target_core_fabrics_item = { |
276 | .ct_item_ops = &target_core_fabric_item_ops, | ||
277 | .ct_group_ops = &target_core_fabric_group_ops, | 259 | .ct_group_ops = &target_core_fabric_group_ops, |
278 | .ct_attrs = target_core_fabric_item_attrs, | 260 | .ct_attrs = target_core_fabric_item_attrs, |
279 | .ct_owner = THIS_MODULE, | 261 | .ct_owner = THIS_MODULE, |
@@ -476,47 +458,54 @@ EXPORT_SYMBOL(target_unregister_template); | |||
476 | // Stop functions called by external Target Fabrics Modules | 458 | // Stop functions called by external Target Fabrics Modules |
477 | //############################################################################*/ | 459 | //############################################################################*/ |
478 | 460 | ||
461 | static inline struct se_dev_attrib *to_attrib(struct config_item *item) | ||
462 | { | ||
463 | return container_of(to_config_group(item), struct se_dev_attrib, | ||
464 | da_group); | ||
465 | } | ||
466 | |||
479 | /* Start functions for struct config_item_type tb_dev_attrib_cit */ | 467 | /* Start functions for struct config_item_type tb_dev_attrib_cit */ |
480 | #define DEF_TB_DEV_ATTRIB_SHOW(_name) \ | 468 | #define DEF_CONFIGFS_ATTRIB_SHOW(_name) \ |
481 | static ssize_t show_##_name(struct se_dev_attrib *da, char *page) \ | 469 | static ssize_t _name##_show(struct config_item *item, char *page) \ |
482 | { \ | 470 | { \ |
483 | return snprintf(page, PAGE_SIZE, "%u\n", da->_name); \ | 471 | return snprintf(page, PAGE_SIZE, "%u\n", to_attrib(item)->_name); \ |
484 | } | 472 | } |
485 | 473 | ||
486 | DEF_TB_DEV_ATTRIB_SHOW(emulate_model_alias); | 474 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_model_alias); |
487 | DEF_TB_DEV_ATTRIB_SHOW(emulate_dpo); | 475 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_dpo); |
488 | DEF_TB_DEV_ATTRIB_SHOW(emulate_fua_write); | 476 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_fua_write); |
489 | DEF_TB_DEV_ATTRIB_SHOW(emulate_fua_read); | 477 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_fua_read); |
490 | DEF_TB_DEV_ATTRIB_SHOW(emulate_write_cache); | 478 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_write_cache); |
491 | DEF_TB_DEV_ATTRIB_SHOW(emulate_ua_intlck_ctrl); | 479 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_ua_intlck_ctrl); |
492 | DEF_TB_DEV_ATTRIB_SHOW(emulate_tas); | 480 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_tas); |
493 | DEF_TB_DEV_ATTRIB_SHOW(emulate_tpu); | 481 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_tpu); |
494 | DEF_TB_DEV_ATTRIB_SHOW(emulate_tpws); | 482 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_tpws); |
495 | DEF_TB_DEV_ATTRIB_SHOW(emulate_caw); | 483 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_caw); |
496 | DEF_TB_DEV_ATTRIB_SHOW(emulate_3pc); | 484 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_3pc); |
497 | DEF_TB_DEV_ATTRIB_SHOW(pi_prot_type); | 485 | DEF_CONFIGFS_ATTRIB_SHOW(pi_prot_type); |
498 | DEF_TB_DEV_ATTRIB_SHOW(hw_pi_prot_type); | 486 | DEF_CONFIGFS_ATTRIB_SHOW(hw_pi_prot_type); |
499 | DEF_TB_DEV_ATTRIB_SHOW(pi_prot_format); | 487 | DEF_CONFIGFS_ATTRIB_SHOW(pi_prot_format); |
500 | DEF_TB_DEV_ATTRIB_SHOW(enforce_pr_isids); | 488 | DEF_CONFIGFS_ATTRIB_SHOW(enforce_pr_isids); |
501 | DEF_TB_DEV_ATTRIB_SHOW(is_nonrot); | 489 | DEF_CONFIGFS_ATTRIB_SHOW(is_nonrot); |
502 | DEF_TB_DEV_ATTRIB_SHOW(emulate_rest_reord); | 490 | DEF_CONFIGFS_ATTRIB_SHOW(emulate_rest_reord); |
503 | DEF_TB_DEV_ATTRIB_SHOW(force_pr_aptpl); | 491 | DEF_CONFIGFS_ATTRIB_SHOW(force_pr_aptpl); |
504 | DEF_TB_DEV_ATTRIB_SHOW(hw_block_size); | 492 | DEF_CONFIGFS_ATTRIB_SHOW(hw_block_size); |
505 | DEF_TB_DEV_ATTRIB_SHOW(block_size); | 493 | DEF_CONFIGFS_ATTRIB_SHOW(block_size); |
506 | DEF_TB_DEV_ATTRIB_SHOW(hw_max_sectors); | 494 | DEF_CONFIGFS_ATTRIB_SHOW(hw_max_sectors); |
507 | DEF_TB_DEV_ATTRIB_SHOW(optimal_sectors); | 495 | DEF_CONFIGFS_ATTRIB_SHOW(optimal_sectors); |
508 | DEF_TB_DEV_ATTRIB_SHOW(hw_queue_depth); | 496 | DEF_CONFIGFS_ATTRIB_SHOW(hw_queue_depth); |
509 | DEF_TB_DEV_ATTRIB_SHOW(queue_depth); | 497 | DEF_CONFIGFS_ATTRIB_SHOW(queue_depth); |
510 | DEF_TB_DEV_ATTRIB_SHOW(max_unmap_lba_count); | 498 | DEF_CONFIGFS_ATTRIB_SHOW(max_unmap_lba_count); |
511 | DEF_TB_DEV_ATTRIB_SHOW(max_unmap_block_desc_count); | 499 | DEF_CONFIGFS_ATTRIB_SHOW(max_unmap_block_desc_count); |
512 | DEF_TB_DEV_ATTRIB_SHOW(unmap_granularity); | 500 | DEF_CONFIGFS_ATTRIB_SHOW(unmap_granularity); |
513 | DEF_TB_DEV_ATTRIB_SHOW(unmap_granularity_alignment); | 501 | DEF_CONFIGFS_ATTRIB_SHOW(unmap_granularity_alignment); |
514 | DEF_TB_DEV_ATTRIB_SHOW(max_write_same_len); | 502 | DEF_CONFIGFS_ATTRIB_SHOW(max_write_same_len); |
515 | 503 | ||
516 | #define DEF_TB_DEV_ATTRIB_STORE_U32(_name) \ | 504 | #define DEF_CONFIGFS_ATTRIB_STORE_U32(_name) \ |
517 | static ssize_t store_##_name(struct se_dev_attrib *da, const char *page,\ | 505 | static ssize_t _name##_store(struct config_item *item, const char *page,\ |
518 | size_t count) \ | 506 | size_t count) \ |
519 | { \ | 507 | { \ |
508 | struct se_dev_attrib *da = to_attrib(item); \ | ||
520 | u32 val; \ | 509 | u32 val; \ |
521 | int ret; \ | 510 | int ret; \ |
522 | \ | 511 | \ |
@@ -527,16 +516,17 @@ static ssize_t store_##_name(struct se_dev_attrib *da, const char *page,\ | |||
527 | return count; \ | 516 | return count; \ |
528 | } | 517 | } |
529 | 518 | ||
530 | DEF_TB_DEV_ATTRIB_STORE_U32(max_unmap_lba_count); | 519 | DEF_CONFIGFS_ATTRIB_STORE_U32(max_unmap_lba_count); |
531 | DEF_TB_DEV_ATTRIB_STORE_U32(max_unmap_block_desc_count); | 520 | DEF_CONFIGFS_ATTRIB_STORE_U32(max_unmap_block_desc_count); |
532 | DEF_TB_DEV_ATTRIB_STORE_U32(unmap_granularity); | 521 | DEF_CONFIGFS_ATTRIB_STORE_U32(unmap_granularity); |
533 | DEF_TB_DEV_ATTRIB_STORE_U32(unmap_granularity_alignment); | 522 | DEF_CONFIGFS_ATTRIB_STORE_U32(unmap_granularity_alignment); |
534 | DEF_TB_DEV_ATTRIB_STORE_U32(max_write_same_len); | 523 | DEF_CONFIGFS_ATTRIB_STORE_U32(max_write_same_len); |
535 | 524 | ||
536 | #define DEF_TB_DEV_ATTRIB_STORE_BOOL(_name) \ | 525 | #define DEF_CONFIGFS_ATTRIB_STORE_BOOL(_name) \ |
537 | static ssize_t store_##_name(struct se_dev_attrib *da, const char *page,\ | 526 | static ssize_t _name##_store(struct config_item *item, const char *page, \ |
538 | size_t count) \ | 527 | size_t count) \ |
539 | { \ | 528 | { \ |
529 | struct se_dev_attrib *da = to_attrib(item); \ | ||
540 | bool flag; \ | 530 | bool flag; \ |
541 | int ret; \ | 531 | int ret; \ |
542 | \ | 532 | \ |
@@ -547,14 +537,14 @@ static ssize_t store_##_name(struct se_dev_attrib *da, const char *page,\ | |||
547 | return count; \ | 537 | return count; \ |
548 | } | 538 | } |
549 | 539 | ||
550 | DEF_TB_DEV_ATTRIB_STORE_BOOL(emulate_fua_write); | 540 | DEF_CONFIGFS_ATTRIB_STORE_BOOL(emulate_fua_write); |
551 | DEF_TB_DEV_ATTRIB_STORE_BOOL(emulate_caw); | 541 | DEF_CONFIGFS_ATTRIB_STORE_BOOL(emulate_caw); |
552 | DEF_TB_DEV_ATTRIB_STORE_BOOL(emulate_3pc); | 542 | DEF_CONFIGFS_ATTRIB_STORE_BOOL(emulate_3pc); |
553 | DEF_TB_DEV_ATTRIB_STORE_BOOL(enforce_pr_isids); | 543 | DEF_CONFIGFS_ATTRIB_STORE_BOOL(enforce_pr_isids); |
554 | DEF_TB_DEV_ATTRIB_STORE_BOOL(is_nonrot); | 544 | DEF_CONFIGFS_ATTRIB_STORE_BOOL(is_nonrot); |
555 | 545 | ||
556 | #define DEF_TB_DEV_ATTRIB_STORE_STUB(_name) \ | 546 | #define DEF_CONFIGFS_ATTRIB_STORE_STUB(_name) \ |
557 | static ssize_t store_##_name(struct se_dev_attrib *da, const char *page,\ | 547 | static ssize_t _name##_store(struct config_item *item, const char *page,\ |
558 | size_t count) \ | 548 | size_t count) \ |
559 | { \ | 549 | { \ |
560 | printk_once(KERN_WARNING \ | 550 | printk_once(KERN_WARNING \ |
@@ -562,8 +552,8 @@ static ssize_t store_##_name(struct se_dev_attrib *da, const char *page,\ | |||
562 | return count; \ | 552 | return count; \ |
563 | } | 553 | } |
564 | 554 | ||
565 | DEF_TB_DEV_ATTRIB_STORE_STUB(emulate_dpo); | 555 | DEF_CONFIGFS_ATTRIB_STORE_STUB(emulate_dpo); |
566 | DEF_TB_DEV_ATTRIB_STORE_STUB(emulate_fua_read); | 556 | DEF_CONFIGFS_ATTRIB_STORE_STUB(emulate_fua_read); |
567 | 557 | ||
568 | static void dev_set_t10_wwn_model_alias(struct se_device *dev) | 558 | static void dev_set_t10_wwn_model_alias(struct se_device *dev) |
569 | { | 559 | { |
@@ -578,9 +568,10 @@ static void dev_set_t10_wwn_model_alias(struct se_device *dev) | |||
578 | snprintf(&dev->t10_wwn.model[0], 16, "%s", configname); | 568 | snprintf(&dev->t10_wwn.model[0], 16, "%s", configname); |
579 | } | 569 | } |
580 | 570 | ||
581 | static ssize_t store_emulate_model_alias(struct se_dev_attrib *da, | 571 | static ssize_t emulate_model_alias_store(struct config_item *item, |
582 | const char *page, size_t count) | 572 | const char *page, size_t count) |
583 | { | 573 | { |
574 | struct se_dev_attrib *da = to_attrib(item); | ||
584 | struct se_device *dev = da->da_dev; | 575 | struct se_device *dev = da->da_dev; |
585 | bool flag; | 576 | bool flag; |
586 | int ret; | 577 | int ret; |
@@ -606,9 +597,10 @@ static ssize_t store_emulate_model_alias(struct se_dev_attrib *da, | |||
606 | return count; | 597 | return count; |
607 | } | 598 | } |
608 | 599 | ||
609 | static ssize_t store_emulate_write_cache(struct se_dev_attrib *da, | 600 | static ssize_t emulate_write_cache_store(struct config_item *item, |
610 | const char *page, size_t count) | 601 | const char *page, size_t count) |
611 | { | 602 | { |
603 | struct se_dev_attrib *da = to_attrib(item); | ||
612 | bool flag; | 604 | bool flag; |
613 | int ret; | 605 | int ret; |
614 | 606 | ||
@@ -627,9 +619,10 @@ static ssize_t store_emulate_write_cache(struct se_dev_attrib *da, | |||
627 | return count; | 619 | return count; |
628 | } | 620 | } |
629 | 621 | ||
630 | static ssize_t store_emulate_ua_intlck_ctrl(struct se_dev_attrib *da, | 622 | static ssize_t emulate_ua_intlck_ctrl_store(struct config_item *item, |
631 | const char *page, size_t count) | 623 | const char *page, size_t count) |
632 | { | 624 | { |
625 | struct se_dev_attrib *da = to_attrib(item); | ||
633 | u32 val; | 626 | u32 val; |
634 | int ret; | 627 | int ret; |
635 | 628 | ||
@@ -654,9 +647,10 @@ static ssize_t store_emulate_ua_intlck_ctrl(struct se_dev_attrib *da, | |||
654 | return count; | 647 | return count; |
655 | } | 648 | } |
656 | 649 | ||
657 | static ssize_t store_emulate_tas(struct se_dev_attrib *da, | 650 | static ssize_t emulate_tas_store(struct config_item *item, |
658 | const char *page, size_t count) | 651 | const char *page, size_t count) |
659 | { | 652 | { |
653 | struct se_dev_attrib *da = to_attrib(item); | ||
660 | bool flag; | 654 | bool flag; |
661 | int ret; | 655 | int ret; |
662 | 656 | ||
@@ -677,9 +671,10 @@ static ssize_t store_emulate_tas(struct se_dev_attrib *da, | |||
677 | return count; | 671 | return count; |
678 | } | 672 | } |
679 | 673 | ||
680 | static ssize_t store_emulate_tpu(struct se_dev_attrib *da, | 674 | static ssize_t emulate_tpu_store(struct config_item *item, |
681 | const char *page, size_t count) | 675 | const char *page, size_t count) |
682 | { | 676 | { |
677 | struct se_dev_attrib *da = to_attrib(item); | ||
683 | bool flag; | 678 | bool flag; |
684 | int ret; | 679 | int ret; |
685 | 680 | ||
@@ -702,9 +697,10 @@ static ssize_t store_emulate_tpu(struct se_dev_attrib *da, | |||
702 | return count; | 697 | return count; |
703 | } | 698 | } |
704 | 699 | ||
705 | static ssize_t store_emulate_tpws(struct se_dev_attrib *da, | 700 | static ssize_t emulate_tpws_store(struct config_item *item, |
706 | const char *page, size_t count) | 701 | const char *page, size_t count) |
707 | { | 702 | { |
703 | struct se_dev_attrib *da = to_attrib(item); | ||
708 | bool flag; | 704 | bool flag; |
709 | int ret; | 705 | int ret; |
710 | 706 | ||
@@ -727,9 +723,10 @@ static ssize_t store_emulate_tpws(struct se_dev_attrib *da, | |||
727 | return count; | 723 | return count; |
728 | } | 724 | } |
729 | 725 | ||
730 | static ssize_t store_pi_prot_type(struct se_dev_attrib *da, | 726 | static ssize_t pi_prot_type_store(struct config_item *item, |
731 | const char *page, size_t count) | 727 | const char *page, size_t count) |
732 | { | 728 | { |
729 | struct se_dev_attrib *da = to_attrib(item); | ||
733 | int old_prot = da->pi_prot_type, ret; | 730 | int old_prot = da->pi_prot_type, ret; |
734 | struct se_device *dev = da->da_dev; | 731 | struct se_device *dev = da->da_dev; |
735 | u32 flag; | 732 | u32 flag; |
@@ -787,9 +784,10 @@ static ssize_t store_pi_prot_type(struct se_dev_attrib *da, | |||
787 | return count; | 784 | return count; |
788 | } | 785 | } |
789 | 786 | ||
790 | static ssize_t store_pi_prot_format(struct se_dev_attrib *da, | 787 | static ssize_t pi_prot_format_store(struct config_item *item, |
791 | const char *page, size_t count) | 788 | const char *page, size_t count) |
792 | { | 789 | { |
790 | struct se_dev_attrib *da = to_attrib(item); | ||
793 | struct se_device *dev = da->da_dev; | 791 | struct se_device *dev = da->da_dev; |
794 | bool flag; | 792 | bool flag; |
795 | int ret; | 793 | int ret; |
@@ -824,9 +822,10 @@ static ssize_t store_pi_prot_format(struct se_dev_attrib *da, | |||
824 | return count; | 822 | return count; |
825 | } | 823 | } |
826 | 824 | ||
827 | static ssize_t store_force_pr_aptpl(struct se_dev_attrib *da, | 825 | static ssize_t force_pr_aptpl_store(struct config_item *item, |
828 | const char *page, size_t count) | 826 | const char *page, size_t count) |
829 | { | 827 | { |
828 | struct se_dev_attrib *da = to_attrib(item); | ||
830 | bool flag; | 829 | bool flag; |
831 | int ret; | 830 | int ret; |
832 | 831 | ||
@@ -845,9 +844,10 @@ static ssize_t store_force_pr_aptpl(struct se_dev_attrib *da, | |||
845 | return count; | 844 | return count; |
846 | } | 845 | } |
847 | 846 | ||
848 | static ssize_t store_emulate_rest_reord(struct se_dev_attrib *da, | 847 | static ssize_t emulate_rest_reord_store(struct config_item *item, |
849 | const char *page, size_t count) | 848 | const char *page, size_t count) |
850 | { | 849 | { |
850 | struct se_dev_attrib *da = to_attrib(item); | ||
851 | bool flag; | 851 | bool flag; |
852 | int ret; | 852 | int ret; |
853 | 853 | ||
@@ -869,9 +869,10 @@ static ssize_t store_emulate_rest_reord(struct se_dev_attrib *da, | |||
869 | /* | 869 | /* |
870 | * Note, this can only be called on unexported SE Device Object. | 870 | * Note, this can only be called on unexported SE Device Object. |
871 | */ | 871 | */ |
872 | static ssize_t store_queue_depth(struct se_dev_attrib *da, | 872 | static ssize_t queue_depth_store(struct config_item *item, |
873 | const char *page, size_t count) | 873 | const char *page, size_t count) |
874 | { | 874 | { |
875 | struct se_dev_attrib *da = to_attrib(item); | ||
875 | struct se_device *dev = da->da_dev; | 876 | struct se_device *dev = da->da_dev; |
876 | u32 val; | 877 | u32 val; |
877 | int ret; | 878 | int ret; |
@@ -905,9 +906,10 @@ static ssize_t store_queue_depth(struct se_dev_attrib *da, | |||
905 | return count; | 906 | return count; |
906 | } | 907 | } |
907 | 908 | ||
908 | static ssize_t store_optimal_sectors(struct se_dev_attrib *da, | 909 | static ssize_t optimal_sectors_store(struct config_item *item, |
909 | const char *page, size_t count) | 910 | const char *page, size_t count) |
910 | { | 911 | { |
912 | struct se_dev_attrib *da = to_attrib(item); | ||
911 | u32 val; | 913 | u32 val; |
912 | int ret; | 914 | int ret; |
913 | 915 | ||
@@ -934,9 +936,10 @@ static ssize_t store_optimal_sectors(struct se_dev_attrib *da, | |||
934 | return count; | 936 | return count; |
935 | } | 937 | } |
936 | 938 | ||
937 | static ssize_t store_block_size(struct se_dev_attrib *da, | 939 | static ssize_t block_size_store(struct config_item *item, |
938 | const char *page, size_t count) | 940 | const char *page, size_t count) |
939 | { | 941 | { |
942 | struct se_dev_attrib *da = to_attrib(item); | ||
940 | u32 val; | 943 | u32 val; |
941 | int ret; | 944 | int ret; |
942 | 945 | ||
@@ -967,50 +970,35 @@ static ssize_t store_block_size(struct se_dev_attrib *da, | |||
967 | return count; | 970 | return count; |
968 | } | 971 | } |
969 | 972 | ||
970 | CONFIGFS_EATTR_STRUCT(target_backend_dev_attrib, se_dev_attrib); | 973 | CONFIGFS_ATTR(, emulate_model_alias); |
971 | #define TB_DEV_ATTR(_backend, _name, _mode) \ | 974 | CONFIGFS_ATTR(, emulate_dpo); |
972 | static struct target_backend_dev_attrib_attribute _backend##_dev_attrib_##_name = \ | 975 | CONFIGFS_ATTR(, emulate_fua_write); |
973 | __CONFIGFS_EATTR(_name, _mode, \ | 976 | CONFIGFS_ATTR(, emulate_fua_read); |
974 | show_##_name, \ | 977 | CONFIGFS_ATTR(, emulate_write_cache); |
975 | store_##_name); | 978 | CONFIGFS_ATTR(, emulate_ua_intlck_ctrl); |
976 | 979 | CONFIGFS_ATTR(, emulate_tas); | |
977 | #define TB_DEV_ATTR_RO(_backend, _name) \ | 980 | CONFIGFS_ATTR(, emulate_tpu); |
978 | static struct target_backend_dev_attrib_attribute _backend##_dev_attrib_##_name = \ | 981 | CONFIGFS_ATTR(, emulate_tpws); |
979 | __CONFIGFS_EATTR_RO(_name, \ | 982 | CONFIGFS_ATTR(, emulate_caw); |
980 | show_##_name); | 983 | CONFIGFS_ATTR(, emulate_3pc); |
981 | 984 | CONFIGFS_ATTR(, pi_prot_type); | |
982 | TB_DEV_ATTR(target_core, emulate_model_alias, S_IRUGO | S_IWUSR); | 985 | CONFIGFS_ATTR_RO(, hw_pi_prot_type); |
983 | TB_DEV_ATTR(target_core, emulate_dpo, S_IRUGO | S_IWUSR); | 986 | CONFIGFS_ATTR(, pi_prot_format); |
984 | TB_DEV_ATTR(target_core, emulate_fua_write, S_IRUGO | S_IWUSR); | 987 | CONFIGFS_ATTR(, enforce_pr_isids); |
985 | TB_DEV_ATTR(target_core, emulate_fua_read, S_IRUGO | S_IWUSR); | 988 | CONFIGFS_ATTR(, is_nonrot); |
986 | TB_DEV_ATTR(target_core, emulate_write_cache, S_IRUGO | S_IWUSR); | 989 | CONFIGFS_ATTR(, emulate_rest_reord); |
987 | TB_DEV_ATTR(target_core, emulate_ua_intlck_ctrl, S_IRUGO | S_IWUSR); | 990 | CONFIGFS_ATTR(, force_pr_aptpl); |
988 | TB_DEV_ATTR(target_core, emulate_tas, S_IRUGO | S_IWUSR); | 991 | CONFIGFS_ATTR_RO(, hw_block_size); |
989 | TB_DEV_ATTR(target_core, emulate_tpu, S_IRUGO | S_IWUSR); | 992 | CONFIGFS_ATTR(, block_size); |
990 | TB_DEV_ATTR(target_core, emulate_tpws, S_IRUGO | S_IWUSR); | 993 | CONFIGFS_ATTR_RO(, hw_max_sectors); |
991 | TB_DEV_ATTR(target_core, emulate_caw, S_IRUGO | S_IWUSR); | 994 | CONFIGFS_ATTR(, optimal_sectors); |
992 | TB_DEV_ATTR(target_core, emulate_3pc, S_IRUGO | S_IWUSR); | 995 | CONFIGFS_ATTR_RO(, hw_queue_depth); |
993 | TB_DEV_ATTR(target_core, pi_prot_type, S_IRUGO | S_IWUSR); | 996 | CONFIGFS_ATTR(, queue_depth); |
994 | TB_DEV_ATTR_RO(target_core, hw_pi_prot_type); | 997 | CONFIGFS_ATTR(, max_unmap_lba_count); |
995 | TB_DEV_ATTR(target_core, pi_prot_format, S_IRUGO | S_IWUSR); | 998 | CONFIGFS_ATTR(, max_unmap_block_desc_count); |
996 | TB_DEV_ATTR(target_core, enforce_pr_isids, S_IRUGO | S_IWUSR); | 999 | CONFIGFS_ATTR(, unmap_granularity); |
997 | TB_DEV_ATTR(target_core, is_nonrot, S_IRUGO | S_IWUSR); | 1000 | CONFIGFS_ATTR(, unmap_granularity_alignment); |
998 | TB_DEV_ATTR(target_core, emulate_rest_reord, S_IRUGO | S_IWUSR); | 1001 | CONFIGFS_ATTR(, max_write_same_len); |
999 | TB_DEV_ATTR(target_core, force_pr_aptpl, S_IRUGO | S_IWUSR) | ||
1000 | TB_DEV_ATTR_RO(target_core, hw_block_size); | ||
1001 | TB_DEV_ATTR(target_core, block_size, S_IRUGO | S_IWUSR) | ||
1002 | TB_DEV_ATTR_RO(target_core, hw_max_sectors); | ||
1003 | TB_DEV_ATTR(target_core, optimal_sectors, S_IRUGO | S_IWUSR); | ||
1004 | TB_DEV_ATTR_RO(target_core, hw_queue_depth); | ||
1005 | TB_DEV_ATTR(target_core, queue_depth, S_IRUGO | S_IWUSR); | ||
1006 | TB_DEV_ATTR(target_core, max_unmap_lba_count, S_IRUGO | S_IWUSR); | ||
1007 | TB_DEV_ATTR(target_core, max_unmap_block_desc_count, S_IRUGO | S_IWUSR); | ||
1008 | TB_DEV_ATTR(target_core, unmap_granularity, S_IRUGO | S_IWUSR); | ||
1009 | TB_DEV_ATTR(target_core, unmap_granularity_alignment, S_IRUGO | S_IWUSR); | ||
1010 | TB_DEV_ATTR(target_core, max_write_same_len, S_IRUGO | S_IWUSR); | ||
1011 | |||
1012 | CONFIGFS_EATTR_STRUCT(target_core_dev_attrib, se_dev_attrib); | ||
1013 | CONFIGFS_EATTR_OPS(target_core_dev_attrib, se_dev_attrib, da_group); | ||
1014 | 1002 | ||
1015 | /* | 1003 | /* |
1016 | * dev_attrib attributes for devices using the target core SBC/SPC | 1004 | * dev_attrib attributes for devices using the target core SBC/SPC |
@@ -1018,100 +1006,78 @@ CONFIGFS_EATTR_OPS(target_core_dev_attrib, se_dev_attrib, da_group); | |||
1018 | * these. | 1006 | * these. |
1019 | */ | 1007 | */ |
1020 | struct configfs_attribute *sbc_attrib_attrs[] = { | 1008 | struct configfs_attribute *sbc_attrib_attrs[] = { |
1021 | &target_core_dev_attrib_emulate_model_alias.attr, | 1009 | &attr_emulate_model_alias, |
1022 | &target_core_dev_attrib_emulate_dpo.attr, | 1010 | &attr_emulate_dpo, |
1023 | &target_core_dev_attrib_emulate_fua_write.attr, | 1011 | &attr_emulate_fua_write, |
1024 | &target_core_dev_attrib_emulate_fua_read.attr, | 1012 | &attr_emulate_fua_read, |
1025 | &target_core_dev_attrib_emulate_write_cache.attr, | 1013 | &attr_emulate_write_cache, |
1026 | &target_core_dev_attrib_emulate_ua_intlck_ctrl.attr, | 1014 | &attr_emulate_ua_intlck_ctrl, |
1027 | &target_core_dev_attrib_emulate_tas.attr, | 1015 | &attr_emulate_tas, |
1028 | &target_core_dev_attrib_emulate_tpu.attr, | 1016 | &attr_emulate_tpu, |
1029 | &target_core_dev_attrib_emulate_tpws.attr, | 1017 | &attr_emulate_tpws, |
1030 | &target_core_dev_attrib_emulate_caw.attr, | 1018 | &attr_emulate_caw, |
1031 | &target_core_dev_attrib_emulate_3pc.attr, | 1019 | &attr_emulate_3pc, |
1032 | &target_core_dev_attrib_pi_prot_type.attr, | 1020 | &attr_pi_prot_type, |
1033 | &target_core_dev_attrib_hw_pi_prot_type.attr, | 1021 | &attr_hw_pi_prot_type, |
1034 | &target_core_dev_attrib_pi_prot_format.attr, | 1022 | &attr_pi_prot_format, |
1035 | &target_core_dev_attrib_enforce_pr_isids.attr, | 1023 | &attr_enforce_pr_isids, |
1036 | &target_core_dev_attrib_is_nonrot.attr, | 1024 | &attr_is_nonrot, |
1037 | &target_core_dev_attrib_emulate_rest_reord.attr, | 1025 | &attr_emulate_rest_reord, |
1038 | &target_core_dev_attrib_force_pr_aptpl.attr, | 1026 | &attr_force_pr_aptpl, |
1039 | &target_core_dev_attrib_hw_block_size.attr, | 1027 | &attr_hw_block_size, |
1040 | &target_core_dev_attrib_block_size.attr, | 1028 | &attr_block_size, |
1041 | &target_core_dev_attrib_hw_max_sectors.attr, | 1029 | &attr_hw_max_sectors, |
1042 | &target_core_dev_attrib_optimal_sectors.attr, | 1030 | &attr_optimal_sectors, |
1043 | &target_core_dev_attrib_hw_queue_depth.attr, | 1031 | &attr_hw_queue_depth, |
1044 | &target_core_dev_attrib_queue_depth.attr, | 1032 | &attr_queue_depth, |
1045 | &target_core_dev_attrib_max_unmap_lba_count.attr, | 1033 | &attr_max_unmap_lba_count, |
1046 | &target_core_dev_attrib_max_unmap_block_desc_count.attr, | 1034 | &attr_max_unmap_block_desc_count, |
1047 | &target_core_dev_attrib_unmap_granularity.attr, | 1035 | &attr_unmap_granularity, |
1048 | &target_core_dev_attrib_unmap_granularity_alignment.attr, | 1036 | &attr_unmap_granularity_alignment, |
1049 | &target_core_dev_attrib_max_write_same_len.attr, | 1037 | &attr_max_write_same_len, |
1050 | NULL, | 1038 | NULL, |
1051 | }; | 1039 | }; |
1052 | EXPORT_SYMBOL(sbc_attrib_attrs); | 1040 | EXPORT_SYMBOL(sbc_attrib_attrs); |
1053 | 1041 | ||
1054 | TB_DEV_ATTR_RO(target_pt, hw_pi_prot_type); | ||
1055 | TB_DEV_ATTR_RO(target_pt, hw_block_size); | ||
1056 | TB_DEV_ATTR_RO(target_pt, hw_max_sectors); | ||
1057 | TB_DEV_ATTR_RO(target_pt, hw_queue_depth); | ||
1058 | |||
1059 | /* | 1042 | /* |
1060 | * Minimal dev_attrib attributes for devices passing through CDBs. | 1043 | * Minimal dev_attrib attributes for devices passing through CDBs. |
1061 | * In this case we only provide a few read-only attributes for | 1044 | * In this case we only provide a few read-only attributes for |
1062 | * backwards compatibility. | 1045 | * backwards compatibility. |
1063 | */ | 1046 | */ |
1064 | struct configfs_attribute *passthrough_attrib_attrs[] = { | 1047 | struct configfs_attribute *passthrough_attrib_attrs[] = { |
1065 | &target_pt_dev_attrib_hw_pi_prot_type.attr, | 1048 | &attr_hw_pi_prot_type, |
1066 | &target_pt_dev_attrib_hw_block_size.attr, | 1049 | &attr_hw_block_size, |
1067 | &target_pt_dev_attrib_hw_max_sectors.attr, | 1050 | &attr_hw_max_sectors, |
1068 | &target_pt_dev_attrib_hw_queue_depth.attr, | 1051 | &attr_hw_queue_depth, |
1069 | NULL, | 1052 | NULL, |
1070 | }; | 1053 | }; |
1071 | EXPORT_SYMBOL(passthrough_attrib_attrs); | 1054 | EXPORT_SYMBOL(passthrough_attrib_attrs); |
1072 | 1055 | ||
1073 | static struct configfs_item_operations target_core_dev_attrib_ops = { | 1056 | TB_CIT_SETUP_DRV(dev_attrib, NULL, NULL); |
1074 | .show_attribute = target_core_dev_attrib_attr_show, | ||
1075 | .store_attribute = target_core_dev_attrib_attr_store, | ||
1076 | }; | ||
1077 | |||
1078 | TB_CIT_SETUP_DRV(dev_attrib, &target_core_dev_attrib_ops, NULL); | ||
1079 | 1057 | ||
1080 | /* End functions for struct config_item_type tb_dev_attrib_cit */ | 1058 | /* End functions for struct config_item_type tb_dev_attrib_cit */ |
1081 | 1059 | ||
1082 | /* Start functions for struct config_item_type tb_dev_wwn_cit */ | 1060 | /* Start functions for struct config_item_type tb_dev_wwn_cit */ |
1083 | 1061 | ||
1084 | CONFIGFS_EATTR_STRUCT(target_core_dev_wwn, t10_wwn); | 1062 | static struct t10_wwn *to_t10_wwn(struct config_item *item) |
1085 | #define SE_DEV_WWN_ATTR(_name, _mode) \ | 1063 | { |
1086 | static struct target_core_dev_wwn_attribute target_core_dev_wwn_##_name = \ | 1064 | return container_of(to_config_group(item), struct t10_wwn, t10_wwn_group); |
1087 | __CONFIGFS_EATTR(_name, _mode, \ | 1065 | } |
1088 | target_core_dev_wwn_show_attr_##_name, \ | ||
1089 | target_core_dev_wwn_store_attr_##_name); | ||
1090 | |||
1091 | #define SE_DEV_WWN_ATTR_RO(_name); \ | ||
1092 | do { \ | ||
1093 | static struct target_core_dev_wwn_attribute \ | ||
1094 | target_core_dev_wwn_##_name = \ | ||
1095 | __CONFIGFS_EATTR_RO(_name, \ | ||
1096 | target_core_dev_wwn_show_attr_##_name); \ | ||
1097 | } while (0); | ||
1098 | 1066 | ||
1099 | /* | 1067 | /* |
1100 | * VPD page 0x80 Unit serial | 1068 | * VPD page 0x80 Unit serial |
1101 | */ | 1069 | */ |
1102 | static ssize_t target_core_dev_wwn_show_attr_vpd_unit_serial( | 1070 | static ssize_t target_wwn_vpd_unit_serial_show(struct config_item *item, |
1103 | struct t10_wwn *t10_wwn, | 1071 | char *page) |
1104 | char *page) | ||
1105 | { | 1072 | { |
1106 | return sprintf(page, "T10 VPD Unit Serial Number: %s\n", | 1073 | return sprintf(page, "T10 VPD Unit Serial Number: %s\n", |
1107 | &t10_wwn->unit_serial[0]); | 1074 | &to_t10_wwn(item)->unit_serial[0]); |
1108 | } | 1075 | } |
1109 | 1076 | ||
1110 | static ssize_t target_core_dev_wwn_store_attr_vpd_unit_serial( | 1077 | static ssize_t target_wwn_vpd_unit_serial_store(struct config_item *item, |
1111 | struct t10_wwn *t10_wwn, | 1078 | const char *page, size_t count) |
1112 | const char *page, | ||
1113 | size_t count) | ||
1114 | { | 1079 | { |
1080 | struct t10_wwn *t10_wwn = to_t10_wwn(item); | ||
1115 | struct se_device *dev = t10_wwn->t10_dev; | 1081 | struct se_device *dev = t10_wwn->t10_dev; |
1116 | unsigned char buf[INQUIRY_VPD_SERIAL_LEN]; | 1082 | unsigned char buf[INQUIRY_VPD_SERIAL_LEN]; |
1117 | 1083 | ||
@@ -1167,15 +1133,13 @@ static ssize_t target_core_dev_wwn_store_attr_vpd_unit_serial( | |||
1167 | return count; | 1133 | return count; |
1168 | } | 1134 | } |
1169 | 1135 | ||
1170 | SE_DEV_WWN_ATTR(vpd_unit_serial, S_IRUGO | S_IWUSR); | ||
1171 | |||
1172 | /* | 1136 | /* |
1173 | * VPD page 0x83 Protocol Identifier | 1137 | * VPD page 0x83 Protocol Identifier |
1174 | */ | 1138 | */ |
1175 | static ssize_t target_core_dev_wwn_show_attr_vpd_protocol_identifier( | 1139 | static ssize_t target_wwn_vpd_protocol_identifier_show(struct config_item *item, |
1176 | struct t10_wwn *t10_wwn, | 1140 | char *page) |
1177 | char *page) | ||
1178 | { | 1141 | { |
1142 | struct t10_wwn *t10_wwn = to_t10_wwn(item); | ||
1179 | struct t10_vpd *vpd; | 1143 | struct t10_vpd *vpd; |
1180 | unsigned char buf[VPD_TMP_BUF_SIZE]; | 1144 | unsigned char buf[VPD_TMP_BUF_SIZE]; |
1181 | ssize_t len = 0; | 1145 | ssize_t len = 0; |
@@ -1199,25 +1163,15 @@ static ssize_t target_core_dev_wwn_show_attr_vpd_protocol_identifier( | |||
1199 | return len; | 1163 | return len; |
1200 | } | 1164 | } |
1201 | 1165 | ||
1202 | static ssize_t target_core_dev_wwn_store_attr_vpd_protocol_identifier( | ||
1203 | struct t10_wwn *t10_wwn, | ||
1204 | const char *page, | ||
1205 | size_t count) | ||
1206 | { | ||
1207 | return -ENOSYS; | ||
1208 | } | ||
1209 | |||
1210 | SE_DEV_WWN_ATTR(vpd_protocol_identifier, S_IRUGO | S_IWUSR); | ||
1211 | |||
1212 | /* | 1166 | /* |
1213 | * Generic wrapper for dumping VPD identifiers by association. | 1167 | * Generic wrapper for dumping VPD identifiers by association. |
1214 | */ | 1168 | */ |
1215 | #define DEF_DEV_WWN_ASSOC_SHOW(_name, _assoc) \ | 1169 | #define DEF_DEV_WWN_ASSOC_SHOW(_name, _assoc) \ |
1216 | static ssize_t target_core_dev_wwn_show_attr_##_name( \ | 1170 | static ssize_t target_wwn_##_name##_show(struct config_item *item, \ |
1217 | struct t10_wwn *t10_wwn, \ | 1171 | char *page) \ |
1218 | char *page) \ | ||
1219 | { \ | 1172 | { \ |
1220 | struct t10_vpd *vpd; \ | 1173 | struct t10_wwn *t10_wwn = to_t10_wwn(item); \ |
1174 | struct t10_vpd *vpd; \ | ||
1221 | unsigned char buf[VPD_TMP_BUF_SIZE]; \ | 1175 | unsigned char buf[VPD_TMP_BUF_SIZE]; \ |
1222 | ssize_t len = 0; \ | 1176 | ssize_t len = 0; \ |
1223 | \ | 1177 | \ |
@@ -1249,84 +1203,39 @@ static ssize_t target_core_dev_wwn_show_attr_##_name( \ | |||
1249 | return len; \ | 1203 | return len; \ |
1250 | } | 1204 | } |
1251 | 1205 | ||
1252 | /* | 1206 | /* VPD page 0x83 Association: Logical Unit */ |
1253 | * VPD page 0x83 Association: Logical Unit | ||
1254 | */ | ||
1255 | DEF_DEV_WWN_ASSOC_SHOW(vpd_assoc_logical_unit, 0x00); | 1207 | DEF_DEV_WWN_ASSOC_SHOW(vpd_assoc_logical_unit, 0x00); |
1256 | 1208 | /* VPD page 0x83 Association: Target Port */ | |
1257 | static ssize_t target_core_dev_wwn_store_attr_vpd_assoc_logical_unit( | ||
1258 | struct t10_wwn *t10_wwn, | ||
1259 | const char *page, | ||
1260 | size_t count) | ||
1261 | { | ||
1262 | return -ENOSYS; | ||
1263 | } | ||
1264 | |||
1265 | SE_DEV_WWN_ATTR(vpd_assoc_logical_unit, S_IRUGO | S_IWUSR); | ||
1266 | |||
1267 | /* | ||
1268 | * VPD page 0x83 Association: Target Port | ||
1269 | */ | ||
1270 | DEF_DEV_WWN_ASSOC_SHOW(vpd_assoc_target_port, 0x10); | 1209 | DEF_DEV_WWN_ASSOC_SHOW(vpd_assoc_target_port, 0x10); |
1271 | 1210 | /* VPD page 0x83 Association: SCSI Target Device */ | |
1272 | static ssize_t target_core_dev_wwn_store_attr_vpd_assoc_target_port( | ||
1273 | struct t10_wwn *t10_wwn, | ||
1274 | const char *page, | ||
1275 | size_t count) | ||
1276 | { | ||
1277 | return -ENOSYS; | ||
1278 | } | ||
1279 | |||
1280 | SE_DEV_WWN_ATTR(vpd_assoc_target_port, S_IRUGO | S_IWUSR); | ||
1281 | |||
1282 | /* | ||
1283 | * VPD page 0x83 Association: SCSI Target Device | ||
1284 | */ | ||
1285 | DEF_DEV_WWN_ASSOC_SHOW(vpd_assoc_scsi_target_device, 0x20); | 1211 | DEF_DEV_WWN_ASSOC_SHOW(vpd_assoc_scsi_target_device, 0x20); |
1286 | 1212 | ||
1287 | static ssize_t target_core_dev_wwn_store_attr_vpd_assoc_scsi_target_device( | 1213 | CONFIGFS_ATTR(target_wwn_, vpd_unit_serial); |
1288 | struct t10_wwn *t10_wwn, | 1214 | CONFIGFS_ATTR_RO(target_wwn_, vpd_protocol_identifier); |
1289 | const char *page, | 1215 | CONFIGFS_ATTR_RO(target_wwn_, vpd_assoc_logical_unit); |
1290 | size_t count) | 1216 | CONFIGFS_ATTR_RO(target_wwn_, vpd_assoc_target_port); |
1291 | { | 1217 | CONFIGFS_ATTR_RO(target_wwn_, vpd_assoc_scsi_target_device); |
1292 | return -ENOSYS; | ||
1293 | } | ||
1294 | |||
1295 | SE_DEV_WWN_ATTR(vpd_assoc_scsi_target_device, S_IRUGO | S_IWUSR); | ||
1296 | |||
1297 | CONFIGFS_EATTR_OPS(target_core_dev_wwn, t10_wwn, t10_wwn_group); | ||
1298 | 1218 | ||
1299 | static struct configfs_attribute *target_core_dev_wwn_attrs[] = { | 1219 | static struct configfs_attribute *target_core_dev_wwn_attrs[] = { |
1300 | &target_core_dev_wwn_vpd_unit_serial.attr, | 1220 | &target_wwn_attr_vpd_unit_serial, |
1301 | &target_core_dev_wwn_vpd_protocol_identifier.attr, | 1221 | &target_wwn_attr_vpd_protocol_identifier, |
1302 | &target_core_dev_wwn_vpd_assoc_logical_unit.attr, | 1222 | &target_wwn_attr_vpd_assoc_logical_unit, |
1303 | &target_core_dev_wwn_vpd_assoc_target_port.attr, | 1223 | &target_wwn_attr_vpd_assoc_target_port, |
1304 | &target_core_dev_wwn_vpd_assoc_scsi_target_device.attr, | 1224 | &target_wwn_attr_vpd_assoc_scsi_target_device, |
1305 | NULL, | 1225 | NULL, |
1306 | }; | 1226 | }; |
1307 | 1227 | ||
1308 | static struct configfs_item_operations target_core_dev_wwn_ops = { | 1228 | TB_CIT_SETUP(dev_wwn, NULL, NULL, target_core_dev_wwn_attrs); |
1309 | .show_attribute = target_core_dev_wwn_attr_show, | ||
1310 | .store_attribute = target_core_dev_wwn_attr_store, | ||
1311 | }; | ||
1312 | |||
1313 | TB_CIT_SETUP(dev_wwn, &target_core_dev_wwn_ops, NULL, target_core_dev_wwn_attrs); | ||
1314 | 1229 | ||
1315 | /* End functions for struct config_item_type tb_dev_wwn_cit */ | 1230 | /* End functions for struct config_item_type tb_dev_wwn_cit */ |
1316 | 1231 | ||
1317 | /* Start functions for struct config_item_type tb_dev_pr_cit */ | 1232 | /* Start functions for struct config_item_type tb_dev_pr_cit */ |
1318 | 1233 | ||
1319 | CONFIGFS_EATTR_STRUCT(target_core_dev_pr, se_device); | 1234 | static struct se_device *pr_to_dev(struct config_item *item) |
1320 | #define SE_DEV_PR_ATTR(_name, _mode) \ | 1235 | { |
1321 | static struct target_core_dev_pr_attribute target_core_dev_pr_##_name = \ | 1236 | return container_of(to_config_group(item), struct se_device, |
1322 | __CONFIGFS_EATTR(_name, _mode, \ | 1237 | dev_pr_group); |
1323 | target_core_dev_pr_show_attr_##_name, \ | 1238 | } |
1324 | target_core_dev_pr_store_attr_##_name); | ||
1325 | |||
1326 | #define SE_DEV_PR_ATTR_RO(_name); \ | ||
1327 | static struct target_core_dev_pr_attribute target_core_dev_pr_##_name = \ | ||
1328 | __CONFIGFS_EATTR_RO(_name, \ | ||
1329 | target_core_dev_pr_show_attr_##_name); | ||
1330 | 1239 | ||
1331 | static ssize_t target_core_dev_pr_show_spc3_res(struct se_device *dev, | 1240 | static ssize_t target_core_dev_pr_show_spc3_res(struct se_device *dev, |
1332 | char *page) | 1241 | char *page) |
@@ -1367,9 +1276,9 @@ static ssize_t target_core_dev_pr_show_spc2_res(struct se_device *dev, | |||
1367 | return len; | 1276 | return len; |
1368 | } | 1277 | } |
1369 | 1278 | ||
1370 | static ssize_t target_core_dev_pr_show_attr_res_holder(struct se_device *dev, | 1279 | static ssize_t target_pr_res_holder_show(struct config_item *item, char *page) |
1371 | char *page) | ||
1372 | { | 1280 | { |
1281 | struct se_device *dev = pr_to_dev(item); | ||
1373 | int ret; | 1282 | int ret; |
1374 | 1283 | ||
1375 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) | 1284 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
@@ -1384,11 +1293,10 @@ static ssize_t target_core_dev_pr_show_attr_res_holder(struct se_device *dev, | |||
1384 | return ret; | 1293 | return ret; |
1385 | } | 1294 | } |
1386 | 1295 | ||
1387 | SE_DEV_PR_ATTR_RO(res_holder); | 1296 | static ssize_t target_pr_res_pr_all_tgt_pts_show(struct config_item *item, |
1388 | 1297 | char *page) | |
1389 | static ssize_t target_core_dev_pr_show_attr_res_pr_all_tgt_pts( | ||
1390 | struct se_device *dev, char *page) | ||
1391 | { | 1298 | { |
1299 | struct se_device *dev = pr_to_dev(item); | ||
1392 | ssize_t len = 0; | 1300 | ssize_t len = 0; |
1393 | 1301 | ||
1394 | spin_lock(&dev->dev_reservation_lock); | 1302 | spin_lock(&dev->dev_reservation_lock); |
@@ -1406,22 +1314,17 @@ static ssize_t target_core_dev_pr_show_attr_res_pr_all_tgt_pts( | |||
1406 | return len; | 1314 | return len; |
1407 | } | 1315 | } |
1408 | 1316 | ||
1409 | SE_DEV_PR_ATTR_RO(res_pr_all_tgt_pts); | 1317 | static ssize_t target_pr_res_pr_generation_show(struct config_item *item, |
1410 | 1318 | char *page) | |
1411 | static ssize_t target_core_dev_pr_show_attr_res_pr_generation( | ||
1412 | struct se_device *dev, char *page) | ||
1413 | { | 1319 | { |
1414 | return sprintf(page, "0x%08x\n", dev->t10_pr.pr_generation); | 1320 | return sprintf(page, "0x%08x\n", pr_to_dev(item)->t10_pr.pr_generation); |
1415 | } | 1321 | } |
1416 | 1322 | ||
1417 | SE_DEV_PR_ATTR_RO(res_pr_generation); | ||
1418 | 1323 | ||
1419 | /* | 1324 | static ssize_t target_pr_res_pr_holder_tg_port_show(struct config_item *item, |
1420 | * res_pr_holder_tg_port | 1325 | char *page) |
1421 | */ | ||
1422 | static ssize_t target_core_dev_pr_show_attr_res_pr_holder_tg_port( | ||
1423 | struct se_device *dev, char *page) | ||
1424 | { | 1326 | { |
1327 | struct se_device *dev = pr_to_dev(item); | ||
1425 | struct se_node_acl *se_nacl; | 1328 | struct se_node_acl *se_nacl; |
1426 | struct se_portal_group *se_tpg; | 1329 | struct se_portal_group *se_tpg; |
1427 | struct t10_pr_registration *pr_reg; | 1330 | struct t10_pr_registration *pr_reg; |
@@ -1453,11 +1356,11 @@ out_unlock: | |||
1453 | return len; | 1356 | return len; |
1454 | } | 1357 | } |
1455 | 1358 | ||
1456 | SE_DEV_PR_ATTR_RO(res_pr_holder_tg_port); | ||
1457 | 1359 | ||
1458 | static ssize_t target_core_dev_pr_show_attr_res_pr_registered_i_pts( | 1360 | static ssize_t target_pr_res_pr_registered_i_pts_show(struct config_item *item, |
1459 | struct se_device *dev, char *page) | 1361 | char *page) |
1460 | { | 1362 | { |
1363 | struct se_device *dev = pr_to_dev(item); | ||
1461 | const struct target_core_fabric_ops *tfo; | 1364 | const struct target_core_fabric_ops *tfo; |
1462 | struct t10_pr_registration *pr_reg; | 1365 | struct t10_pr_registration *pr_reg; |
1463 | unsigned char buf[384]; | 1366 | unsigned char buf[384]; |
@@ -1495,11 +1398,9 @@ static ssize_t target_core_dev_pr_show_attr_res_pr_registered_i_pts( | |||
1495 | return len; | 1398 | return len; |
1496 | } | 1399 | } |
1497 | 1400 | ||
1498 | SE_DEV_PR_ATTR_RO(res_pr_registered_i_pts); | 1401 | static ssize_t target_pr_res_pr_type_show(struct config_item *item, char *page) |
1499 | |||
1500 | static ssize_t target_core_dev_pr_show_attr_res_pr_type( | ||
1501 | struct se_device *dev, char *page) | ||
1502 | { | 1402 | { |
1403 | struct se_device *dev = pr_to_dev(item); | ||
1503 | struct t10_pr_registration *pr_reg; | 1404 | struct t10_pr_registration *pr_reg; |
1504 | ssize_t len = 0; | 1405 | ssize_t len = 0; |
1505 | 1406 | ||
@@ -1516,11 +1417,10 @@ static ssize_t target_core_dev_pr_show_attr_res_pr_type( | |||
1516 | return len; | 1417 | return len; |
1517 | } | 1418 | } |
1518 | 1419 | ||
1519 | SE_DEV_PR_ATTR_RO(res_pr_type); | 1420 | static ssize_t target_pr_res_type_show(struct config_item *item, char *page) |
1520 | |||
1521 | static ssize_t target_core_dev_pr_show_attr_res_type( | ||
1522 | struct se_device *dev, char *page) | ||
1523 | { | 1421 | { |
1422 | struct se_device *dev = pr_to_dev(item); | ||
1423 | |||
1524 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) | 1424 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1525 | return sprintf(page, "SPC_PASSTHROUGH\n"); | 1425 | return sprintf(page, "SPC_PASSTHROUGH\n"); |
1526 | else if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) | 1426 | else if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) |
@@ -1529,11 +1429,11 @@ static ssize_t target_core_dev_pr_show_attr_res_type( | |||
1529 | return sprintf(page, "SPC3_PERSISTENT_RESERVATIONS\n"); | 1429 | return sprintf(page, "SPC3_PERSISTENT_RESERVATIONS\n"); |
1530 | } | 1430 | } |
1531 | 1431 | ||
1532 | SE_DEV_PR_ATTR_RO(res_type); | 1432 | static ssize_t target_pr_res_aptpl_active_show(struct config_item *item, |
1533 | 1433 | char *page) | |
1534 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_active( | ||
1535 | struct se_device *dev, char *page) | ||
1536 | { | 1434 | { |
1435 | struct se_device *dev = pr_to_dev(item); | ||
1436 | |||
1537 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) | 1437 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1538 | return 0; | 1438 | return 0; |
1539 | 1439 | ||
@@ -1541,14 +1441,11 @@ static ssize_t target_core_dev_pr_show_attr_res_aptpl_active( | |||
1541 | (dev->t10_pr.pr_aptpl_active) ? "Activated" : "Disabled"); | 1441 | (dev->t10_pr.pr_aptpl_active) ? "Activated" : "Disabled"); |
1542 | } | 1442 | } |
1543 | 1443 | ||
1544 | SE_DEV_PR_ATTR_RO(res_aptpl_active); | 1444 | static ssize_t target_pr_res_aptpl_metadata_show(struct config_item *item, |
1545 | 1445 | char *page) | |
1546 | /* | ||
1547 | * res_aptpl_metadata | ||
1548 | */ | ||
1549 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_metadata( | ||
1550 | struct se_device *dev, char *page) | ||
1551 | { | 1446 | { |
1447 | struct se_device *dev = pr_to_dev(item); | ||
1448 | |||
1552 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) | 1449 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1553 | return 0; | 1450 | return 0; |
1554 | 1451 | ||
@@ -1580,11 +1477,10 @@ static match_table_t tokens = { | |||
1580 | {Opt_err, NULL} | 1477 | {Opt_err, NULL} |
1581 | }; | 1478 | }; |
1582 | 1479 | ||
1583 | static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata( | 1480 | static ssize_t target_pr_res_aptpl_metadata_store(struct config_item *item, |
1584 | struct se_device *dev, | 1481 | const char *page, size_t count) |
1585 | const char *page, | ||
1586 | size_t count) | ||
1587 | { | 1482 | { |
1483 | struct se_device *dev = pr_to_dev(item); | ||
1588 | unsigned char *i_fabric = NULL, *i_port = NULL, *isid = NULL; | 1484 | unsigned char *i_fabric = NULL, *i_port = NULL, *isid = NULL; |
1589 | unsigned char *t_fabric = NULL, *t_port = NULL; | 1485 | unsigned char *t_fabric = NULL, *t_port = NULL; |
1590 | char *orig, *ptr, *opts; | 1486 | char *orig, *ptr, *opts; |
@@ -1765,37 +1661,44 @@ out: | |||
1765 | return (ret == 0) ? count : ret; | 1661 | return (ret == 0) ? count : ret; |
1766 | } | 1662 | } |
1767 | 1663 | ||
1768 | SE_DEV_PR_ATTR(res_aptpl_metadata, S_IRUGO | S_IWUSR); | ||
1769 | 1664 | ||
1770 | CONFIGFS_EATTR_OPS(target_core_dev_pr, se_device, dev_pr_group); | 1665 | CONFIGFS_ATTR_RO(target_pr_, res_holder); |
1666 | CONFIGFS_ATTR_RO(target_pr_, res_pr_all_tgt_pts); | ||
1667 | CONFIGFS_ATTR_RO(target_pr_, res_pr_generation); | ||
1668 | CONFIGFS_ATTR_RO(target_pr_, res_pr_holder_tg_port); | ||
1669 | CONFIGFS_ATTR_RO(target_pr_, res_pr_registered_i_pts); | ||
1670 | CONFIGFS_ATTR_RO(target_pr_, res_pr_type); | ||
1671 | CONFIGFS_ATTR_RO(target_pr_, res_type); | ||
1672 | CONFIGFS_ATTR_RO(target_pr_, res_aptpl_active); | ||
1673 | CONFIGFS_ATTR(target_pr_, res_aptpl_metadata); | ||
1771 | 1674 | ||
1772 | static struct configfs_attribute *target_core_dev_pr_attrs[] = { | 1675 | static struct configfs_attribute *target_core_dev_pr_attrs[] = { |
1773 | &target_core_dev_pr_res_holder.attr, | 1676 | &target_pr_attr_res_holder, |
1774 | &target_core_dev_pr_res_pr_all_tgt_pts.attr, | 1677 | &target_pr_attr_res_pr_all_tgt_pts, |
1775 | &target_core_dev_pr_res_pr_generation.attr, | 1678 | &target_pr_attr_res_pr_generation, |
1776 | &target_core_dev_pr_res_pr_holder_tg_port.attr, | 1679 | &target_pr_attr_res_pr_holder_tg_port, |
1777 | &target_core_dev_pr_res_pr_registered_i_pts.attr, | 1680 | &target_pr_attr_res_pr_registered_i_pts, |
1778 | &target_core_dev_pr_res_pr_type.attr, | 1681 | &target_pr_attr_res_pr_type, |
1779 | &target_core_dev_pr_res_type.attr, | 1682 | &target_pr_attr_res_type, |
1780 | &target_core_dev_pr_res_aptpl_active.attr, | 1683 | &target_pr_attr_res_aptpl_active, |
1781 | &target_core_dev_pr_res_aptpl_metadata.attr, | 1684 | &target_pr_attr_res_aptpl_metadata, |
1782 | NULL, | 1685 | NULL, |
1783 | }; | 1686 | }; |
1784 | 1687 | ||
1785 | static struct configfs_item_operations target_core_dev_pr_ops = { | 1688 | TB_CIT_SETUP(dev_pr, NULL, NULL, target_core_dev_pr_attrs); |
1786 | .show_attribute = target_core_dev_pr_attr_show, | ||
1787 | .store_attribute = target_core_dev_pr_attr_store, | ||
1788 | }; | ||
1789 | |||
1790 | TB_CIT_SETUP(dev_pr, &target_core_dev_pr_ops, NULL, target_core_dev_pr_attrs); | ||
1791 | 1689 | ||
1792 | /* End functions for struct config_item_type tb_dev_pr_cit */ | 1690 | /* End functions for struct config_item_type tb_dev_pr_cit */ |
1793 | 1691 | ||
1794 | /* Start functions for struct config_item_type tb_dev_cit */ | 1692 | /* Start functions for struct config_item_type tb_dev_cit */ |
1795 | 1693 | ||
1796 | static ssize_t target_core_show_dev_info(void *p, char *page) | 1694 | static inline struct se_device *to_device(struct config_item *item) |
1695 | { | ||
1696 | return container_of(to_config_group(item), struct se_device, dev_group); | ||
1697 | } | ||
1698 | |||
1699 | static ssize_t target_dev_info_show(struct config_item *item, char *page) | ||
1797 | { | 1700 | { |
1798 | struct se_device *dev = p; | 1701 | struct se_device *dev = to_device(item); |
1799 | int bl = 0; | 1702 | int bl = 0; |
1800 | ssize_t read_bytes = 0; | 1703 | ssize_t read_bytes = 0; |
1801 | 1704 | ||
@@ -1806,35 +1709,17 @@ static ssize_t target_core_show_dev_info(void *p, char *page) | |||
1806 | return read_bytes; | 1709 | return read_bytes; |
1807 | } | 1710 | } |
1808 | 1711 | ||
1809 | static struct target_core_configfs_attribute target_core_attr_dev_info = { | 1712 | static ssize_t target_dev_control_store(struct config_item *item, |
1810 | .attr = { .ca_owner = THIS_MODULE, | 1713 | const char *page, size_t count) |
1811 | .ca_name = "info", | ||
1812 | .ca_mode = S_IRUGO }, | ||
1813 | .show = target_core_show_dev_info, | ||
1814 | .store = NULL, | ||
1815 | }; | ||
1816 | |||
1817 | static ssize_t target_core_store_dev_control( | ||
1818 | void *p, | ||
1819 | const char *page, | ||
1820 | size_t count) | ||
1821 | { | 1714 | { |
1822 | struct se_device *dev = p; | 1715 | struct se_device *dev = to_device(item); |
1823 | 1716 | ||
1824 | return dev->transport->set_configfs_dev_params(dev, page, count); | 1717 | return dev->transport->set_configfs_dev_params(dev, page, count); |
1825 | } | 1718 | } |
1826 | 1719 | ||
1827 | static struct target_core_configfs_attribute target_core_attr_dev_control = { | 1720 | static ssize_t target_dev_alias_show(struct config_item *item, char *page) |
1828 | .attr = { .ca_owner = THIS_MODULE, | ||
1829 | .ca_name = "control", | ||
1830 | .ca_mode = S_IWUSR }, | ||
1831 | .show = NULL, | ||
1832 | .store = target_core_store_dev_control, | ||
1833 | }; | ||
1834 | |||
1835 | static ssize_t target_core_show_dev_alias(void *p, char *page) | ||
1836 | { | 1721 | { |
1837 | struct se_device *dev = p; | 1722 | struct se_device *dev = to_device(item); |
1838 | 1723 | ||
1839 | if (!(dev->dev_flags & DF_USING_ALIAS)) | 1724 | if (!(dev->dev_flags & DF_USING_ALIAS)) |
1840 | return 0; | 1725 | return 0; |
@@ -1842,12 +1727,10 @@ static ssize_t target_core_show_dev_alias(void *p, char *page) | |||
1842 | return snprintf(page, PAGE_SIZE, "%s\n", dev->dev_alias); | 1727 | return snprintf(page, PAGE_SIZE, "%s\n", dev->dev_alias); |
1843 | } | 1728 | } |
1844 | 1729 | ||
1845 | static ssize_t target_core_store_dev_alias( | 1730 | static ssize_t target_dev_alias_store(struct config_item *item, |
1846 | void *p, | 1731 | const char *page, size_t count) |
1847 | const char *page, | ||
1848 | size_t count) | ||
1849 | { | 1732 | { |
1850 | struct se_device *dev = p; | 1733 | struct se_device *dev = to_device(item); |
1851 | struct se_hba *hba = dev->se_hba; | 1734 | struct se_hba *hba = dev->se_hba; |
1852 | ssize_t read_bytes; | 1735 | ssize_t read_bytes; |
1853 | 1736 | ||
@@ -1874,17 +1757,9 @@ static ssize_t target_core_store_dev_alias( | |||
1874 | return read_bytes; | 1757 | return read_bytes; |
1875 | } | 1758 | } |
1876 | 1759 | ||
1877 | static struct target_core_configfs_attribute target_core_attr_dev_alias = { | 1760 | static ssize_t target_dev_udev_path_show(struct config_item *item, char *page) |
1878 | .attr = { .ca_owner = THIS_MODULE, | ||
1879 | .ca_name = "alias", | ||
1880 | .ca_mode = S_IRUGO | S_IWUSR }, | ||
1881 | .show = target_core_show_dev_alias, | ||
1882 | .store = target_core_store_dev_alias, | ||
1883 | }; | ||
1884 | |||
1885 | static ssize_t target_core_show_dev_udev_path(void *p, char *page) | ||
1886 | { | 1761 | { |
1887 | struct se_device *dev = p; | 1762 | struct se_device *dev = to_device(item); |
1888 | 1763 | ||
1889 | if (!(dev->dev_flags & DF_USING_UDEV_PATH)) | 1764 | if (!(dev->dev_flags & DF_USING_UDEV_PATH)) |
1890 | return 0; | 1765 | return 0; |
@@ -1892,12 +1767,10 @@ static ssize_t target_core_show_dev_udev_path(void *p, char *page) | |||
1892 | return snprintf(page, PAGE_SIZE, "%s\n", dev->udev_path); | 1767 | return snprintf(page, PAGE_SIZE, "%s\n", dev->udev_path); |
1893 | } | 1768 | } |
1894 | 1769 | ||
1895 | static ssize_t target_core_store_dev_udev_path( | 1770 | static ssize_t target_dev_udev_path_store(struct config_item *item, |
1896 | void *p, | 1771 | const char *page, size_t count) |
1897 | const char *page, | ||
1898 | size_t count) | ||
1899 | { | 1772 | { |
1900 | struct se_device *dev = p; | 1773 | struct se_device *dev = to_device(item); |
1901 | struct se_hba *hba = dev->se_hba; | 1774 | struct se_hba *hba = dev->se_hba; |
1902 | ssize_t read_bytes; | 1775 | ssize_t read_bytes; |
1903 | 1776 | ||
@@ -1925,27 +1798,17 @@ static ssize_t target_core_store_dev_udev_path( | |||
1925 | return read_bytes; | 1798 | return read_bytes; |
1926 | } | 1799 | } |
1927 | 1800 | ||
1928 | static struct target_core_configfs_attribute target_core_attr_dev_udev_path = { | 1801 | static ssize_t target_dev_enable_show(struct config_item *item, char *page) |
1929 | .attr = { .ca_owner = THIS_MODULE, | ||
1930 | .ca_name = "udev_path", | ||
1931 | .ca_mode = S_IRUGO | S_IWUSR }, | ||
1932 | .show = target_core_show_dev_udev_path, | ||
1933 | .store = target_core_store_dev_udev_path, | ||
1934 | }; | ||
1935 | |||
1936 | static ssize_t target_core_show_dev_enable(void *p, char *page) | ||
1937 | { | 1802 | { |
1938 | struct se_device *dev = p; | 1803 | struct se_device *dev = to_device(item); |
1939 | 1804 | ||
1940 | return snprintf(page, PAGE_SIZE, "%d\n", !!(dev->dev_flags & DF_CONFIGURED)); | 1805 | return snprintf(page, PAGE_SIZE, "%d\n", !!(dev->dev_flags & DF_CONFIGURED)); |
1941 | } | 1806 | } |
1942 | 1807 | ||
1943 | static ssize_t target_core_store_dev_enable( | 1808 | static ssize_t target_dev_enable_store(struct config_item *item, |
1944 | void *p, | 1809 | const char *page, size_t count) |
1945 | const char *page, | ||
1946 | size_t count) | ||
1947 | { | 1810 | { |
1948 | struct se_device *dev = p; | 1811 | struct se_device *dev = to_device(item); |
1949 | char *ptr; | 1812 | char *ptr; |
1950 | int ret; | 1813 | int ret; |
1951 | 1814 | ||
@@ -1962,17 +1825,9 @@ static ssize_t target_core_store_dev_enable( | |||
1962 | return count; | 1825 | return count; |
1963 | } | 1826 | } |
1964 | 1827 | ||
1965 | static struct target_core_configfs_attribute target_core_attr_dev_enable = { | 1828 | static ssize_t target_dev_alua_lu_gp_show(struct config_item *item, char *page) |
1966 | .attr = { .ca_owner = THIS_MODULE, | ||
1967 | .ca_name = "enable", | ||
1968 | .ca_mode = S_IRUGO | S_IWUSR }, | ||
1969 | .show = target_core_show_dev_enable, | ||
1970 | .store = target_core_store_dev_enable, | ||
1971 | }; | ||
1972 | |||
1973 | static ssize_t target_core_show_alua_lu_gp(void *p, char *page) | ||
1974 | { | 1829 | { |
1975 | struct se_device *dev = p; | 1830 | struct se_device *dev = to_device(item); |
1976 | struct config_item *lu_ci; | 1831 | struct config_item *lu_ci; |
1977 | struct t10_alua_lu_gp *lu_gp; | 1832 | struct t10_alua_lu_gp *lu_gp; |
1978 | struct t10_alua_lu_gp_member *lu_gp_mem; | 1833 | struct t10_alua_lu_gp_member *lu_gp_mem; |
@@ -1994,12 +1849,10 @@ static ssize_t target_core_show_alua_lu_gp(void *p, char *page) | |||
1994 | return len; | 1849 | return len; |
1995 | } | 1850 | } |
1996 | 1851 | ||
1997 | static ssize_t target_core_store_alua_lu_gp( | 1852 | static ssize_t target_dev_alua_lu_gp_store(struct config_item *item, |
1998 | void *p, | 1853 | const char *page, size_t count) |
1999 | const char *page, | ||
2000 | size_t count) | ||
2001 | { | 1854 | { |
2002 | struct se_device *dev = p; | 1855 | struct se_device *dev = to_device(item); |
2003 | struct se_hba *hba = dev->se_hba; | 1856 | struct se_hba *hba = dev->se_hba; |
2004 | struct t10_alua_lu_gp *lu_gp = NULL, *lu_gp_new = NULL; | 1857 | struct t10_alua_lu_gp *lu_gp = NULL, *lu_gp_new = NULL; |
2005 | struct t10_alua_lu_gp_member *lu_gp_mem; | 1858 | struct t10_alua_lu_gp_member *lu_gp_mem; |
@@ -2076,17 +1929,9 @@ static ssize_t target_core_store_alua_lu_gp( | |||
2076 | return count; | 1929 | return count; |
2077 | } | 1930 | } |
2078 | 1931 | ||
2079 | static struct target_core_configfs_attribute target_core_attr_dev_alua_lu_gp = { | 1932 | static ssize_t target_dev_lba_map_show(struct config_item *item, char *page) |
2080 | .attr = { .ca_owner = THIS_MODULE, | ||
2081 | .ca_name = "alua_lu_gp", | ||
2082 | .ca_mode = S_IRUGO | S_IWUSR }, | ||
2083 | .show = target_core_show_alua_lu_gp, | ||
2084 | .store = target_core_store_alua_lu_gp, | ||
2085 | }; | ||
2086 | |||
2087 | static ssize_t target_core_show_dev_lba_map(void *p, char *page) | ||
2088 | { | 1933 | { |
2089 | struct se_device *dev = p; | 1934 | struct se_device *dev = to_device(item); |
2090 | struct t10_alua_lba_map *map; | 1935 | struct t10_alua_lba_map *map; |
2091 | struct t10_alua_lba_map_member *mem; | 1936 | struct t10_alua_lba_map_member *mem; |
2092 | char *b = page; | 1937 | char *b = page; |
@@ -2129,12 +1974,10 @@ static ssize_t target_core_show_dev_lba_map(void *p, char *page) | |||
2129 | return bl; | 1974 | return bl; |
2130 | } | 1975 | } |
2131 | 1976 | ||
2132 | static ssize_t target_core_store_dev_lba_map( | 1977 | static ssize_t target_dev_lba_map_store(struct config_item *item, |
2133 | void *p, | 1978 | const char *page, size_t count) |
2134 | const char *page, | ||
2135 | size_t count) | ||
2136 | { | 1979 | { |
2137 | struct se_device *dev = p; | 1980 | struct se_device *dev = to_device(item); |
2138 | struct t10_alua_lba_map *lba_map = NULL; | 1981 | struct t10_alua_lba_map *lba_map = NULL; |
2139 | struct list_head lba_list; | 1982 | struct list_head lba_list; |
2140 | char *map_entries, *ptr; | 1983 | char *map_entries, *ptr; |
@@ -2246,22 +2089,22 @@ out: | |||
2246 | return count; | 2089 | return count; |
2247 | } | 2090 | } |
2248 | 2091 | ||
2249 | static struct target_core_configfs_attribute target_core_attr_dev_lba_map = { | 2092 | CONFIGFS_ATTR_RO(target_dev_, info); |
2250 | .attr = { .ca_owner = THIS_MODULE, | 2093 | CONFIGFS_ATTR_WO(target_dev_, control); |
2251 | .ca_name = "lba_map", | 2094 | CONFIGFS_ATTR(target_dev_, alias); |
2252 | .ca_mode = S_IRUGO | S_IWUSR }, | 2095 | CONFIGFS_ATTR(target_dev_, udev_path); |
2253 | .show = target_core_show_dev_lba_map, | 2096 | CONFIGFS_ATTR(target_dev_, enable); |
2254 | .store = target_core_store_dev_lba_map, | 2097 | CONFIGFS_ATTR(target_dev_, alua_lu_gp); |
2255 | }; | 2098 | CONFIGFS_ATTR(target_dev_, lba_map); |
2256 | 2099 | ||
2257 | static struct configfs_attribute *target_core_dev_attrs[] = { | 2100 | static struct configfs_attribute *target_core_dev_attrs[] = { |
2258 | &target_core_attr_dev_info.attr, | 2101 | &target_dev_attr_info, |
2259 | &target_core_attr_dev_control.attr, | 2102 | &target_dev_attr_control, |
2260 | &target_core_attr_dev_alias.attr, | 2103 | &target_dev_attr_alias, |
2261 | &target_core_attr_dev_udev_path.attr, | 2104 | &target_dev_attr_udev_path, |
2262 | &target_core_attr_dev_enable.attr, | 2105 | &target_dev_attr_enable, |
2263 | &target_core_attr_dev_alua_lu_gp.attr, | 2106 | &target_dev_attr_alua_lu_gp, |
2264 | &target_core_attr_dev_lba_map.attr, | 2107 | &target_dev_attr_lba_map, |
2265 | NULL, | 2108 | NULL, |
2266 | }; | 2109 | }; |
2267 | 2110 | ||
@@ -2275,42 +2118,8 @@ static void target_core_dev_release(struct config_item *item) | |||
2275 | target_free_device(dev); | 2118 | target_free_device(dev); |
2276 | } | 2119 | } |
2277 | 2120 | ||
2278 | static ssize_t target_core_dev_show(struct config_item *item, | ||
2279 | struct configfs_attribute *attr, | ||
2280 | char *page) | ||
2281 | { | ||
2282 | struct config_group *dev_cg = to_config_group(item); | ||
2283 | struct se_device *dev = | ||
2284 | container_of(dev_cg, struct se_device, dev_group); | ||
2285 | struct target_core_configfs_attribute *tc_attr = container_of( | ||
2286 | attr, struct target_core_configfs_attribute, attr); | ||
2287 | |||
2288 | if (!tc_attr->show) | ||
2289 | return -EINVAL; | ||
2290 | |||
2291 | return tc_attr->show(dev, page); | ||
2292 | } | ||
2293 | |||
2294 | static ssize_t target_core_dev_store(struct config_item *item, | ||
2295 | struct configfs_attribute *attr, | ||
2296 | const char *page, size_t count) | ||
2297 | { | ||
2298 | struct config_group *dev_cg = to_config_group(item); | ||
2299 | struct se_device *dev = | ||
2300 | container_of(dev_cg, struct se_device, dev_group); | ||
2301 | struct target_core_configfs_attribute *tc_attr = container_of( | ||
2302 | attr, struct target_core_configfs_attribute, attr); | ||
2303 | |||
2304 | if (!tc_attr->store) | ||
2305 | return -EINVAL; | ||
2306 | |||
2307 | return tc_attr->store(dev, page, count); | ||
2308 | } | ||
2309 | |||
2310 | static struct configfs_item_operations target_core_dev_item_ops = { | 2121 | static struct configfs_item_operations target_core_dev_item_ops = { |
2311 | .release = target_core_dev_release, | 2122 | .release = target_core_dev_release, |
2312 | .show_attribute = target_core_dev_show, | ||
2313 | .store_attribute = target_core_dev_store, | ||
2314 | }; | 2123 | }; |
2315 | 2124 | ||
2316 | TB_CIT_SETUP(dev, &target_core_dev_item_ops, NULL, target_core_dev_attrs); | 2125 | TB_CIT_SETUP(dev, &target_core_dev_item_ops, NULL, target_core_dev_attrs); |
@@ -2319,38 +2128,25 @@ TB_CIT_SETUP(dev, &target_core_dev_item_ops, NULL, target_core_dev_attrs); | |||
2319 | 2128 | ||
2320 | /* Start functions for struct config_item_type target_core_alua_lu_gp_cit */ | 2129 | /* Start functions for struct config_item_type target_core_alua_lu_gp_cit */ |
2321 | 2130 | ||
2322 | CONFIGFS_EATTR_STRUCT(target_core_alua_lu_gp, t10_alua_lu_gp); | 2131 | static inline struct t10_alua_lu_gp *to_lu_gp(struct config_item *item) |
2323 | #define SE_DEV_ALUA_LU_ATTR(_name, _mode) \ | 2132 | { |
2324 | static struct target_core_alua_lu_gp_attribute \ | 2133 | return container_of(to_config_group(item), struct t10_alua_lu_gp, |
2325 | target_core_alua_lu_gp_##_name = \ | 2134 | lu_gp_group); |
2326 | __CONFIGFS_EATTR(_name, _mode, \ | 2135 | } |
2327 | target_core_alua_lu_gp_show_attr_##_name, \ | ||
2328 | target_core_alua_lu_gp_store_attr_##_name); | ||
2329 | |||
2330 | #define SE_DEV_ALUA_LU_ATTR_RO(_name) \ | ||
2331 | static struct target_core_alua_lu_gp_attribute \ | ||
2332 | target_core_alua_lu_gp_##_name = \ | ||
2333 | __CONFIGFS_EATTR_RO(_name, \ | ||
2334 | target_core_alua_lu_gp_show_attr_##_name); | ||
2335 | 2136 | ||
2336 | /* | 2137 | static ssize_t target_lu_gp_lu_gp_id_show(struct config_item *item, char *page) |
2337 | * lu_gp_id | ||
2338 | */ | ||
2339 | static ssize_t target_core_alua_lu_gp_show_attr_lu_gp_id( | ||
2340 | struct t10_alua_lu_gp *lu_gp, | ||
2341 | char *page) | ||
2342 | { | 2138 | { |
2139 | struct t10_alua_lu_gp *lu_gp = to_lu_gp(item); | ||
2140 | |||
2343 | if (!lu_gp->lu_gp_valid_id) | 2141 | if (!lu_gp->lu_gp_valid_id) |
2344 | return 0; | 2142 | return 0; |
2345 | |||
2346 | return sprintf(page, "%hu\n", lu_gp->lu_gp_id); | 2143 | return sprintf(page, "%hu\n", lu_gp->lu_gp_id); |
2347 | } | 2144 | } |
2348 | 2145 | ||
2349 | static ssize_t target_core_alua_lu_gp_store_attr_lu_gp_id( | 2146 | static ssize_t target_lu_gp_lu_gp_id_store(struct config_item *item, |
2350 | struct t10_alua_lu_gp *lu_gp, | 2147 | const char *page, size_t count) |
2351 | const char *page, | ||
2352 | size_t count) | ||
2353 | { | 2148 | { |
2149 | struct t10_alua_lu_gp *lu_gp = to_lu_gp(item); | ||
2354 | struct config_group *alua_lu_gp_cg = &lu_gp->lu_gp_group; | 2150 | struct config_group *alua_lu_gp_cg = &lu_gp->lu_gp_group; |
2355 | unsigned long lu_gp_id; | 2151 | unsigned long lu_gp_id; |
2356 | int ret; | 2152 | int ret; |
@@ -2379,15 +2175,9 @@ static ssize_t target_core_alua_lu_gp_store_attr_lu_gp_id( | |||
2379 | return count; | 2175 | return count; |
2380 | } | 2176 | } |
2381 | 2177 | ||
2382 | SE_DEV_ALUA_LU_ATTR(lu_gp_id, S_IRUGO | S_IWUSR); | 2178 | static ssize_t target_lu_gp_members_show(struct config_item *item, char *page) |
2383 | |||
2384 | /* | ||
2385 | * members | ||
2386 | */ | ||
2387 | static ssize_t target_core_alua_lu_gp_show_attr_members( | ||
2388 | struct t10_alua_lu_gp *lu_gp, | ||
2389 | char *page) | ||
2390 | { | 2179 | { |
2180 | struct t10_alua_lu_gp *lu_gp = to_lu_gp(item); | ||
2391 | struct se_device *dev; | 2181 | struct se_device *dev; |
2392 | struct se_hba *hba; | 2182 | struct se_hba *hba; |
2393 | struct t10_alua_lu_gp_member *lu_gp_mem; | 2183 | struct t10_alua_lu_gp_member *lu_gp_mem; |
@@ -2419,13 +2209,12 @@ static ssize_t target_core_alua_lu_gp_show_attr_members( | |||
2419 | return len; | 2209 | return len; |
2420 | } | 2210 | } |
2421 | 2211 | ||
2422 | SE_DEV_ALUA_LU_ATTR_RO(members); | 2212 | CONFIGFS_ATTR(target_lu_gp_, lu_gp_id); |
2423 | 2213 | CONFIGFS_ATTR_RO(target_lu_gp_, members); | |
2424 | CONFIGFS_EATTR_OPS(target_core_alua_lu_gp, t10_alua_lu_gp, lu_gp_group); | ||
2425 | 2214 | ||
2426 | static struct configfs_attribute *target_core_alua_lu_gp_attrs[] = { | 2215 | static struct configfs_attribute *target_core_alua_lu_gp_attrs[] = { |
2427 | &target_core_alua_lu_gp_lu_gp_id.attr, | 2216 | &target_lu_gp_attr_lu_gp_id, |
2428 | &target_core_alua_lu_gp_members.attr, | 2217 | &target_lu_gp_attr_members, |
2429 | NULL, | 2218 | NULL, |
2430 | }; | 2219 | }; |
2431 | 2220 | ||
@@ -2439,8 +2228,6 @@ static void target_core_alua_lu_gp_release(struct config_item *item) | |||
2439 | 2228 | ||
2440 | static struct configfs_item_operations target_core_alua_lu_gp_ops = { | 2229 | static struct configfs_item_operations target_core_alua_lu_gp_ops = { |
2441 | .release = target_core_alua_lu_gp_release, | 2230 | .release = target_core_alua_lu_gp_release, |
2442 | .show_attribute = target_core_alua_lu_gp_attr_show, | ||
2443 | .store_attribute = target_core_alua_lu_gp_attr_store, | ||
2444 | }; | 2231 | }; |
2445 | 2232 | ||
2446 | static struct config_item_type target_core_alua_lu_gp_cit = { | 2233 | static struct config_item_type target_core_alua_lu_gp_cit = { |
@@ -2511,36 +2298,23 @@ static struct config_item_type target_core_alua_lu_gps_cit = { | |||
2511 | 2298 | ||
2512 | /* Start functions for struct config_item_type target_core_alua_tg_pt_gp_cit */ | 2299 | /* Start functions for struct config_item_type target_core_alua_tg_pt_gp_cit */ |
2513 | 2300 | ||
2514 | CONFIGFS_EATTR_STRUCT(target_core_alua_tg_pt_gp, t10_alua_tg_pt_gp); | 2301 | static inline struct t10_alua_tg_pt_gp *to_tg_pt_gp(struct config_item *item) |
2515 | #define SE_DEV_ALUA_TG_PT_ATTR(_name, _mode) \ | 2302 | { |
2516 | static struct target_core_alua_tg_pt_gp_attribute \ | 2303 | return container_of(to_config_group(item), struct t10_alua_tg_pt_gp, |
2517 | target_core_alua_tg_pt_gp_##_name = \ | 2304 | tg_pt_gp_group); |
2518 | __CONFIGFS_EATTR(_name, _mode, \ | 2305 | } |
2519 | target_core_alua_tg_pt_gp_show_attr_##_name, \ | ||
2520 | target_core_alua_tg_pt_gp_store_attr_##_name); | ||
2521 | |||
2522 | #define SE_DEV_ALUA_TG_PT_ATTR_RO(_name) \ | ||
2523 | static struct target_core_alua_tg_pt_gp_attribute \ | ||
2524 | target_core_alua_tg_pt_gp_##_name = \ | ||
2525 | __CONFIGFS_EATTR_RO(_name, \ | ||
2526 | target_core_alua_tg_pt_gp_show_attr_##_name); | ||
2527 | 2306 | ||
2528 | /* | 2307 | static ssize_t target_tg_pt_gp_alua_access_state_show(struct config_item *item, |
2529 | * alua_access_state | 2308 | char *page) |
2530 | */ | ||
2531 | static ssize_t target_core_alua_tg_pt_gp_show_attr_alua_access_state( | ||
2532 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2533 | char *page) | ||
2534 | { | 2309 | { |
2535 | return sprintf(page, "%d\n", | 2310 | return sprintf(page, "%d\n", |
2536 | atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state)); | 2311 | atomic_read(&to_tg_pt_gp(item)->tg_pt_gp_alua_access_state)); |
2537 | } | 2312 | } |
2538 | 2313 | ||
2539 | static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_access_state( | 2314 | static ssize_t target_tg_pt_gp_alua_access_state_store(struct config_item *item, |
2540 | struct t10_alua_tg_pt_gp *tg_pt_gp, | 2315 | const char *page, size_t count) |
2541 | const char *page, | ||
2542 | size_t count) | ||
2543 | { | 2316 | { |
2317 | struct t10_alua_tg_pt_gp *tg_pt_gp = to_tg_pt_gp(item); | ||
2544 | struct se_device *dev = tg_pt_gp->tg_pt_gp_dev; | 2318 | struct se_device *dev = tg_pt_gp->tg_pt_gp_dev; |
2545 | unsigned long tmp; | 2319 | unsigned long tmp; |
2546 | int new_state, ret; | 2320 | int new_state, ret; |
@@ -2582,24 +2356,18 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_access_state( | |||
2582 | return (!ret) ? count : -EINVAL; | 2356 | return (!ret) ? count : -EINVAL; |
2583 | } | 2357 | } |
2584 | 2358 | ||
2585 | SE_DEV_ALUA_TG_PT_ATTR(alua_access_state, S_IRUGO | S_IWUSR); | 2359 | static ssize_t target_tg_pt_gp_alua_access_status_show(struct config_item *item, |
2586 | 2360 | char *page) | |
2587 | /* | ||
2588 | * alua_access_status | ||
2589 | */ | ||
2590 | static ssize_t target_core_alua_tg_pt_gp_show_attr_alua_access_status( | ||
2591 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2592 | char *page) | ||
2593 | { | 2361 | { |
2362 | struct t10_alua_tg_pt_gp *tg_pt_gp = to_tg_pt_gp(item); | ||
2594 | return sprintf(page, "%s\n", | 2363 | return sprintf(page, "%s\n", |
2595 | core_alua_dump_status(tg_pt_gp->tg_pt_gp_alua_access_status)); | 2364 | core_alua_dump_status(tg_pt_gp->tg_pt_gp_alua_access_status)); |
2596 | } | 2365 | } |
2597 | 2366 | ||
2598 | static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_access_status( | 2367 | static ssize_t target_tg_pt_gp_alua_access_status_store( |
2599 | struct t10_alua_tg_pt_gp *tg_pt_gp, | 2368 | struct config_item *item, const char *page, size_t count) |
2600 | const char *page, | ||
2601 | size_t count) | ||
2602 | { | 2369 | { |
2370 | struct t10_alua_tg_pt_gp *tg_pt_gp = to_tg_pt_gp(item); | ||
2603 | unsigned long tmp; | 2371 | unsigned long tmp; |
2604 | int new_status, ret; | 2372 | int new_status, ret; |
2605 | 2373 | ||
@@ -2630,43 +2398,31 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_access_status( | |||
2630 | return count; | 2398 | return count; |
2631 | } | 2399 | } |
2632 | 2400 | ||
2633 | SE_DEV_ALUA_TG_PT_ATTR(alua_access_status, S_IRUGO | S_IWUSR); | 2401 | static ssize_t target_tg_pt_gp_alua_access_type_show(struct config_item *item, |
2634 | 2402 | char *page) | |
2635 | /* | ||
2636 | * alua_access_type | ||
2637 | */ | ||
2638 | static ssize_t target_core_alua_tg_pt_gp_show_attr_alua_access_type( | ||
2639 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2640 | char *page) | ||
2641 | { | 2403 | { |
2642 | return core_alua_show_access_type(tg_pt_gp, page); | 2404 | return core_alua_show_access_type(to_tg_pt_gp(item), page); |
2643 | } | 2405 | } |
2644 | 2406 | ||
2645 | static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_access_type( | 2407 | static ssize_t target_tg_pt_gp_alua_access_type_store(struct config_item *item, |
2646 | struct t10_alua_tg_pt_gp *tg_pt_gp, | 2408 | const char *page, size_t count) |
2647 | const char *page, | ||
2648 | size_t count) | ||
2649 | { | 2409 | { |
2650 | return core_alua_store_access_type(tg_pt_gp, page, count); | 2410 | return core_alua_store_access_type(to_tg_pt_gp(item), page, count); |
2651 | } | 2411 | } |
2652 | 2412 | ||
2653 | SE_DEV_ALUA_TG_PT_ATTR(alua_access_type, S_IRUGO | S_IWUSR); | 2413 | #define ALUA_SUPPORTED_STATE_ATTR(_name, _bit) \ |
2654 | 2414 | static ssize_t target_tg_pt_gp_alua_support_##_name##_show( \ | |
2655 | /* | 2415 | struct config_item *item, char *p) \ |
2656 | * alua_supported_states | ||
2657 | */ | ||
2658 | |||
2659 | #define SE_DEV_ALUA_SUPPORT_STATE_SHOW(_name, _var, _bit) \ | ||
2660 | static ssize_t target_core_alua_tg_pt_gp_show_attr_alua_support_##_name( \ | ||
2661 | struct t10_alua_tg_pt_gp *t, char *p) \ | ||
2662 | { \ | 2416 | { \ |
2663 | return sprintf(p, "%d\n", !!(t->_var & _bit)); \ | 2417 | struct t10_alua_tg_pt_gp *t = to_tg_pt_gp(item); \ |
2664 | } | 2418 | return sprintf(p, "%d\n", \ |
2665 | 2419 | !!(t->tg_pt_gp_alua_supported_states & _bit)); \ | |
2666 | #define SE_DEV_ALUA_SUPPORT_STATE_STORE(_name, _var, _bit) \ | 2420 | } \ |
2667 | static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_support_##_name(\ | 2421 | \ |
2668 | struct t10_alua_tg_pt_gp *t, const char *p, size_t c) \ | 2422 | static ssize_t target_tg_pt_gp_alua_support_##_name##_store( \ |
2423 | struct config_item *item, const char *p, size_t c) \ | ||
2669 | { \ | 2424 | { \ |
2425 | struct t10_alua_tg_pt_gp *t = to_tg_pt_gp(item); \ | ||
2670 | unsigned long tmp; \ | 2426 | unsigned long tmp; \ |
2671 | int ret; \ | 2427 | int ret; \ |
2672 | \ | 2428 | \ |
@@ -2687,70 +2443,32 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_support_##_name(\ | |||
2687 | return -EINVAL; \ | 2443 | return -EINVAL; \ |
2688 | } \ | 2444 | } \ |
2689 | if (tmp) \ | 2445 | if (tmp) \ |
2690 | t->_var |= _bit; \ | 2446 | t->tg_pt_gp_alua_supported_states |= _bit; \ |
2691 | else \ | 2447 | else \ |
2692 | t->_var &= ~_bit; \ | 2448 | t->tg_pt_gp_alua_supported_states &= ~_bit; \ |
2693 | \ | 2449 | \ |
2694 | return c; \ | 2450 | return c; \ |
2695 | } | 2451 | } |
2696 | 2452 | ||
2697 | SE_DEV_ALUA_SUPPORT_STATE_SHOW(transitioning, | 2453 | ALUA_SUPPORTED_STATE_ATTR(transitioning, ALUA_T_SUP); |
2698 | tg_pt_gp_alua_supported_states, ALUA_T_SUP); | 2454 | ALUA_SUPPORTED_STATE_ATTR(offline, ALUA_O_SUP); |
2699 | SE_DEV_ALUA_SUPPORT_STATE_STORE(transitioning, | 2455 | ALUA_SUPPORTED_STATE_ATTR(lba_dependent, ALUA_LBD_SUP); |
2700 | tg_pt_gp_alua_supported_states, ALUA_T_SUP); | 2456 | ALUA_SUPPORTED_STATE_ATTR(unavailable, ALUA_U_SUP); |
2701 | SE_DEV_ALUA_TG_PT_ATTR(alua_support_transitioning, S_IRUGO | S_IWUSR); | 2457 | ALUA_SUPPORTED_STATE_ATTR(standby, ALUA_S_SUP); |
2702 | 2458 | ALUA_SUPPORTED_STATE_ATTR(active_optimized, ALUA_AO_SUP); | |
2703 | SE_DEV_ALUA_SUPPORT_STATE_SHOW(offline, | 2459 | ALUA_SUPPORTED_STATE_ATTR(active_nonoptimized, ALUA_AN_SUP); |
2704 | tg_pt_gp_alua_supported_states, ALUA_O_SUP); | ||
2705 | SE_DEV_ALUA_SUPPORT_STATE_STORE(offline, | ||
2706 | tg_pt_gp_alua_supported_states, ALUA_O_SUP); | ||
2707 | SE_DEV_ALUA_TG_PT_ATTR(alua_support_offline, S_IRUGO | S_IWUSR); | ||
2708 | |||
2709 | SE_DEV_ALUA_SUPPORT_STATE_SHOW(lba_dependent, | ||
2710 | tg_pt_gp_alua_supported_states, ALUA_LBD_SUP); | ||
2711 | SE_DEV_ALUA_SUPPORT_STATE_STORE(lba_dependent, | ||
2712 | tg_pt_gp_alua_supported_states, ALUA_LBD_SUP); | ||
2713 | SE_DEV_ALUA_TG_PT_ATTR(alua_support_lba_dependent, S_IRUGO); | ||
2714 | |||
2715 | SE_DEV_ALUA_SUPPORT_STATE_SHOW(unavailable, | ||
2716 | tg_pt_gp_alua_supported_states, ALUA_U_SUP); | ||
2717 | SE_DEV_ALUA_SUPPORT_STATE_STORE(unavailable, | ||
2718 | tg_pt_gp_alua_supported_states, ALUA_U_SUP); | ||
2719 | SE_DEV_ALUA_TG_PT_ATTR(alua_support_unavailable, S_IRUGO | S_IWUSR); | ||
2720 | |||
2721 | SE_DEV_ALUA_SUPPORT_STATE_SHOW(standby, | ||
2722 | tg_pt_gp_alua_supported_states, ALUA_S_SUP); | ||
2723 | SE_DEV_ALUA_SUPPORT_STATE_STORE(standby, | ||
2724 | tg_pt_gp_alua_supported_states, ALUA_S_SUP); | ||
2725 | SE_DEV_ALUA_TG_PT_ATTR(alua_support_standby, S_IRUGO | S_IWUSR); | ||
2726 | |||
2727 | SE_DEV_ALUA_SUPPORT_STATE_SHOW(active_optimized, | ||
2728 | tg_pt_gp_alua_supported_states, ALUA_AO_SUP); | ||
2729 | SE_DEV_ALUA_SUPPORT_STATE_STORE(active_optimized, | ||
2730 | tg_pt_gp_alua_supported_states, ALUA_AO_SUP); | ||
2731 | SE_DEV_ALUA_TG_PT_ATTR(alua_support_active_optimized, S_IRUGO | S_IWUSR); | ||
2732 | |||
2733 | SE_DEV_ALUA_SUPPORT_STATE_SHOW(active_nonoptimized, | ||
2734 | tg_pt_gp_alua_supported_states, ALUA_AN_SUP); | ||
2735 | SE_DEV_ALUA_SUPPORT_STATE_STORE(active_nonoptimized, | ||
2736 | tg_pt_gp_alua_supported_states, ALUA_AN_SUP); | ||
2737 | SE_DEV_ALUA_TG_PT_ATTR(alua_support_active_nonoptimized, S_IRUGO | S_IWUSR); | ||
2738 | 2460 | ||
2739 | /* | 2461 | static ssize_t target_tg_pt_gp_alua_write_metadata_show( |
2740 | * alua_write_metadata | 2462 | struct config_item *item, char *page) |
2741 | */ | ||
2742 | static ssize_t target_core_alua_tg_pt_gp_show_attr_alua_write_metadata( | ||
2743 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2744 | char *page) | ||
2745 | { | 2463 | { |
2746 | return sprintf(page, "%d\n", tg_pt_gp->tg_pt_gp_write_metadata); | 2464 | return sprintf(page, "%d\n", |
2465 | to_tg_pt_gp(item)->tg_pt_gp_write_metadata); | ||
2747 | } | 2466 | } |
2748 | 2467 | ||
2749 | static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_write_metadata( | 2468 | static ssize_t target_tg_pt_gp_alua_write_metadata_store( |
2750 | struct t10_alua_tg_pt_gp *tg_pt_gp, | 2469 | struct config_item *item, const char *page, size_t count) |
2751 | const char *page, | ||
2752 | size_t count) | ||
2753 | { | 2470 | { |
2471 | struct t10_alua_tg_pt_gp *tg_pt_gp = to_tg_pt_gp(item); | ||
2754 | unsigned long tmp; | 2472 | unsigned long tmp; |
2755 | int ret; | 2473 | int ret; |
2756 | 2474 | ||
@@ -2770,110 +2488,71 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_write_metadata( | |||
2770 | return count; | 2488 | return count; |
2771 | } | 2489 | } |
2772 | 2490 | ||
2773 | SE_DEV_ALUA_TG_PT_ATTR(alua_write_metadata, S_IRUGO | S_IWUSR); | 2491 | static ssize_t target_tg_pt_gp_nonop_delay_msecs_show(struct config_item *item, |
2774 | 2492 | char *page) | |
2775 | |||
2776 | |||
2777 | /* | ||
2778 | * nonop_delay_msecs | ||
2779 | */ | ||
2780 | static ssize_t target_core_alua_tg_pt_gp_show_attr_nonop_delay_msecs( | ||
2781 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2782 | char *page) | ||
2783 | { | 2493 | { |
2784 | return core_alua_show_nonop_delay_msecs(tg_pt_gp, page); | 2494 | return core_alua_show_nonop_delay_msecs(to_tg_pt_gp(item), page); |
2785 | |||
2786 | } | 2495 | } |
2787 | 2496 | ||
2788 | static ssize_t target_core_alua_tg_pt_gp_store_attr_nonop_delay_msecs( | 2497 | static ssize_t target_tg_pt_gp_nonop_delay_msecs_store(struct config_item *item, |
2789 | struct t10_alua_tg_pt_gp *tg_pt_gp, | 2498 | const char *page, size_t count) |
2790 | const char *page, | ||
2791 | size_t count) | ||
2792 | { | 2499 | { |
2793 | return core_alua_store_nonop_delay_msecs(tg_pt_gp, page, count); | 2500 | return core_alua_store_nonop_delay_msecs(to_tg_pt_gp(item), page, |
2501 | count); | ||
2794 | } | 2502 | } |
2795 | 2503 | ||
2796 | SE_DEV_ALUA_TG_PT_ATTR(nonop_delay_msecs, S_IRUGO | S_IWUSR); | 2504 | static ssize_t target_tg_pt_gp_trans_delay_msecs_show(struct config_item *item, |
2797 | 2505 | char *page) | |
2798 | /* | ||
2799 | * trans_delay_msecs | ||
2800 | */ | ||
2801 | static ssize_t target_core_alua_tg_pt_gp_show_attr_trans_delay_msecs( | ||
2802 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2803 | char *page) | ||
2804 | { | 2506 | { |
2805 | return core_alua_show_trans_delay_msecs(tg_pt_gp, page); | 2507 | return core_alua_show_trans_delay_msecs(to_tg_pt_gp(item), page); |
2806 | } | 2508 | } |
2807 | 2509 | ||
2808 | static ssize_t target_core_alua_tg_pt_gp_store_attr_trans_delay_msecs( | 2510 | static ssize_t target_tg_pt_gp_trans_delay_msecs_store(struct config_item *item, |
2809 | struct t10_alua_tg_pt_gp *tg_pt_gp, | 2511 | const char *page, size_t count) |
2810 | const char *page, | ||
2811 | size_t count) | ||
2812 | { | 2512 | { |
2813 | return core_alua_store_trans_delay_msecs(tg_pt_gp, page, count); | 2513 | return core_alua_store_trans_delay_msecs(to_tg_pt_gp(item), page, |
2514 | count); | ||
2814 | } | 2515 | } |
2815 | 2516 | ||
2816 | SE_DEV_ALUA_TG_PT_ATTR(trans_delay_msecs, S_IRUGO | S_IWUSR); | 2517 | static ssize_t target_tg_pt_gp_implicit_trans_secs_show( |
2817 | 2518 | struct config_item *item, char *page) | |
2818 | /* | ||
2819 | * implicit_trans_secs | ||
2820 | */ | ||
2821 | static ssize_t target_core_alua_tg_pt_gp_show_attr_implicit_trans_secs( | ||
2822 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2823 | char *page) | ||
2824 | { | 2519 | { |
2825 | return core_alua_show_implicit_trans_secs(tg_pt_gp, page); | 2520 | return core_alua_show_implicit_trans_secs(to_tg_pt_gp(item), page); |
2826 | } | 2521 | } |
2827 | 2522 | ||
2828 | static ssize_t target_core_alua_tg_pt_gp_store_attr_implicit_trans_secs( | 2523 | static ssize_t target_tg_pt_gp_implicit_trans_secs_store( |
2829 | struct t10_alua_tg_pt_gp *tg_pt_gp, | 2524 | struct config_item *item, const char *page, size_t count) |
2830 | const char *page, | ||
2831 | size_t count) | ||
2832 | { | 2525 | { |
2833 | return core_alua_store_implicit_trans_secs(tg_pt_gp, page, count); | 2526 | return core_alua_store_implicit_trans_secs(to_tg_pt_gp(item), page, |
2527 | count); | ||
2834 | } | 2528 | } |
2835 | 2529 | ||
2836 | SE_DEV_ALUA_TG_PT_ATTR(implicit_trans_secs, S_IRUGO | S_IWUSR); | 2530 | static ssize_t target_tg_pt_gp_preferred_show(struct config_item *item, |
2837 | 2531 | char *page) | |
2838 | /* | ||
2839 | * preferred | ||
2840 | */ | ||
2841 | |||
2842 | static ssize_t target_core_alua_tg_pt_gp_show_attr_preferred( | ||
2843 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2844 | char *page) | ||
2845 | { | 2532 | { |
2846 | return core_alua_show_preferred_bit(tg_pt_gp, page); | 2533 | return core_alua_show_preferred_bit(to_tg_pt_gp(item), page); |
2847 | } | 2534 | } |
2848 | 2535 | ||
2849 | static ssize_t target_core_alua_tg_pt_gp_store_attr_preferred( | 2536 | static ssize_t target_tg_pt_gp_preferred_store(struct config_item *item, |
2850 | struct t10_alua_tg_pt_gp *tg_pt_gp, | 2537 | const char *page, size_t count) |
2851 | const char *page, | ||
2852 | size_t count) | ||
2853 | { | 2538 | { |
2854 | return core_alua_store_preferred_bit(tg_pt_gp, page, count); | 2539 | return core_alua_store_preferred_bit(to_tg_pt_gp(item), page, count); |
2855 | } | 2540 | } |
2856 | 2541 | ||
2857 | SE_DEV_ALUA_TG_PT_ATTR(preferred, S_IRUGO | S_IWUSR); | 2542 | static ssize_t target_tg_pt_gp_tg_pt_gp_id_show(struct config_item *item, |
2858 | 2543 | char *page) | |
2859 | /* | ||
2860 | * tg_pt_gp_id | ||
2861 | */ | ||
2862 | static ssize_t target_core_alua_tg_pt_gp_show_attr_tg_pt_gp_id( | ||
2863 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2864 | char *page) | ||
2865 | { | 2544 | { |
2545 | struct t10_alua_tg_pt_gp *tg_pt_gp = to_tg_pt_gp(item); | ||
2546 | |||
2866 | if (!tg_pt_gp->tg_pt_gp_valid_id) | 2547 | if (!tg_pt_gp->tg_pt_gp_valid_id) |
2867 | return 0; | 2548 | return 0; |
2868 | |||
2869 | return sprintf(page, "%hu\n", tg_pt_gp->tg_pt_gp_id); | 2549 | return sprintf(page, "%hu\n", tg_pt_gp->tg_pt_gp_id); |
2870 | } | 2550 | } |
2871 | 2551 | ||
2872 | static ssize_t target_core_alua_tg_pt_gp_store_attr_tg_pt_gp_id( | 2552 | static ssize_t target_tg_pt_gp_tg_pt_gp_id_store(struct config_item *item, |
2873 | struct t10_alua_tg_pt_gp *tg_pt_gp, | 2553 | const char *page, size_t count) |
2874 | const char *page, | ||
2875 | size_t count) | ||
2876 | { | 2554 | { |
2555 | struct t10_alua_tg_pt_gp *tg_pt_gp = to_tg_pt_gp(item); | ||
2877 | struct config_group *alua_tg_pt_gp_cg = &tg_pt_gp->tg_pt_gp_group; | 2556 | struct config_group *alua_tg_pt_gp_cg = &tg_pt_gp->tg_pt_gp_group; |
2878 | unsigned long tg_pt_gp_id; | 2557 | unsigned long tg_pt_gp_id; |
2879 | int ret; | 2558 | int ret; |
@@ -2902,15 +2581,10 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_tg_pt_gp_id( | |||
2902 | return count; | 2581 | return count; |
2903 | } | 2582 | } |
2904 | 2583 | ||
2905 | SE_DEV_ALUA_TG_PT_ATTR(tg_pt_gp_id, S_IRUGO | S_IWUSR); | 2584 | static ssize_t target_tg_pt_gp_members_show(struct config_item *item, |
2906 | 2585 | char *page) | |
2907 | /* | ||
2908 | * members | ||
2909 | */ | ||
2910 | static ssize_t target_core_alua_tg_pt_gp_show_attr_members( | ||
2911 | struct t10_alua_tg_pt_gp *tg_pt_gp, | ||
2912 | char *page) | ||
2913 | { | 2586 | { |
2587 | struct t10_alua_tg_pt_gp *tg_pt_gp = to_tg_pt_gp(item); | ||
2914 | struct se_lun *lun; | 2588 | struct se_lun *lun; |
2915 | ssize_t len = 0, cur_len; | 2589 | ssize_t len = 0, cur_len; |
2916 | unsigned char buf[TG_PT_GROUP_NAME_BUF]; | 2590 | unsigned char buf[TG_PT_GROUP_NAME_BUF]; |
@@ -2942,29 +2616,42 @@ static ssize_t target_core_alua_tg_pt_gp_show_attr_members( | |||
2942 | return len; | 2616 | return len; |
2943 | } | 2617 | } |
2944 | 2618 | ||
2945 | SE_DEV_ALUA_TG_PT_ATTR_RO(members); | 2619 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_access_state); |
2946 | 2620 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_access_status); | |
2947 | CONFIGFS_EATTR_OPS(target_core_alua_tg_pt_gp, t10_alua_tg_pt_gp, | 2621 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_access_type); |
2948 | tg_pt_gp_group); | 2622 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_support_transitioning); |
2623 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_support_offline); | ||
2624 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_support_lba_dependent); | ||
2625 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_support_unavailable); | ||
2626 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_support_standby); | ||
2627 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_support_active_optimized); | ||
2628 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_support_active_nonoptimized); | ||
2629 | CONFIGFS_ATTR(target_tg_pt_gp_, alua_write_metadata); | ||
2630 | CONFIGFS_ATTR(target_tg_pt_gp_, nonop_delay_msecs); | ||
2631 | CONFIGFS_ATTR(target_tg_pt_gp_, trans_delay_msecs); | ||
2632 | CONFIGFS_ATTR(target_tg_pt_gp_, implicit_trans_secs); | ||
2633 | CONFIGFS_ATTR(target_tg_pt_gp_, preferred); | ||
2634 | CONFIGFS_ATTR(target_tg_pt_gp_, tg_pt_gp_id); | ||
2635 | CONFIGFS_ATTR_RO(target_tg_pt_gp_, members); | ||
2949 | 2636 | ||
2950 | static struct configfs_attribute *target_core_alua_tg_pt_gp_attrs[] = { | 2637 | static struct configfs_attribute *target_core_alua_tg_pt_gp_attrs[] = { |
2951 | &target_core_alua_tg_pt_gp_alua_access_state.attr, | 2638 | &target_tg_pt_gp_attr_alua_access_state, |
2952 | &target_core_alua_tg_pt_gp_alua_access_status.attr, | 2639 | &target_tg_pt_gp_attr_alua_access_status, |
2953 | &target_core_alua_tg_pt_gp_alua_access_type.attr, | 2640 | &target_tg_pt_gp_attr_alua_access_type, |
2954 | &target_core_alua_tg_pt_gp_alua_support_transitioning.attr, | 2641 | &target_tg_pt_gp_attr_alua_support_transitioning, |
2955 | &target_core_alua_tg_pt_gp_alua_support_offline.attr, | 2642 | &target_tg_pt_gp_attr_alua_support_offline, |
2956 | &target_core_alua_tg_pt_gp_alua_support_lba_dependent.attr, | 2643 | &target_tg_pt_gp_attr_alua_support_lba_dependent, |
2957 | &target_core_alua_tg_pt_gp_alua_support_unavailable.attr, | 2644 | &target_tg_pt_gp_attr_alua_support_unavailable, |
2958 | &target_core_alua_tg_pt_gp_alua_support_standby.attr, | 2645 | &target_tg_pt_gp_attr_alua_support_standby, |
2959 | &target_core_alua_tg_pt_gp_alua_support_active_nonoptimized.attr, | 2646 | &target_tg_pt_gp_attr_alua_support_active_nonoptimized, |
2960 | &target_core_alua_tg_pt_gp_alua_support_active_optimized.attr, | 2647 | &target_tg_pt_gp_attr_alua_support_active_optimized, |
2961 | &target_core_alua_tg_pt_gp_alua_write_metadata.attr, | 2648 | &target_tg_pt_gp_attr_alua_write_metadata, |
2962 | &target_core_alua_tg_pt_gp_nonop_delay_msecs.attr, | 2649 | &target_tg_pt_gp_attr_nonop_delay_msecs, |
2963 | &target_core_alua_tg_pt_gp_trans_delay_msecs.attr, | 2650 | &target_tg_pt_gp_attr_trans_delay_msecs, |
2964 | &target_core_alua_tg_pt_gp_implicit_trans_secs.attr, | 2651 | &target_tg_pt_gp_attr_implicit_trans_secs, |
2965 | &target_core_alua_tg_pt_gp_preferred.attr, | 2652 | &target_tg_pt_gp_attr_preferred, |
2966 | &target_core_alua_tg_pt_gp_tg_pt_gp_id.attr, | 2653 | &target_tg_pt_gp_attr_tg_pt_gp_id, |
2967 | &target_core_alua_tg_pt_gp_members.attr, | 2654 | &target_tg_pt_gp_attr_members, |
2968 | NULL, | 2655 | NULL, |
2969 | }; | 2656 | }; |
2970 | 2657 | ||
@@ -2978,8 +2665,6 @@ static void target_core_alua_tg_pt_gp_release(struct config_item *item) | |||
2978 | 2665 | ||
2979 | static struct configfs_item_operations target_core_alua_tg_pt_gp_ops = { | 2666 | static struct configfs_item_operations target_core_alua_tg_pt_gp_ops = { |
2980 | .release = target_core_alua_tg_pt_gp_release, | 2667 | .release = target_core_alua_tg_pt_gp_release, |
2981 | .show_attribute = target_core_alua_tg_pt_gp_attr_show, | ||
2982 | .store_attribute = target_core_alua_tg_pt_gp_attr_store, | ||
2983 | }; | 2668 | }; |
2984 | 2669 | ||
2985 | static struct config_item_type target_core_alua_tg_pt_gp_cit = { | 2670 | static struct config_item_type target_core_alua_tg_pt_gp_cit = { |
@@ -3237,34 +2922,24 @@ static struct configfs_group_operations target_core_hba_group_ops = { | |||
3237 | .drop_item = target_core_drop_subdev, | 2922 | .drop_item = target_core_drop_subdev, |
3238 | }; | 2923 | }; |
3239 | 2924 | ||
3240 | CONFIGFS_EATTR_STRUCT(target_core_hba, se_hba); | ||
3241 | #define SE_HBA_ATTR(_name, _mode) \ | ||
3242 | static struct target_core_hba_attribute \ | ||
3243 | target_core_hba_##_name = \ | ||
3244 | __CONFIGFS_EATTR(_name, _mode, \ | ||
3245 | target_core_hba_show_attr_##_name, \ | ||
3246 | target_core_hba_store_attr_##_name); | ||
3247 | 2925 | ||
3248 | #define SE_HBA_ATTR_RO(_name) \ | 2926 | static inline struct se_hba *to_hba(struct config_item *item) |
3249 | static struct target_core_hba_attribute \ | 2927 | { |
3250 | target_core_hba_##_name = \ | 2928 | return container_of(to_config_group(item), struct se_hba, hba_group); |
3251 | __CONFIGFS_EATTR_RO(_name, \ | 2929 | } |
3252 | target_core_hba_show_attr_##_name); | ||
3253 | 2930 | ||
3254 | static ssize_t target_core_hba_show_attr_hba_info( | 2931 | static ssize_t target_hba_info_show(struct config_item *item, char *page) |
3255 | struct se_hba *hba, | ||
3256 | char *page) | ||
3257 | { | 2932 | { |
2933 | struct se_hba *hba = to_hba(item); | ||
2934 | |||
3258 | return sprintf(page, "HBA Index: %d plugin: %s version: %s\n", | 2935 | return sprintf(page, "HBA Index: %d plugin: %s version: %s\n", |
3259 | hba->hba_id, hba->backend->ops->name, | 2936 | hba->hba_id, hba->backend->ops->name, |
3260 | TARGET_CORE_VERSION); | 2937 | TARGET_CORE_VERSION); |
3261 | } | 2938 | } |
3262 | 2939 | ||
3263 | SE_HBA_ATTR_RO(hba_info); | 2940 | static ssize_t target_hba_mode_show(struct config_item *item, char *page) |
3264 | |||
3265 | static ssize_t target_core_hba_show_attr_hba_mode(struct se_hba *hba, | ||
3266 | char *page) | ||
3267 | { | 2941 | { |
2942 | struct se_hba *hba = to_hba(item); | ||
3268 | int hba_mode = 0; | 2943 | int hba_mode = 0; |
3269 | 2944 | ||
3270 | if (hba->hba_flags & HBA_FLAGS_PSCSI_MODE) | 2945 | if (hba->hba_flags & HBA_FLAGS_PSCSI_MODE) |
@@ -3273,9 +2948,10 @@ static ssize_t target_core_hba_show_attr_hba_mode(struct se_hba *hba, | |||
3273 | return sprintf(page, "%d\n", hba_mode); | 2948 | return sprintf(page, "%d\n", hba_mode); |
3274 | } | 2949 | } |
3275 | 2950 | ||
3276 | static ssize_t target_core_hba_store_attr_hba_mode(struct se_hba *hba, | 2951 | static ssize_t target_hba_mode_store(struct config_item *item, |
3277 | const char *page, size_t count) | 2952 | const char *page, size_t count) |
3278 | { | 2953 | { |
2954 | struct se_hba *hba = to_hba(item); | ||
3279 | unsigned long mode_flag; | 2955 | unsigned long mode_flag; |
3280 | int ret; | 2956 | int ret; |
3281 | 2957 | ||
@@ -3304,9 +2980,8 @@ static ssize_t target_core_hba_store_attr_hba_mode(struct se_hba *hba, | |||
3304 | return count; | 2980 | return count; |
3305 | } | 2981 | } |
3306 | 2982 | ||
3307 | SE_HBA_ATTR(hba_mode, S_IRUGO | S_IWUSR); | 2983 | CONFIGFS_ATTR_RO(target_, hba_info); |
3308 | 2984 | CONFIGFS_ATTR(target_, hba_mode); | |
3309 | CONFIGFS_EATTR_OPS(target_core_hba, se_hba, hba_group); | ||
3310 | 2985 | ||
3311 | static void target_core_hba_release(struct config_item *item) | 2986 | static void target_core_hba_release(struct config_item *item) |
3312 | { | 2987 | { |
@@ -3316,15 +2991,13 @@ static void target_core_hba_release(struct config_item *item) | |||
3316 | } | 2991 | } |
3317 | 2992 | ||
3318 | static struct configfs_attribute *target_core_hba_attrs[] = { | 2993 | static struct configfs_attribute *target_core_hba_attrs[] = { |
3319 | &target_core_hba_hba_info.attr, | 2994 | &target_attr_hba_info, |
3320 | &target_core_hba_hba_mode.attr, | 2995 | &target_attr_hba_mode, |
3321 | NULL, | 2996 | NULL, |
3322 | }; | 2997 | }; |
3323 | 2998 | ||
3324 | static struct configfs_item_operations target_core_hba_item_ops = { | 2999 | static struct configfs_item_operations target_core_hba_item_ops = { |
3325 | .release = target_core_hba_release, | 3000 | .release = target_core_hba_release, |
3326 | .show_attribute = target_core_hba_attr_show, | ||
3327 | .store_attribute = target_core_hba_attr_store, | ||
3328 | }; | 3001 | }; |
3329 | 3002 | ||
3330 | static struct config_item_type target_core_hba_cit = { | 3003 | static struct config_item_type target_core_hba_cit = { |
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index be42429468e2..f916d18ccb48 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
@@ -35,8 +35,6 @@ | |||
35 | 35 | ||
36 | #include <target/target_core_base.h> | 36 | #include <target/target_core_base.h> |
37 | #include <target/target_core_fabric.h> | 37 | #include <target/target_core_fabric.h> |
38 | #include <target/target_core_fabric_configfs.h> | ||
39 | #include <target/configfs_macros.h> | ||
40 | 38 | ||
41 | #include "target_core_internal.h" | 39 | #include "target_core_internal.h" |
42 | #include "target_core_alua.h" | 40 | #include "target_core_alua.h" |
@@ -152,17 +150,16 @@ static int target_fabric_mappedlun_unlink( | |||
152 | return core_dev_del_initiator_node_lun_acl(lun, lacl); | 150 | return core_dev_del_initiator_node_lun_acl(lun, lacl); |
153 | } | 151 | } |
154 | 152 | ||
155 | CONFIGFS_EATTR_STRUCT(target_fabric_mappedlun, se_lun_acl); | 153 | static struct se_lun_acl *item_to_lun_acl(struct config_item *item) |
156 | #define TCM_MAPPEDLUN_ATTR(_name, _mode) \ | 154 | { |
157 | static struct target_fabric_mappedlun_attribute target_fabric_mappedlun_##_name = \ | 155 | return container_of(to_config_group(item), struct se_lun_acl, |
158 | __CONFIGFS_EATTR(_name, _mode, \ | 156 | se_lun_group); |
159 | target_fabric_mappedlun_show_##_name, \ | 157 | } |
160 | target_fabric_mappedlun_store_##_name); | ||
161 | 158 | ||
162 | static ssize_t target_fabric_mappedlun_show_write_protect( | 159 | static ssize_t target_fabric_mappedlun_write_protect_show( |
163 | struct se_lun_acl *lacl, | 160 | struct config_item *item, char *page) |
164 | char *page) | ||
165 | { | 161 | { |
162 | struct se_lun_acl *lacl = item_to_lun_acl(item); | ||
166 | struct se_node_acl *se_nacl = lacl->se_lun_nacl; | 163 | struct se_node_acl *se_nacl = lacl->se_lun_nacl; |
167 | struct se_dev_entry *deve; | 164 | struct se_dev_entry *deve; |
168 | ssize_t len = 0; | 165 | ssize_t len = 0; |
@@ -178,11 +175,10 @@ static ssize_t target_fabric_mappedlun_show_write_protect( | |||
178 | return len; | 175 | return len; |
179 | } | 176 | } |
180 | 177 | ||
181 | static ssize_t target_fabric_mappedlun_store_write_protect( | 178 | static ssize_t target_fabric_mappedlun_write_protect_store( |
182 | struct se_lun_acl *lacl, | 179 | struct config_item *item, const char *page, size_t count) |
183 | const char *page, | ||
184 | size_t count) | ||
185 | { | 180 | { |
181 | struct se_lun_acl *lacl = item_to_lun_acl(item); | ||
186 | struct se_node_acl *se_nacl = lacl->se_lun_nacl; | 182 | struct se_node_acl *se_nacl = lacl->se_lun_nacl; |
187 | struct se_portal_group *se_tpg = se_nacl->se_tpg; | 183 | struct se_portal_group *se_tpg = se_nacl->se_tpg; |
188 | unsigned long op; | 184 | unsigned long op; |
@@ -209,9 +205,12 @@ static ssize_t target_fabric_mappedlun_store_write_protect( | |||
209 | 205 | ||
210 | } | 206 | } |
211 | 207 | ||
212 | TCM_MAPPEDLUN_ATTR(write_protect, S_IRUGO | S_IWUSR); | 208 | CONFIGFS_ATTR(target_fabric_mappedlun_, write_protect); |
213 | 209 | ||
214 | CONFIGFS_EATTR_OPS(target_fabric_mappedlun, se_lun_acl, se_lun_group); | 210 | static struct configfs_attribute *target_fabric_mappedlun_attrs[] = { |
211 | &target_fabric_mappedlun_attr_write_protect, | ||
212 | NULL, | ||
213 | }; | ||
215 | 214 | ||
216 | static void target_fabric_mappedlun_release(struct config_item *item) | 215 | static void target_fabric_mappedlun_release(struct config_item *item) |
217 | { | 216 | { |
@@ -222,15 +221,8 @@ static void target_fabric_mappedlun_release(struct config_item *item) | |||
222 | core_dev_free_initiator_node_lun_acl(se_tpg, lacl); | 221 | core_dev_free_initiator_node_lun_acl(se_tpg, lacl); |
223 | } | 222 | } |
224 | 223 | ||
225 | static struct configfs_attribute *target_fabric_mappedlun_attrs[] = { | ||
226 | &target_fabric_mappedlun_write_protect.attr, | ||
227 | NULL, | ||
228 | }; | ||
229 | |||
230 | static struct configfs_item_operations target_fabric_mappedlun_item_ops = { | 224 | static struct configfs_item_operations target_fabric_mappedlun_item_ops = { |
231 | .release = target_fabric_mappedlun_release, | 225 | .release = target_fabric_mappedlun_release, |
232 | .show_attribute = target_fabric_mappedlun_attr_show, | ||
233 | .store_attribute = target_fabric_mappedlun_attr_store, | ||
234 | .allow_link = target_fabric_mappedlun_link, | 226 | .allow_link = target_fabric_mappedlun_link, |
235 | .drop_link = target_fabric_mappedlun_unlink, | 227 | .drop_link = target_fabric_mappedlun_unlink, |
236 | }; | 228 | }; |
@@ -266,49 +258,12 @@ TF_CIT_SETUP(tpg_mappedlun_stat, NULL, &target_fabric_mappedlun_stat_group_ops, | |||
266 | 258 | ||
267 | /* End of tfc_tpg_mappedlun_port_cit */ | 259 | /* End of tfc_tpg_mappedlun_port_cit */ |
268 | 260 | ||
269 | /* Start of tfc_tpg_nacl_attrib_cit */ | 261 | TF_CIT_SETUP_DRV(tpg_nacl_attrib, NULL, NULL); |
270 | 262 | TF_CIT_SETUP_DRV(tpg_nacl_auth, NULL, NULL); | |
271 | CONFIGFS_EATTR_OPS(target_fabric_nacl_attrib, se_node_acl, acl_attrib_group); | 263 | TF_CIT_SETUP_DRV(tpg_nacl_param, NULL, NULL); |
272 | |||
273 | static struct configfs_item_operations target_fabric_nacl_attrib_item_ops = { | ||
274 | .show_attribute = target_fabric_nacl_attrib_attr_show, | ||
275 | .store_attribute = target_fabric_nacl_attrib_attr_store, | ||
276 | }; | ||
277 | |||
278 | TF_CIT_SETUP_DRV(tpg_nacl_attrib, &target_fabric_nacl_attrib_item_ops, NULL); | ||
279 | |||
280 | /* End of tfc_tpg_nacl_attrib_cit */ | ||
281 | |||
282 | /* Start of tfc_tpg_nacl_auth_cit */ | ||
283 | |||
284 | CONFIGFS_EATTR_OPS(target_fabric_nacl_auth, se_node_acl, acl_auth_group); | ||
285 | |||
286 | static struct configfs_item_operations target_fabric_nacl_auth_item_ops = { | ||
287 | .show_attribute = target_fabric_nacl_auth_attr_show, | ||
288 | .store_attribute = target_fabric_nacl_auth_attr_store, | ||
289 | }; | ||
290 | |||
291 | TF_CIT_SETUP_DRV(tpg_nacl_auth, &target_fabric_nacl_auth_item_ops, NULL); | ||
292 | |||
293 | /* End of tfc_tpg_nacl_auth_cit */ | ||
294 | |||
295 | /* Start of tfc_tpg_nacl_param_cit */ | ||
296 | |||
297 | CONFIGFS_EATTR_OPS(target_fabric_nacl_param, se_node_acl, acl_param_group); | ||
298 | |||
299 | static struct configfs_item_operations target_fabric_nacl_param_item_ops = { | ||
300 | .show_attribute = target_fabric_nacl_param_attr_show, | ||
301 | .store_attribute = target_fabric_nacl_param_attr_store, | ||
302 | }; | ||
303 | |||
304 | TF_CIT_SETUP_DRV(tpg_nacl_param, &target_fabric_nacl_param_item_ops, NULL); | ||
305 | |||
306 | /* End of tfc_tpg_nacl_param_cit */ | ||
307 | 264 | ||
308 | /* Start of tfc_tpg_nacl_base_cit */ | 265 | /* Start of tfc_tpg_nacl_base_cit */ |
309 | 266 | ||
310 | CONFIGFS_EATTR_OPS(target_fabric_nacl_base, se_node_acl, acl_group); | ||
311 | |||
312 | static struct config_group *target_fabric_make_mappedlun( | 267 | static struct config_group *target_fabric_make_mappedlun( |
313 | struct config_group *group, | 268 | struct config_group *group, |
314 | const char *name) | 269 | const char *name) |
@@ -438,8 +393,6 @@ static void target_fabric_nacl_base_release(struct config_item *item) | |||
438 | 393 | ||
439 | static struct configfs_item_operations target_fabric_nacl_base_item_ops = { | 394 | static struct configfs_item_operations target_fabric_nacl_base_item_ops = { |
440 | .release = target_fabric_nacl_base_release, | 395 | .release = target_fabric_nacl_base_release, |
441 | .show_attribute = target_fabric_nacl_base_attr_show, | ||
442 | .store_attribute = target_fabric_nacl_base_attr_store, | ||
443 | }; | 396 | }; |
444 | 397 | ||
445 | static struct configfs_group_operations target_fabric_nacl_base_group_ops = { | 398 | static struct configfs_group_operations target_fabric_nacl_base_group_ops = { |
@@ -540,8 +493,6 @@ TF_CIT_SETUP(tpg_nacl, NULL, &target_fabric_nacl_group_ops, NULL); | |||
540 | 493 | ||
541 | /* Start of tfc_tpg_np_base_cit */ | 494 | /* Start of tfc_tpg_np_base_cit */ |
542 | 495 | ||
543 | CONFIGFS_EATTR_OPS(target_fabric_np_base, se_tpg_np, tpg_np_group); | ||
544 | |||
545 | static void target_fabric_np_base_release(struct config_item *item) | 496 | static void target_fabric_np_base_release(struct config_item *item) |
546 | { | 497 | { |
547 | struct se_tpg_np *se_tpg_np = container_of(to_config_group(item), | 498 | struct se_tpg_np *se_tpg_np = container_of(to_config_group(item), |
@@ -554,8 +505,6 @@ static void target_fabric_np_base_release(struct config_item *item) | |||
554 | 505 | ||
555 | static struct configfs_item_operations target_fabric_np_base_item_ops = { | 506 | static struct configfs_item_operations target_fabric_np_base_item_ops = { |
556 | .release = target_fabric_np_base_release, | 507 | .release = target_fabric_np_base_release, |
557 | .show_attribute = target_fabric_np_base_attr_show, | ||
558 | .store_attribute = target_fabric_np_base_attr_store, | ||
559 | }; | 508 | }; |
560 | 509 | ||
561 | TF_CIT_SETUP_DRV(tpg_np_base, &target_fabric_np_base_item_ops, NULL); | 510 | TF_CIT_SETUP_DRV(tpg_np_base, &target_fabric_np_base_item_ops, NULL); |
@@ -610,132 +559,113 @@ TF_CIT_SETUP(tpg_np, NULL, &target_fabric_np_group_ops, NULL); | |||
610 | 559 | ||
611 | /* Start of tfc_tpg_port_cit */ | 560 | /* Start of tfc_tpg_port_cit */ |
612 | 561 | ||
613 | CONFIGFS_EATTR_STRUCT(target_fabric_port, se_lun); | 562 | static struct se_lun *item_to_lun(struct config_item *item) |
614 | #define TCM_PORT_ATTR(_name, _mode) \ | 563 | { |
615 | static struct target_fabric_port_attribute target_fabric_port_##_name = \ | 564 | return container_of(to_config_group(item), struct se_lun, |
616 | __CONFIGFS_EATTR(_name, _mode, \ | 565 | lun_group); |
617 | target_fabric_port_show_attr_##_name, \ | 566 | } |
618 | target_fabric_port_store_attr_##_name); | ||
619 | |||
620 | #define TCM_PORT_ATTOR_RO(_name) \ | ||
621 | __CONFIGFS_EATTR_RO(_name, \ | ||
622 | target_fabric_port_show_attr_##_name); | ||
623 | 567 | ||
624 | /* | 568 | static ssize_t target_fabric_port_alua_tg_pt_gp_show(struct config_item *item, |
625 | * alua_tg_pt_gp | 569 | char *page) |
626 | */ | ||
627 | static ssize_t target_fabric_port_show_attr_alua_tg_pt_gp( | ||
628 | struct se_lun *lun, | ||
629 | char *page) | ||
630 | { | 570 | { |
571 | struct se_lun *lun = item_to_lun(item); | ||
572 | |||
631 | if (!lun || !lun->lun_se_dev) | 573 | if (!lun || !lun->lun_se_dev) |
632 | return -ENODEV; | 574 | return -ENODEV; |
633 | 575 | ||
634 | return core_alua_show_tg_pt_gp_info(lun, page); | 576 | return core_alua_show_tg_pt_gp_info(lun, page); |
635 | } | 577 | } |
636 | 578 | ||
637 | static ssize_t target_fabric_port_store_attr_alua_tg_pt_gp( | 579 | static ssize_t target_fabric_port_alua_tg_pt_gp_store(struct config_item *item, |
638 | struct se_lun *lun, | 580 | const char *page, size_t count) |
639 | const char *page, | ||
640 | size_t count) | ||
641 | { | 581 | { |
582 | struct se_lun *lun = item_to_lun(item); | ||
583 | |||
642 | if (!lun || !lun->lun_se_dev) | 584 | if (!lun || !lun->lun_se_dev) |
643 | return -ENODEV; | 585 | return -ENODEV; |
644 | 586 | ||
645 | return core_alua_store_tg_pt_gp_info(lun, page, count); | 587 | return core_alua_store_tg_pt_gp_info(lun, page, count); |
646 | } | 588 | } |
647 | 589 | ||
648 | TCM_PORT_ATTR(alua_tg_pt_gp, S_IRUGO | S_IWUSR); | 590 | static ssize_t target_fabric_port_alua_tg_pt_offline_show( |
649 | 591 | struct config_item *item, char *page) | |
650 | /* | ||
651 | * alua_tg_pt_offline | ||
652 | */ | ||
653 | static ssize_t target_fabric_port_show_attr_alua_tg_pt_offline( | ||
654 | struct se_lun *lun, | ||
655 | char *page) | ||
656 | { | 592 | { |
593 | struct se_lun *lun = item_to_lun(item); | ||
594 | |||
657 | if (!lun || !lun->lun_se_dev) | 595 | if (!lun || !lun->lun_se_dev) |
658 | return -ENODEV; | 596 | return -ENODEV; |
659 | 597 | ||
660 | return core_alua_show_offline_bit(lun, page); | 598 | return core_alua_show_offline_bit(lun, page); |
661 | } | 599 | } |
662 | 600 | ||
663 | static ssize_t target_fabric_port_store_attr_alua_tg_pt_offline( | 601 | static ssize_t target_fabric_port_alua_tg_pt_offline_store( |
664 | struct se_lun *lun, | 602 | struct config_item *item, const char *page, size_t count) |
665 | const char *page, | ||
666 | size_t count) | ||
667 | { | 603 | { |
604 | struct se_lun *lun = item_to_lun(item); | ||
605 | |||
668 | if (!lun || !lun->lun_se_dev) | 606 | if (!lun || !lun->lun_se_dev) |
669 | return -ENODEV; | 607 | return -ENODEV; |
670 | 608 | ||
671 | return core_alua_store_offline_bit(lun, page, count); | 609 | return core_alua_store_offline_bit(lun, page, count); |
672 | } | 610 | } |
673 | 611 | ||
674 | TCM_PORT_ATTR(alua_tg_pt_offline, S_IRUGO | S_IWUSR); | 612 | static ssize_t target_fabric_port_alua_tg_pt_status_show( |
675 | 613 | struct config_item *item, char *page) | |
676 | /* | ||
677 | * alua_tg_pt_status | ||
678 | */ | ||
679 | static ssize_t target_fabric_port_show_attr_alua_tg_pt_status( | ||
680 | struct se_lun *lun, | ||
681 | char *page) | ||
682 | { | 614 | { |
615 | struct se_lun *lun = item_to_lun(item); | ||
616 | |||
683 | if (!lun || !lun->lun_se_dev) | 617 | if (!lun || !lun->lun_se_dev) |
684 | return -ENODEV; | 618 | return -ENODEV; |
685 | 619 | ||
686 | return core_alua_show_secondary_status(lun, page); | 620 | return core_alua_show_secondary_status(lun, page); |
687 | } | 621 | } |
688 | 622 | ||
689 | static ssize_t target_fabric_port_store_attr_alua_tg_pt_status( | 623 | static ssize_t target_fabric_port_alua_tg_pt_status_store( |
690 | struct se_lun *lun, | 624 | struct config_item *item, const char *page, size_t count) |
691 | const char *page, | ||
692 | size_t count) | ||
693 | { | 625 | { |
626 | struct se_lun *lun = item_to_lun(item); | ||
627 | |||
694 | if (!lun || !lun->lun_se_dev) | 628 | if (!lun || !lun->lun_se_dev) |
695 | return -ENODEV; | 629 | return -ENODEV; |
696 | 630 | ||
697 | return core_alua_store_secondary_status(lun, page, count); | 631 | return core_alua_store_secondary_status(lun, page, count); |
698 | } | 632 | } |
699 | 633 | ||
700 | TCM_PORT_ATTR(alua_tg_pt_status, S_IRUGO | S_IWUSR); | 634 | static ssize_t target_fabric_port_alua_tg_pt_write_md_show( |
701 | 635 | struct config_item *item, char *page) | |
702 | /* | ||
703 | * alua_tg_pt_write_md | ||
704 | */ | ||
705 | static ssize_t target_fabric_port_show_attr_alua_tg_pt_write_md( | ||
706 | struct se_lun *lun, | ||
707 | char *page) | ||
708 | { | 636 | { |
637 | struct se_lun *lun = item_to_lun(item); | ||
638 | |||
709 | if (!lun || !lun->lun_se_dev) | 639 | if (!lun || !lun->lun_se_dev) |
710 | return -ENODEV; | 640 | return -ENODEV; |
711 | 641 | ||
712 | return core_alua_show_secondary_write_metadata(lun, page); | 642 | return core_alua_show_secondary_write_metadata(lun, page); |
713 | } | 643 | } |
714 | 644 | ||
715 | static ssize_t target_fabric_port_store_attr_alua_tg_pt_write_md( | 645 | static ssize_t target_fabric_port_alua_tg_pt_write_md_store( |
716 | struct se_lun *lun, | 646 | struct config_item *item, const char *page, size_t count) |
717 | const char *page, | ||
718 | size_t count) | ||
719 | { | 647 | { |
648 | struct se_lun *lun = item_to_lun(item); | ||
649 | |||
720 | if (!lun || !lun->lun_se_dev) | 650 | if (!lun || !lun->lun_se_dev) |
721 | return -ENODEV; | 651 | return -ENODEV; |
722 | 652 | ||
723 | return core_alua_store_secondary_write_metadata(lun, page, count); | 653 | return core_alua_store_secondary_write_metadata(lun, page, count); |
724 | } | 654 | } |
725 | 655 | ||
726 | TCM_PORT_ATTR(alua_tg_pt_write_md, S_IRUGO | S_IWUSR); | 656 | CONFIGFS_ATTR(target_fabric_port_, alua_tg_pt_gp); |
727 | 657 | CONFIGFS_ATTR(target_fabric_port_, alua_tg_pt_offline); | |
658 | CONFIGFS_ATTR(target_fabric_port_, alua_tg_pt_status); | ||
659 | CONFIGFS_ATTR(target_fabric_port_, alua_tg_pt_write_md); | ||
728 | 660 | ||
729 | static struct configfs_attribute *target_fabric_port_attrs[] = { | 661 | static struct configfs_attribute *target_fabric_port_attrs[] = { |
730 | &target_fabric_port_alua_tg_pt_gp.attr, | 662 | &target_fabric_port_attr_alua_tg_pt_gp, |
731 | &target_fabric_port_alua_tg_pt_offline.attr, | 663 | &target_fabric_port_attr_alua_tg_pt_offline, |
732 | &target_fabric_port_alua_tg_pt_status.attr, | 664 | &target_fabric_port_attr_alua_tg_pt_status, |
733 | &target_fabric_port_alua_tg_pt_write_md.attr, | 665 | &target_fabric_port_attr_alua_tg_pt_write_md, |
734 | NULL, | 666 | NULL, |
735 | }; | 667 | }; |
736 | 668 | ||
737 | CONFIGFS_EATTR_OPS(target_fabric_port, se_lun, lun_group); | ||
738 | |||
739 | static int target_fabric_port_link( | 669 | static int target_fabric_port_link( |
740 | struct config_item *lun_ci, | 670 | struct config_item *lun_ci, |
741 | struct config_item *se_dev_ci) | 671 | struct config_item *se_dev_ci) |
@@ -821,8 +751,6 @@ static void target_fabric_port_release(struct config_item *item) | |||
821 | } | 751 | } |
822 | 752 | ||
823 | static struct configfs_item_operations target_fabric_port_item_ops = { | 753 | static struct configfs_item_operations target_fabric_port_item_ops = { |
824 | .show_attribute = target_fabric_port_attr_show, | ||
825 | .store_attribute = target_fabric_port_attr_store, | ||
826 | .release = target_fabric_port_release, | 754 | .release = target_fabric_port_release, |
827 | .allow_link = target_fabric_port_link, | 755 | .allow_link = target_fabric_port_link, |
828 | .drop_link = target_fabric_port_unlink, | 756 | .drop_link = target_fabric_port_unlink, |
@@ -952,50 +880,11 @@ TF_CIT_SETUP(tpg_lun, NULL, &target_fabric_lun_group_ops, NULL); | |||
952 | 880 | ||
953 | /* End of tfc_tpg_lun_cit */ | 881 | /* End of tfc_tpg_lun_cit */ |
954 | 882 | ||
955 | /* Start of tfc_tpg_attrib_cit */ | 883 | TF_CIT_SETUP_DRV(tpg_attrib, NULL, NULL); |
956 | 884 | TF_CIT_SETUP_DRV(tpg_auth, NULL, NULL); | |
957 | CONFIGFS_EATTR_OPS(target_fabric_tpg_attrib, se_portal_group, tpg_attrib_group); | 885 | TF_CIT_SETUP_DRV(tpg_param, NULL, NULL); |
958 | |||
959 | static struct configfs_item_operations target_fabric_tpg_attrib_item_ops = { | ||
960 | .show_attribute = target_fabric_tpg_attrib_attr_show, | ||
961 | .store_attribute = target_fabric_tpg_attrib_attr_store, | ||
962 | }; | ||
963 | |||
964 | TF_CIT_SETUP_DRV(tpg_attrib, &target_fabric_tpg_attrib_item_ops, NULL); | ||
965 | |||
966 | /* End of tfc_tpg_attrib_cit */ | ||
967 | |||
968 | /* Start of tfc_tpg_auth_cit */ | ||
969 | |||
970 | CONFIGFS_EATTR_OPS(target_fabric_tpg_auth, se_portal_group, tpg_auth_group); | ||
971 | |||
972 | static struct configfs_item_operations target_fabric_tpg_auth_item_ops = { | ||
973 | .show_attribute = target_fabric_tpg_auth_attr_show, | ||
974 | .store_attribute = target_fabric_tpg_auth_attr_store, | ||
975 | }; | ||
976 | |||
977 | TF_CIT_SETUP_DRV(tpg_auth, &target_fabric_tpg_auth_item_ops, NULL); | ||
978 | |||
979 | /* End of tfc_tpg_attrib_cit */ | ||
980 | |||
981 | /* Start of tfc_tpg_param_cit */ | ||
982 | |||
983 | CONFIGFS_EATTR_OPS(target_fabric_tpg_param, se_portal_group, tpg_param_group); | ||
984 | |||
985 | static struct configfs_item_operations target_fabric_tpg_param_item_ops = { | ||
986 | .show_attribute = target_fabric_tpg_param_attr_show, | ||
987 | .store_attribute = target_fabric_tpg_param_attr_store, | ||
988 | }; | ||
989 | |||
990 | TF_CIT_SETUP_DRV(tpg_param, &target_fabric_tpg_param_item_ops, NULL); | ||
991 | |||
992 | /* End of tfc_tpg_param_cit */ | ||
993 | 886 | ||
994 | /* Start of tfc_tpg_base_cit */ | 887 | /* Start of tfc_tpg_base_cit */ |
995 | /* | ||
996 | * For use with TF_TPG_ATTR() and TF_TPG_ATTR_RO() | ||
997 | */ | ||
998 | CONFIGFS_EATTR_OPS(target_fabric_tpg, se_portal_group, tpg_group); | ||
999 | 888 | ||
1000 | static void target_fabric_tpg_release(struct config_item *item) | 889 | static void target_fabric_tpg_release(struct config_item *item) |
1001 | { | 890 | { |
@@ -1009,8 +898,6 @@ static void target_fabric_tpg_release(struct config_item *item) | |||
1009 | 898 | ||
1010 | static struct configfs_item_operations target_fabric_tpg_base_item_ops = { | 899 | static struct configfs_item_operations target_fabric_tpg_base_item_ops = { |
1011 | .release = target_fabric_tpg_release, | 900 | .release = target_fabric_tpg_release, |
1012 | .show_attribute = target_fabric_tpg_attr_show, | ||
1013 | .store_attribute = target_fabric_tpg_attr_store, | ||
1014 | }; | 901 | }; |
1015 | 902 | ||
1016 | TF_CIT_SETUP_DRV(tpg_base, &target_fabric_tpg_base_item_ops, NULL); | 903 | TF_CIT_SETUP_DRV(tpg_base, &target_fabric_tpg_base_item_ops, NULL); |
@@ -1176,33 +1063,9 @@ static struct configfs_group_operations target_fabric_wwn_group_ops = { | |||
1176 | .make_group = target_fabric_make_wwn, | 1063 | .make_group = target_fabric_make_wwn, |
1177 | .drop_item = target_fabric_drop_wwn, | 1064 | .drop_item = target_fabric_drop_wwn, |
1178 | }; | 1065 | }; |
1179 | /* | ||
1180 | * For use with TF_WWN_ATTR() and TF_WWN_ATTR_RO() | ||
1181 | */ | ||
1182 | CONFIGFS_EATTR_OPS(target_fabric_wwn, target_fabric_configfs, tf_group); | ||
1183 | |||
1184 | static struct configfs_item_operations target_fabric_wwn_item_ops = { | ||
1185 | .show_attribute = target_fabric_wwn_attr_show, | ||
1186 | .store_attribute = target_fabric_wwn_attr_store, | ||
1187 | }; | ||
1188 | |||
1189 | TF_CIT_SETUP_DRV(wwn, &target_fabric_wwn_item_ops, &target_fabric_wwn_group_ops); | ||
1190 | |||
1191 | /* End of tfc_wwn_cit */ | ||
1192 | |||
1193 | /* Start of tfc_discovery_cit */ | ||
1194 | |||
1195 | CONFIGFS_EATTR_OPS(target_fabric_discovery, target_fabric_configfs, | ||
1196 | tf_disc_group); | ||
1197 | |||
1198 | static struct configfs_item_operations target_fabric_discovery_item_ops = { | ||
1199 | .show_attribute = target_fabric_discovery_attr_show, | ||
1200 | .store_attribute = target_fabric_discovery_attr_store, | ||
1201 | }; | ||
1202 | |||
1203 | TF_CIT_SETUP_DRV(discovery, &target_fabric_discovery_item_ops, NULL); | ||
1204 | 1066 | ||
1205 | /* End of tfc_discovery_cit */ | 1067 | TF_CIT_SETUP_DRV(wwn, NULL, &target_fabric_wwn_group_ops); |
1068 | TF_CIT_SETUP_DRV(discovery, NULL, NULL); | ||
1206 | 1069 | ||
1207 | int target_fabric_setup_cits(struct target_fabric_configfs *tf) | 1070 | int target_fabric_setup_cits(struct target_fabric_configfs *tf) |
1208 | { | 1071 | { |
diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 99c24acfe676..dae0750c2032 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h | |||
@@ -87,6 +87,9 @@ void target_free_device(struct se_device *); | |||
87 | /* target_core_configfs.c */ | 87 | /* target_core_configfs.c */ |
88 | void target_setup_backend_cits(struct target_backend *); | 88 | void target_setup_backend_cits(struct target_backend *); |
89 | 89 | ||
90 | /* target_core_fabric_configfs.c */ | ||
91 | int target_fabric_setup_cits(struct target_fabric_configfs *); | ||
92 | |||
90 | /* target_core_fabric_lib.c */ | 93 | /* target_core_fabric_lib.c */ |
91 | int target_get_pr_transport_id_len(struct se_node_acl *nacl, | 94 | int target_get_pr_transport_id_len(struct se_node_acl *nacl, |
92 | struct t10_pr_registration *pr_reg, int *format_code); | 95 | struct t10_pr_registration *pr_reg, int *format_code); |
diff --git a/drivers/target/target_core_stat.c b/drivers/target/target_core_stat.c index 20ed5d2e151a..273c72b2b83d 100644 --- a/drivers/target/target_core_stat.c +++ b/drivers/target/target_core_stat.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <target/target_core_base.h> | 37 | #include <target/target_core_base.h> |
38 | #include <target/target_core_backend.h> | 38 | #include <target/target_core_backend.h> |
39 | #include <target/target_core_fabric.h> | 39 | #include <target/target_core_fabric.h> |
40 | #include <target/configfs_macros.h> | ||
41 | 40 | ||
42 | #include "target_core_internal.h" | 41 | #include "target_core_internal.h" |
43 | 42 | ||
@@ -55,75 +54,49 @@ | |||
55 | * SCSI Device Table | 54 | * SCSI Device Table |
56 | */ | 55 | */ |
57 | 56 | ||
58 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_dev, se_dev_stat_grps); | 57 | static struct se_device *to_stat_dev(struct config_item *item) |
59 | #define DEV_STAT_SCSI_DEV_ATTR(_name, _mode) \ | 58 | { |
60 | static struct target_stat_scsi_dev_attribute \ | 59 | struct se_dev_stat_grps *sgrps = container_of(to_config_group(item), |
61 | target_stat_scsi_dev_##_name = \ | 60 | struct se_dev_stat_grps, scsi_dev_group); |
62 | __CONFIGFS_EATTR(_name, _mode, \ | 61 | return container_of(sgrps, struct se_device, dev_stat_grps); |
63 | target_stat_scsi_dev_show_attr_##_name, \ | 62 | } |
64 | target_stat_scsi_dev_store_attr_##_name); | ||
65 | |||
66 | #define DEV_STAT_SCSI_DEV_ATTR_RO(_name) \ | ||
67 | static struct target_stat_scsi_dev_attribute \ | ||
68 | target_stat_scsi_dev_##_name = \ | ||
69 | __CONFIGFS_EATTR_RO(_name, \ | ||
70 | target_stat_scsi_dev_show_attr_##_name); | ||
71 | 63 | ||
72 | static ssize_t target_stat_scsi_dev_show_attr_inst( | 64 | static ssize_t target_stat_inst_show(struct config_item *item, char *page) |
73 | struct se_dev_stat_grps *sgrps, char *page) | ||
74 | { | 65 | { |
75 | struct se_device *dev = | 66 | struct se_hba *hba = to_stat_dev(item)->se_hba; |
76 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
77 | struct se_hba *hba = dev->se_hba; | ||
78 | 67 | ||
79 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); | 68 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); |
80 | } | 69 | } |
81 | DEV_STAT_SCSI_DEV_ATTR_RO(inst); | ||
82 | 70 | ||
83 | static ssize_t target_stat_scsi_dev_show_attr_indx( | 71 | static ssize_t target_stat_indx_show(struct config_item *item, char *page) |
84 | struct se_dev_stat_grps *sgrps, char *page) | ||
85 | { | 72 | { |
86 | struct se_device *dev = | 73 | return snprintf(page, PAGE_SIZE, "%u\n", to_stat_dev(item)->dev_index); |
87 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
88 | |||
89 | return snprintf(page, PAGE_SIZE, "%u\n", dev->dev_index); | ||
90 | } | 74 | } |
91 | DEV_STAT_SCSI_DEV_ATTR_RO(indx); | ||
92 | 75 | ||
93 | static ssize_t target_stat_scsi_dev_show_attr_role( | 76 | static ssize_t target_stat_role_show(struct config_item *item, char *page) |
94 | struct se_dev_stat_grps *sgrps, char *page) | ||
95 | { | 77 | { |
96 | return snprintf(page, PAGE_SIZE, "Target\n"); | 78 | return snprintf(page, PAGE_SIZE, "Target\n"); |
97 | } | 79 | } |
98 | DEV_STAT_SCSI_DEV_ATTR_RO(role); | ||
99 | 80 | ||
100 | static ssize_t target_stat_scsi_dev_show_attr_ports( | 81 | static ssize_t target_stat_ports_show(struct config_item *item, char *page) |
101 | struct se_dev_stat_grps *sgrps, char *page) | ||
102 | { | 82 | { |
103 | struct se_device *dev = | 83 | return snprintf(page, PAGE_SIZE, "%u\n", to_stat_dev(item)->export_count); |
104 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
105 | |||
106 | return snprintf(page, PAGE_SIZE, "%u\n", dev->export_count); | ||
107 | } | 84 | } |
108 | DEV_STAT_SCSI_DEV_ATTR_RO(ports); | ||
109 | 85 | ||
110 | CONFIGFS_EATTR_OPS(target_stat_scsi_dev, se_dev_stat_grps, scsi_dev_group); | 86 | CONFIGFS_ATTR_RO(target_stat_, inst); |
87 | CONFIGFS_ATTR_RO(target_stat_, indx); | ||
88 | CONFIGFS_ATTR_RO(target_stat_, role); | ||
89 | CONFIGFS_ATTR_RO(target_stat_, ports); | ||
111 | 90 | ||
112 | static struct configfs_attribute *target_stat_scsi_dev_attrs[] = { | 91 | static struct configfs_attribute *target_stat_scsi_dev_attrs[] = { |
113 | &target_stat_scsi_dev_inst.attr, | 92 | &target_stat_attr_inst, |
114 | &target_stat_scsi_dev_indx.attr, | 93 | &target_stat_attr_indx, |
115 | &target_stat_scsi_dev_role.attr, | 94 | &target_stat_attr_role, |
116 | &target_stat_scsi_dev_ports.attr, | 95 | &target_stat_attr_ports, |
117 | NULL, | 96 | NULL, |
118 | }; | 97 | }; |
119 | 98 | ||
120 | static struct configfs_item_operations target_stat_scsi_dev_attrib_ops = { | ||
121 | .show_attribute = target_stat_scsi_dev_attr_show, | ||
122 | .store_attribute = target_stat_scsi_dev_attr_store, | ||
123 | }; | ||
124 | |||
125 | static struct config_item_type target_stat_scsi_dev_cit = { | 99 | static struct config_item_type target_stat_scsi_dev_cit = { |
126 | .ct_item_ops = &target_stat_scsi_dev_attrib_ops, | ||
127 | .ct_attrs = target_stat_scsi_dev_attrs, | 100 | .ct_attrs = target_stat_scsi_dev_attrs, |
128 | .ct_owner = THIS_MODULE, | 101 | .ct_owner = THIS_MODULE, |
129 | }; | 102 | }; |
@@ -131,109 +104,78 @@ static struct config_item_type target_stat_scsi_dev_cit = { | |||
131 | /* | 104 | /* |
132 | * SCSI Target Device Table | 105 | * SCSI Target Device Table |
133 | */ | 106 | */ |
107 | static struct se_device *to_stat_tgt_dev(struct config_item *item) | ||
108 | { | ||
109 | struct se_dev_stat_grps *sgrps = container_of(to_config_group(item), | ||
110 | struct se_dev_stat_grps, scsi_tgt_dev_group); | ||
111 | return container_of(sgrps, struct se_device, dev_stat_grps); | ||
112 | } | ||
134 | 113 | ||
135 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_tgt_dev, se_dev_stat_grps); | 114 | static ssize_t target_stat_tgt_inst_show(struct config_item *item, char *page) |
136 | #define DEV_STAT_SCSI_TGT_DEV_ATTR(_name, _mode) \ | ||
137 | static struct target_stat_scsi_tgt_dev_attribute \ | ||
138 | target_stat_scsi_tgt_dev_##_name = \ | ||
139 | __CONFIGFS_EATTR(_name, _mode, \ | ||
140 | target_stat_scsi_tgt_dev_show_attr_##_name, \ | ||
141 | target_stat_scsi_tgt_dev_store_attr_##_name); | ||
142 | |||
143 | #define DEV_STAT_SCSI_TGT_DEV_ATTR_RO(_name) \ | ||
144 | static struct target_stat_scsi_tgt_dev_attribute \ | ||
145 | target_stat_scsi_tgt_dev_##_name = \ | ||
146 | __CONFIGFS_EATTR_RO(_name, \ | ||
147 | target_stat_scsi_tgt_dev_show_attr_##_name); | ||
148 | |||
149 | static ssize_t target_stat_scsi_tgt_dev_show_attr_inst( | ||
150 | struct se_dev_stat_grps *sgrps, char *page) | ||
151 | { | 115 | { |
152 | struct se_device *dev = | 116 | struct se_hba *hba = to_stat_tgt_dev(item)->se_hba; |
153 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
154 | struct se_hba *hba = dev->se_hba; | ||
155 | 117 | ||
156 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); | 118 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); |
157 | } | 119 | } |
158 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(inst); | ||
159 | 120 | ||
160 | static ssize_t target_stat_scsi_tgt_dev_show_attr_indx( | 121 | static ssize_t target_stat_tgt_indx_show(struct config_item *item, char *page) |
161 | struct se_dev_stat_grps *sgrps, char *page) | ||
162 | { | 122 | { |
163 | struct se_device *dev = | 123 | return snprintf(page, PAGE_SIZE, "%u\n", to_stat_tgt_dev(item)->dev_index); |
164 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
165 | |||
166 | return snprintf(page, PAGE_SIZE, "%u\n", dev->dev_index); | ||
167 | } | 124 | } |
168 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(indx); | ||
169 | 125 | ||
170 | static ssize_t target_stat_scsi_tgt_dev_show_attr_num_lus( | 126 | static ssize_t target_stat_tgt_num_lus_show(struct config_item *item, |
171 | struct se_dev_stat_grps *sgrps, char *page) | 127 | char *page) |
172 | { | 128 | { |
173 | return snprintf(page, PAGE_SIZE, "%u\n", LU_COUNT); | 129 | return snprintf(page, PAGE_SIZE, "%u\n", LU_COUNT); |
174 | } | 130 | } |
175 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(num_lus); | ||
176 | 131 | ||
177 | static ssize_t target_stat_scsi_tgt_dev_show_attr_status( | 132 | static ssize_t target_stat_tgt_status_show(struct config_item *item, |
178 | struct se_dev_stat_grps *sgrps, char *page) | 133 | char *page) |
179 | { | 134 | { |
180 | struct se_device *dev = | 135 | if (to_stat_tgt_dev(item)->export_count) |
181 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
182 | |||
183 | if (dev->export_count) | ||
184 | return snprintf(page, PAGE_SIZE, "activated"); | 136 | return snprintf(page, PAGE_SIZE, "activated"); |
185 | else | 137 | else |
186 | return snprintf(page, PAGE_SIZE, "deactivated"); | 138 | return snprintf(page, PAGE_SIZE, "deactivated"); |
187 | } | 139 | } |
188 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(status); | ||
189 | 140 | ||
190 | static ssize_t target_stat_scsi_tgt_dev_show_attr_non_access_lus( | 141 | static ssize_t target_stat_tgt_non_access_lus_show(struct config_item *item, |
191 | struct se_dev_stat_grps *sgrps, char *page) | 142 | char *page) |
192 | { | 143 | { |
193 | struct se_device *dev = | ||
194 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
195 | int non_accessible_lus; | 144 | int non_accessible_lus; |
196 | 145 | ||
197 | if (dev->export_count) | 146 | if (to_stat_tgt_dev(item)->export_count) |
198 | non_accessible_lus = 0; | 147 | non_accessible_lus = 0; |
199 | else | 148 | else |
200 | non_accessible_lus = 1; | 149 | non_accessible_lus = 1; |
201 | 150 | ||
202 | return snprintf(page, PAGE_SIZE, "%u\n", non_accessible_lus); | 151 | return snprintf(page, PAGE_SIZE, "%u\n", non_accessible_lus); |
203 | } | 152 | } |
204 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(non_access_lus); | ||
205 | 153 | ||
206 | static ssize_t target_stat_scsi_tgt_dev_show_attr_resets( | 154 | static ssize_t target_stat_tgt_resets_show(struct config_item *item, |
207 | struct se_dev_stat_grps *sgrps, char *page) | 155 | char *page) |
208 | { | 156 | { |
209 | struct se_device *dev = | ||
210 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
211 | |||
212 | return snprintf(page, PAGE_SIZE, "%lu\n", | 157 | return snprintf(page, PAGE_SIZE, "%lu\n", |
213 | atomic_long_read(&dev->num_resets)); | 158 | atomic_long_read(&to_stat_tgt_dev(item)->num_resets)); |
214 | } | 159 | } |
215 | DEV_STAT_SCSI_TGT_DEV_ATTR_RO(resets); | ||
216 | 160 | ||
217 | 161 | CONFIGFS_ATTR_RO(target_stat_tgt_, inst); | |
218 | CONFIGFS_EATTR_OPS(target_stat_scsi_tgt_dev, se_dev_stat_grps, scsi_tgt_dev_group); | 162 | CONFIGFS_ATTR_RO(target_stat_tgt_, indx); |
163 | CONFIGFS_ATTR_RO(target_stat_tgt_, num_lus); | ||
164 | CONFIGFS_ATTR_RO(target_stat_tgt_, status); | ||
165 | CONFIGFS_ATTR_RO(target_stat_tgt_, non_access_lus); | ||
166 | CONFIGFS_ATTR_RO(target_stat_tgt_, resets); | ||
219 | 167 | ||
220 | static struct configfs_attribute *target_stat_scsi_tgt_dev_attrs[] = { | 168 | static struct configfs_attribute *target_stat_scsi_tgt_dev_attrs[] = { |
221 | &target_stat_scsi_tgt_dev_inst.attr, | 169 | &target_stat_tgt_attr_inst, |
222 | &target_stat_scsi_tgt_dev_indx.attr, | 170 | &target_stat_tgt_attr_indx, |
223 | &target_stat_scsi_tgt_dev_num_lus.attr, | 171 | &target_stat_tgt_attr_num_lus, |
224 | &target_stat_scsi_tgt_dev_status.attr, | 172 | &target_stat_tgt_attr_status, |
225 | &target_stat_scsi_tgt_dev_non_access_lus.attr, | 173 | &target_stat_tgt_attr_non_access_lus, |
226 | &target_stat_scsi_tgt_dev_resets.attr, | 174 | &target_stat_tgt_attr_resets, |
227 | NULL, | 175 | NULL, |
228 | }; | 176 | }; |
229 | 177 | ||
230 | static struct configfs_item_operations target_stat_scsi_tgt_dev_attrib_ops = { | ||
231 | .show_attribute = target_stat_scsi_tgt_dev_attr_show, | ||
232 | .store_attribute = target_stat_scsi_tgt_dev_attr_store, | ||
233 | }; | ||
234 | |||
235 | static struct config_item_type target_stat_scsi_tgt_dev_cit = { | 178 | static struct config_item_type target_stat_scsi_tgt_dev_cit = { |
236 | .ct_item_ops = &target_stat_scsi_tgt_dev_attrib_ops, | ||
237 | .ct_attrs = target_stat_scsi_tgt_dev_attrs, | 179 | .ct_attrs = target_stat_scsi_tgt_dev_attrs, |
238 | .ct_owner = THIS_MODULE, | 180 | .ct_owner = THIS_MODULE, |
239 | }; | 181 | }; |
@@ -242,72 +184,50 @@ static struct config_item_type target_stat_scsi_tgt_dev_cit = { | |||
242 | * SCSI Logical Unit Table | 184 | * SCSI Logical Unit Table |
243 | */ | 185 | */ |
244 | 186 | ||
245 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_lu, se_dev_stat_grps); | 187 | static struct se_device *to_stat_lu_dev(struct config_item *item) |
246 | #define DEV_STAT_SCSI_LU_ATTR(_name, _mode) \ | 188 | { |
247 | static struct target_stat_scsi_lu_attribute target_stat_scsi_lu_##_name = \ | 189 | struct se_dev_stat_grps *sgrps = container_of(to_config_group(item), |
248 | __CONFIGFS_EATTR(_name, _mode, \ | 190 | struct se_dev_stat_grps, scsi_lu_group); |
249 | target_stat_scsi_lu_show_attr_##_name, \ | 191 | return container_of(sgrps, struct se_device, dev_stat_grps); |
250 | target_stat_scsi_lu_store_attr_##_name); | 192 | } |
251 | |||
252 | #define DEV_STAT_SCSI_LU_ATTR_RO(_name) \ | ||
253 | static struct target_stat_scsi_lu_attribute target_stat_scsi_lu_##_name = \ | ||
254 | __CONFIGFS_EATTR_RO(_name, \ | ||
255 | target_stat_scsi_lu_show_attr_##_name); | ||
256 | 193 | ||
257 | static ssize_t target_stat_scsi_lu_show_attr_inst( | 194 | static ssize_t target_stat_lu_inst_show(struct config_item *item, char *page) |
258 | struct se_dev_stat_grps *sgrps, char *page) | ||
259 | { | 195 | { |
260 | struct se_device *dev = | 196 | struct se_hba *hba = to_stat_lu_dev(item)->se_hba; |
261 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
262 | struct se_hba *hba = dev->se_hba; | ||
263 | 197 | ||
264 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); | 198 | return snprintf(page, PAGE_SIZE, "%u\n", hba->hba_index); |
265 | } | 199 | } |
266 | DEV_STAT_SCSI_LU_ATTR_RO(inst); | ||
267 | 200 | ||
268 | static ssize_t target_stat_scsi_lu_show_attr_dev( | 201 | static ssize_t target_stat_lu_dev_show(struct config_item *item, char *page) |
269 | struct se_dev_stat_grps *sgrps, char *page) | ||
270 | { | 202 | { |
271 | struct se_device *dev = | 203 | return snprintf(page, PAGE_SIZE, "%u\n", |
272 | container_of(sgrps, struct se_device, dev_stat_grps); | 204 | to_stat_lu_dev(item)->dev_index); |
273 | |||
274 | return snprintf(page, PAGE_SIZE, "%u\n", dev->dev_index); | ||
275 | } | 205 | } |
276 | DEV_STAT_SCSI_LU_ATTR_RO(dev); | ||
277 | 206 | ||
278 | static ssize_t target_stat_scsi_lu_show_attr_indx( | 207 | static ssize_t target_stat_lu_indx_show(struct config_item *item, char *page) |
279 | struct se_dev_stat_grps *sgrps, char *page) | ||
280 | { | 208 | { |
281 | return snprintf(page, PAGE_SIZE, "%u\n", SCSI_LU_INDEX); | 209 | return snprintf(page, PAGE_SIZE, "%u\n", SCSI_LU_INDEX); |
282 | } | 210 | } |
283 | DEV_STAT_SCSI_LU_ATTR_RO(indx); | ||
284 | 211 | ||
285 | static ssize_t target_stat_scsi_lu_show_attr_lun( | 212 | static ssize_t target_stat_lu_lun_show(struct config_item *item, char *page) |
286 | struct se_dev_stat_grps *sgrps, char *page) | ||
287 | { | 213 | { |
288 | /* FIXME: scsiLuDefaultLun */ | 214 | /* FIXME: scsiLuDefaultLun */ |
289 | return snprintf(page, PAGE_SIZE, "%llu\n", (unsigned long long)0); | 215 | return snprintf(page, PAGE_SIZE, "%llu\n", (unsigned long long)0); |
290 | } | 216 | } |
291 | DEV_STAT_SCSI_LU_ATTR_RO(lun); | ||
292 | 217 | ||
293 | static ssize_t target_stat_scsi_lu_show_attr_lu_name( | 218 | static ssize_t target_stat_lu_lu_name_show(struct config_item *item, char *page) |
294 | struct se_dev_stat_grps *sgrps, char *page) | ||
295 | { | 219 | { |
296 | struct se_device *dev = | 220 | struct se_device *dev = to_stat_lu_dev(item); |
297 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
298 | 221 | ||
299 | /* scsiLuWwnName */ | 222 | /* scsiLuWwnName */ |
300 | return snprintf(page, PAGE_SIZE, "%s\n", | 223 | return snprintf(page, PAGE_SIZE, "%s\n", |
301 | (strlen(dev->t10_wwn.unit_serial)) ? | 224 | (strlen(dev->t10_wwn.unit_serial)) ? |
302 | dev->t10_wwn.unit_serial : "None"); | 225 | dev->t10_wwn.unit_serial : "None"); |
303 | } | 226 | } |
304 | DEV_STAT_SCSI_LU_ATTR_RO(lu_name); | ||
305 | 227 | ||
306 | static ssize_t target_stat_scsi_lu_show_attr_vend( | 228 | static ssize_t target_stat_lu_vend_show(struct config_item *item, char *page) |
307 | struct se_dev_stat_grps *sgrps, char *page) | ||
308 | { | 229 | { |
309 | struct se_device *dev = | 230 | struct se_device *dev = to_stat_lu_dev(item); |
310 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
311 | int i; | 231 | int i; |
312 | char str[sizeof(dev->t10_wwn.vendor)+1]; | 232 | char str[sizeof(dev->t10_wwn.vendor)+1]; |
313 | 233 | ||
@@ -318,13 +238,10 @@ static ssize_t target_stat_scsi_lu_show_attr_vend( | |||
318 | str[i] = '\0'; | 238 | str[i] = '\0'; |
319 | return snprintf(page, PAGE_SIZE, "%s\n", str); | 239 | return snprintf(page, PAGE_SIZE, "%s\n", str); |
320 | } | 240 | } |
321 | DEV_STAT_SCSI_LU_ATTR_RO(vend); | ||
322 | 241 | ||
323 | static ssize_t target_stat_scsi_lu_show_attr_prod( | 242 | static ssize_t target_stat_lu_prod_show(struct config_item *item, char *page) |
324 | struct se_dev_stat_grps *sgrps, char *page) | ||
325 | { | 243 | { |
326 | struct se_device *dev = | 244 | struct se_device *dev = to_stat_lu_dev(item); |
327 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
328 | int i; | 245 | int i; |
329 | char str[sizeof(dev->t10_wwn.model)+1]; | 246 | char str[sizeof(dev->t10_wwn.model)+1]; |
330 | 247 | ||
@@ -335,13 +252,10 @@ static ssize_t target_stat_scsi_lu_show_attr_prod( | |||
335 | str[i] = '\0'; | 252 | str[i] = '\0'; |
336 | return snprintf(page, PAGE_SIZE, "%s\n", str); | 253 | return snprintf(page, PAGE_SIZE, "%s\n", str); |
337 | } | 254 | } |
338 | DEV_STAT_SCSI_LU_ATTR_RO(prod); | ||
339 | 255 | ||
340 | static ssize_t target_stat_scsi_lu_show_attr_rev( | 256 | static ssize_t target_stat_lu_rev_show(struct config_item *item, char *page) |
341 | struct se_dev_stat_grps *sgrps, char *page) | ||
342 | { | 257 | { |
343 | struct se_device *dev = | 258 | struct se_device *dev = to_stat_lu_dev(item); |
344 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
345 | int i; | 259 | int i; |
346 | char str[sizeof(dev->t10_wwn.revision)+1]; | 260 | char str[sizeof(dev->t10_wwn.revision)+1]; |
347 | 261 | ||
@@ -352,146 +266,137 @@ static ssize_t target_stat_scsi_lu_show_attr_rev( | |||
352 | str[i] = '\0'; | 266 | str[i] = '\0'; |
353 | return snprintf(page, PAGE_SIZE, "%s\n", str); | 267 | return snprintf(page, PAGE_SIZE, "%s\n", str); |
354 | } | 268 | } |
355 | DEV_STAT_SCSI_LU_ATTR_RO(rev); | ||
356 | 269 | ||
357 | static ssize_t target_stat_scsi_lu_show_attr_dev_type( | 270 | static ssize_t target_stat_lu_dev_type_show(struct config_item *item, char *page) |
358 | struct se_dev_stat_grps *sgrps, char *page) | ||
359 | { | 271 | { |
360 | struct se_device *dev = | 272 | struct se_device *dev = to_stat_lu_dev(item); |
361 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
362 | 273 | ||
363 | /* scsiLuPeripheralType */ | 274 | /* scsiLuPeripheralType */ |
364 | return snprintf(page, PAGE_SIZE, "%u\n", | 275 | return snprintf(page, PAGE_SIZE, "%u\n", |
365 | dev->transport->get_device_type(dev)); | 276 | dev->transport->get_device_type(dev)); |
366 | } | 277 | } |
367 | DEV_STAT_SCSI_LU_ATTR_RO(dev_type); | ||
368 | 278 | ||
369 | static ssize_t target_stat_scsi_lu_show_attr_status( | 279 | static ssize_t target_stat_lu_status_show(struct config_item *item, char *page) |
370 | struct se_dev_stat_grps *sgrps, char *page) | ||
371 | { | 280 | { |
372 | struct se_device *dev = | 281 | struct se_device *dev = to_stat_lu_dev(item); |
373 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
374 | 282 | ||
375 | /* scsiLuStatus */ | 283 | /* scsiLuStatus */ |
376 | return snprintf(page, PAGE_SIZE, "%s\n", | 284 | return snprintf(page, PAGE_SIZE, "%s\n", |
377 | (dev->export_count) ? "available" : "notavailable"); | 285 | (dev->export_count) ? "available" : "notavailable"); |
378 | } | 286 | } |
379 | DEV_STAT_SCSI_LU_ATTR_RO(status); | ||
380 | 287 | ||
381 | static ssize_t target_stat_scsi_lu_show_attr_state_bit( | 288 | static ssize_t target_stat_lu_state_bit_show(struct config_item *item, |
382 | struct se_dev_stat_grps *sgrps, char *page) | 289 | char *page) |
383 | { | 290 | { |
384 | /* scsiLuState */ | 291 | /* scsiLuState */ |
385 | return snprintf(page, PAGE_SIZE, "exposed\n"); | 292 | return snprintf(page, PAGE_SIZE, "exposed\n"); |
386 | } | 293 | } |
387 | DEV_STAT_SCSI_LU_ATTR_RO(state_bit); | ||
388 | 294 | ||
389 | static ssize_t target_stat_scsi_lu_show_attr_num_cmds( | 295 | static ssize_t target_stat_lu_num_cmds_show(struct config_item *item, |
390 | struct se_dev_stat_grps *sgrps, char *page) | 296 | char *page) |
391 | { | 297 | { |
392 | struct se_device *dev = | 298 | struct se_device *dev = to_stat_lu_dev(item); |
393 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
394 | 299 | ||
395 | /* scsiLuNumCommands */ | 300 | /* scsiLuNumCommands */ |
396 | return snprintf(page, PAGE_SIZE, "%lu\n", | 301 | return snprintf(page, PAGE_SIZE, "%lu\n", |
397 | atomic_long_read(&dev->num_cmds)); | 302 | atomic_long_read(&dev->num_cmds)); |
398 | } | 303 | } |
399 | DEV_STAT_SCSI_LU_ATTR_RO(num_cmds); | ||
400 | 304 | ||
401 | static ssize_t target_stat_scsi_lu_show_attr_read_mbytes( | 305 | static ssize_t target_stat_lu_read_mbytes_show(struct config_item *item, |
402 | struct se_dev_stat_grps *sgrps, char *page) | 306 | char *page) |
403 | { | 307 | { |
404 | struct se_device *dev = | 308 | struct se_device *dev = to_stat_lu_dev(item); |
405 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
406 | 309 | ||
407 | /* scsiLuReadMegaBytes */ | 310 | /* scsiLuReadMegaBytes */ |
408 | return snprintf(page, PAGE_SIZE, "%lu\n", | 311 | return snprintf(page, PAGE_SIZE, "%lu\n", |
409 | atomic_long_read(&dev->read_bytes) >> 20); | 312 | atomic_long_read(&dev->read_bytes) >> 20); |
410 | } | 313 | } |
411 | DEV_STAT_SCSI_LU_ATTR_RO(read_mbytes); | ||
412 | 314 | ||
413 | static ssize_t target_stat_scsi_lu_show_attr_write_mbytes( | 315 | static ssize_t target_stat_lu_write_mbytes_show(struct config_item *item, |
414 | struct se_dev_stat_grps *sgrps, char *page) | 316 | char *page) |
415 | { | 317 | { |
416 | struct se_device *dev = | 318 | struct se_device *dev = to_stat_lu_dev(item); |
417 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
418 | 319 | ||
419 | /* scsiLuWrittenMegaBytes */ | 320 | /* scsiLuWrittenMegaBytes */ |
420 | return snprintf(page, PAGE_SIZE, "%lu\n", | 321 | return snprintf(page, PAGE_SIZE, "%lu\n", |
421 | atomic_long_read(&dev->write_bytes) >> 20); | 322 | atomic_long_read(&dev->write_bytes) >> 20); |
422 | } | 323 | } |
423 | DEV_STAT_SCSI_LU_ATTR_RO(write_mbytes); | ||
424 | 324 | ||
425 | static ssize_t target_stat_scsi_lu_show_attr_resets( | 325 | static ssize_t target_stat_lu_resets_show(struct config_item *item, char *page) |
426 | struct se_dev_stat_grps *sgrps, char *page) | ||
427 | { | 326 | { |
428 | struct se_device *dev = | 327 | struct se_device *dev = to_stat_lu_dev(item); |
429 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
430 | 328 | ||
431 | /* scsiLuInResets */ | 329 | /* scsiLuInResets */ |
432 | return snprintf(page, PAGE_SIZE, "%lu\n", atomic_long_read(&dev->num_resets)); | 330 | return snprintf(page, PAGE_SIZE, "%lu\n", |
331 | atomic_long_read(&dev->num_resets)); | ||
433 | } | 332 | } |
434 | DEV_STAT_SCSI_LU_ATTR_RO(resets); | ||
435 | 333 | ||
436 | static ssize_t target_stat_scsi_lu_show_attr_full_stat( | 334 | static ssize_t target_stat_lu_full_stat_show(struct config_item *item, |
437 | struct se_dev_stat_grps *sgrps, char *page) | 335 | char *page) |
438 | { | 336 | { |
439 | /* FIXME: scsiLuOutTaskSetFullStatus */ | 337 | /* FIXME: scsiLuOutTaskSetFullStatus */ |
440 | return snprintf(page, PAGE_SIZE, "%u\n", 0); | 338 | return snprintf(page, PAGE_SIZE, "%u\n", 0); |
441 | } | 339 | } |
442 | DEV_STAT_SCSI_LU_ATTR_RO(full_stat); | ||
443 | 340 | ||
444 | static ssize_t target_stat_scsi_lu_show_attr_hs_num_cmds( | 341 | static ssize_t target_stat_lu_hs_num_cmds_show(struct config_item *item, |
445 | struct se_dev_stat_grps *sgrps, char *page) | 342 | char *page) |
446 | { | 343 | { |
447 | /* FIXME: scsiLuHSInCommands */ | 344 | /* FIXME: scsiLuHSInCommands */ |
448 | return snprintf(page, PAGE_SIZE, "%u\n", 0); | 345 | return snprintf(page, PAGE_SIZE, "%u\n", 0); |
449 | } | 346 | } |
450 | DEV_STAT_SCSI_LU_ATTR_RO(hs_num_cmds); | ||
451 | 347 | ||
452 | static ssize_t target_stat_scsi_lu_show_attr_creation_time( | 348 | static ssize_t target_stat_lu_creation_time_show(struct config_item *item, |
453 | struct se_dev_stat_grps *sgrps, char *page) | 349 | char *page) |
454 | { | 350 | { |
455 | struct se_device *dev = | 351 | struct se_device *dev = to_stat_lu_dev(item); |
456 | container_of(sgrps, struct se_device, dev_stat_grps); | ||
457 | 352 | ||
458 | /* scsiLuCreationTime */ | 353 | /* scsiLuCreationTime */ |
459 | return snprintf(page, PAGE_SIZE, "%u\n", (u32)(((u32)dev->creation_time - | 354 | return snprintf(page, PAGE_SIZE, "%u\n", (u32)(((u32)dev->creation_time - |
460 | INITIAL_JIFFIES) * 100 / HZ)); | 355 | INITIAL_JIFFIES) * 100 / HZ)); |
461 | } | 356 | } |
462 | DEV_STAT_SCSI_LU_ATTR_RO(creation_time); | ||
463 | 357 | ||
464 | CONFIGFS_EATTR_OPS(target_stat_scsi_lu, se_dev_stat_grps, scsi_lu_group); | 358 | CONFIGFS_ATTR_RO(target_stat_lu_, inst); |
359 | CONFIGFS_ATTR_RO(target_stat_lu_, dev); | ||
360 | CONFIGFS_ATTR_RO(target_stat_lu_, indx); | ||
361 | CONFIGFS_ATTR_RO(target_stat_lu_, lun); | ||
362 | CONFIGFS_ATTR_RO(target_stat_lu_, lu_name); | ||
363 | CONFIGFS_ATTR_RO(target_stat_lu_, vend); | ||
364 | CONFIGFS_ATTR_RO(target_stat_lu_, prod); | ||
365 | CONFIGFS_ATTR_RO(target_stat_lu_, rev); | ||
366 | CONFIGFS_ATTR_RO(target_stat_lu_, dev_type); | ||
367 | CONFIGFS_ATTR_RO(target_stat_lu_, status); | ||
368 | CONFIGFS_ATTR_RO(target_stat_lu_, state_bit); | ||
369 | CONFIGFS_ATTR_RO(target_stat_lu_, num_cmds); | ||
370 | CONFIGFS_ATTR_RO(target_stat_lu_, read_mbytes); | ||
371 | CONFIGFS_ATTR_RO(target_stat_lu_, write_mbytes); | ||
372 | CONFIGFS_ATTR_RO(target_stat_lu_, resets); | ||
373 | CONFIGFS_ATTR_RO(target_stat_lu_, full_stat); | ||
374 | CONFIGFS_ATTR_RO(target_stat_lu_, hs_num_cmds); | ||
375 | CONFIGFS_ATTR_RO(target_stat_lu_, creation_time); | ||
465 | 376 | ||
466 | static struct configfs_attribute *target_stat_scsi_lu_attrs[] = { | 377 | static struct configfs_attribute *target_stat_scsi_lu_attrs[] = { |
467 | &target_stat_scsi_lu_inst.attr, | 378 | &target_stat_lu_attr_inst, |
468 | &target_stat_scsi_lu_dev.attr, | 379 | &target_stat_lu_attr_dev, |
469 | &target_stat_scsi_lu_indx.attr, | 380 | &target_stat_lu_attr_indx, |
470 | &target_stat_scsi_lu_lun.attr, | 381 | &target_stat_lu_attr_lun, |
471 | &target_stat_scsi_lu_lu_name.attr, | 382 | &target_stat_lu_attr_lu_name, |
472 | &target_stat_scsi_lu_vend.attr, | 383 | &target_stat_lu_attr_vend, |
473 | &target_stat_scsi_lu_prod.attr, | 384 | &target_stat_lu_attr_prod, |
474 | &target_stat_scsi_lu_rev.attr, | 385 | &target_stat_lu_attr_rev, |
475 | &target_stat_scsi_lu_dev_type.attr, | 386 | &target_stat_lu_attr_dev_type, |
476 | &target_stat_scsi_lu_status.attr, | 387 | &target_stat_lu_attr_status, |
477 | &target_stat_scsi_lu_state_bit.attr, | 388 | &target_stat_lu_attr_state_bit, |
478 | &target_stat_scsi_lu_num_cmds.attr, | 389 | &target_stat_lu_attr_num_cmds, |
479 | &target_stat_scsi_lu_read_mbytes.attr, | 390 | &target_stat_lu_attr_read_mbytes, |
480 | &target_stat_scsi_lu_write_mbytes.attr, | 391 | &target_stat_lu_attr_write_mbytes, |
481 | &target_stat_scsi_lu_resets.attr, | 392 | &target_stat_lu_attr_resets, |
482 | &target_stat_scsi_lu_full_stat.attr, | 393 | &target_stat_lu_attr_full_stat, |
483 | &target_stat_scsi_lu_hs_num_cmds.attr, | 394 | &target_stat_lu_attr_hs_num_cmds, |
484 | &target_stat_scsi_lu_creation_time.attr, | 395 | &target_stat_lu_attr_creation_time, |
485 | NULL, | 396 | NULL, |
486 | }; | 397 | }; |
487 | 398 | ||
488 | static struct configfs_item_operations target_stat_scsi_lu_attrib_ops = { | ||
489 | .show_attribute = target_stat_scsi_lu_attr_show, | ||
490 | .store_attribute = target_stat_scsi_lu_attr_store, | ||
491 | }; | ||
492 | |||
493 | static struct config_item_type target_stat_scsi_lu_cit = { | 399 | static struct config_item_type target_stat_scsi_lu_cit = { |
494 | .ct_item_ops = &target_stat_scsi_lu_attrib_ops, | ||
495 | .ct_attrs = target_stat_scsi_lu_attrs, | 400 | .ct_attrs = target_stat_scsi_lu_attrs, |
496 | .ct_owner = THIS_MODULE, | 401 | .ct_owner = THIS_MODULE, |
497 | }; | 402 | }; |
@@ -521,24 +426,16 @@ void target_stat_setup_dev_default_groups(struct se_device *dev) | |||
521 | * SCSI Port Table | 426 | * SCSI Port Table |
522 | */ | 427 | */ |
523 | 428 | ||
524 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_port, se_port_stat_grps); | 429 | static struct se_lun *to_stat_port(struct config_item *item) |
525 | #define DEV_STAT_SCSI_PORT_ATTR(_name, _mode) \ | 430 | { |
526 | static struct target_stat_scsi_port_attribute \ | 431 | struct se_port_stat_grps *pgrps = container_of(to_config_group(item), |
527 | target_stat_scsi_port_##_name = \ | 432 | struct se_port_stat_grps, scsi_port_group); |
528 | __CONFIGFS_EATTR(_name, _mode, \ | 433 | return container_of(pgrps, struct se_lun, port_stat_grps); |
529 | target_stat_scsi_port_show_attr_##_name, \ | 434 | } |
530 | target_stat_scsi_port_store_attr_##_name); | ||
531 | |||
532 | #define DEV_STAT_SCSI_PORT_ATTR_RO(_name) \ | ||
533 | static struct target_stat_scsi_port_attribute \ | ||
534 | target_stat_scsi_port_##_name = \ | ||
535 | __CONFIGFS_EATTR_RO(_name, \ | ||
536 | target_stat_scsi_port_show_attr_##_name); | ||
537 | 435 | ||
538 | static ssize_t target_stat_scsi_port_show_attr_inst( | 436 | static ssize_t target_stat_port_inst_show(struct config_item *item, char *page) |
539 | struct se_port_stat_grps *pgrps, char *page) | ||
540 | { | 437 | { |
541 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 438 | struct se_lun *lun = to_stat_port(item); |
542 | struct se_device *dev; | 439 | struct se_device *dev; |
543 | ssize_t ret = -ENODEV; | 440 | ssize_t ret = -ENODEV; |
544 | 441 | ||
@@ -549,12 +446,10 @@ static ssize_t target_stat_scsi_port_show_attr_inst( | |||
549 | rcu_read_unlock(); | 446 | rcu_read_unlock(); |
550 | return ret; | 447 | return ret; |
551 | } | 448 | } |
552 | DEV_STAT_SCSI_PORT_ATTR_RO(inst); | ||
553 | 449 | ||
554 | static ssize_t target_stat_scsi_port_show_attr_dev( | 450 | static ssize_t target_stat_port_dev_show(struct config_item *item, char *page) |
555 | struct se_port_stat_grps *pgrps, char *page) | ||
556 | { | 451 | { |
557 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 452 | struct se_lun *lun = to_stat_port(item); |
558 | struct se_device *dev; | 453 | struct se_device *dev; |
559 | ssize_t ret = -ENODEV; | 454 | ssize_t ret = -ENODEV; |
560 | 455 | ||
@@ -565,12 +460,10 @@ static ssize_t target_stat_scsi_port_show_attr_dev( | |||
565 | rcu_read_unlock(); | 460 | rcu_read_unlock(); |
566 | return ret; | 461 | return ret; |
567 | } | 462 | } |
568 | DEV_STAT_SCSI_PORT_ATTR_RO(dev); | ||
569 | 463 | ||
570 | static ssize_t target_stat_scsi_port_show_attr_indx( | 464 | static ssize_t target_stat_port_indx_show(struct config_item *item, char *page) |
571 | struct se_port_stat_grps *pgrps, char *page) | ||
572 | { | 465 | { |
573 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 466 | struct se_lun *lun = to_stat_port(item); |
574 | struct se_device *dev; | 467 | struct se_device *dev; |
575 | ssize_t ret = -ENODEV; | 468 | ssize_t ret = -ENODEV; |
576 | 469 | ||
@@ -581,12 +474,10 @@ static ssize_t target_stat_scsi_port_show_attr_indx( | |||
581 | rcu_read_unlock(); | 474 | rcu_read_unlock(); |
582 | return ret; | 475 | return ret; |
583 | } | 476 | } |
584 | DEV_STAT_SCSI_PORT_ATTR_RO(indx); | ||
585 | 477 | ||
586 | static ssize_t target_stat_scsi_port_show_attr_role( | 478 | static ssize_t target_stat_port_role_show(struct config_item *item, char *page) |
587 | struct se_port_stat_grps *pgrps, char *page) | ||
588 | { | 479 | { |
589 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 480 | struct se_lun *lun = to_stat_port(item); |
590 | struct se_device *dev; | 481 | struct se_device *dev; |
591 | ssize_t ret = -ENODEV; | 482 | ssize_t ret = -ENODEV; |
592 | 483 | ||
@@ -597,12 +488,11 @@ static ssize_t target_stat_scsi_port_show_attr_role( | |||
597 | rcu_read_unlock(); | 488 | rcu_read_unlock(); |
598 | return ret; | 489 | return ret; |
599 | } | 490 | } |
600 | DEV_STAT_SCSI_PORT_ATTR_RO(role); | ||
601 | 491 | ||
602 | static ssize_t target_stat_scsi_port_show_attr_busy_count( | 492 | static ssize_t target_stat_port_busy_count_show(struct config_item *item, |
603 | struct se_port_stat_grps *pgrps, char *page) | 493 | char *page) |
604 | { | 494 | { |
605 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 495 | struct se_lun *lun = to_stat_port(item); |
606 | struct se_device *dev; | 496 | struct se_device *dev; |
607 | ssize_t ret = -ENODEV; | 497 | ssize_t ret = -ENODEV; |
608 | 498 | ||
@@ -615,26 +505,23 @@ static ssize_t target_stat_scsi_port_show_attr_busy_count( | |||
615 | rcu_read_unlock(); | 505 | rcu_read_unlock(); |
616 | return ret; | 506 | return ret; |
617 | } | 507 | } |
618 | DEV_STAT_SCSI_PORT_ATTR_RO(busy_count); | ||
619 | 508 | ||
620 | CONFIGFS_EATTR_OPS(target_stat_scsi_port, se_port_stat_grps, scsi_port_group); | 509 | CONFIGFS_ATTR_RO(target_stat_port_, inst); |
510 | CONFIGFS_ATTR_RO(target_stat_port_, dev); | ||
511 | CONFIGFS_ATTR_RO(target_stat_port_, indx); | ||
512 | CONFIGFS_ATTR_RO(target_stat_port_, role); | ||
513 | CONFIGFS_ATTR_RO(target_stat_port_, busy_count); | ||
621 | 514 | ||
622 | static struct configfs_attribute *target_stat_scsi_port_attrs[] = { | 515 | static struct configfs_attribute *target_stat_scsi_port_attrs[] = { |
623 | &target_stat_scsi_port_inst.attr, | 516 | &target_stat_port_attr_inst, |
624 | &target_stat_scsi_port_dev.attr, | 517 | &target_stat_port_attr_dev, |
625 | &target_stat_scsi_port_indx.attr, | 518 | &target_stat_port_attr_indx, |
626 | &target_stat_scsi_port_role.attr, | 519 | &target_stat_port_attr_role, |
627 | &target_stat_scsi_port_busy_count.attr, | 520 | &target_stat_port_attr_busy_count, |
628 | NULL, | 521 | NULL, |
629 | }; | 522 | }; |
630 | 523 | ||
631 | static struct configfs_item_operations target_stat_scsi_port_attrib_ops = { | ||
632 | .show_attribute = target_stat_scsi_port_attr_show, | ||
633 | .store_attribute = target_stat_scsi_port_attr_store, | ||
634 | }; | ||
635 | |||
636 | static struct config_item_type target_stat_scsi_port_cit = { | 524 | static struct config_item_type target_stat_scsi_port_cit = { |
637 | .ct_item_ops = &target_stat_scsi_port_attrib_ops, | ||
638 | .ct_attrs = target_stat_scsi_port_attrs, | 525 | .ct_attrs = target_stat_scsi_port_attrs, |
639 | .ct_owner = THIS_MODULE, | 526 | .ct_owner = THIS_MODULE, |
640 | }; | 527 | }; |
@@ -642,24 +529,17 @@ static struct config_item_type target_stat_scsi_port_cit = { | |||
642 | /* | 529 | /* |
643 | * SCSI Target Port Table | 530 | * SCSI Target Port Table |
644 | */ | 531 | */ |
645 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_tgt_port, se_port_stat_grps); | 532 | static struct se_lun *to_stat_tgt_port(struct config_item *item) |
646 | #define DEV_STAT_SCSI_TGT_PORT_ATTR(_name, _mode) \ | 533 | { |
647 | static struct target_stat_scsi_tgt_port_attribute \ | 534 | struct se_port_stat_grps *pgrps = container_of(to_config_group(item), |
648 | target_stat_scsi_tgt_port_##_name = \ | 535 | struct se_port_stat_grps, scsi_tgt_port_group); |
649 | __CONFIGFS_EATTR(_name, _mode, \ | 536 | return container_of(pgrps, struct se_lun, port_stat_grps); |
650 | target_stat_scsi_tgt_port_show_attr_##_name, \ | 537 | } |
651 | target_stat_scsi_tgt_port_store_attr_##_name); | 538 | |
652 | 539 | static ssize_t target_stat_tgt_port_inst_show(struct config_item *item, | |
653 | #define DEV_STAT_SCSI_TGT_PORT_ATTR_RO(_name) \ | 540 | char *page) |
654 | static struct target_stat_scsi_tgt_port_attribute \ | 541 | { |
655 | target_stat_scsi_tgt_port_##_name = \ | 542 | struct se_lun *lun = to_stat_tgt_port(item); |
656 | __CONFIGFS_EATTR_RO(_name, \ | ||
657 | target_stat_scsi_tgt_port_show_attr_##_name); | ||
658 | |||
659 | static ssize_t target_stat_scsi_tgt_port_show_attr_inst( | ||
660 | struct se_port_stat_grps *pgrps, char *page) | ||
661 | { | ||
662 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | ||
663 | struct se_device *dev; | 543 | struct se_device *dev; |
664 | ssize_t ret = -ENODEV; | 544 | ssize_t ret = -ENODEV; |
665 | 545 | ||
@@ -670,12 +550,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_inst( | |||
670 | rcu_read_unlock(); | 550 | rcu_read_unlock(); |
671 | return ret; | 551 | return ret; |
672 | } | 552 | } |
673 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(inst); | ||
674 | 553 | ||
675 | static ssize_t target_stat_scsi_tgt_port_show_attr_dev( | 554 | static ssize_t target_stat_tgt_port_dev_show(struct config_item *item, |
676 | struct se_port_stat_grps *pgrps, char *page) | 555 | char *page) |
677 | { | 556 | { |
678 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 557 | struct se_lun *lun = to_stat_tgt_port(item); |
679 | struct se_device *dev; | 558 | struct se_device *dev; |
680 | ssize_t ret = -ENODEV; | 559 | ssize_t ret = -ENODEV; |
681 | 560 | ||
@@ -686,12 +565,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_dev( | |||
686 | rcu_read_unlock(); | 565 | rcu_read_unlock(); |
687 | return ret; | 566 | return ret; |
688 | } | 567 | } |
689 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(dev); | ||
690 | 568 | ||
691 | static ssize_t target_stat_scsi_tgt_port_show_attr_indx( | 569 | static ssize_t target_stat_tgt_port_indx_show(struct config_item *item, |
692 | struct se_port_stat_grps *pgrps, char *page) | 570 | char *page) |
693 | { | 571 | { |
694 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 572 | struct se_lun *lun = to_stat_tgt_port(item); |
695 | struct se_device *dev; | 573 | struct se_device *dev; |
696 | ssize_t ret = -ENODEV; | 574 | ssize_t ret = -ENODEV; |
697 | 575 | ||
@@ -702,12 +580,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_indx( | |||
702 | rcu_read_unlock(); | 580 | rcu_read_unlock(); |
703 | return ret; | 581 | return ret; |
704 | } | 582 | } |
705 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(indx); | ||
706 | 583 | ||
707 | static ssize_t target_stat_scsi_tgt_port_show_attr_name( | 584 | static ssize_t target_stat_tgt_port_name_show(struct config_item *item, |
708 | struct se_port_stat_grps *pgrps, char *page) | 585 | char *page) |
709 | { | 586 | { |
710 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 587 | struct se_lun *lun = to_stat_tgt_port(item); |
711 | struct se_portal_group *tpg = lun->lun_tpg; | 588 | struct se_portal_group *tpg = lun->lun_tpg; |
712 | struct se_device *dev; | 589 | struct se_device *dev; |
713 | ssize_t ret = -ENODEV; | 590 | ssize_t ret = -ENODEV; |
@@ -721,12 +598,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_name( | |||
721 | rcu_read_unlock(); | 598 | rcu_read_unlock(); |
722 | return ret; | 599 | return ret; |
723 | } | 600 | } |
724 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(name); | ||
725 | 601 | ||
726 | static ssize_t target_stat_scsi_tgt_port_show_attr_port_index( | 602 | static ssize_t target_stat_tgt_port_port_index_show(struct config_item *item, |
727 | struct se_port_stat_grps *pgrps, char *page) | 603 | char *page) |
728 | { | 604 | { |
729 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 605 | struct se_lun *lun = to_stat_tgt_port(item); |
730 | struct se_portal_group *tpg = lun->lun_tpg; | 606 | struct se_portal_group *tpg = lun->lun_tpg; |
731 | struct se_device *dev; | 607 | struct se_device *dev; |
732 | ssize_t ret = -ENODEV; | 608 | ssize_t ret = -ENODEV; |
@@ -740,12 +616,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_port_index( | |||
740 | rcu_read_unlock(); | 616 | rcu_read_unlock(); |
741 | return ret; | 617 | return ret; |
742 | } | 618 | } |
743 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(port_index); | ||
744 | 619 | ||
745 | static ssize_t target_stat_scsi_tgt_port_show_attr_in_cmds( | 620 | static ssize_t target_stat_tgt_port_in_cmds_show(struct config_item *item, |
746 | struct se_port_stat_grps *pgrps, char *page) | 621 | char *page) |
747 | { | 622 | { |
748 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 623 | struct se_lun *lun = to_stat_tgt_port(item); |
749 | struct se_device *dev; | 624 | struct se_device *dev; |
750 | ssize_t ret = -ENODEV; | 625 | ssize_t ret = -ENODEV; |
751 | 626 | ||
@@ -757,12 +632,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_in_cmds( | |||
757 | rcu_read_unlock(); | 632 | rcu_read_unlock(); |
758 | return ret; | 633 | return ret; |
759 | } | 634 | } |
760 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(in_cmds); | ||
761 | 635 | ||
762 | static ssize_t target_stat_scsi_tgt_port_show_attr_write_mbytes( | 636 | static ssize_t target_stat_tgt_port_write_mbytes_show(struct config_item *item, |
763 | struct se_port_stat_grps *pgrps, char *page) | 637 | char *page) |
764 | { | 638 | { |
765 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 639 | struct se_lun *lun = to_stat_tgt_port(item); |
766 | struct se_device *dev; | 640 | struct se_device *dev; |
767 | ssize_t ret = -ENODEV; | 641 | ssize_t ret = -ENODEV; |
768 | 642 | ||
@@ -774,12 +648,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_write_mbytes( | |||
774 | rcu_read_unlock(); | 648 | rcu_read_unlock(); |
775 | return ret; | 649 | return ret; |
776 | } | 650 | } |
777 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(write_mbytes); | ||
778 | 651 | ||
779 | static ssize_t target_stat_scsi_tgt_port_show_attr_read_mbytes( | 652 | static ssize_t target_stat_tgt_port_read_mbytes_show(struct config_item *item, |
780 | struct se_port_stat_grps *pgrps, char *page) | 653 | char *page) |
781 | { | 654 | { |
782 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 655 | struct se_lun *lun = to_stat_tgt_port(item); |
783 | struct se_device *dev; | 656 | struct se_device *dev; |
784 | ssize_t ret = -ENODEV; | 657 | ssize_t ret = -ENODEV; |
785 | 658 | ||
@@ -791,12 +664,11 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_read_mbytes( | |||
791 | rcu_read_unlock(); | 664 | rcu_read_unlock(); |
792 | return ret; | 665 | return ret; |
793 | } | 666 | } |
794 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(read_mbytes); | ||
795 | 667 | ||
796 | static ssize_t target_stat_scsi_tgt_port_show_attr_hs_in_cmds( | 668 | static ssize_t target_stat_tgt_port_hs_in_cmds_show(struct config_item *item, |
797 | struct se_port_stat_grps *pgrps, char *page) | 669 | char *page) |
798 | { | 670 | { |
799 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 671 | struct se_lun *lun = to_stat_tgt_port(item); |
800 | struct se_device *dev; | 672 | struct se_device *dev; |
801 | ssize_t ret = -ENODEV; | 673 | ssize_t ret = -ENODEV; |
802 | 674 | ||
@@ -809,57 +681,49 @@ static ssize_t target_stat_scsi_tgt_port_show_attr_hs_in_cmds( | |||
809 | rcu_read_unlock(); | 681 | rcu_read_unlock(); |
810 | return ret; | 682 | return ret; |
811 | } | 683 | } |
812 | DEV_STAT_SCSI_TGT_PORT_ATTR_RO(hs_in_cmds); | ||
813 | 684 | ||
814 | CONFIGFS_EATTR_OPS(target_stat_scsi_tgt_port, se_port_stat_grps, | 685 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, inst); |
815 | scsi_tgt_port_group); | 686 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, dev); |
687 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, indx); | ||
688 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, name); | ||
689 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, port_index); | ||
690 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, in_cmds); | ||
691 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, write_mbytes); | ||
692 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, read_mbytes); | ||
693 | CONFIGFS_ATTR_RO(target_stat_tgt_port_, hs_in_cmds); | ||
816 | 694 | ||
817 | static struct configfs_attribute *target_stat_scsi_tgt_port_attrs[] = { | 695 | static struct configfs_attribute *target_stat_scsi_tgt_port_attrs[] = { |
818 | &target_stat_scsi_tgt_port_inst.attr, | 696 | &target_stat_tgt_port_attr_inst, |
819 | &target_stat_scsi_tgt_port_dev.attr, | 697 | &target_stat_tgt_port_attr_dev, |
820 | &target_stat_scsi_tgt_port_indx.attr, | 698 | &target_stat_tgt_port_attr_indx, |
821 | &target_stat_scsi_tgt_port_name.attr, | 699 | &target_stat_tgt_port_attr_name, |
822 | &target_stat_scsi_tgt_port_port_index.attr, | 700 | &target_stat_tgt_port_attr_port_index, |
823 | &target_stat_scsi_tgt_port_in_cmds.attr, | 701 | &target_stat_tgt_port_attr_in_cmds, |
824 | &target_stat_scsi_tgt_port_write_mbytes.attr, | 702 | &target_stat_tgt_port_attr_write_mbytes, |
825 | &target_stat_scsi_tgt_port_read_mbytes.attr, | 703 | &target_stat_tgt_port_attr_read_mbytes, |
826 | &target_stat_scsi_tgt_port_hs_in_cmds.attr, | 704 | &target_stat_tgt_port_attr_hs_in_cmds, |
827 | NULL, | 705 | NULL, |
828 | }; | 706 | }; |
829 | 707 | ||
830 | static struct configfs_item_operations target_stat_scsi_tgt_port_attrib_ops = { | ||
831 | .show_attribute = target_stat_scsi_tgt_port_attr_show, | ||
832 | .store_attribute = target_stat_scsi_tgt_port_attr_store, | ||
833 | }; | ||
834 | |||
835 | static struct config_item_type target_stat_scsi_tgt_port_cit = { | 708 | static struct config_item_type target_stat_scsi_tgt_port_cit = { |
836 | .ct_item_ops = &target_stat_scsi_tgt_port_attrib_ops, | ||
837 | .ct_attrs = target_stat_scsi_tgt_port_attrs, | 709 | .ct_attrs = target_stat_scsi_tgt_port_attrs, |
838 | .ct_owner = THIS_MODULE, | 710 | .ct_owner = THIS_MODULE, |
839 | }; | 711 | }; |
840 | 712 | ||
841 | /* | 713 | /* |
842 | * SCSI Transport Table | 714 | * SCSI Transport Table |
843 | o */ | 715 | */ |
844 | 716 | static struct se_lun *to_transport_stat(struct config_item *item) | |
845 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_transport, se_port_stat_grps); | 717 | { |
846 | #define DEV_STAT_SCSI_TRANSPORT_ATTR(_name, _mode) \ | 718 | struct se_port_stat_grps *pgrps = container_of(to_config_group(item), |
847 | static struct target_stat_scsi_transport_attribute \ | 719 | struct se_port_stat_grps, scsi_transport_group); |
848 | target_stat_scsi_transport_##_name = \ | 720 | return container_of(pgrps, struct se_lun, port_stat_grps); |
849 | __CONFIGFS_EATTR(_name, _mode, \ | 721 | } |
850 | target_stat_scsi_transport_show_attr_##_name, \ | 722 | |
851 | target_stat_scsi_transport_store_attr_##_name); | 723 | static ssize_t target_stat_transport_inst_show(struct config_item *item, |
852 | 724 | char *page) | |
853 | #define DEV_STAT_SCSI_TRANSPORT_ATTR_RO(_name) \ | 725 | { |
854 | static struct target_stat_scsi_transport_attribute \ | 726 | struct se_lun *lun = to_transport_stat(item); |
855 | target_stat_scsi_transport_##_name = \ | ||
856 | __CONFIGFS_EATTR_RO(_name, \ | ||
857 | target_stat_scsi_transport_show_attr_##_name); | ||
858 | |||
859 | static ssize_t target_stat_scsi_transport_show_attr_inst( | ||
860 | struct se_port_stat_grps *pgrps, char *page) | ||
861 | { | ||
862 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | ||
863 | struct se_device *dev; | 727 | struct se_device *dev; |
864 | ssize_t ret = -ENODEV; | 728 | ssize_t ret = -ENODEV; |
865 | 729 | ||
@@ -870,12 +734,11 @@ static ssize_t target_stat_scsi_transport_show_attr_inst( | |||
870 | rcu_read_unlock(); | 734 | rcu_read_unlock(); |
871 | return ret; | 735 | return ret; |
872 | } | 736 | } |
873 | DEV_STAT_SCSI_TRANSPORT_ATTR_RO(inst); | ||
874 | 737 | ||
875 | static ssize_t target_stat_scsi_transport_show_attr_device( | 738 | static ssize_t target_stat_transport_device_show(struct config_item *item, |
876 | struct se_port_stat_grps *pgrps, char *page) | 739 | char *page) |
877 | { | 740 | { |
878 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 741 | struct se_lun *lun = to_transport_stat(item); |
879 | struct se_device *dev; | 742 | struct se_device *dev; |
880 | struct se_portal_group *tpg = lun->lun_tpg; | 743 | struct se_portal_group *tpg = lun->lun_tpg; |
881 | ssize_t ret = -ENODEV; | 744 | ssize_t ret = -ENODEV; |
@@ -890,12 +753,11 @@ static ssize_t target_stat_scsi_transport_show_attr_device( | |||
890 | rcu_read_unlock(); | 753 | rcu_read_unlock(); |
891 | return ret; | 754 | return ret; |
892 | } | 755 | } |
893 | DEV_STAT_SCSI_TRANSPORT_ATTR_RO(device); | ||
894 | 756 | ||
895 | static ssize_t target_stat_scsi_transport_show_attr_indx( | 757 | static ssize_t target_stat_transport_indx_show(struct config_item *item, |
896 | struct se_port_stat_grps *pgrps, char *page) | 758 | char *page) |
897 | { | 759 | { |
898 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 760 | struct se_lun *lun = to_transport_stat(item); |
899 | struct se_device *dev; | 761 | struct se_device *dev; |
900 | struct se_portal_group *tpg = lun->lun_tpg; | 762 | struct se_portal_group *tpg = lun->lun_tpg; |
901 | ssize_t ret = -ENODEV; | 763 | ssize_t ret = -ENODEV; |
@@ -908,12 +770,11 @@ static ssize_t target_stat_scsi_transport_show_attr_indx( | |||
908 | rcu_read_unlock(); | 770 | rcu_read_unlock(); |
909 | return ret; | 771 | return ret; |
910 | } | 772 | } |
911 | DEV_STAT_SCSI_TRANSPORT_ATTR_RO(indx); | ||
912 | 773 | ||
913 | static ssize_t target_stat_scsi_transport_show_attr_dev_name( | 774 | static ssize_t target_stat_transport_dev_name_show(struct config_item *item, |
914 | struct se_port_stat_grps *pgrps, char *page) | 775 | char *page) |
915 | { | 776 | { |
916 | struct se_lun *lun = container_of(pgrps, struct se_lun, port_stat_grps); | 777 | struct se_lun *lun = to_transport_stat(item); |
917 | struct se_device *dev; | 778 | struct se_device *dev; |
918 | struct se_portal_group *tpg = lun->lun_tpg; | 779 | struct se_portal_group *tpg = lun->lun_tpg; |
919 | struct t10_wwn *wwn; | 780 | struct t10_wwn *wwn; |
@@ -932,26 +793,21 @@ static ssize_t target_stat_scsi_transport_show_attr_dev_name( | |||
932 | rcu_read_unlock(); | 793 | rcu_read_unlock(); |
933 | return ret; | 794 | return ret; |
934 | } | 795 | } |
935 | DEV_STAT_SCSI_TRANSPORT_ATTR_RO(dev_name); | ||
936 | 796 | ||
937 | CONFIGFS_EATTR_OPS(target_stat_scsi_transport, se_port_stat_grps, | 797 | CONFIGFS_ATTR_RO(target_stat_transport_, inst); |
938 | scsi_transport_group); | 798 | CONFIGFS_ATTR_RO(target_stat_transport_, device); |
799 | CONFIGFS_ATTR_RO(target_stat_transport_, indx); | ||
800 | CONFIGFS_ATTR_RO(target_stat_transport_, dev_name); | ||
939 | 801 | ||
940 | static struct configfs_attribute *target_stat_scsi_transport_attrs[] = { | 802 | static struct configfs_attribute *target_stat_scsi_transport_attrs[] = { |
941 | &target_stat_scsi_transport_inst.attr, | 803 | &target_stat_transport_attr_inst, |
942 | &target_stat_scsi_transport_device.attr, | 804 | &target_stat_transport_attr_device, |
943 | &target_stat_scsi_transport_indx.attr, | 805 | &target_stat_transport_attr_indx, |
944 | &target_stat_scsi_transport_dev_name.attr, | 806 | &target_stat_transport_attr_dev_name, |
945 | NULL, | 807 | NULL, |
946 | }; | 808 | }; |
947 | 809 | ||
948 | static struct configfs_item_operations target_stat_scsi_transport_attrib_ops = { | ||
949 | .show_attribute = target_stat_scsi_transport_attr_show, | ||
950 | .store_attribute = target_stat_scsi_transport_attr_store, | ||
951 | }; | ||
952 | |||
953 | static struct config_item_type target_stat_scsi_transport_cit = { | 810 | static struct config_item_type target_stat_scsi_transport_cit = { |
954 | .ct_item_ops = &target_stat_scsi_transport_attrib_ops, | ||
955 | .ct_attrs = target_stat_scsi_transport_attrs, | 811 | .ct_attrs = target_stat_scsi_transport_attrs, |
956 | .ct_owner = THIS_MODULE, | 812 | .ct_owner = THIS_MODULE, |
957 | }; | 813 | }; |
@@ -981,25 +837,17 @@ void target_stat_setup_port_default_groups(struct se_lun *lun) | |||
981 | * SCSI Authorized Initiator Table | 837 | * SCSI Authorized Initiator Table |
982 | */ | 838 | */ |
983 | 839 | ||
984 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_auth_intr, se_ml_stat_grps); | 840 | static struct se_lun_acl *auth_to_lacl(struct config_item *item) |
985 | #define DEV_STAT_SCSI_AUTH_INTR_ATTR(_name, _mode) \ | 841 | { |
986 | static struct target_stat_scsi_auth_intr_attribute \ | 842 | struct se_ml_stat_grps *lgrps = container_of(to_config_group(item), |
987 | target_stat_scsi_auth_intr_##_name = \ | 843 | struct se_ml_stat_grps, scsi_auth_intr_group); |
988 | __CONFIGFS_EATTR(_name, _mode, \ | 844 | return container_of(lgrps, struct se_lun_acl, ml_stat_grps); |
989 | target_stat_scsi_auth_intr_show_attr_##_name, \ | 845 | } |
990 | target_stat_scsi_auth_intr_store_attr_##_name); | 846 | |
991 | 847 | static ssize_t target_stat_auth_inst_show(struct config_item *item, | |
992 | #define DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(_name) \ | 848 | char *page) |
993 | static struct target_stat_scsi_auth_intr_attribute \ | 849 | { |
994 | target_stat_scsi_auth_intr_##_name = \ | 850 | struct se_lun_acl *lacl = auth_to_lacl(item); |
995 | __CONFIGFS_EATTR_RO(_name, \ | ||
996 | target_stat_scsi_auth_intr_show_attr_##_name); | ||
997 | |||
998 | static ssize_t target_stat_scsi_auth_intr_show_attr_inst( | ||
999 | struct se_ml_stat_grps *lgrps, char *page) | ||
1000 | { | ||
1001 | struct se_lun_acl *lacl = container_of(lgrps, | ||
1002 | struct se_lun_acl, ml_stat_grps); | ||
1003 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 851 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1004 | struct se_dev_entry *deve; | 852 | struct se_dev_entry *deve; |
1005 | struct se_portal_group *tpg; | 853 | struct se_portal_group *tpg; |
@@ -1018,13 +866,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_inst( | |||
1018 | rcu_read_unlock(); | 866 | rcu_read_unlock(); |
1019 | return ret; | 867 | return ret; |
1020 | } | 868 | } |
1021 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(inst); | ||
1022 | 869 | ||
1023 | static ssize_t target_stat_scsi_auth_intr_show_attr_dev( | 870 | static ssize_t target_stat_auth_dev_show(struct config_item *item, |
1024 | struct se_ml_stat_grps *lgrps, char *page) | 871 | char *page) |
1025 | { | 872 | { |
1026 | struct se_lun_acl *lacl = container_of(lgrps, | 873 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1027 | struct se_lun_acl, ml_stat_grps); | ||
1028 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 874 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1029 | struct se_dev_entry *deve; | 875 | struct se_dev_entry *deve; |
1030 | struct se_lun *lun; | 876 | struct se_lun *lun; |
@@ -1042,13 +888,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev( | |||
1042 | rcu_read_unlock(); | 888 | rcu_read_unlock(); |
1043 | return ret; | 889 | return ret; |
1044 | } | 890 | } |
1045 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(dev); | ||
1046 | 891 | ||
1047 | static ssize_t target_stat_scsi_auth_intr_show_attr_port( | 892 | static ssize_t target_stat_auth_port_show(struct config_item *item, |
1048 | struct se_ml_stat_grps *lgrps, char *page) | 893 | char *page) |
1049 | { | 894 | { |
1050 | struct se_lun_acl *lacl = container_of(lgrps, | 895 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1051 | struct se_lun_acl, ml_stat_grps); | ||
1052 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 896 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1053 | struct se_dev_entry *deve; | 897 | struct se_dev_entry *deve; |
1054 | struct se_portal_group *tpg; | 898 | struct se_portal_group *tpg; |
@@ -1066,13 +910,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_port( | |||
1066 | rcu_read_unlock(); | 910 | rcu_read_unlock(); |
1067 | return ret; | 911 | return ret; |
1068 | } | 912 | } |
1069 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(port); | ||
1070 | 913 | ||
1071 | static ssize_t target_stat_scsi_auth_intr_show_attr_indx( | 914 | static ssize_t target_stat_auth_indx_show(struct config_item *item, |
1072 | struct se_ml_stat_grps *lgrps, char *page) | 915 | char *page) |
1073 | { | 916 | { |
1074 | struct se_lun_acl *lacl = container_of(lgrps, | 917 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1075 | struct se_lun_acl, ml_stat_grps); | ||
1076 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 918 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1077 | struct se_dev_entry *deve; | 919 | struct se_dev_entry *deve; |
1078 | ssize_t ret; | 920 | ssize_t ret; |
@@ -1088,13 +930,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_indx( | |||
1088 | rcu_read_unlock(); | 930 | rcu_read_unlock(); |
1089 | return ret; | 931 | return ret; |
1090 | } | 932 | } |
1091 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(indx); | ||
1092 | 933 | ||
1093 | static ssize_t target_stat_scsi_auth_intr_show_attr_dev_or_port( | 934 | static ssize_t target_stat_auth_dev_or_port_show(struct config_item *item, |
1094 | struct se_ml_stat_grps *lgrps, char *page) | 935 | char *page) |
1095 | { | 936 | { |
1096 | struct se_lun_acl *lacl = container_of(lgrps, | 937 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1097 | struct se_lun_acl, ml_stat_grps); | ||
1098 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 938 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1099 | struct se_dev_entry *deve; | 939 | struct se_dev_entry *deve; |
1100 | ssize_t ret; | 940 | ssize_t ret; |
@@ -1110,13 +950,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_dev_or_port( | |||
1110 | rcu_read_unlock(); | 950 | rcu_read_unlock(); |
1111 | return ret; | 951 | return ret; |
1112 | } | 952 | } |
1113 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(dev_or_port); | ||
1114 | 953 | ||
1115 | static ssize_t target_stat_scsi_auth_intr_show_attr_intr_name( | 954 | static ssize_t target_stat_auth_intr_name_show(struct config_item *item, |
1116 | struct se_ml_stat_grps *lgrps, char *page) | 955 | char *page) |
1117 | { | 956 | { |
1118 | struct se_lun_acl *lacl = container_of(lgrps, | 957 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1119 | struct se_lun_acl, ml_stat_grps); | ||
1120 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 958 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1121 | struct se_dev_entry *deve; | 959 | struct se_dev_entry *deve; |
1122 | ssize_t ret; | 960 | ssize_t ret; |
@@ -1132,13 +970,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_intr_name( | |||
1132 | rcu_read_unlock(); | 970 | rcu_read_unlock(); |
1133 | return ret; | 971 | return ret; |
1134 | } | 972 | } |
1135 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(intr_name); | ||
1136 | 973 | ||
1137 | static ssize_t target_stat_scsi_auth_intr_show_attr_map_indx( | 974 | static ssize_t target_stat_auth_map_indx_show(struct config_item *item, |
1138 | struct se_ml_stat_grps *lgrps, char *page) | 975 | char *page) |
1139 | { | 976 | { |
1140 | struct se_lun_acl *lacl = container_of(lgrps, | 977 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1141 | struct se_lun_acl, ml_stat_grps); | ||
1142 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 978 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1143 | struct se_dev_entry *deve; | 979 | struct se_dev_entry *deve; |
1144 | ssize_t ret; | 980 | ssize_t ret; |
@@ -1154,13 +990,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_map_indx( | |||
1154 | rcu_read_unlock(); | 990 | rcu_read_unlock(); |
1155 | return ret; | 991 | return ret; |
1156 | } | 992 | } |
1157 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(map_indx); | ||
1158 | 993 | ||
1159 | static ssize_t target_stat_scsi_auth_intr_show_attr_att_count( | 994 | static ssize_t target_stat_auth_att_count_show(struct config_item *item, |
1160 | struct se_ml_stat_grps *lgrps, char *page) | 995 | char *page) |
1161 | { | 996 | { |
1162 | struct se_lun_acl *lacl = container_of(lgrps, | 997 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1163 | struct se_lun_acl, ml_stat_grps); | ||
1164 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 998 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1165 | struct se_dev_entry *deve; | 999 | struct se_dev_entry *deve; |
1166 | ssize_t ret; | 1000 | ssize_t ret; |
@@ -1176,13 +1010,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_att_count( | |||
1176 | rcu_read_unlock(); | 1010 | rcu_read_unlock(); |
1177 | return ret; | 1011 | return ret; |
1178 | } | 1012 | } |
1179 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(att_count); | ||
1180 | 1013 | ||
1181 | static ssize_t target_stat_scsi_auth_intr_show_attr_num_cmds( | 1014 | static ssize_t target_stat_auth_num_cmds_show(struct config_item *item, |
1182 | struct se_ml_stat_grps *lgrps, char *page) | 1015 | char *page) |
1183 | { | 1016 | { |
1184 | struct se_lun_acl *lacl = container_of(lgrps, | 1017 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1185 | struct se_lun_acl, ml_stat_grps); | ||
1186 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1018 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1187 | struct se_dev_entry *deve; | 1019 | struct se_dev_entry *deve; |
1188 | ssize_t ret; | 1020 | ssize_t ret; |
@@ -1199,13 +1031,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_num_cmds( | |||
1199 | rcu_read_unlock(); | 1031 | rcu_read_unlock(); |
1200 | return ret; | 1032 | return ret; |
1201 | } | 1033 | } |
1202 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(num_cmds); | ||
1203 | 1034 | ||
1204 | static ssize_t target_stat_scsi_auth_intr_show_attr_read_mbytes( | 1035 | static ssize_t target_stat_auth_read_mbytes_show(struct config_item *item, |
1205 | struct se_ml_stat_grps *lgrps, char *page) | 1036 | char *page) |
1206 | { | 1037 | { |
1207 | struct se_lun_acl *lacl = container_of(lgrps, | 1038 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1208 | struct se_lun_acl, ml_stat_grps); | ||
1209 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1039 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1210 | struct se_dev_entry *deve; | 1040 | struct se_dev_entry *deve; |
1211 | ssize_t ret; | 1041 | ssize_t ret; |
@@ -1222,13 +1052,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_read_mbytes( | |||
1222 | rcu_read_unlock(); | 1052 | rcu_read_unlock(); |
1223 | return ret; | 1053 | return ret; |
1224 | } | 1054 | } |
1225 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(read_mbytes); | ||
1226 | 1055 | ||
1227 | static ssize_t target_stat_scsi_auth_intr_show_attr_write_mbytes( | 1056 | static ssize_t target_stat_auth_write_mbytes_show(struct config_item *item, |
1228 | struct se_ml_stat_grps *lgrps, char *page) | 1057 | char *page) |
1229 | { | 1058 | { |
1230 | struct se_lun_acl *lacl = container_of(lgrps, | 1059 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1231 | struct se_lun_acl, ml_stat_grps); | ||
1232 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1060 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1233 | struct se_dev_entry *deve; | 1061 | struct se_dev_entry *deve; |
1234 | ssize_t ret; | 1062 | ssize_t ret; |
@@ -1245,13 +1073,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_write_mbytes( | |||
1245 | rcu_read_unlock(); | 1073 | rcu_read_unlock(); |
1246 | return ret; | 1074 | return ret; |
1247 | } | 1075 | } |
1248 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(write_mbytes); | ||
1249 | 1076 | ||
1250 | static ssize_t target_stat_scsi_auth_intr_show_attr_hs_num_cmds( | 1077 | static ssize_t target_stat_auth_hs_num_cmds_show(struct config_item *item, |
1251 | struct se_ml_stat_grps *lgrps, char *page) | 1078 | char *page) |
1252 | { | 1079 | { |
1253 | struct se_lun_acl *lacl = container_of(lgrps, | 1080 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1254 | struct se_lun_acl, ml_stat_grps); | ||
1255 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1081 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1256 | struct se_dev_entry *deve; | 1082 | struct se_dev_entry *deve; |
1257 | ssize_t ret; | 1083 | ssize_t ret; |
@@ -1267,13 +1093,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_hs_num_cmds( | |||
1267 | rcu_read_unlock(); | 1093 | rcu_read_unlock(); |
1268 | return ret; | 1094 | return ret; |
1269 | } | 1095 | } |
1270 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(hs_num_cmds); | ||
1271 | 1096 | ||
1272 | static ssize_t target_stat_scsi_auth_intr_show_attr_creation_time( | 1097 | static ssize_t target_stat_auth_creation_time_show(struct config_item *item, |
1273 | struct se_ml_stat_grps *lgrps, char *page) | 1098 | char *page) |
1274 | { | 1099 | { |
1275 | struct se_lun_acl *lacl = container_of(lgrps, | 1100 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1276 | struct se_lun_acl, ml_stat_grps); | ||
1277 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1101 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1278 | struct se_dev_entry *deve; | 1102 | struct se_dev_entry *deve; |
1279 | ssize_t ret; | 1103 | ssize_t ret; |
@@ -1290,13 +1114,11 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_creation_time( | |||
1290 | rcu_read_unlock(); | 1114 | rcu_read_unlock(); |
1291 | return ret; | 1115 | return ret; |
1292 | } | 1116 | } |
1293 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(creation_time); | ||
1294 | 1117 | ||
1295 | static ssize_t target_stat_scsi_auth_intr_show_attr_row_status( | 1118 | static ssize_t target_stat_auth_row_status_show(struct config_item *item, |
1296 | struct se_ml_stat_grps *lgrps, char *page) | 1119 | char *page) |
1297 | { | 1120 | { |
1298 | struct se_lun_acl *lacl = container_of(lgrps, | 1121 | struct se_lun_acl *lacl = auth_to_lacl(item); |
1299 | struct se_lun_acl, ml_stat_grps); | ||
1300 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1122 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1301 | struct se_dev_entry *deve; | 1123 | struct se_dev_entry *deve; |
1302 | ssize_t ret; | 1124 | ssize_t ret; |
@@ -1312,36 +1134,41 @@ static ssize_t target_stat_scsi_auth_intr_show_attr_row_status( | |||
1312 | rcu_read_unlock(); | 1134 | rcu_read_unlock(); |
1313 | return ret; | 1135 | return ret; |
1314 | } | 1136 | } |
1315 | DEV_STAT_SCSI_AUTH_INTR_ATTR_RO(row_status); | ||
1316 | 1137 | ||
1317 | CONFIGFS_EATTR_OPS(target_stat_scsi_auth_intr, se_ml_stat_grps, | 1138 | CONFIGFS_ATTR_RO(target_stat_auth_, inst); |
1318 | scsi_auth_intr_group); | 1139 | CONFIGFS_ATTR_RO(target_stat_auth_, dev); |
1140 | CONFIGFS_ATTR_RO(target_stat_auth_, port); | ||
1141 | CONFIGFS_ATTR_RO(target_stat_auth_, indx); | ||
1142 | CONFIGFS_ATTR_RO(target_stat_auth_, dev_or_port); | ||
1143 | CONFIGFS_ATTR_RO(target_stat_auth_, intr_name); | ||
1144 | CONFIGFS_ATTR_RO(target_stat_auth_, map_indx); | ||
1145 | CONFIGFS_ATTR_RO(target_stat_auth_, att_count); | ||
1146 | CONFIGFS_ATTR_RO(target_stat_auth_, num_cmds); | ||
1147 | CONFIGFS_ATTR_RO(target_stat_auth_, read_mbytes); | ||
1148 | CONFIGFS_ATTR_RO(target_stat_auth_, write_mbytes); | ||
1149 | CONFIGFS_ATTR_RO(target_stat_auth_, hs_num_cmds); | ||
1150 | CONFIGFS_ATTR_RO(target_stat_auth_, creation_time); | ||
1151 | CONFIGFS_ATTR_RO(target_stat_auth_, row_status); | ||
1319 | 1152 | ||
1320 | static struct configfs_attribute *target_stat_scsi_auth_intr_attrs[] = { | 1153 | static struct configfs_attribute *target_stat_scsi_auth_intr_attrs[] = { |
1321 | &target_stat_scsi_auth_intr_inst.attr, | 1154 | &target_stat_auth_attr_inst, |
1322 | &target_stat_scsi_auth_intr_dev.attr, | 1155 | &target_stat_auth_attr_dev, |
1323 | &target_stat_scsi_auth_intr_port.attr, | 1156 | &target_stat_auth_attr_port, |
1324 | &target_stat_scsi_auth_intr_indx.attr, | 1157 | &target_stat_auth_attr_indx, |
1325 | &target_stat_scsi_auth_intr_dev_or_port.attr, | 1158 | &target_stat_auth_attr_dev_or_port, |
1326 | &target_stat_scsi_auth_intr_intr_name.attr, | 1159 | &target_stat_auth_attr_intr_name, |
1327 | &target_stat_scsi_auth_intr_map_indx.attr, | 1160 | &target_stat_auth_attr_map_indx, |
1328 | &target_stat_scsi_auth_intr_att_count.attr, | 1161 | &target_stat_auth_attr_att_count, |
1329 | &target_stat_scsi_auth_intr_num_cmds.attr, | 1162 | &target_stat_auth_attr_num_cmds, |
1330 | &target_stat_scsi_auth_intr_read_mbytes.attr, | 1163 | &target_stat_auth_attr_read_mbytes, |
1331 | &target_stat_scsi_auth_intr_write_mbytes.attr, | 1164 | &target_stat_auth_attr_write_mbytes, |
1332 | &target_stat_scsi_auth_intr_hs_num_cmds.attr, | 1165 | &target_stat_auth_attr_hs_num_cmds, |
1333 | &target_stat_scsi_auth_intr_creation_time.attr, | 1166 | &target_stat_auth_attr_creation_time, |
1334 | &target_stat_scsi_auth_intr_row_status.attr, | 1167 | &target_stat_auth_attr_row_status, |
1335 | NULL, | 1168 | NULL, |
1336 | }; | 1169 | }; |
1337 | 1170 | ||
1338 | static struct configfs_item_operations target_stat_scsi_auth_intr_attrib_ops = { | ||
1339 | .show_attribute = target_stat_scsi_auth_intr_attr_show, | ||
1340 | .store_attribute = target_stat_scsi_auth_intr_attr_store, | ||
1341 | }; | ||
1342 | |||
1343 | static struct config_item_type target_stat_scsi_auth_intr_cit = { | 1171 | static struct config_item_type target_stat_scsi_auth_intr_cit = { |
1344 | .ct_item_ops = &target_stat_scsi_auth_intr_attrib_ops, | ||
1345 | .ct_attrs = target_stat_scsi_auth_intr_attrs, | 1172 | .ct_attrs = target_stat_scsi_auth_intr_attrs, |
1346 | .ct_owner = THIS_MODULE, | 1173 | .ct_owner = THIS_MODULE, |
1347 | }; | 1174 | }; |
@@ -1350,25 +1177,17 @@ static struct config_item_type target_stat_scsi_auth_intr_cit = { | |||
1350 | * SCSI Attached Initiator Port Table | 1177 | * SCSI Attached Initiator Port Table |
1351 | */ | 1178 | */ |
1352 | 1179 | ||
1353 | CONFIGFS_EATTR_STRUCT(target_stat_scsi_att_intr_port, se_ml_stat_grps); | 1180 | static struct se_lun_acl *iport_to_lacl(struct config_item *item) |
1354 | #define DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR(_name, _mode) \ | 1181 | { |
1355 | static struct target_stat_scsi_att_intr_port_attribute \ | 1182 | struct se_ml_stat_grps *lgrps = container_of(to_config_group(item), |
1356 | target_stat_scsi_att_intr_port_##_name = \ | 1183 | struct se_ml_stat_grps, scsi_att_intr_port_group); |
1357 | __CONFIGFS_EATTR(_name, _mode, \ | 1184 | return container_of(lgrps, struct se_lun_acl, ml_stat_grps); |
1358 | target_stat_scsi_att_intr_port_show_attr_##_name, \ | 1185 | } |
1359 | target_stat_scsi_att_intr_port_store_attr_##_name); | 1186 | |
1360 | 1187 | static ssize_t target_stat_iport_inst_show(struct config_item *item, | |
1361 | #define DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(_name) \ | 1188 | char *page) |
1362 | static struct target_stat_scsi_att_intr_port_attribute \ | 1189 | { |
1363 | target_stat_scsi_att_intr_port_##_name = \ | 1190 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1364 | __CONFIGFS_EATTR_RO(_name, \ | ||
1365 | target_stat_scsi_att_intr_port_show_attr_##_name); | ||
1366 | |||
1367 | static ssize_t target_stat_scsi_att_intr_port_show_attr_inst( | ||
1368 | struct se_ml_stat_grps *lgrps, char *page) | ||
1369 | { | ||
1370 | struct se_lun_acl *lacl = container_of(lgrps, | ||
1371 | struct se_lun_acl, ml_stat_grps); | ||
1372 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1191 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1373 | struct se_dev_entry *deve; | 1192 | struct se_dev_entry *deve; |
1374 | struct se_portal_group *tpg; | 1193 | struct se_portal_group *tpg; |
@@ -1387,13 +1206,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_inst( | |||
1387 | rcu_read_unlock(); | 1206 | rcu_read_unlock(); |
1388 | return ret; | 1207 | return ret; |
1389 | } | 1208 | } |
1390 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(inst); | ||
1391 | 1209 | ||
1392 | static ssize_t target_stat_scsi_att_intr_port_show_attr_dev( | 1210 | static ssize_t target_stat_iport_dev_show(struct config_item *item, |
1393 | struct se_ml_stat_grps *lgrps, char *page) | 1211 | char *page) |
1394 | { | 1212 | { |
1395 | struct se_lun_acl *lacl = container_of(lgrps, | 1213 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1396 | struct se_lun_acl, ml_stat_grps); | ||
1397 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1214 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1398 | struct se_dev_entry *deve; | 1215 | struct se_dev_entry *deve; |
1399 | struct se_lun *lun; | 1216 | struct se_lun *lun; |
@@ -1411,13 +1228,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_dev( | |||
1411 | rcu_read_unlock(); | 1228 | rcu_read_unlock(); |
1412 | return ret; | 1229 | return ret; |
1413 | } | 1230 | } |
1414 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(dev); | ||
1415 | 1231 | ||
1416 | static ssize_t target_stat_scsi_att_intr_port_show_attr_port( | 1232 | static ssize_t target_stat_iport_port_show(struct config_item *item, |
1417 | struct se_ml_stat_grps *lgrps, char *page) | 1233 | char *page) |
1418 | { | 1234 | { |
1419 | struct se_lun_acl *lacl = container_of(lgrps, | 1235 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1420 | struct se_lun_acl, ml_stat_grps); | ||
1421 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1236 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1422 | struct se_dev_entry *deve; | 1237 | struct se_dev_entry *deve; |
1423 | struct se_portal_group *tpg; | 1238 | struct se_portal_group *tpg; |
@@ -1435,13 +1250,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port( | |||
1435 | rcu_read_unlock(); | 1250 | rcu_read_unlock(); |
1436 | return ret; | 1251 | return ret; |
1437 | } | 1252 | } |
1438 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port); | ||
1439 | 1253 | ||
1440 | static ssize_t target_stat_scsi_att_intr_port_show_attr_indx( | 1254 | static ssize_t target_stat_iport_indx_show(struct config_item *item, |
1441 | struct se_ml_stat_grps *lgrps, char *page) | 1255 | char *page) |
1442 | { | 1256 | { |
1443 | struct se_lun_acl *lacl = container_of(lgrps, | 1257 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1444 | struct se_lun_acl, ml_stat_grps); | ||
1445 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1258 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1446 | struct se_session *se_sess; | 1259 | struct se_session *se_sess; |
1447 | struct se_portal_group *tpg; | 1260 | struct se_portal_group *tpg; |
@@ -1461,13 +1274,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_indx( | |||
1461 | spin_unlock_irq(&nacl->nacl_sess_lock); | 1274 | spin_unlock_irq(&nacl->nacl_sess_lock); |
1462 | return ret; | 1275 | return ret; |
1463 | } | 1276 | } |
1464 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(indx); | ||
1465 | 1277 | ||
1466 | static ssize_t target_stat_scsi_att_intr_port_show_attr_port_auth_indx( | 1278 | static ssize_t target_stat_iport_port_auth_indx_show(struct config_item *item, |
1467 | struct se_ml_stat_grps *lgrps, char *page) | 1279 | char *page) |
1468 | { | 1280 | { |
1469 | struct se_lun_acl *lacl = container_of(lgrps, | 1281 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1470 | struct se_lun_acl, ml_stat_grps); | ||
1471 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1282 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1472 | struct se_dev_entry *deve; | 1283 | struct se_dev_entry *deve; |
1473 | ssize_t ret; | 1284 | ssize_t ret; |
@@ -1483,13 +1294,11 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port_auth_indx( | |||
1483 | rcu_read_unlock(); | 1294 | rcu_read_unlock(); |
1484 | return ret; | 1295 | return ret; |
1485 | } | 1296 | } |
1486 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port_auth_indx); | ||
1487 | 1297 | ||
1488 | static ssize_t target_stat_scsi_att_intr_port_show_attr_port_ident( | 1298 | static ssize_t target_stat_iport_port_ident_show(struct config_item *item, |
1489 | struct se_ml_stat_grps *lgrps, char *page) | 1299 | char *page) |
1490 | { | 1300 | { |
1491 | struct se_lun_acl *lacl = container_of(lgrps, | 1301 | struct se_lun_acl *lacl = iport_to_lacl(item); |
1492 | struct se_lun_acl, ml_stat_grps); | ||
1493 | struct se_node_acl *nacl = lacl->se_lun_nacl; | 1302 | struct se_node_acl *nacl = lacl->se_lun_nacl; |
1494 | struct se_session *se_sess; | 1303 | struct se_session *se_sess; |
1495 | struct se_portal_group *tpg; | 1304 | struct se_portal_group *tpg; |
@@ -1513,28 +1322,25 @@ static ssize_t target_stat_scsi_att_intr_port_show_attr_port_ident( | |||
1513 | spin_unlock_irq(&nacl->nacl_sess_lock); | 1322 | spin_unlock_irq(&nacl->nacl_sess_lock); |
1514 | return ret; | 1323 | return ret; |
1515 | } | 1324 | } |
1516 | DEV_STAT_SCSI_ATTR_INTR_PORT_ATTR_RO(port_ident); | ||
1517 | 1325 | ||
1518 | CONFIGFS_EATTR_OPS(target_stat_scsi_att_intr_port, se_ml_stat_grps, | 1326 | CONFIGFS_ATTR_RO(target_stat_iport_, inst); |
1519 | scsi_att_intr_port_group); | 1327 | CONFIGFS_ATTR_RO(target_stat_iport_, dev); |
1328 | CONFIGFS_ATTR_RO(target_stat_iport_, port); | ||
1329 | CONFIGFS_ATTR_RO(target_stat_iport_, indx); | ||
1330 | CONFIGFS_ATTR_RO(target_stat_iport_, port_auth_indx); | ||
1331 | CONFIGFS_ATTR_RO(target_stat_iport_, port_ident); | ||
1520 | 1332 | ||
1521 | static struct configfs_attribute *target_stat_scsi_ath_intr_port_attrs[] = { | 1333 | static struct configfs_attribute *target_stat_scsi_ath_intr_port_attrs[] = { |
1522 | &target_stat_scsi_att_intr_port_inst.attr, | 1334 | &target_stat_iport_attr_inst, |
1523 | &target_stat_scsi_att_intr_port_dev.attr, | 1335 | &target_stat_iport_attr_dev, |
1524 | &target_stat_scsi_att_intr_port_port.attr, | 1336 | &target_stat_iport_attr_port, |
1525 | &target_stat_scsi_att_intr_port_indx.attr, | 1337 | &target_stat_iport_attr_indx, |
1526 | &target_stat_scsi_att_intr_port_port_auth_indx.attr, | 1338 | &target_stat_iport_attr_port_auth_indx, |
1527 | &target_stat_scsi_att_intr_port_port_ident.attr, | 1339 | &target_stat_iport_attr_port_ident, |
1528 | NULL, | 1340 | NULL, |
1529 | }; | 1341 | }; |
1530 | 1342 | ||
1531 | static struct configfs_item_operations target_stat_scsi_att_intr_port_attrib_ops = { | ||
1532 | .show_attribute = target_stat_scsi_att_intr_port_attr_show, | ||
1533 | .store_attribute = target_stat_scsi_att_intr_port_attr_store, | ||
1534 | }; | ||
1535 | |||
1536 | static struct config_item_type target_stat_scsi_att_intr_port_cit = { | 1343 | static struct config_item_type target_stat_scsi_att_intr_port_cit = { |
1537 | .ct_item_ops = &target_stat_scsi_att_intr_port_attrib_ops, | ||
1538 | .ct_attrs = target_stat_scsi_ath_intr_port_attrs, | 1344 | .ct_attrs = target_stat_scsi_ath_intr_port_attrs, |
1539 | .ct_owner = THIS_MODULE, | 1345 | .ct_owner = THIS_MODULE, |
1540 | }; | 1346 | }; |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index aa3caca8bace..064d6dfb5b6d 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -36,7 +36,6 @@ | |||
36 | 36 | ||
37 | #include <target/target_core_base.h> | 37 | #include <target/target_core_base.h> |
38 | #include <target/target_core_fabric.h> | 38 | #include <target/target_core_fabric.h> |
39 | #include <target/configfs_macros.h> | ||
40 | 39 | ||
41 | #include "tcm_fc.h" | 40 | #include "tcm_fc.h" |
42 | 41 | ||
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index 16670933013b..85aeaa0ad303 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c | |||
@@ -38,8 +38,6 @@ | |||
38 | 38 | ||
39 | #include <target/target_core_base.h> | 39 | #include <target/target_core_base.h> |
40 | #include <target/target_core_fabric.h> | 40 | #include <target/target_core_fabric.h> |
41 | #include <target/target_core_fabric_configfs.h> | ||
42 | #include <target/configfs_macros.h> | ||
43 | 41 | ||
44 | #include "tcm_fc.h" | 42 | #include "tcm_fc.h" |
45 | 43 | ||
@@ -131,55 +129,51 @@ static ssize_t ft_wwn_store(void *arg, const char *buf, size_t len) | |||
131 | * ACL auth ops. | 129 | * ACL auth ops. |
132 | */ | 130 | */ |
133 | 131 | ||
134 | static ssize_t ft_nacl_show_port_name( | 132 | static ssize_t ft_nacl_port_name_show(struct config_item *item, char *page) |
135 | struct se_node_acl *se_nacl, | ||
136 | char *page) | ||
137 | { | 133 | { |
134 | struct se_node_acl *se_nacl = acl_to_nacl(item); | ||
138 | struct ft_node_acl *acl = container_of(se_nacl, | 135 | struct ft_node_acl *acl = container_of(se_nacl, |
139 | struct ft_node_acl, se_node_acl); | 136 | struct ft_node_acl, se_node_acl); |
140 | 137 | ||
141 | return ft_wwn_show(&acl->node_auth.port_name, page); | 138 | return ft_wwn_show(&acl->node_auth.port_name, page); |
142 | } | 139 | } |
143 | 140 | ||
144 | static ssize_t ft_nacl_store_port_name( | 141 | static ssize_t ft_nacl_port_name_store(struct config_item *item, |
145 | struct se_node_acl *se_nacl, | 142 | const char *page, size_t count) |
146 | const char *page, | ||
147 | size_t count) | ||
148 | { | 143 | { |
144 | struct se_node_acl *se_nacl = acl_to_nacl(item); | ||
149 | struct ft_node_acl *acl = container_of(se_nacl, | 145 | struct ft_node_acl *acl = container_of(se_nacl, |
150 | struct ft_node_acl, se_node_acl); | 146 | struct ft_node_acl, se_node_acl); |
151 | 147 | ||
152 | return ft_wwn_store(&acl->node_auth.port_name, page, count); | 148 | return ft_wwn_store(&acl->node_auth.port_name, page, count); |
153 | } | 149 | } |
154 | 150 | ||
155 | TF_NACL_BASE_ATTR(ft, port_name, S_IRUGO | S_IWUSR); | 151 | static ssize_t ft_nacl_node_name_show(struct config_item *item, |
156 | 152 | char *page) | |
157 | static ssize_t ft_nacl_show_node_name( | ||
158 | struct se_node_acl *se_nacl, | ||
159 | char *page) | ||
160 | { | 153 | { |
154 | struct se_node_acl *se_nacl = acl_to_nacl(item); | ||
161 | struct ft_node_acl *acl = container_of(se_nacl, | 155 | struct ft_node_acl *acl = container_of(se_nacl, |
162 | struct ft_node_acl, se_node_acl); | 156 | struct ft_node_acl, se_node_acl); |
163 | 157 | ||
164 | return ft_wwn_show(&acl->node_auth.node_name, page); | 158 | return ft_wwn_show(&acl->node_auth.node_name, page); |
165 | } | 159 | } |
166 | 160 | ||
167 | static ssize_t ft_nacl_store_node_name( | 161 | static ssize_t ft_nacl_node_name_store(struct config_item *item, |
168 | struct se_node_acl *se_nacl, | 162 | const char *page, size_t count) |
169 | const char *page, | ||
170 | size_t count) | ||
171 | { | 163 | { |
164 | struct se_node_acl *se_nacl = acl_to_nacl(item); | ||
172 | struct ft_node_acl *acl = container_of(se_nacl, | 165 | struct ft_node_acl *acl = container_of(se_nacl, |
173 | struct ft_node_acl, se_node_acl); | 166 | struct ft_node_acl, se_node_acl); |
174 | 167 | ||
175 | return ft_wwn_store(&acl->node_auth.node_name, page, count); | 168 | return ft_wwn_store(&acl->node_auth.node_name, page, count); |
176 | } | 169 | } |
177 | 170 | ||
178 | TF_NACL_BASE_ATTR(ft, node_name, S_IRUGO | S_IWUSR); | 171 | CONFIGFS_ATTR(ft_nacl_, node_name); |
172 | CONFIGFS_ATTR(ft_nacl_, port_name); | ||
179 | 173 | ||
180 | static struct configfs_attribute *ft_nacl_base_attrs[] = { | 174 | static struct configfs_attribute *ft_nacl_base_attrs[] = { |
181 | &ft_nacl_port_name.attr, | 175 | &ft_nacl_attr_port_name, |
182 | &ft_nacl_node_name.attr, | 176 | &ft_nacl_attr_node_name, |
183 | NULL, | 177 | NULL, |
184 | }; | 178 | }; |
185 | 179 | ||
@@ -386,18 +380,16 @@ static void ft_del_wwn(struct se_wwn *wwn) | |||
386 | kfree(ft_wwn); | 380 | kfree(ft_wwn); |
387 | } | 381 | } |
388 | 382 | ||
389 | static ssize_t ft_wwn_show_attr_version( | 383 | static ssize_t ft_wwn_version_show(struct config_item *item, char *page) |
390 | struct target_fabric_configfs *tf, | ||
391 | char *page) | ||
392 | { | 384 | { |
393 | return sprintf(page, "TCM FC " FT_VERSION " on %s/%s on " | 385 | return sprintf(page, "TCM FC " FT_VERSION " on %s/%s on " |
394 | ""UTS_RELEASE"\n", utsname()->sysname, utsname()->machine); | 386 | ""UTS_RELEASE"\n", utsname()->sysname, utsname()->machine); |
395 | } | 387 | } |
396 | 388 | ||
397 | TF_WWN_ATTR_RO(ft, version); | 389 | CONFIGFS_ATTR_RO(ft_wwn_, version); |
398 | 390 | ||
399 | static struct configfs_attribute *ft_wwn_attrs[] = { | 391 | static struct configfs_attribute *ft_wwn_attrs[] = { |
400 | &ft_wwn_version.attr, | 392 | &ft_wwn_attr_version, |
401 | NULL, | 393 | NULL, |
402 | }; | 394 | }; |
403 | 395 | ||
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c index 4b0fedd6bd4b..847c1aa6fbf4 100644 --- a/drivers/target/tcm_fc/tfc_io.c +++ b/drivers/target/tcm_fc/tfc_io.c | |||
@@ -44,7 +44,6 @@ | |||
44 | 44 | ||
45 | #include <target/target_core_base.h> | 45 | #include <target/target_core_base.h> |
46 | #include <target/target_core_fabric.h> | 46 | #include <target/target_core_fabric.h> |
47 | #include <target/configfs_macros.h> | ||
48 | 47 | ||
49 | #include "tcm_fc.h" | 48 | #include "tcm_fc.h" |
50 | 49 | ||
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index 31a9e3fb98c5..7b934eac995d 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c | |||
@@ -36,7 +36,6 @@ | |||
36 | 36 | ||
37 | #include <target/target_core_base.h> | 37 | #include <target/target_core_base.h> |
38 | #include <target/target_core_fabric.h> | 38 | #include <target/target_core_fabric.h> |
39 | #include <target/configfs_macros.h> | ||
40 | 39 | ||
41 | #include "tcm_fc.h" | 40 | #include "tcm_fc.h" |
42 | 41 | ||
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c index c3c48088fced..33833fe2e163 100644 --- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c +++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c | |||
@@ -19,8 +19,6 @@ | |||
19 | #include <scsi/scsi_tcq.h> | 19 | #include <scsi/scsi_tcq.h> |
20 | #include <target/target_core_base.h> | 20 | #include <target/target_core_base.h> |
21 | #include <target/target_core_fabric.h> | 21 | #include <target/target_core_fabric.h> |
22 | #include <target/target_core_fabric_configfs.h> | ||
23 | #include <target/configfs_macros.h> | ||
24 | #include <asm/unaligned.h> | 22 | #include <asm/unaligned.h> |
25 | 23 | ||
26 | #include "tcm_usb_gadget.h" | 24 | #include "tcm_usb_gadget.h" |
@@ -1467,23 +1465,21 @@ static void usbg_drop_tport(struct se_wwn *wwn) | |||
1467 | /* | 1465 | /* |
1468 | * If somebody feels like dropping the version property, go ahead. | 1466 | * If somebody feels like dropping the version property, go ahead. |
1469 | */ | 1467 | */ |
1470 | static ssize_t usbg_wwn_show_attr_version( | 1468 | static ssize_t usbg_wwn_version_show(struct config_item *item, char *page) |
1471 | struct target_fabric_configfs *tf, | ||
1472 | char *page) | ||
1473 | { | 1469 | { |
1474 | return sprintf(page, "usb-gadget fabric module\n"); | 1470 | return sprintf(page, "usb-gadget fabric module\n"); |
1475 | } | 1471 | } |
1476 | TF_WWN_ATTR_RO(usbg, version); | 1472 | |
1473 | CONFIGFS_ATTR_RO(usbg_wwn_, version); | ||
1477 | 1474 | ||
1478 | static struct configfs_attribute *usbg_wwn_attrs[] = { | 1475 | static struct configfs_attribute *usbg_wwn_attrs[] = { |
1479 | &usbg_wwn_version.attr, | 1476 | &usbg_wwn_attr_version, |
1480 | NULL, | 1477 | NULL, |
1481 | }; | 1478 | }; |
1482 | 1479 | ||
1483 | static ssize_t tcm_usbg_tpg_show_enable( | 1480 | static ssize_t tcm_usbg_tpg_enable_show(struct config_item *item, char *page) |
1484 | struct se_portal_group *se_tpg, | ||
1485 | char *page) | ||
1486 | { | 1481 | { |
1482 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1487 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); | 1483 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); |
1488 | 1484 | ||
1489 | return snprintf(page, PAGE_SIZE, "%u\n", tpg->gadget_connect); | 1485 | return snprintf(page, PAGE_SIZE, "%u\n", tpg->gadget_connect); |
@@ -1492,11 +1488,10 @@ static ssize_t tcm_usbg_tpg_show_enable( | |||
1492 | static int usbg_attach(struct usbg_tpg *); | 1488 | static int usbg_attach(struct usbg_tpg *); |
1493 | static void usbg_detach(struct usbg_tpg *); | 1489 | static void usbg_detach(struct usbg_tpg *); |
1494 | 1490 | ||
1495 | static ssize_t tcm_usbg_tpg_store_enable( | 1491 | static ssize_t tcm_usbg_tpg_enable_store(struct config_item *item, |
1496 | struct se_portal_group *se_tpg, | 1492 | const char *page, size_t count) |
1497 | const char *page, | ||
1498 | size_t count) | ||
1499 | { | 1493 | { |
1494 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1500 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); | 1495 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); |
1501 | unsigned long op; | 1496 | unsigned long op; |
1502 | ssize_t ret; | 1497 | ssize_t ret; |
@@ -1523,12 +1518,10 @@ static ssize_t tcm_usbg_tpg_store_enable( | |||
1523 | out: | 1518 | out: |
1524 | return count; | 1519 | return count; |
1525 | } | 1520 | } |
1526 | TF_TPG_BASE_ATTR(tcm_usbg, enable, S_IRUGO | S_IWUSR); | ||
1527 | 1521 | ||
1528 | static ssize_t tcm_usbg_tpg_show_nexus( | 1522 | static ssize_t tcm_usbg_tpg_nexus_show(struct config_item *item, char *page) |
1529 | struct se_portal_group *se_tpg, | ||
1530 | char *page) | ||
1531 | { | 1523 | { |
1524 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1532 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); | 1525 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); |
1533 | struct tcm_usbg_nexus *tv_nexus; | 1526 | struct tcm_usbg_nexus *tv_nexus; |
1534 | ssize_t ret; | 1527 | ssize_t ret; |
@@ -1636,11 +1629,10 @@ out: | |||
1636 | return ret; | 1629 | return ret; |
1637 | } | 1630 | } |
1638 | 1631 | ||
1639 | static ssize_t tcm_usbg_tpg_store_nexus( | 1632 | static ssize_t tcm_usbg_tpg_nexus_store(struct config_item *item, |
1640 | struct se_portal_group *se_tpg, | 1633 | const char *page, size_t count) |
1641 | const char *page, | ||
1642 | size_t count) | ||
1643 | { | 1634 | { |
1635 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1644 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); | 1636 | struct usbg_tpg *tpg = container_of(se_tpg, struct usbg_tpg, se_tpg); |
1645 | unsigned char i_port[USBG_NAMELEN], *ptr; | 1637 | unsigned char i_port[USBG_NAMELEN], *ptr; |
1646 | int ret; | 1638 | int ret; |
@@ -1670,11 +1662,13 @@ static ssize_t tcm_usbg_tpg_store_nexus( | |||
1670 | return ret; | 1662 | return ret; |
1671 | return count; | 1663 | return count; |
1672 | } | 1664 | } |
1673 | TF_TPG_BASE_ATTR(tcm_usbg, nexus, S_IRUGO | S_IWUSR); | 1665 | |
1666 | CONFIGFS_ATTR(tcm_usbg_tpg_, enable); | ||
1667 | CONFIGFS_ATTR(tcm_usbg_tpg_, nexus); | ||
1674 | 1668 | ||
1675 | static struct configfs_attribute *usbg_base_attrs[] = { | 1669 | static struct configfs_attribute *usbg_base_attrs[] = { |
1676 | &tcm_usbg_tpg_enable.attr, | 1670 | &tcm_usbg_tpg_attr_enable, |
1677 | &tcm_usbg_tpg_nexus.attr, | 1671 | &tcm_usbg_tpg_attr_nexus, |
1678 | NULL, | 1672 | NULL, |
1679 | }; | 1673 | }; |
1680 | 1674 | ||
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index f114a9dbb48f..a971765eb9f2 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -42,8 +42,6 @@ | |||
42 | #include <scsi/scsi_proto.h> | 42 | #include <scsi/scsi_proto.h> |
43 | #include <target/target_core_base.h> | 43 | #include <target/target_core_base.h> |
44 | #include <target/target_core_fabric.h> | 44 | #include <target/target_core_fabric.h> |
45 | #include <target/target_core_fabric_configfs.h> | ||
46 | #include <target/configfs_macros.h> | ||
47 | #include <linux/vhost.h> | 45 | #include <linux/vhost.h> |
48 | #include <linux/virtio_scsi.h> | 46 | #include <linux/virtio_scsi.h> |
49 | #include <linux/llist.h> | 47 | #include <linux/llist.h> |
@@ -1686,11 +1684,10 @@ static void vhost_scsi_free_cmd_map_res(struct vhost_scsi_nexus *nexus, | |||
1686 | } | 1684 | } |
1687 | } | 1685 | } |
1688 | 1686 | ||
1689 | static ssize_t vhost_scsi_tpg_attrib_store_fabric_prot_type( | 1687 | static ssize_t vhost_scsi_tpg_attrib_fabric_prot_type_store( |
1690 | struct se_portal_group *se_tpg, | 1688 | struct config_item *item, const char *page, size_t count) |
1691 | const char *page, | ||
1692 | size_t count) | ||
1693 | { | 1689 | { |
1690 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
1694 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, | 1691 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, |
1695 | struct vhost_scsi_tpg, se_tpg); | 1692 | struct vhost_scsi_tpg, se_tpg); |
1696 | unsigned long val; | 1693 | unsigned long val; |
@@ -1709,19 +1706,20 @@ static ssize_t vhost_scsi_tpg_attrib_store_fabric_prot_type( | |||
1709 | return count; | 1706 | return count; |
1710 | } | 1707 | } |
1711 | 1708 | ||
1712 | static ssize_t vhost_scsi_tpg_attrib_show_fabric_prot_type( | 1709 | static ssize_t vhost_scsi_tpg_attrib_fabric_prot_type_show( |
1713 | struct se_portal_group *se_tpg, | 1710 | struct config_item *item, char *page) |
1714 | char *page) | ||
1715 | { | 1711 | { |
1712 | struct se_portal_group *se_tpg = attrib_to_tpg(item); | ||
1716 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, | 1713 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, |
1717 | struct vhost_scsi_tpg, se_tpg); | 1714 | struct vhost_scsi_tpg, se_tpg); |
1718 | 1715 | ||
1719 | return sprintf(page, "%d\n", tpg->tv_fabric_prot_type); | 1716 | return sprintf(page, "%d\n", tpg->tv_fabric_prot_type); |
1720 | } | 1717 | } |
1721 | TF_TPG_ATTRIB_ATTR(vhost_scsi, fabric_prot_type, S_IRUGO | S_IWUSR); | 1718 | |
1719 | CONFIGFS_ATTR(vhost_scsi_tpg_attrib_, fabric_prot_type); | ||
1722 | 1720 | ||
1723 | static struct configfs_attribute *vhost_scsi_tpg_attrib_attrs[] = { | 1721 | static struct configfs_attribute *vhost_scsi_tpg_attrib_attrs[] = { |
1724 | &vhost_scsi_tpg_attrib_fabric_prot_type.attr, | 1722 | &vhost_scsi_tpg_attrib_attr_fabric_prot_type, |
1725 | NULL, | 1723 | NULL, |
1726 | }; | 1724 | }; |
1727 | 1725 | ||
@@ -1869,9 +1867,9 @@ static int vhost_scsi_drop_nexus(struct vhost_scsi_tpg *tpg) | |||
1869 | return 0; | 1867 | return 0; |
1870 | } | 1868 | } |
1871 | 1869 | ||
1872 | static ssize_t vhost_scsi_tpg_show_nexus(struct se_portal_group *se_tpg, | 1870 | static ssize_t vhost_scsi_tpg_nexus_show(struct config_item *item, char *page) |
1873 | char *page) | ||
1874 | { | 1871 | { |
1872 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1875 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, | 1873 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, |
1876 | struct vhost_scsi_tpg, se_tpg); | 1874 | struct vhost_scsi_tpg, se_tpg); |
1877 | struct vhost_scsi_nexus *tv_nexus; | 1875 | struct vhost_scsi_nexus *tv_nexus; |
@@ -1890,10 +1888,10 @@ static ssize_t vhost_scsi_tpg_show_nexus(struct se_portal_group *se_tpg, | |||
1890 | return ret; | 1888 | return ret; |
1891 | } | 1889 | } |
1892 | 1890 | ||
1893 | static ssize_t vhost_scsi_tpg_store_nexus(struct se_portal_group *se_tpg, | 1891 | static ssize_t vhost_scsi_tpg_nexus_store(struct config_item *item, |
1894 | const char *page, | 1892 | const char *page, size_t count) |
1895 | size_t count) | ||
1896 | { | 1893 | { |
1894 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1897 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, | 1895 | struct vhost_scsi_tpg *tpg = container_of(se_tpg, |
1898 | struct vhost_scsi_tpg, se_tpg); | 1896 | struct vhost_scsi_tpg, se_tpg); |
1899 | struct vhost_scsi_tport *tport_wwn = tpg->tport; | 1897 | struct vhost_scsi_tport *tport_wwn = tpg->tport; |
@@ -1968,10 +1966,10 @@ check_newline: | |||
1968 | return count; | 1966 | return count; |
1969 | } | 1967 | } |
1970 | 1968 | ||
1971 | TF_TPG_BASE_ATTR(vhost_scsi, nexus, S_IRUGO | S_IWUSR); | 1969 | CONFIGFS_ATTR(vhost_scsi_tpg_, nexus); |
1972 | 1970 | ||
1973 | static struct configfs_attribute *vhost_scsi_tpg_attrs[] = { | 1971 | static struct configfs_attribute *vhost_scsi_tpg_attrs[] = { |
1974 | &vhost_scsi_tpg_nexus.attr, | 1972 | &vhost_scsi_tpg_attr_nexus, |
1975 | NULL, | 1973 | NULL, |
1976 | }; | 1974 | }; |
1977 | 1975 | ||
@@ -2107,18 +2105,17 @@ static void vhost_scsi_drop_tport(struct se_wwn *wwn) | |||
2107 | } | 2105 | } |
2108 | 2106 | ||
2109 | static ssize_t | 2107 | static ssize_t |
2110 | vhost_scsi_wwn_show_attr_version(struct target_fabric_configfs *tf, | 2108 | vhost_scsi_wwn_version_show(struct config_item *item, char *page) |
2111 | char *page) | ||
2112 | { | 2109 | { |
2113 | return sprintf(page, "TCM_VHOST fabric module %s on %s/%s" | 2110 | return sprintf(page, "TCM_VHOST fabric module %s on %s/%s" |
2114 | "on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname, | 2111 | "on "UTS_RELEASE"\n", VHOST_SCSI_VERSION, utsname()->sysname, |
2115 | utsname()->machine); | 2112 | utsname()->machine); |
2116 | } | 2113 | } |
2117 | 2114 | ||
2118 | TF_WWN_ATTR_RO(vhost_scsi, version); | 2115 | CONFIGFS_ATTR_RO(vhost_scsi_wwn_, version); |
2119 | 2116 | ||
2120 | static struct configfs_attribute *vhost_scsi_wwn_attrs[] = { | 2117 | static struct configfs_attribute *vhost_scsi_wwn_attrs[] = { |
2121 | &vhost_scsi_wwn_version.attr, | 2118 | &vhost_scsi_wwn_attr_version, |
2122 | NULL, | 2119 | NULL, |
2123 | }; | 2120 | }; |
2124 | 2121 | ||
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 9eeefd7cad41..43bcae852546 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c | |||
@@ -53,7 +53,6 @@ | |||
53 | 53 | ||
54 | #include <target/target_core_base.h> | 54 | #include <target/target_core_base.h> |
55 | #include <target/target_core_fabric.h> | 55 | #include <target/target_core_fabric.h> |
56 | #include <target/target_core_fabric_configfs.h> | ||
57 | 56 | ||
58 | #include <asm/hypervisor.h> | 57 | #include <asm/hypervisor.h> |
59 | 58 | ||
@@ -1438,9 +1437,10 @@ static void scsiback_aborted_task(struct se_cmd *se_cmd) | |||
1438 | { | 1437 | { |
1439 | } | 1438 | } |
1440 | 1439 | ||
1441 | static ssize_t scsiback_tpg_param_show_alias(struct se_portal_group *se_tpg, | 1440 | static ssize_t scsiback_tpg_param_alias_show(struct config_item *item, |
1442 | char *page) | 1441 | char *page) |
1443 | { | 1442 | { |
1443 | struct se_portal_group *se_tpg = param_to_tpg(item); | ||
1444 | struct scsiback_tpg *tpg = container_of(se_tpg, struct scsiback_tpg, | 1444 | struct scsiback_tpg *tpg = container_of(se_tpg, struct scsiback_tpg, |
1445 | se_tpg); | 1445 | se_tpg); |
1446 | ssize_t rb; | 1446 | ssize_t rb; |
@@ -1452,9 +1452,10 @@ static ssize_t scsiback_tpg_param_show_alias(struct se_portal_group *se_tpg, | |||
1452 | return rb; | 1452 | return rb; |
1453 | } | 1453 | } |
1454 | 1454 | ||
1455 | static ssize_t scsiback_tpg_param_store_alias(struct se_portal_group *se_tpg, | 1455 | static ssize_t scsiback_tpg_param_alias_store(struct config_item *item, |
1456 | const char *page, size_t count) | 1456 | const char *page, size_t count) |
1457 | { | 1457 | { |
1458 | struct se_portal_group *se_tpg = param_to_tpg(item); | ||
1458 | struct scsiback_tpg *tpg = container_of(se_tpg, struct scsiback_tpg, | 1459 | struct scsiback_tpg *tpg = container_of(se_tpg, struct scsiback_tpg, |
1459 | se_tpg); | 1460 | se_tpg); |
1460 | int len; | 1461 | int len; |
@@ -1474,10 +1475,10 @@ static ssize_t scsiback_tpg_param_store_alias(struct se_portal_group *se_tpg, | |||
1474 | return count; | 1475 | return count; |
1475 | } | 1476 | } |
1476 | 1477 | ||
1477 | TF_TPG_PARAM_ATTR(scsiback, alias, S_IRUGO | S_IWUSR); | 1478 | CONFIGFS_ATTR(scsiback_tpg_param_, alias); |
1478 | 1479 | ||
1479 | static struct configfs_attribute *scsiback_param_attrs[] = { | 1480 | static struct configfs_attribute *scsiback_param_attrs[] = { |
1480 | &scsiback_tpg_param_alias.attr, | 1481 | &scsiback_tpg_param_attr_alias, |
1481 | NULL, | 1482 | NULL, |
1482 | }; | 1483 | }; |
1483 | 1484 | ||
@@ -1585,9 +1586,9 @@ static int scsiback_drop_nexus(struct scsiback_tpg *tpg) | |||
1585 | return 0; | 1586 | return 0; |
1586 | } | 1587 | } |
1587 | 1588 | ||
1588 | static ssize_t scsiback_tpg_show_nexus(struct se_portal_group *se_tpg, | 1589 | static ssize_t scsiback_tpg_nexus_show(struct config_item *item, char *page) |
1589 | char *page) | ||
1590 | { | 1590 | { |
1591 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1591 | struct scsiback_tpg *tpg = container_of(se_tpg, | 1592 | struct scsiback_tpg *tpg = container_of(se_tpg, |
1592 | struct scsiback_tpg, se_tpg); | 1593 | struct scsiback_tpg, se_tpg); |
1593 | struct scsiback_nexus *tv_nexus; | 1594 | struct scsiback_nexus *tv_nexus; |
@@ -1606,10 +1607,10 @@ static ssize_t scsiback_tpg_show_nexus(struct se_portal_group *se_tpg, | |||
1606 | return ret; | 1607 | return ret; |
1607 | } | 1608 | } |
1608 | 1609 | ||
1609 | static ssize_t scsiback_tpg_store_nexus(struct se_portal_group *se_tpg, | 1610 | static ssize_t scsiback_tpg_nexus_store(struct config_item *item, |
1610 | const char *page, | 1611 | const char *page, size_t count) |
1611 | size_t count) | ||
1612 | { | 1612 | { |
1613 | struct se_portal_group *se_tpg = to_tpg(item); | ||
1613 | struct scsiback_tpg *tpg = container_of(se_tpg, | 1614 | struct scsiback_tpg *tpg = container_of(se_tpg, |
1614 | struct scsiback_tpg, se_tpg); | 1615 | struct scsiback_tpg, se_tpg); |
1615 | struct scsiback_tport *tport_wwn = tpg->tport; | 1616 | struct scsiback_tport *tport_wwn = tpg->tport; |
@@ -1681,26 +1682,25 @@ check_newline: | |||
1681 | return count; | 1682 | return count; |
1682 | } | 1683 | } |
1683 | 1684 | ||
1684 | TF_TPG_BASE_ATTR(scsiback, nexus, S_IRUGO | S_IWUSR); | 1685 | CONFIGFS_ATTR(scsiback_tpg_, nexus); |
1685 | 1686 | ||
1686 | static struct configfs_attribute *scsiback_tpg_attrs[] = { | 1687 | static struct configfs_attribute *scsiback_tpg_attrs[] = { |
1687 | &scsiback_tpg_nexus.attr, | 1688 | &scsiback_tpg_attr_nexus, |
1688 | NULL, | 1689 | NULL, |
1689 | }; | 1690 | }; |
1690 | 1691 | ||
1691 | static ssize_t | 1692 | static ssize_t |
1692 | scsiback_wwn_show_attr_version(struct target_fabric_configfs *tf, | 1693 | scsiback_wwn_version_show(struct config_item *item, char *page) |
1693 | char *page) | ||
1694 | { | 1694 | { |
1695 | return sprintf(page, "xen-pvscsi fabric module %s on %s/%s on " | 1695 | return sprintf(page, "xen-pvscsi fabric module %s on %s/%s on " |
1696 | UTS_RELEASE"\n", | 1696 | UTS_RELEASE"\n", |
1697 | VSCSI_VERSION, utsname()->sysname, utsname()->machine); | 1697 | VSCSI_VERSION, utsname()->sysname, utsname()->machine); |
1698 | } | 1698 | } |
1699 | 1699 | ||
1700 | TF_WWN_ATTR_RO(scsiback, version); | 1700 | CONFIGFS_ATTR_RO(scsiback_wwn_, version); |
1701 | 1701 | ||
1702 | static struct configfs_attribute *scsiback_wwn_attrs[] = { | 1702 | static struct configfs_attribute *scsiback_wwn_attrs[] = { |
1703 | &scsiback_wwn_version.attr, | 1703 | &scsiback_wwn_attr_version, |
1704 | NULL, | 1704 | NULL, |
1705 | }; | 1705 | }; |
1706 | 1706 | ||
diff --git a/include/target/configfs_macros.h b/include/target/configfs_macros.h deleted file mode 100644 index a0fc85bbe2da..000000000000 --- a/include/target/configfs_macros.h +++ /dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | /* -*- mode: c; c-basic-offset: 8; -*- | ||
2 | * vim: noexpandtab sw=8 ts=8 sts=0: | ||
3 | * | ||
4 | * configfs_macros.h - extends macros for configfs | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public | ||
17 | * License along with this program; if not, write to the | ||
18 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
19 | * Boston, MA 021110-1307, USA. | ||
20 | * | ||
21 | * Based on sysfs: | ||
22 | * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel | ||
23 | * | ||
24 | * Based on kobject.h: | ||
25 | * Copyright (c) 2002-2003 Patrick Mochel | ||
26 | * Copyright (c) 2002-2003 Open Source Development Labs | ||
27 | * | ||
28 | * configfs Copyright (C) 2005 Oracle. All rights reserved. | ||
29 | * | ||
30 | * Added CONFIGFS_EATTR() macros from original configfs.h macros | ||
31 | * Copright (C) 2008-2009 Nicholas A. Bellinger <nab@linux-iscsi.org> | ||
32 | * | ||
33 | * Please read Documentation/filesystems/configfs/configfs.txt before using | ||
34 | * the configfs interface, ESPECIALLY the parts about reference counts and | ||
35 | * item destructors. | ||
36 | */ | ||
37 | |||
38 | #ifndef _CONFIGFS_MACROS_H_ | ||
39 | #define _CONFIGFS_MACROS_H_ | ||
40 | |||
41 | #include <linux/configfs.h> | ||
42 | |||
43 | /* | ||
44 | * Users often need to create attribute structures for their configurable | ||
45 | * attributes, containing a configfs_attribute member and function pointers | ||
46 | * for the show() and store() operations on that attribute. If they don't | ||
47 | * need anything else on the extended attribute structure, they can use | ||
48 | * this macro to define it. The argument _name isends up as | ||
49 | * 'struct _name_attribute, as well as names of to CONFIGFS_ATTR_OPS() below. | ||
50 | * The argument _item is the name of the structure containing the | ||
51 | * struct config_item or struct config_group structure members | ||
52 | */ | ||
53 | #define CONFIGFS_EATTR_STRUCT(_name, _item) \ | ||
54 | struct _name##_attribute { \ | ||
55 | struct configfs_attribute attr; \ | ||
56 | ssize_t (*show)(struct _item *, char *); \ | ||
57 | ssize_t (*store)(struct _item *, const char *, size_t); \ | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * With the extended attribute structure, users can use this macro | ||
62 | * (similar to sysfs' __ATTR) to make defining attributes easier. | ||
63 | * An example: | ||
64 | * #define MYITEM_EATTR(_name, _mode, _show, _store) \ | ||
65 | * struct myitem_attribute childless_attr_##_name = \ | ||
66 | * __CONFIGFS_EATTR(_name, _mode, _show, _store) | ||
67 | */ | ||
68 | #define __CONFIGFS_EATTR(_name, _mode, _show, _store) \ | ||
69 | { \ | ||
70 | .attr = { \ | ||
71 | .ca_name = __stringify(_name), \ | ||
72 | .ca_mode = _mode, \ | ||
73 | .ca_owner = THIS_MODULE, \ | ||
74 | }, \ | ||
75 | .show = _show, \ | ||
76 | .store = _store, \ | ||
77 | } | ||
78 | /* Here is a readonly version, only requiring a show() operation */ | ||
79 | #define __CONFIGFS_EATTR_RO(_name, _show) \ | ||
80 | { \ | ||
81 | .attr = { \ | ||
82 | .ca_name = __stringify(_name), \ | ||
83 | .ca_mode = 0444, \ | ||
84 | .ca_owner = THIS_MODULE, \ | ||
85 | }, \ | ||
86 | .show = _show, \ | ||
87 | } | ||
88 | |||
89 | /* | ||
90 | * With these extended attributes, the simple show_attribute() and | ||
91 | * store_attribute() operations need to call the show() and store() of the | ||
92 | * attributes. This is a common pattern, so we provide a macro to define | ||
93 | * them. The argument _name is the name of the attribute defined by | ||
94 | * CONFIGFS_ATTR_STRUCT(). The argument _item is the name of the structure | ||
95 | * containing the struct config_item or struct config_group structure member. | ||
96 | * The argument _item_member is the actual name of the struct config_* struct | ||
97 | * in your _item structure. Meaning my_structure->some_config_group. | ||
98 | * ^^_item^^^^^ ^^_item_member^^^ | ||
99 | * This macro expects the attributes to be named "struct <name>_attribute". | ||
100 | */ | ||
101 | #define CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member) \ | ||
102 | static struct _item *to_##_name(struct config_item *ci) \ | ||
103 | { \ | ||
104 | return (ci) ? container_of(to_config_group(ci), struct _item, \ | ||
105 | _item_member) : NULL; \ | ||
106 | } | ||
107 | |||
108 | #define CONFIGFS_EATTR_OPS_SHOW(_name, _item) \ | ||
109 | static ssize_t _name##_attr_show(struct config_item *item, \ | ||
110 | struct configfs_attribute *attr, \ | ||
111 | char *page) \ | ||
112 | { \ | ||
113 | struct _item *_item = to_##_name(item); \ | ||
114 | struct _name##_attribute * _name##_attr = \ | ||
115 | container_of(attr, struct _name##_attribute, attr); \ | ||
116 | ssize_t ret = 0; \ | ||
117 | \ | ||
118 | if (_name##_attr->show) \ | ||
119 | ret = _name##_attr->show(_item, page); \ | ||
120 | return ret; \ | ||
121 | } | ||
122 | |||
123 | #define CONFIGFS_EATTR_OPS_STORE(_name, _item) \ | ||
124 | static ssize_t _name##_attr_store(struct config_item *item, \ | ||
125 | struct configfs_attribute *attr, \ | ||
126 | const char *page, size_t count) \ | ||
127 | { \ | ||
128 | struct _item *_item = to_##_name(item); \ | ||
129 | struct _name##_attribute * _name##_attr = \ | ||
130 | container_of(attr, struct _name##_attribute, attr); \ | ||
131 | ssize_t ret = -EINVAL; \ | ||
132 | \ | ||
133 | if (_name##_attr->store) \ | ||
134 | ret = _name##_attr->store(_item, page, count); \ | ||
135 | return ret; \ | ||
136 | } | ||
137 | |||
138 | #define CONFIGFS_EATTR_OPS(_name, _item, _item_member) \ | ||
139 | CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member); \ | ||
140 | CONFIGFS_EATTR_OPS_SHOW(_name, _item); \ | ||
141 | CONFIGFS_EATTR_OPS_STORE(_name, _item); | ||
142 | |||
143 | #define CONFIGFS_EATTR_OPS_RO(_name, _item, _item_member) \ | ||
144 | CONFIGFS_EATTR_OPS_TO_FUNC(_name, _item, _item_member); \ | ||
145 | CONFIGFS_EATTR_OPS_SHOW(_name, _item); | ||
146 | |||
147 | #endif /* _CONFIGFS_MACROS_H_ */ | ||
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index ac9bf1c0e42d..8b9c727b533b 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -563,6 +563,36 @@ struct se_node_acl { | |||
563 | struct kref acl_kref; | 563 | struct kref acl_kref; |
564 | }; | 564 | }; |
565 | 565 | ||
566 | static inline struct se_node_acl *acl_to_nacl(struct config_item *item) | ||
567 | { | ||
568 | return container_of(to_config_group(item), struct se_node_acl, | ||
569 | acl_group); | ||
570 | } | ||
571 | |||
572 | static inline struct se_node_acl *attrib_to_nacl(struct config_item *item) | ||
573 | { | ||
574 | return container_of(to_config_group(item), struct se_node_acl, | ||
575 | acl_attrib_group); | ||
576 | } | ||
577 | |||
578 | static inline struct se_node_acl *auth_to_nacl(struct config_item *item) | ||
579 | { | ||
580 | return container_of(to_config_group(item), struct se_node_acl, | ||
581 | acl_auth_group); | ||
582 | } | ||
583 | |||
584 | static inline struct se_node_acl *param_to_nacl(struct config_item *item) | ||
585 | { | ||
586 | return container_of(to_config_group(item), struct se_node_acl, | ||
587 | acl_param_group); | ||
588 | } | ||
589 | |||
590 | static inline struct se_node_acl *fabric_stat_to_nacl(struct config_item *item) | ||
591 | { | ||
592 | return container_of(to_config_group(item), struct se_node_acl, | ||
593 | acl_fabric_stat_group); | ||
594 | } | ||
595 | |||
566 | struct se_session { | 596 | struct se_session { |
567 | unsigned sess_tearing_down:1; | 597 | unsigned sess_tearing_down:1; |
568 | u64 sess_bin_isid; | 598 | u64 sess_bin_isid; |
@@ -820,6 +850,12 @@ struct se_tpg_np { | |||
820 | struct config_group tpg_np_group; | 850 | struct config_group tpg_np_group; |
821 | }; | 851 | }; |
822 | 852 | ||
853 | static inline struct se_tpg_np *to_tpg_np(struct config_item *item) | ||
854 | { | ||
855 | return container_of(to_config_group(item), struct se_tpg_np, | ||
856 | tpg_np_group); | ||
857 | } | ||
858 | |||
823 | struct se_portal_group { | 859 | struct se_portal_group { |
824 | /* | 860 | /* |
825 | * PROTOCOL IDENTIFIER value per SPC4, 7.5.1. | 861 | * PROTOCOL IDENTIFIER value per SPC4, 7.5.1. |
@@ -856,6 +892,30 @@ struct se_portal_group { | |||
856 | struct config_group tpg_param_group; | 892 | struct config_group tpg_param_group; |
857 | }; | 893 | }; |
858 | 894 | ||
895 | static inline struct se_portal_group *to_tpg(struct config_item *item) | ||
896 | { | ||
897 | return container_of(to_config_group(item), struct se_portal_group, | ||
898 | tpg_group); | ||
899 | } | ||
900 | |||
901 | static inline struct se_portal_group *attrib_to_tpg(struct config_item *item) | ||
902 | { | ||
903 | return container_of(to_config_group(item), struct se_portal_group, | ||
904 | tpg_attrib_group); | ||
905 | } | ||
906 | |||
907 | static inline struct se_portal_group *auth_to_tpg(struct config_item *item) | ||
908 | { | ||
909 | return container_of(to_config_group(item), struct se_portal_group, | ||
910 | tpg_auth_group); | ||
911 | } | ||
912 | |||
913 | static inline struct se_portal_group *param_to_tpg(struct config_item *item) | ||
914 | { | ||
915 | return container_of(to_config_group(item), struct se_portal_group, | ||
916 | tpg_param_group); | ||
917 | } | ||
918 | |||
859 | struct se_wwn { | 919 | struct se_wwn { |
860 | struct target_fabric_configfs *wwn_tf; | 920 | struct target_fabric_configfs *wwn_tf; |
861 | struct config_group wwn_group; | 921 | struct config_group wwn_group; |
diff --git a/include/target/target_core_fabric_configfs.h b/include/target/target_core_fabric_configfs.h deleted file mode 100644 index 7a0649c09e79..000000000000 --- a/include/target/target_core_fabric_configfs.h +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | /* | ||
2 | * Used for tfc_wwn_cit attributes | ||
3 | */ | ||
4 | |||
5 | #include <target/configfs_macros.h> | ||
6 | |||
7 | CONFIGFS_EATTR_STRUCT(target_fabric_nacl_attrib, se_node_acl); | ||
8 | #define TF_NACL_ATTRIB_ATTR(_fabric, _name, _mode) \ | ||
9 | static struct target_fabric_nacl_attrib_attribute _fabric##_nacl_attrib_##_name = \ | ||
10 | __CONFIGFS_EATTR(_name, _mode, \ | ||
11 | _fabric##_nacl_attrib_show_##_name, \ | ||
12 | _fabric##_nacl_attrib_store_##_name); | ||
13 | |||
14 | CONFIGFS_EATTR_STRUCT(target_fabric_nacl_auth, se_node_acl); | ||
15 | #define TF_NACL_AUTH_ATTR(_fabric, _name, _mode) \ | ||
16 | static struct target_fabric_nacl_auth_attribute _fabric##_nacl_auth_##_name = \ | ||
17 | __CONFIGFS_EATTR(_name, _mode, \ | ||
18 | _fabric##_nacl_auth_show_##_name, \ | ||
19 | _fabric##_nacl_auth_store_##_name); | ||
20 | |||
21 | #define TF_NACL_AUTH_ATTR_RO(_fabric, _name) \ | ||
22 | static struct target_fabric_nacl_auth_attribute _fabric##_nacl_auth_##_name = \ | ||
23 | __CONFIGFS_EATTR_RO(_name, \ | ||
24 | _fabric##_nacl_auth_show_##_name); | ||
25 | |||
26 | CONFIGFS_EATTR_STRUCT(target_fabric_nacl_param, se_node_acl); | ||
27 | #define TF_NACL_PARAM_ATTR(_fabric, _name, _mode) \ | ||
28 | static struct target_fabric_nacl_param_attribute _fabric##_nacl_param_##_name = \ | ||
29 | __CONFIGFS_EATTR(_name, _mode, \ | ||
30 | _fabric##_nacl_param_show_##_name, \ | ||
31 | _fabric##_nacl_param_store_##_name); | ||
32 | |||
33 | #define TF_NACL_PARAM_ATTR_RO(_fabric, _name) \ | ||
34 | static struct target_fabric_nacl_param_attribute _fabric##_nacl_param_##_name = \ | ||
35 | __CONFIGFS_EATTR_RO(_name, \ | ||
36 | _fabric##_nacl_param_show_##_name); | ||
37 | |||
38 | |||
39 | CONFIGFS_EATTR_STRUCT(target_fabric_nacl_base, se_node_acl); | ||
40 | #define TF_NACL_BASE_ATTR(_fabric, _name, _mode) \ | ||
41 | static struct target_fabric_nacl_base_attribute _fabric##_nacl_##_name = \ | ||
42 | __CONFIGFS_EATTR(_name, _mode, \ | ||
43 | _fabric##_nacl_show_##_name, \ | ||
44 | _fabric##_nacl_store_##_name); | ||
45 | |||
46 | #define TF_NACL_BASE_ATTR_RO(_fabric, _name) \ | ||
47 | static struct target_fabric_nacl_base_attribute _fabric##_nacl_##_name = \ | ||
48 | __CONFIGFS_EATTR_RO(_name, \ | ||
49 | _fabric##_nacl_show_##_name); | ||
50 | |||
51 | CONFIGFS_EATTR_STRUCT(target_fabric_np_base, se_tpg_np); | ||
52 | #define TF_NP_BASE_ATTR(_fabric, _name, _mode) \ | ||
53 | static struct target_fabric_np_base_attribute _fabric##_np_##_name = \ | ||
54 | __CONFIGFS_EATTR(_name, _mode, \ | ||
55 | _fabric##_np_show_##_name, \ | ||
56 | _fabric##_np_store_##_name); | ||
57 | |||
58 | CONFIGFS_EATTR_STRUCT(target_fabric_tpg_attrib, se_portal_group); | ||
59 | #define TF_TPG_ATTRIB_ATTR(_fabric, _name, _mode) \ | ||
60 | static struct target_fabric_tpg_attrib_attribute _fabric##_tpg_attrib_##_name = \ | ||
61 | __CONFIGFS_EATTR(_name, _mode, \ | ||
62 | _fabric##_tpg_attrib_show_##_name, \ | ||
63 | _fabric##_tpg_attrib_store_##_name); | ||
64 | |||
65 | CONFIGFS_EATTR_STRUCT(target_fabric_tpg_auth, se_portal_group); | ||
66 | #define TF_TPG_AUTH_ATTR(_fabric, _name, _mode) \ | ||
67 | static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \ | ||
68 | __CONFIGFS_EATTR(_name, _mode, \ | ||
69 | _fabric##_tpg_auth_show_##_name, \ | ||
70 | _fabric##_tpg_auth_store_##_name); | ||
71 | |||
72 | #define TF_TPG_AUTH_ATTR_RO(_fabric, _name) \ | ||
73 | static struct target_fabric_tpg_auth_attribute _fabric##_tpg_auth_##_name = \ | ||
74 | __CONFIGFS_EATTR_RO(_name, \ | ||
75 | _fabric##_tpg_auth_show_##_name); | ||
76 | |||
77 | CONFIGFS_EATTR_STRUCT(target_fabric_tpg_param, se_portal_group); | ||
78 | #define TF_TPG_PARAM_ATTR(_fabric, _name, _mode) \ | ||
79 | static struct target_fabric_tpg_param_attribute _fabric##_tpg_param_##_name = \ | ||
80 | __CONFIGFS_EATTR(_name, _mode, \ | ||
81 | _fabric##_tpg_param_show_##_name, \ | ||
82 | _fabric##_tpg_param_store_##_name); | ||
83 | |||
84 | |||
85 | CONFIGFS_EATTR_STRUCT(target_fabric_tpg, se_portal_group); | ||
86 | #define TF_TPG_BASE_ATTR(_fabric, _name, _mode) \ | ||
87 | static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \ | ||
88 | __CONFIGFS_EATTR(_name, _mode, \ | ||
89 | _fabric##_tpg_show_##_name, \ | ||
90 | _fabric##_tpg_store_##_name); | ||
91 | |||
92 | |||
93 | #define TF_TPG_BASE_ATTR_RO(_fabric, _name) \ | ||
94 | static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \ | ||
95 | __CONFIGFS_EATTR_RO(_name, \ | ||
96 | _fabric##_tpg_show_##_name); | ||
97 | |||
98 | CONFIGFS_EATTR_STRUCT(target_fabric_wwn, target_fabric_configfs); | ||
99 | #define TF_WWN_ATTR(_fabric, _name, _mode) \ | ||
100 | static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \ | ||
101 | __CONFIGFS_EATTR(_name, _mode, \ | ||
102 | _fabric##_wwn_show_attr_##_name, \ | ||
103 | _fabric##_wwn_store_attr_##_name); | ||
104 | |||
105 | #define TF_WWN_ATTR_RO(_fabric, _name) \ | ||
106 | static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \ | ||
107 | __CONFIGFS_EATTR_RO(_name, \ | ||
108 | _fabric##_wwn_show_attr_##_name); | ||
109 | |||
110 | CONFIGFS_EATTR_STRUCT(target_fabric_discovery, target_fabric_configfs); | ||
111 | #define TF_DISC_ATTR(_fabric, _name, _mode) \ | ||
112 | static struct target_fabric_discovery_attribute _fabric##_disc_##_name = \ | ||
113 | __CONFIGFS_EATTR(_name, _mode, \ | ||
114 | _fabric##_disc_show_##_name, \ | ||
115 | _fabric##_disc_store_##_name); | ||
116 | |||
117 | #define TF_DISC_ATTR_RO(_fabric, _name) \ | ||
118 | static struct target_fabric_discovery_attribute _fabric##_disc_##_name = \ | ||
119 | __CONFIGFS_EATTR_RO(_name, \ | ||
120 | _fabric##_disc_show_##_name); | ||
121 | |||
122 | extern int target_fabric_setup_cits(struct target_fabric_configfs *); | ||