This patch adds more info about the attribute being changed, so that usersapce can easily figure out what is happening.
Unified · Split
| @@ -1176,7 +1176,8 @@ static int tcmu_release(struct uio_info *info, struct inode *inode) · 1175 unmodified lines | ||
| 1176 | 1176 | return 0; |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | −static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, int minor) | |
| 1179 | +static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, | |
| 1180 | + int minor, int type) | |
| 1180 | 1181 | { |
| 1181 | 1182 | struct sk_buff *skb; |
| 1182 | 1183 | void *msg_header; |
| @@ -1198,6 +1199,10 @@ static int tcmu_netlink_event(enum tcmu_genl_cmd cmd, const char *name, int mino · 15 unmodified lines | ||
| 1198 | 1199 | if (ret < 0) |
| 1199 | 1200 | goto free_skb; |
| 1200 | 1201 | |
| 1202 | + ret = nla_put_u32(skb, TCMU_ATTR_TYPE, type); | |
| 1203 | + if (ret < 0) | |
| 1204 | + goto free_skb; | |
| 1205 | + | |
| 1201 | 1206 | genlmsg_end(skb, msg_header); |
| 1202 | 1207 | |
| 1203 | 1208 | ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0, |
| @@ -1301,7 +1306,7 @@ static int tcmu_configure_device(struct se_device *dev) · 97 unmodified lines | ||
| 1301 | 1306 | kref_get(&udev->kref); |
| 1302 | 1307 | |
| 1303 | 1308 | ret = tcmu_netlink_event(TCMU_CMD_ADDED_DEVICE, udev->uio_info.name, |
| 1304 | − udev->uio_info.uio_dev->minor); | |
| 1309 | + udev->uio_info.uio_dev->minor, NO_RECONFIG); | |
| 1305 | 1310 | if (ret) |
| 1306 | 1311 | goto err_netlink; |
| 1307 | 1312 | |
| @@ -1383,7 +1388,7 @@ static void tcmu_free_device(struct se_device *dev) · 75 unmodified lines | ||
| 1383 | 1388 | |
| 1384 | 1389 | if (tcmu_dev_configured(udev)) { |
| 1385 | 1390 | tcmu_netlink_event(TCMU_CMD_REMOVED_DEVICE, udev->uio_info.name, |
| 1386 | − udev->uio_info.uio_dev->minor); | |
| 1391 | + udev->uio_info.uio_dev->minor, NO_RECONFIG); | |
| 1387 | 1392 | |
| 1388 | 1393 | uio_unregister_device(&udev->uio_info); |
| 1389 | 1394 | } |
| @@ -1577,7 +1582,8 @@ static ssize_t tcmu_dev_path_store(struct config_item *item, const char *page, · 187 unmodified lines | ||
| 1577 | 1582 | if (tcmu_dev_configured(udev)) { |
| 1578 | 1583 | ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE, |
| 1579 | 1584 | udev->uio_info.name, |
| 1580 | − udev->uio_info.uio_dev->minor); | |
| 1585 | + udev->uio_info.uio_dev->minor, | |
| 1586 | + CONFIG_PATH); | |
| 1581 | 1587 | if (ret) { |
| 1582 | 1588 | pr_err("Unable to reconfigure device\n"); |
| 1583 | 1589 | return ret; |
| @@ -1615,7 +1621,8 @@ static ssize_t tcmu_dev_size_store(struct config_item *item, const char *page, · 31 unmodified lines | ||
| 1615 | 1621 | if (tcmu_dev_configured(udev)) { |
| 1616 | 1622 | ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE, |
| 1617 | 1623 | udev->uio_info.name, |
| 1618 | − udev->uio_info.uio_dev->minor); | |
| 1624 | + udev->uio_info.uio_dev->minor, | |
| 1625 | + CONFIG_SIZE); | |
| 1619 | 1626 | if (ret) { |
| 1620 | 1627 | pr_err("Unable to reconfigure device\n"); |
| 1621 | 1628 | return ret; |
| @@ -1654,7 +1661,8 @@ static ssize_t tcmu_emulate_write_cache_store(struct config_item *item, · 32 unmodified lines | ||
| 1654 | 1661 | if (tcmu_dev_configured(udev)) { |
| 1655 | 1662 | ret = tcmu_netlink_event(TCMU_CMD_RECONFIG_DEVICE, |
| 1656 | 1663 | udev->uio_info.name, |
| 1657 | − udev->uio_info.uio_dev->minor); | |
| 1664 | + udev->uio_info.uio_dev->minor, | |
| 1665 | + CONFIG_WRITECACHE); | |
| 1658 | 1666 | if (ret) { |
| 1659 | 1667 | pr_err("Unable to reconfigure device\n"); |
| 1660 | 1668 | return ret; |
| @@ -139,8 +139,16 @@ enum tcmu_genl_attr { · 138 unmodified lines | ||
| 139 | 139 | TCMU_ATTR_UNSPEC, |
| 140 | 140 | TCMU_ATTR_DEVICE, |
| 141 | 141 | TCMU_ATTR_MINOR, |
| 142 | + TCMU_ATTR_TYPE, | |
| 142 | 143 | __TCMU_ATTR_MAX, |
| 143 | 144 | }; |
| 144 | 145 | #define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1) |
| 145 | 146 | |
| 147 | +enum tcmu_reconfig_types { | |
| 148 | + NO_RECONFIG, | |
| 149 | + CONFIG_PATH, | |
| 150 | + CONFIG_SIZE, | |
| 151 | + CONFIG_WRITECACHE, | |
| 152 | +}; | |
| 153 | + | |
| 146 | 154 | #endif |