Skip to contentSkip to conversation

vmbus: Switch to use new generic UUID API

PATCH Applied Andy Shevchenko 4 participants 4 messages Jan 10, 2019 – Jan 23, 2019 Hyper-V/Azure core and drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 vmbus: Switch to use new generic UUID API

There are new types and helpers that are supposed to be used in new code.

As a preparation to get rid of legacy types and API functions do the conversion here.

Cc "K. Y. Srinivasan" <[email protected]>
Cc Haiyang Zhang <[email protected]>
Cc Stephen Hemminger <[email protected]>

---

v2:
- leave uapi untouched (Christoph, Haiyang)
- rebase on top of latest linux-next

 drivers/hv/channel.c      |  4 +-
 drivers/hv/channel_mgmt.c | 18 +++----
 drivers/hv/hyperv_vmbus.h |  4 +-
 drivers/hv/vmbus_drv.c    | 48 +++++++------------
 include/linux/hyperv.h    | 98 +++++++++++++++++++--------------------
 5 files changed, 79 insertions(+), 93 deletions(-)
drivers/hv/channel.c +2 -2
index ce0ba2062723..7f3f9994e55e 100644
@@ -282,8 +282,8 @@ int vmbus_open(struct vmbus_channel *newchannel,
 EXPORT_SYMBOL_GPL(vmbus_open);
 
 /* Used for Hyper-V Socket: a guest client's connect() to the host */
-int vmbus_send_tl_connect_request(const uuid_le *shv_guest_servie_id,
-				  const uuid_le *shv_host_servie_id)
+int vmbus_send_tl_connect_request(const guid_t *shv_guest_servie_id,
+				  const guid_t *shv_host_servie_id)
 {
 	struct vmbus_channel_tl_connect_request conn_msg;
 	int ret;
drivers/hv/channel_mgmt.c +9 -9
index d01689079e9b..62703b354d6d 100644
@@ -141,7 +141,7 @@ static const struct vmbus_device vmbus_devs[] = {
 };
 
 static const struct {
-	uuid_le guid;
+	guid_t guid;
 } vmbus_unsupported_devs[] = {
 	{ HV_AVMA1_GUID },
 	{ HV_AVMA2_GUID },
@@ -171,26 +171,26 @@ static void vmbus_rescind_cleanup(struct vmbus_channel *channel)
 	spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
 }
 
-static bool is_unsupported_vmbus_devs(const uuid_le *guid)
+static bool is_unsupported_vmbus_devs(const guid_t *guid)
 {
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(vmbus_unsupported_devs); i++)
-		if (!uuid_le_cmp(*guid, vmbus_unsupported_devs[i].guid))
+		if (guid_equal(guid, &vmbus_unsupported_devs[i].guid))
 			return true;
 	return false;
 }
 
 static u16 hv_get_dev_type(const struct vmbus_channel *channel)
 {
-	const uuid_le *guid = &channel->offermsg.offer.if_type;
+	const guid_t *guid = &channel->offermsg.offer.if_type;
 	u16 i;
 
 	if (is_hvsock_channel(channel) || is_unsupported_vmbus_devs(guid))
 		return HV_UNKNOWN;
 
 	for (i = HV_IDE; i < HV_UNKNOWN; i++) {
-		if (!uuid_le_cmp(*guid, vmbus_devs[i].guid))
+		if (guid_equal(guid, &vmbus_devs[i].guid))
 			return i;
 	}
 	pr_info("Unknown GUID: %pUl\n", guid);
@@ -561,10 +561,10 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
 	atomic_dec(&vmbus_connection.offer_in_progress);
 
 	list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
-		if (!uuid_le_cmp(channel->offermsg.offer.if_type,
-				 newchannel->offermsg.offer.if_type) &&
-		    !uuid_le_cmp(channel->offermsg.offer.if_instance,
-				 newchannel->offermsg.offer.if_instance)) {
+		if (guid_equal(&channel->offermsg.offer.if_type,
+			       &newchannel->offermsg.offer.if_type) &&
+		    guid_equal(&channel->offermsg.offer.if_instance,
+			       &newchannel->offermsg.offer.if_instance)) {
 			fnew = false;
 			break;
 		}
drivers/hv/hyperv_vmbus.h +2 -2
index a1f6ce6e5974..cb86b133eb4d 100644
@@ -312,8 +312,8 @@ extern const struct vmbus_channel_message_table_entry
 
 /* General vmbus interface */
 
-struct hv_device *vmbus_device_create(const uuid_le *type,
-				      const uuid_le *instance,
+struct hv_device *vmbus_device_create(const guid_t *type,
+				      const guid_t *instance,
 				      struct vmbus_channel *channel);
 
 int vmbus_device_register(struct hv_device *child_device_obj);
drivers/hv/vmbus_drv.c +17 -31

125 lines not on this page · raw message

include/linux/hyperv.h +49 -49

246 lines not on this page · raw message

Signature · 1 line
2.20.1
Reviewed-by on v2 1/1
#1 lore raw

From: Andy Shevchenko <[email protected]> Sent: Thursday, January 10, 2019 6:26 AM

Quoted 17 lines

There are new types and helpers that are supposed to be used in new code.

As a preparation to get rid of legacy types and API functions do the conversion here.

Cc "K. Y. Srinivasan" <[email protected]>
Cc Haiyang Zhang <[email protected]>
Cc Stephen Hemminger <[email protected]>

---

v2:
- leave uapi untouched (Christoph, Haiyang)
- rebase on top of latest linux-next

Quoted 6 lines
 drivers/hv/channel.c      |  4 +-
 drivers/hv/channel_mgmt.c | 18 +++----
 drivers/hv/hyperv_vmbus.h |  4 +-
 drivers/hv/vmbus_drv.c    | 48 +++++++------------
 include/linux/hyperv.h    | 98 +++++++++++++++++++--------------------
 5 files changed, 79 insertions(+), 93 deletions(-)