Commit 64146db71e1aab919a3861d4ac958086da3a0973
Committed by
Nicholas Bellinger
1 parent
e3e84cda32
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
target: Have dev/enable show if TCM device is configured
User tools need to know if the device is properly configured, since if not, some other attributes are invalid. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Showing 1 changed file with 9 additions and 2 deletions Side-by-side Diff
drivers/target/target_core_configfs.c
... | ... | @@ -1584,6 +1584,13 @@ |
1584 | 1584 | .store = target_core_store_dev_udev_path, |
1585 | 1585 | }; |
1586 | 1586 | |
1587 | +static ssize_t target_core_show_dev_enable(void *p, char *page) | |
1588 | +{ | |
1589 | + struct se_device *dev = p; | |
1590 | + | |
1591 | + return snprintf(page, PAGE_SIZE, "%d\n", !!(dev->dev_flags & DF_CONFIGURED)); | |
1592 | +} | |
1593 | + | |
1587 | 1594 | static ssize_t target_core_store_dev_enable( |
1588 | 1595 | void *p, |
1589 | 1596 | const char *page, |
... | ... | @@ -1609,8 +1616,8 @@ |
1609 | 1616 | static struct target_core_configfs_attribute target_core_attr_dev_enable = { |
1610 | 1617 | .attr = { .ca_owner = THIS_MODULE, |
1611 | 1618 | .ca_name = "enable", |
1612 | - .ca_mode = S_IWUSR }, | |
1613 | - .show = NULL, | |
1619 | + .ca_mode = S_IRUGO | S_IWUSR }, | |
1620 | + .show = target_core_show_dev_enable, | |
1614 | 1621 | .store = target_core_store_dev_enable, |
1615 | 1622 | }; |
1616 | 1623 |