From foo@baz Wed Aug 19 16:17:03 PDT 2009 Date: Wed, 19 Aug 2009 16:17:03 -0700 To: Greg KH From: Greg Kroah-Hartman Subject: Staging: hv: osd.h: remove GUID typedef GUID should not be a typedef. As proof of the problem of typedefs, look, we are passing 2 of these as a value in functions! Bah... Cc: Hank Janssen Signed-off-by: Greg Kroah-Hartman --- drivers/staging/hv/BlkVsc.c | 18 ++-- drivers/staging/hv/Channel.c | 4 drivers/staging/hv/ChannelInterface.c | 4 drivers/staging/hv/ChannelMgmt.c | 58 ++++++++++--- drivers/staging/hv/ChannelMgmt.h | 4 drivers/staging/hv/Hv.h | 4 drivers/staging/hv/NetVsc.c | 9 +- drivers/staging/hv/StorVsc.c | 9 +- drivers/staging/hv/Vmbus.c | 24 +++-- drivers/staging/hv/VmbusPrivate.h | 4 drivers/staging/hv/blkvsc_drv.c | 2 drivers/staging/hv/include/List.h | 13 --- drivers/staging/hv/include/NetVscApi.h | 6 - drivers/staging/hv/include/VmbusApi.h | 12 +- drivers/staging/hv/include/VmbusChannelInterface.h | 4 drivers/staging/hv/include/vmbus.h | 6 - drivers/staging/hv/netvsc_drv.c | 2 drivers/staging/hv/osd.h | 11 -- drivers/staging/hv/storvsc_drv.c | 2 drivers/staging/hv/vmbus_drv.c | 91 +++++++++++++-------- 20 files changed, 175 insertions(+), 112 deletions(-) --- a/drivers/staging/hv/BlkVsc.c +++ b/drivers/staging/hv/BlkVsc.c @@ -28,8 +28,11 @@ static const char* gBlkDriverName="blkvsc"; /* {32412632-86cb-44a2-9b5c-50d1417354f5} */ -static const GUID gBlkVscDeviceType={ - .Data = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5} +static const struct hv_guid gBlkVscDeviceType={ + .data = { + 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, + 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5 + } }; /* Static routines */ @@ -54,7 +57,7 @@ BlkVscInitialize( ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); Driver->name = gBlkDriverName; - memcpy(&Driver->deviceType, &gBlkVscDeviceType, sizeof(GUID)); + memcpy(&Driver->deviceType, &gBlkVscDeviceType, sizeof(struct hv_guid)); storDriver->RequestExtSize = sizeof(STORVSC_REQUEST_EXTENSION); /* Divide the ring buffer data size (which is 1 page less than the ring buffer size since that page is reserved for the ring buffer indices) */ @@ -98,10 +101,13 @@ BlkVscOnDeviceAdd( /* We need to use the device instance guid to set the path and target id. For IDE devices, the */ /* device instance id is formatted as - - 8899 - 000000000000. */ - deviceInfo->PathId = Device->deviceInstance.Data[3] << 24 | Device->deviceInstance.Data[2] << 16 | - Device->deviceInstance.Data[1] << 8 |Device->deviceInstance.Data[0]; + deviceInfo->PathId = Device->deviceInstance.data[3] << 24 | + Device->deviceInstance.data[2] << 16 | + Device->deviceInstance.data[1] << 8 | + Device->deviceInstance.data[0]; - deviceInfo->TargetId = Device->deviceInstance.Data[5] << 8 | Device->deviceInstance.Data[4]; + deviceInfo->TargetId = Device->deviceInstance.data[5] << 8 | + Device->deviceInstance.data[4]; DPRINT_EXIT(BLKVSC); --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c @@ -186,7 +186,7 @@ static int blkvsc_drv_init(PFN_DRIVERINI pfn_drv_init(&storvsc_drv_obj->Base); drv_ctx->driver.name = storvsc_drv_obj->Base.name; - memcpy(&drv_ctx->class_id, &storvsc_drv_obj->Base.deviceType, sizeof(GUID)); + memcpy(&drv_ctx->class_id, &storvsc_drv_obj->Base.deviceType, sizeof(struct hv_guid)); drv_ctx->probe = blkvsc_probe; drv_ctx->remove = blkvsc_remove; --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -154,8 +154,8 @@ void VmbusChannelGetDebugInfo(struct vmb DebugInfo->RelId = Channel->OfferMsg.ChildRelId; DebugInfo->State = Channel->State; - memcpy(&DebugInfo->InterfaceType, &Channel->OfferMsg.Offer.InterfaceType, sizeof(GUID)); - memcpy(&DebugInfo->InterfaceInstance, &Channel->OfferMsg.Offer.InterfaceInstance, sizeof(GUID)); + memcpy(&DebugInfo->InterfaceType, &Channel->OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid)); + memcpy(&DebugInfo->InterfaceInstance, &Channel->OfferMsg.Offer.InterfaceInstance, sizeof(struct hv_guid)); monitorPage = (HV_MONITOR_PAGE*)gVmbusConnection.MonitorPages; --- a/drivers/staging/hv/ChannelInterface.c +++ b/drivers/staging/hv/ChannelInterface.c @@ -190,8 +190,8 @@ void GetChannelInfo(struct hv_device *De DeviceInfo->ChannelId = debugInfo.RelId; DeviceInfo->ChannelState = debugInfo.State; - memcpy(&DeviceInfo->ChannelType, &debugInfo.InterfaceType, sizeof(GUID)); - memcpy(&DeviceInfo->ChannelInstance, &debugInfo.InterfaceInstance, sizeof(GUID)); + memcpy(&DeviceInfo->ChannelType, &debugInfo.InterfaceType, sizeof(struct hv_guid)); + memcpy(&DeviceInfo->ChannelInstance, &debugInfo.InterfaceInstance, sizeof(struct hv_guid)); DeviceInfo->MonitorId = debugInfo.MonitorId; --- a/drivers/staging/hv/ChannelMgmt.c +++ b/drivers/staging/hv/ChannelMgmt.c @@ -89,16 +89,42 @@ VmbusChannelProcessRescindOffer( #define MAX_NUM_DEVICE_CLASSES_SUPPORTED 4 -static const GUID gSupportedDeviceClasses[MAX_NUM_DEVICE_CLASSES_SUPPORTED]= { +static const struct hv_guid gSupportedDeviceClasses[MAX_NUM_DEVICE_CLASSES_SUPPORTED] = { /* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */ - {.Data = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f}},/* Storage - SCSI */ + /* Storage - SCSI */ + { + .data = { + 0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, + 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f + } + }, + /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ - {.Data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E}}, /* Network */ + /* Network */ + { + .data = { + 0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, + 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E + } + }, + /* {CFA8B69E-5B4A-4cc0-B98B-8BA1A1F3F95A} */ - {.Data = {0x9E, 0xB6, 0xA8, 0xCF, 0x4A, 0x5B, 0xc0, 0x4c, 0xB9, 0x8B, 0x8B, 0xA1, 0xA1, 0xF3, 0xF9, 0x5A}}, /* Input */ - /* {32412632-86cb-44a2-9b5c-50d1417354f5} */ - {.Data = {0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5}}, /* IDE */ + /* Input */ + { + .data = { + 0x9E, 0xB6, 0xA8, 0xCF, 0x4A, 0x5B, 0xc0, 0x4c, + 0xB9, 0x8B, 0x8B, 0xA1, 0xA1, 0xF3, 0xF9, 0x5A + } + }, + /* {32412632-86cb-44a2-9b5c-50d1417354f5} */ + /* IDE */ + { + .data = { + 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44, + 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5 + } + }, }; /* Channel message dispatch table */ @@ -233,8 +259,8 @@ VmbusChannelProcessOffer( { channel = CONTAINING_RECORD(curr, struct vmbus_channel, ListEntry); - if (!memcmp(&channel->OfferMsg.Offer.InterfaceType, &newChannel->OfferMsg.Offer.InterfaceType,sizeof(GUID)) && - !memcmp(&channel->OfferMsg.Offer.InterfaceInstance, &newChannel->OfferMsg.Offer.InterfaceInstance, sizeof(GUID))) + if (!memcmp(&channel->OfferMsg.Offer.InterfaceType, &newChannel->OfferMsg.Offer.InterfaceType,sizeof(struct hv_guid)) && + !memcmp(&channel->OfferMsg.Offer.InterfaceInstance, &newChannel->OfferMsg.Offer.InterfaceInstance, sizeof(struct hv_guid))) { fNew = false; break; @@ -337,8 +363,8 @@ VmbusChannelOnOffer( VMBUS_CHANNEL_OFFER_CHANNEL* offer = (VMBUS_CHANNEL_OFFER_CHANNEL*)hdr; struct vmbus_channel *newChannel; - GUID *guidType; - GUID *guidInstance; + struct hv_guid *guidType; + struct hv_guid *guidInstance; int i; int fSupported=0; @@ -346,7 +372,7 @@ VmbusChannelOnOffer( for (i=0; iOffer.InterfaceType, &gSupportedDeviceClasses[i], sizeof(GUID)) == 0) + if (memcmp(&offer->Offer.InterfaceType, &gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) { fSupported = 1; break; @@ -370,8 +396,14 @@ VmbusChannelOnOffer( offer->ChildRelId, offer->MonitorId, offer->MonitorAllocated, - guidType->Data[3], guidType->Data[2], guidType->Data[1], guidType->Data[0], guidType->Data[5], guidType->Data[4], guidType->Data[7], guidType->Data[6], guidType->Data[8], guidType->Data[9], guidType->Data[10], guidType->Data[11], guidType->Data[12], guidType->Data[13], guidType->Data[14], guidType->Data[15], - guidInstance->Data[3], guidInstance->Data[2], guidInstance->Data[1], guidInstance->Data[0], guidInstance->Data[5], guidInstance->Data[4], guidInstance->Data[7], guidInstance->Data[6], guidInstance->Data[8], guidInstance->Data[9], guidInstance->Data[10], guidInstance->Data[11], guidInstance->Data[12], guidInstance->Data[13], guidInstance->Data[14], guidInstance->Data[15]); + guidType->data[3], guidType->data[2], guidType->data[1], guidType->data[0], + guidType->data[5], guidType->data[4], guidType->data[7], guidType->data[6], + guidType->data[8], guidType->data[9], guidType->data[10], guidType->data[11], + guidType->data[12], guidType->data[13], guidType->data[14], guidType->data[15], + guidInstance->data[3], guidInstance->data[2], guidInstance->data[1], guidInstance->data[0], + guidInstance->data[5], guidInstance->data[4], guidInstance->data[7], guidInstance->data[6], + guidInstance->data[8], guidInstance->data[9], guidInstance->data[10], guidInstance->data[11], + guidInstance->data[12], guidInstance->data[13], guidInstance->data[14], guidInstance->data[15]); /* Allocate the channel object and save this offer. */ newChannel = AllocVmbusChannel(); --- a/drivers/staging/hv/ChannelMgmt.h +++ b/drivers/staging/hv/ChannelMgmt.h @@ -78,8 +78,8 @@ struct vmbus_channel { struct vmbus_channel_debug_info { u32 RelId; enum vmbus_channel_state State; - GUID InterfaceType; - GUID InterfaceInstance; + struct hv_guid InterfaceType; + struct hv_guid InterfaceInstance; u32 MonitorId; u32 ServerMonitorPending; u32 ServerMonitorLatency; --- a/drivers/staging/hv/Hv.h +++ b/drivers/staging/hv/Hv.h @@ -92,8 +92,8 @@ enum { /* #define VMBUS_PORT_ID 11 */ /* 628180B8-308D-4c5e-B7DB-1BEB62E62EF4 */ -static const GUID VMBUS_SERVICE_ID = { - .Data = { +static const struct hv_guid VMBUS_SERVICE_ID = { + .data = { 0xb8, 0x80, 0x81, 0x62, 0x8d, 0x30, 0x5e, 0x4c, 0xb7, 0xdb, 0x1b, 0xeb, 0x62, 0xe6, 0x2e, 0xf4 }, --- a/drivers/staging/hv/include/List.h +++ b/drivers/staging/hv/include/List.h @@ -32,15 +32,10 @@ * */ -typedef DLIST_ENTRY LIST_ENTRY; -typedef DLIST_ENTRY *PLIST_ENTRY; - -/* typedef struct LIST_ENTRY { */ -/* struct LIST_ENTRY * volatile Flink; */ -/* struct LIST_ENTRY * volatile Blink; */ -/* } LIST_ENTRY, *PLIST_ENTRY; */ - - +typedef struct _LIST_ENTRY { + struct _LIST_ENTRY *Flink; + struct _LIST_ENTRY *Blink; +} LIST_ENTRY, *PLIST_ENTRY; /* * void --- a/drivers/staging/hv/include/NetVscApi.h +++ b/drivers/staging/hv/include/NetVscApi.h @@ -26,7 +26,7 @@ #define _NETVSC_API_H_ #include "VmbusApi.h" - +#include "List.h" /* Defines */ @@ -56,7 +56,7 @@ typedef void (*PFN_ON_LINKSTATUS_CHANGED /* Represent the xfer page packet which contains 1 or more netvsc packet */ typedef struct _XFERPAGE_PACKET { - DLIST_ENTRY ListEntry; + LIST_ENTRY ListEntry; /* # of netvsc packets this xfer packet contains */ u32 Count; @@ -72,7 +72,7 @@ typedef struct _XFERPAGE_PACKET { */ struct hv_netvsc_packet { /* Bookkeeping stuff */ - DLIST_ENTRY ListEntry; + LIST_ENTRY ListEntry; struct hv_device *Device; bool IsDataPacket; --- a/drivers/staging/hv/include/VmbusApi.h +++ b/drivers/staging/hv/include/VmbusApi.h @@ -76,7 +76,7 @@ typedef int (*PFN_ON_ISR)(struct hv_driv typedef void (*PFN_ON_DPC)(struct hv_driver *drv); typedef void (*PFN_GET_CHANNEL_OFFERS)(void); -typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)(GUID DeviceType, GUID DeviceInstance, void *Context); +typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)(struct hv_guid DeviceType, struct hv_guid DeviceInstance, void *Context); typedef void (*PFN_ON_CHILDDEVICE_DESTROY)(struct hv_device *Device); typedef int (*PFN_ON_CHILDDEVICE_ADD)(struct hv_device *RootDevice, struct hv_device *ChildDevice); typedef void (*PFN_ON_CHILDDEVICE_REMOVE)(struct hv_device *Device); @@ -165,8 +165,8 @@ typedef struct _PORT_INFO { typedef struct _DEVICE_INFO { u32 ChannelId; u32 ChannelState; - GUID ChannelType; - GUID ChannelInstance; + struct hv_guid ChannelType; + struct hv_guid ChannelInstance; u32 MonitorId; u32 ServerMonitorPending; @@ -200,7 +200,7 @@ typedef void (*VMBUS_GET_CHANNEL_INTERFA /* Base driver object */ struct hv_driver { const char* name; - GUID deviceType; /* the device type supported by this driver */ + struct hv_guid deviceType; /* the device type supported by this driver */ PFN_ON_DEVICEADD OnDeviceAdd; PFN_ON_DEVICEREMOVE OnDeviceRemove; @@ -215,8 +215,8 @@ struct hv_driver { struct hv_device { struct hv_driver *Driver; /* the driver for this device */ char name[64]; - GUID deviceType; /* the device type id of this device */ - GUID deviceInstance; /* the device instance id of this device */ + struct hv_guid deviceType; /* the device type id of this device */ + struct hv_guid deviceInstance; /* the device instance id of this device */ void* context; void* Extension; /* Device extension; */ }; --- a/drivers/staging/hv/include/VmbusChannelInterface.h +++ b/drivers/staging/hv/include/VmbusChannelInterface.h @@ -64,8 +64,8 @@ typedef struct { - GUID InterfaceType; - GUID InterfaceInstance; + struct hv_guid InterfaceType; + struct hv_guid InterfaceInstance; u64 InterruptLatencyIn100nsUnits; u32 InterfaceRevision; u32 ServerContextAreaSize; /* in bytes */ --- a/drivers/staging/hv/include/vmbus.h +++ b/drivers/staging/hv/include/vmbus.h @@ -37,7 +37,7 @@ typedef int (*PFN_DRIVERINITIALIZE)(stru typedef int (*PFN_DRIVEREXIT)(struct hv_driver *drv); struct driver_context { - GUID class_id; + struct hv_guid class_id; struct device_driver driver; @@ -49,8 +49,8 @@ struct driver_context { struct device_context { struct work_struct probe_failed_work_item; - GUID class_id; - GUID device_id; + struct hv_guid class_id; + struct hv_guid device_id; int probe_error; struct device device; struct hv_device device_obj; --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -34,8 +34,11 @@ static const char* gDriverName="netvsc"; /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */ -static const GUID gNetVscDeviceType={ - .Data = {0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E} +static const struct hv_guid gNetVscDeviceType = { + .data = { + 0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46, + 0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E + } }; @@ -240,7 +243,7 @@ NetVscInitialize( ASSERT(driver->RingBufferSize >= (PAGE_SIZE << 1)); drv->name = gDriverName; - memcpy(&drv->deviceType, &gNetVscDeviceType, sizeof(GUID)); + memcpy(&drv->deviceType, &gNetVscDeviceType, sizeof(struct hv_guid)); /* Make sure it is set by the caller */ ASSERT(driver->OnReceiveCallback); --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c @@ -109,7 +109,7 @@ static int netvsc_drv_init(PFN_DRIVERINI pfn_drv_init(&net_drv_obj->Base); drv_ctx->driver.name = net_drv_obj->Base.name; - memcpy(&drv_ctx->class_id, &net_drv_obj->Base.deviceType, sizeof(GUID)); + memcpy(&drv_ctx->class_id, &net_drv_obj->Base.deviceType, sizeof(struct hv_guid)); drv_ctx->probe = netvsc_probe; drv_ctx->remove = netvsc_remove; --- a/drivers/staging/hv/osd.h +++ b/drivers/staging/hv/osd.h @@ -38,14 +38,9 @@ #define LOWORD(dw) ((unsigned short)(dw)) #define HIWORD(dw) ((unsigned short)(((unsigned int) (dw) >> 16) & 0xFFFF)) -typedef struct _DLIST_ENTRY { - struct _DLIST_ENTRY *Flink; - struct _DLIST_ENTRY *Blink; -} DLIST_ENTRY; - -typedef struct { - unsigned char Data[16]; -} GUID; +struct hv_guid { + unsigned char data[16]; +}; struct osd_waitevent { int condition; --- a/drivers/staging/hv/StorVsc.c +++ b/drivers/staging/hv/StorVsc.c @@ -87,8 +87,11 @@ typedef struct _STORVSC_DEVICE{ static const char* gDriverName="storvsc"; /* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */ -static const GUID gStorVscDeviceType={ - .Data = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f} +static const struct hv_guid gStorVscDeviceType = { + .data = { + 0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, + 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f + } }; @@ -270,7 +273,7 @@ StorVscInitialize( ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); Driver->name = gDriverName; - memcpy(&Driver->deviceType, &gStorVscDeviceType, sizeof(GUID)); + memcpy(&Driver->deviceType, &gStorVscDeviceType, sizeof(struct hv_guid)); storDriver->RequestExtSize = sizeof(STORVSC_REQUEST_EXTENSION); --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c @@ -156,7 +156,7 @@ static int storvsc_drv_init(PFN_DRIVERIN } drv_ctx->driver.name = storvsc_drv_obj->Base.name; - memcpy(&drv_ctx->class_id, &storvsc_drv_obj->Base.deviceType, sizeof(GUID)); + memcpy(&drv_ctx->class_id, &storvsc_drv_obj->Base.deviceType, sizeof(struct hv_guid)); drv_ctx->probe = storvsc_probe; drv_ctx->remove = storvsc_remove; --- a/drivers/staging/hv/Vmbus.c +++ b/drivers/staging/hv/Vmbus.c @@ -37,13 +37,19 @@ static const char* gDriverName="vmbus"; * We defined this to be consistent with other devices */ /* {c5295816-f63a-4d5f-8d1a-4daf999ca185} */ -static const GUID gVmbusDeviceType={ - .Data = {0x16, 0x58, 0x29, 0xc5, 0x3a, 0xf6, 0x5f, 0x4d, 0x8d, 0x1a, 0x4d, 0xaf, 0x99, 0x9c, 0xa1, 0x85} +static const struct hv_guid gVmbusDeviceType = { + .data = { + 0x16, 0x58, 0x29, 0xc5, 0x3a, 0xf6, 0x5f, 0x4d, + 0x8d, 0x1a, 0x4d, 0xaf, 0x99, 0x9c, 0xa1, 0x85 + } }; /* {ac3760fc-9adf-40aa-9427-a70ed6de95c5} */ -static const GUID gVmbusDeviceId={ - .Data = {0xfc, 0x60, 0x37, 0xac, 0xdf, 0x9a, 0xaa, 0x40, 0x94, 0x27, 0xa7, 0x0e, 0xd6, 0xde, 0x95, 0xc5} +static const struct hv_guid gVmbusDeviceId = { + .data = { + 0xfc, 0x60, 0x37, 0xac, 0xdf, 0x9a, 0xaa, 0x40, + 0x94, 0x27, 0xa7, 0x0e, 0xd6, 0xde, 0x95, 0xc5 + } }; static struct hv_driver *gDriver; /* vmbus driver object */ @@ -130,7 +136,7 @@ VmbusInitialize( sizeof(struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER), sizeof(struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER)); drv->name = gDriverName; - memcpy(&drv->deviceType, &gVmbusDeviceType, sizeof(GUID)); + memcpy(&drv->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid)); /* Setup dispatch table */ driver->Base.OnDeviceAdd = VmbusOnDeviceAdd; @@ -225,8 +231,8 @@ Description: --*/ -struct hv_device *VmbusChildDeviceCreate(GUID DeviceType, - GUID DeviceInstance, +struct hv_device *VmbusChildDeviceCreate(struct hv_guid DeviceType, + struct hv_guid DeviceInstance, void *Context) { VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver; @@ -315,8 +321,8 @@ VmbusOnDeviceAdd( gDevice = dev; - memcpy(&gDevice->deviceType, &gVmbusDeviceType, sizeof(GUID)); - memcpy(&gDevice->deviceInstance, &gVmbusDeviceId, sizeof(GUID)); + memcpy(&gDevice->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid)); + memcpy(&gDevice->deviceInstance, &gVmbusDeviceId, sizeof(struct hv_guid)); /* strcpy(dev->name, "vmbus"); */ /* SynIC setup... */ --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -75,7 +75,7 @@ static irqreturn_t vmbus_isr(int irq, vo static void vmbus_device_release(struct device *device); static void vmbus_bus_release(struct device *device); -static struct hv_device *vmbus_child_device_create(GUID type, GUID instance, void* context); +static struct hv_device *vmbus_child_device_create(struct hv_guid type, struct hv_guid instance, void* context); static void vmbus_child_device_destroy(struct hv_device *device_obj); static int vmbus_child_device_register(struct hv_device *root_device_obj, struct hv_device *child_device_obj); static void vmbus_child_device_unregister(struct hv_device *child_device_obj); @@ -168,19 +168,27 @@ static ssize_t vmbus_show_device_attr(st if (!strcmp(dev_attr->attr.name, "class_id")) { return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%02x%02x}\n", - device_info.ChannelType.Data[3], device_info.ChannelType.Data[2], device_info.ChannelType.Data[1], device_info.ChannelType.Data[0], - device_info.ChannelType.Data[5], device_info.ChannelType.Data[4], - device_info.ChannelType.Data[7], device_info.ChannelType.Data[6], - device_info.ChannelType.Data[8], device_info.ChannelType.Data[9], device_info.ChannelType.Data[10], device_info.ChannelType.Data[11], device_info.ChannelType.Data[12], device_info.ChannelType.Data[13], device_info.ChannelType.Data[14], device_info.ChannelType.Data[15]); + device_info.ChannelType.data[3], device_info.ChannelType.data[2], + device_info.ChannelType.data[1], device_info.ChannelType.data[0], + device_info.ChannelType.data[5], device_info.ChannelType.data[4], + device_info.ChannelType.data[7], device_info.ChannelType.data[6], + device_info.ChannelType.data[8], device_info.ChannelType.data[9], + device_info.ChannelType.data[10], device_info.ChannelType.data[11], + device_info.ChannelType.data[12], device_info.ChannelType.data[13], + device_info.ChannelType.data[14], device_info.ChannelType.data[15]); } else if (!strcmp(dev_attr->attr.name, "device_id")) { return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%02x%02x}\n", - device_info.ChannelInstance.Data[3], device_info.ChannelInstance.Data[2], device_info.ChannelInstance.Data[1], device_info.ChannelInstance.Data[0], - device_info.ChannelInstance.Data[5], device_info.ChannelInstance.Data[4], - device_info.ChannelInstance.Data[7], device_info.ChannelInstance.Data[6], - device_info.ChannelInstance.Data[8], device_info.ChannelInstance.Data[9], device_info.ChannelInstance.Data[10], device_info.ChannelInstance.Data[11], device_info.ChannelInstance.Data[12], device_info.ChannelInstance.Data[13], device_info.ChannelInstance.Data[14], device_info.ChannelInstance.Data[15]); + device_info.ChannelInstance.data[3], device_info.ChannelInstance.data[2], + device_info.ChannelInstance.data[1], device_info.ChannelInstance.data[0], + device_info.ChannelInstance.data[5], device_info.ChannelInstance.data[4], + device_info.ChannelInstance.data[7], device_info.ChannelInstance.data[6], + device_info.ChannelInstance.data[8], device_info.ChannelInstance.data[9], + device_info.ChannelInstance.data[10], device_info.ChannelInstance.data[11], + device_info.ChannelInstance.data[12], device_info.ChannelInstance.data[13], + device_info.ChannelInstance.data[14], device_info.ChannelInstance.data[15]); } else if (!strcmp(dev_attr->attr.name, "state")) { @@ -396,8 +404,8 @@ static int vmbus_bus_init(PFN_DRIVERINIT } /* strcpy(dev_ctx->device.bus_id, dev_ctx->device_obj.name); */ dev_set_name(&dev_ctx->device, "vmbus_0_0"); - memcpy(&dev_ctx->class_id, &dev_ctx->device_obj.deviceType, sizeof(GUID)); - memcpy(&dev_ctx->device_id, &dev_ctx->device_obj.deviceInstance, sizeof(GUID)); + memcpy(&dev_ctx->class_id, &dev_ctx->device_obj.deviceType, sizeof(struct hv_guid)); + memcpy(&dev_ctx->device_id, &dev_ctx->device_obj.deviceInstance, sizeof(struct hv_guid)); /* No need to bind a driver to the root device. */ dev_ctx->device.parent = NULL; @@ -557,7 +565,7 @@ Name: vmbus_child_device_create() Desc: Creates and registers a new child device on the vmbus. --*/ -static struct hv_device *vmbus_child_device_create(GUID type, GUID instance, void* context) +static struct hv_device *vmbus_child_device_create(struct hv_guid type, struct hv_guid instance, void* context) { struct device_context *child_device_ctx; struct hv_device *child_device_obj; @@ -578,16 +586,22 @@ static struct hv_device *vmbus_child_dev "type {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%02x%02x}," "id {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%02x%02x}", &child_device_ctx->device, - type.Data[3], type.Data[2], type.Data[1], type.Data[0], type.Data[5], type.Data[4], type.Data[7], type.Data[6], type.Data[8], type.Data[9], type.Data[10], type.Data[11], type.Data[12], type.Data[13], type.Data[14], type.Data[15], - instance.Data[3], instance.Data[2], instance.Data[1], instance.Data[0], instance.Data[5], instance.Data[4], instance.Data[7], instance.Data[6], instance.Data[8], instance.Data[9], instance.Data[10], instance.Data[11], instance.Data[12], instance.Data[13], instance.Data[14], instance.Data[15]); + type.data[3], type.data[2], type.data[1], type.data[0], + type.data[5], type.data[4], type.data[7], type.data[6], + type.data[8], type.data[9], type.data[10], type.data[11], + type.data[12], type.data[13], type.data[14], type.data[15], + instance.data[3], instance.data[2], instance.data[1], instance.data[0], + instance.data[5], instance.data[4], instance.data[7], instance.data[6], + instance.data[8], instance.data[9], instance.data[10], instance.data[11], + instance.data[12], instance.data[13], instance.data[14], instance.data[15]); child_device_obj = &child_device_ctx->device_obj; child_device_obj->context = context; - memcpy(&child_device_obj->deviceType, &type, sizeof(GUID)); - memcpy(&child_device_obj->deviceInstance, &instance, sizeof(GUID)); + memcpy(&child_device_obj->deviceType, &type, sizeof(struct hv_guid)); + memcpy(&child_device_obj->deviceInstance, &instance, sizeof(struct hv_guid)); - memcpy(&child_device_ctx->class_id, &type, sizeof(GUID)); - memcpy(&child_device_ctx->device_id, &instance, sizeof(GUID)); + memcpy(&child_device_ctx->class_id, &type, sizeof(struct hv_guid)); + memcpy(&child_device_ctx->device_id, &instance, sizeof(struct hv_guid)); DPRINT_EXIT(VMBUS_DRV); @@ -705,21 +719,27 @@ static int vmbus_uevent(struct device *d DPRINT_ENTER(VMBUS_DRV); DPRINT_INFO(VMBUS_DRV, "generating uevent - VMBUS_DEVICE_CLASS_GUID={%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%02x%02x}", - device_ctx->class_id.Data[3], device_ctx->class_id.Data[2], device_ctx->class_id.Data[1], device_ctx->class_id.Data[0], - device_ctx->class_id.Data[5], device_ctx->class_id.Data[4], - device_ctx->class_id.Data[7], device_ctx->class_id.Data[6], - device_ctx->class_id.Data[8], device_ctx->class_id.Data[9], device_ctx->class_id.Data[10], device_ctx->class_id.Data[11], - device_ctx->class_id.Data[12], device_ctx->class_id.Data[13], device_ctx->class_id.Data[14], device_ctx->class_id.Data[15]); + device_ctx->class_id.data[3], device_ctx->class_id.data[2], + device_ctx->class_id.data[1], device_ctx->class_id.data[0], + device_ctx->class_id.data[5], device_ctx->class_id.data[4], + device_ctx->class_id.data[7], device_ctx->class_id.data[6], + device_ctx->class_id.data[8], device_ctx->class_id.data[9], + device_ctx->class_id.data[10], device_ctx->class_id.data[11], + device_ctx->class_id.data[12], device_ctx->class_id.data[13], + device_ctx->class_id.data[14], device_ctx->class_id.data[15]); env->envp_idx = i; env->buflen = len; ret = add_uevent_var(env, "VMBUS_DEVICE_CLASS_GUID={%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%02x%02x}", - device_ctx->class_id.Data[3], device_ctx->class_id.Data[2], device_ctx->class_id.Data[1], device_ctx->class_id.Data[0], - device_ctx->class_id.Data[5], device_ctx->class_id.Data[4], - device_ctx->class_id.Data[7], device_ctx->class_id.Data[6], - device_ctx->class_id.Data[8], device_ctx->class_id.Data[9], device_ctx->class_id.Data[10], device_ctx->class_id.Data[11], - device_ctx->class_id.Data[12], device_ctx->class_id.Data[13], device_ctx->class_id.Data[14], device_ctx->class_id.Data[15]); + device_ctx->class_id.data[3], device_ctx->class_id.data[2], + device_ctx->class_id.data[1], device_ctx->class_id.data[0], + device_ctx->class_id.data[5], device_ctx->class_id.data[4], + device_ctx->class_id.data[7], device_ctx->class_id.data[6], + device_ctx->class_id.data[8], device_ctx->class_id.data[9], + device_ctx->class_id.data[10], device_ctx->class_id.data[11], + device_ctx->class_id.data[12], device_ctx->class_id.data[13], + device_ctx->class_id.data[14], device_ctx->class_id.data[15]); if (ret) { @@ -728,11 +748,14 @@ static int vmbus_uevent(struct device *d ret = add_uevent_var(env, "VMBUS_DEVICE_DEVICE_GUID={%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x%02x%02x}", - device_ctx->device_id.Data[3], device_ctx->device_id.Data[2], device_ctx->device_id.Data[1], device_ctx->device_id.Data[0], - device_ctx->device_id.Data[5], device_ctx->device_id.Data[4], - device_ctx->device_id.Data[7], device_ctx->device_id.Data[6], - device_ctx->device_id.Data[8], device_ctx->device_id.Data[9], device_ctx->device_id.Data[10], device_ctx->device_id.Data[11], - device_ctx->device_id.Data[12], device_ctx->device_id.Data[13], device_ctx->device_id.Data[14], device_ctx->device_id.Data[15]); + device_ctx->device_id.data[3], device_ctx->device_id.data[2], + device_ctx->device_id.data[1], device_ctx->device_id.data[0], + device_ctx->device_id.data[5], device_ctx->device_id.data[4], + device_ctx->device_id.data[7], device_ctx->device_id.data[6], + device_ctx->device_id.data[8], device_ctx->device_id.data[9], + device_ctx->device_id.data[10], device_ctx->device_id.data[11], + device_ctx->device_id.data[12], device_ctx->device_id.data[13], + device_ctx->device_id.data[14], device_ctx->device_id.data[15]); if (ret) { @@ -762,7 +785,7 @@ static int vmbus_match(struct device *de DPRINT_ENTER(VMBUS_DRV); /* We found our driver ? */ - if (memcmp(&device_ctx->class_id, &driver_ctx->class_id, sizeof(GUID)) == 0) + if (memcmp(&device_ctx->class_id, &driver_ctx->class_id, sizeof(struct hv_guid)) == 0) { /* !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast it here to access the */ /* struct hv_driver field */ --- a/drivers/staging/hv/VmbusPrivate.h +++ b/drivers/staging/hv/VmbusPrivate.h @@ -103,8 +103,8 @@ extern struct VMBUS_CONNECTION gVmbusCon /* General vmbus interface */ -struct hv_device *VmbusChildDeviceCreate(GUID deviceType, - GUID deviceInstance, +struct hv_device *VmbusChildDeviceCreate(struct hv_guid deviceType, + struct hv_guid deviceInstance, void *context); int VmbusChildDeviceAdd(struct hv_device *Device);