summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorBryant G. Ly <bryantly@linux.vnet.ibm.com>2017-06-06 09:28:52 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2017-07-06 23:11:32 -0700
commit8a45885c1514cdae2ee64b5ac03ffc00a1a8a9d7 (patch)
tree9d094ca4f89ce0674875dc6da1a80f2e1cfb752b /drivers/target
parentee01825220f01c0befea25f08325962fa9374ee2 (diff)
downloadlinux-stable-8a45885c1514cdae2ee64b5ac03ffc00a1a8a9d7.tar.gz
linux-stable-8a45885c1514cdae2ee64b5ac03ffc00a1a8a9d7.tar.bz2
linux-stable-8a45885c1514cdae2ee64b5ac03ffc00a1a8a9d7.zip
tcmu: Add Type of reconfig into netlink
This patch adds more info about the attribute being changed, so that usersapce can easily figure out what is happening. Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Reviewed-By: Mike Christie <mchristi@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_user.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 7c6475731895..afc1fd6bacaf 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1176,7 +1176,8 @@ static int tcmu_release(struct uio_info *info, struct inode *inode)
return 0;
}
-static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, int minor)
+static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name,
+ int minor, int type)
{
struct sk_buff *skb;
void *msg_header;
@@ -1198,6 +1199,10 @@ static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, int mino
if (ret < 0)
goto free_skb;
+ ret = nla_put_u32(skb, TCMU_ATTR_TYPE, type);
+ if (ret < 0)
+ goto free_skb;
+
genlmsg_end(skb, msg_header);
ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0,
@@ -1301,7 +1306,7 @@ static int tcmu_configure_device(struct se_device *dev)
kref_get(&udev->kref);
ret = tcmu_netlink_event(TCMU_CMD_ADDED_DEVICE, udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor, NO_RECONFIG);
if (ret)
goto err_netlink;
@@ -1383,7 +1388,7 @@ static void tcmu_free_device(struct se_device *dev)
if (tcmu_dev_configured(udev)) {
tcmu_netlink_event(TCMU_CMD_REMOVED_DEVICE, udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor, NO_RECONFIG);
uio_unregister_device(&udev->uio_info);
}
@@ -1577,7 +1582,8 @@ static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page,
if (tcmu_dev_configured(udev)) {
ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor,
+ CONFIG_PATH);
if (ret) {
pr_err("Unable to reconfigure device\n");
return ret;
@@ -1615,7 +1621,8 @@ static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page,
if (tcmu_dev_configured(udev)) {
ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor,
+ CONFIG_SIZE);
if (ret) {
pr_err("Unable to reconfigure device\n");
return ret;
@@ -1654,7 +1661,8 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item,
if (tcmu_dev_configured(udev)) {
ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE,
udev->uio_info.name,
- udev->uio_info.uio_dev->minor);
+ udev->uio_info.uio_dev->minor,
+ CONFIG_WRITECACHE);
if (ret) {
pr_err("Unable to reconfigure device\n");
return ret;