Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64146db7 authored by Andy Grover's avatar Andy Grover Committed by Nicholas Bellinger
Browse files

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: default avatarAndy Grover <agrover@redhat.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent e3e84cda
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -1584,6 +1584,13 @@ static struct target_core_configfs_attribute target_core_attr_dev_udev_path = {
	.store	= target_core_store_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(
static ssize_t target_core_store_dev_enable(
	void *p,
	void *p,
	const char *page,
	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 = {
static struct target_core_configfs_attribute target_core_attr_dev_enable = {
	.attr	= { .ca_owner = THIS_MODULE,
	.attr	= { .ca_owner = THIS_MODULE,
		    .ca_name = "enable",
		    .ca_name = "enable",
		    .ca_mode = S_IWUSR },
		    .ca_mode =  S_IRUGO | S_IWUSR },
	.show	= NULL,
	.show	= target_core_show_dev_enable,
	.store	= target_core_store_dev_enable,
	.store	= target_core_store_dev_enable,
};
};