diff options
author | Andy Grover <agrover@redhat.com> | 2013-04-30 11:59:15 -0700 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-05-03 16:46:02 -0700 |
commit | 64146db71e1aab919a3861d4ac958086da3a0973 (patch) | |
tree | 2cbe188952f768ac04b513a19b6245b943429d55 /drivers/target | |
parent | e3e84cda321703b123f36488f50700f371bc7230 (diff) | |
download | talos-obmc-linux-64146db71e1aab919a3861d4ac958086da3a0973.tar.gz talos-obmc-linux-64146db71e1aab919a3861d4ac958086da3a0973.zip |
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>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_configfs.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 43b7ac6c5b1c..4a8bd36d3958 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -1584,6 +1584,13 @@ static struct target_core_configfs_attribute target_core_attr_dev_udev_path = { .store = target_core_store_dev_udev_path, }; +static ssize_t target_core_show_dev_enable(void *p, char *page) +{ + struct se_device *dev = p; + + return snprintf(page, PAGE_SIZE, "%d\n", !!(dev->dev_flags & DF_CONFIGURED)); +} + static ssize_t target_core_store_dev_enable( void *p, const char *page, @@ -1609,8 +1616,8 @@ static ssize_t target_core_store_dev_enable( static struct target_core_configfs_attribute target_core_attr_dev_enable = { .attr = { .ca_owner = THIS_MODULE, .ca_name = "enable", - .ca_mode = S_IWUSR }, - .show = NULL, + .ca_mode = S_IRUGO | S_IWUSR }, + .show = target_core_show_dev_enable, .store = target_core_store_dev_enable, }; |