From e26a83cd29073c6528aee29226c4795ae1b1fd40 Mon Sep 17 00:00:00 2001 From: Anthony PERARD Date: Fri, 31 Oct 2014 21:25:23 +0000 Subject: OvmfPkg/Xen*: Pass struct XENSTORE_TRANSACTION argument as a pointer As EDK II does not allow calls with a struct. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Anthony PERARD Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16294 6f19259b-4bc3-4df7-8a09-765794883524 --- OvmfPkg/Include/Protocol/XenBus.h | 14 +++++++------- OvmfPkg/XenBusDxe/XenBus.c | 2 +- OvmfPkg/XenBusDxe/XenStore.c | 36 ++++++++++++++++++++---------------- OvmfPkg/XenBusDxe/XenStore.h | 28 ++++++++++++++-------------- OvmfPkg/XenPvBlkDxe/BlockFront.c | 16 ++++++++-------- 5 files changed, 50 insertions(+), 46 deletions(-) (limited to 'OvmfPkg') diff --git a/OvmfPkg/Include/Protocol/XenBus.h b/OvmfPkg/Include/Protocol/XenBus.h index 4c1247bc93..3509691e03 100644 --- a/OvmfPkg/Include/Protocol/XenBus.h +++ b/OvmfPkg/Include/Protocol/XenBus.h @@ -39,7 +39,7 @@ typedef struct UINT32 Id; } XENSTORE_TRANSACTION; -#define XST_NIL ((XENSTORE_TRANSACTION) { 0 }) +#define XST_NIL ((XENSTORE_TRANSACTION *) NULL) typedef enum { XENSTORE_STATUS_SUCCESS = 0, @@ -88,7 +88,7 @@ typedef XENSTORE_STATUS (EFIAPI *XENBUS_XS_READ)( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Node, OUT VOID **Result ); @@ -112,7 +112,7 @@ typedef XENSTORE_STATUS (EFIAPI *XENBUS_XS_BACKEND_READ)( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Node, OUT VOID **Result ); @@ -134,7 +134,7 @@ typedef XENSTORE_STATUS (EFIAPI *XENBUS_XS_PRINTF) ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Directory, IN CONST CHAR8 *Node, IN CONST CHAR8 *Format, @@ -156,7 +156,7 @@ typedef XENSTORE_STATUS (EFIAPI *XENBUS_XS_REMOVE) ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Node ); @@ -195,7 +195,7 @@ typedef XENSTORE_STATUS (EFIAPI *XENBUS_XS_TRANSACTION_END) ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN BOOLEAN Abort ); @@ -213,7 +213,7 @@ typedef XENSTORE_STATUS (EFIAPI *XENBUS_SET_STATE)( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN XenBusState State ); diff --git a/OvmfPkg/XenBusDxe/XenBus.c b/OvmfPkg/XenBusDxe/XenBus.c index 896a6607b7..a569cfa088 100644 --- a/OvmfPkg/XenBusDxe/XenBus.c +++ b/OvmfPkg/XenBusDxe/XenBus.c @@ -314,7 +314,7 @@ XENSTORE_STATUS EFIAPI XenBusSetState ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN enum xenbus_state NewState ) { diff --git a/OvmfPkg/XenBusDxe/XenStore.c b/OvmfPkg/XenBusDxe/XenStore.c index aed6b141bd..f176b95a4d 100644 --- a/OvmfPkg/XenBusDxe/XenStore.c +++ b/OvmfPkg/XenBusDxe/XenStore.c @@ -790,7 +790,7 @@ XenStoreReadReply ( STATIC XENSTORE_STATUS XenStoreTalkv ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN enum xsd_sockmsg_type RequestType, IN CONST WRITE_REQUEST *WriteRequest, IN UINT32 NumRequests, @@ -803,7 +803,11 @@ XenStoreTalkv ( UINT32 Index; XENSTORE_STATUS Status; - Message.tx_id = Transaction.Id; + if (Transaction == XST_NIL) { + Message.tx_id = 0; + } else { + Message.tx_id = Transaction->Id; + } Message.req_id = 0; Message.type = RequestType; Message.len = 0; @@ -869,7 +873,7 @@ Error: STATIC XENSTORE_STATUS XenStoreSingle ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN enum xsd_sockmsg_type RequestType, IN CONST CHAR8 *Body, OUT UINT32 *LenPtr OPTIONAL, @@ -1157,7 +1161,7 @@ XenStoreDeinit ( XENSTORE_STATUS XenStoreListDirectory ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, OUT UINT32 *DirectoryCountPtr, @@ -1184,7 +1188,7 @@ XenStoreListDirectory ( BOOLEAN XenStorePathExists ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Directory, IN CONST CHAR8 *Node ) @@ -1204,7 +1208,7 @@ XenStorePathExists ( XENSTORE_STATUS XenStoreRead ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, OUT UINT32 *LenPtr OPTIONAL, @@ -1228,7 +1232,7 @@ XenStoreRead ( XENSTORE_STATUS XenStoreWrite ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, IN CONST CHAR8 *Str @@ -1253,7 +1257,7 @@ XenStoreWrite ( XENSTORE_STATUS XenStoreRemove ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node ) @@ -1288,7 +1292,7 @@ XenStoreTransactionStart ( XENSTORE_STATUS XenStoreTransactionEnd ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN BOOLEAN Abort ) { @@ -1305,7 +1309,7 @@ XenStoreTransactionEnd ( XENSTORE_STATUS XenStoreVSPrint ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, IN CONST CHAR8 *FormatString, @@ -1328,7 +1332,7 @@ XenStoreVSPrint ( XENSTORE_STATUS EFIAPI XenStoreSPrint ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, IN CONST CHAR8 *FormatString, @@ -1444,7 +1448,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreRead ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Node, OUT VOID **Value ) @@ -1456,7 +1460,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreBackendRead ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Node, OUT VOID **Value ) @@ -1468,7 +1472,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreRemove ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN const char *Node ) { @@ -1489,7 +1493,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreTransactionEnd ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN BOOLEAN Abort ) { @@ -1500,7 +1504,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreSPrint ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, IN CONST CHAR8 *FormatString, diff --git a/OvmfPkg/XenBusDxe/XenStore.h b/OvmfPkg/XenBusDxe/XenStore.h index 9020411f6a..de5690119e 100644 --- a/OvmfPkg/XenBusDxe/XenStore.h +++ b/OvmfPkg/XenBusDxe/XenStore.h @@ -54,7 +54,7 @@ typedef struct _XENSTORE_WATCH XENSTORE_WATCH; **/ XENSTORE_STATUS XenStoreListDirectory ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, OUT UINT32 *DirectoryCountPtr, @@ -74,7 +74,7 @@ XenStoreListDirectory ( **/ BOOLEAN XenStorePathExists ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Directory, IN CONST CHAR8 *Node ); @@ -98,7 +98,7 @@ XenStorePathExists ( **/ XENSTORE_STATUS XenStoreRead ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, OUT UINT32 *LenPtr OPTIONAL, @@ -118,7 +118,7 @@ XenStoreRead ( **/ XENSTORE_STATUS XenStoreWrite ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, IN CONST CHAR8 *Str @@ -136,7 +136,7 @@ XenStoreWrite ( **/ XENSTORE_STATUS XenStoreRemove ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node ); @@ -155,7 +155,7 @@ XenStoreRemove ( **/ XENSTORE_STATUS XenStoreTransactionStart ( - OUT XENSTORE_TRANSACTION *Transaction + OUT XENSTORE_TRANSACTION *Transaction ); /** @@ -170,7 +170,7 @@ XenStoreTransactionStart ( **/ XENSTORE_STATUS XenStoreTransactionEnd ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN BOOLEAN Abort ); @@ -189,7 +189,7 @@ XenStoreTransactionEnd ( XENSTORE_STATUS EFIAPI XenStoreSPrint ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, IN CONST CHAR8 *FormatString, @@ -210,7 +210,7 @@ XenStoreSPrint ( **/ XENSTORE_STATUS XenStoreVSPrint ( - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, IN CONST CHAR8 *FormatString, @@ -305,7 +305,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreRead ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Node, OUT VOID **Value ); @@ -314,7 +314,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreBackendRead ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Node, OUT VOID **Value ); @@ -323,7 +323,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreRemove ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *Node ); @@ -338,7 +338,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreTransactionEnd ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN BOOLEAN Abort ); @@ -346,7 +346,7 @@ XENSTORE_STATUS EFIAPI XenBusXenStoreSPrint ( IN XENBUS_PROTOCOL *This, - IN XENSTORE_TRANSACTION Transaction, + IN CONST XENSTORE_TRANSACTION *Transaction, IN CONST CHAR8 *DirectoryPath, IN CONST CHAR8 *Node, IN CONST CHAR8 *FormatString, diff --git a/OvmfPkg/XenPvBlkDxe/BlockFront.c b/OvmfPkg/XenPvBlkDxe/BlockFront.c index 3c039e7add..8d43d833b0 100644 --- a/OvmfPkg/XenPvBlkDxe/BlockFront.c +++ b/OvmfPkg/XenPvBlkDxe/BlockFront.c @@ -166,7 +166,7 @@ XenPvBlockFrontInitialization ( OUT XEN_BLOCK_FRONT_DEVICE **DevPtr ) { - XENSTORE_TRANSACTION xbt; + XENSTORE_TRANSACTION Transaction; CHAR8 *DeviceType; blkif_sring_t *SharedRing; XENSTORE_STATUS Status; @@ -209,38 +209,38 @@ XenPvBlockFrontInitialization ( &Dev->RingRef); Again: - Status = XenBusIo->XsTransactionStart (XenBusIo, &xbt); + Status = XenBusIo->XsTransactionStart (XenBusIo, &Transaction); if (Status != XENSTORE_STATUS_SUCCESS) { DEBUG ((EFI_D_WARN, "XenPvBlk: Failed to start transaction, %d\n", Status)); goto Error; } - Status = XenBusIo->XsPrintf (XenBusIo, xbt, NodeName, "ring-ref", "%d", + Status = XenBusIo->XsPrintf (XenBusIo, &Transaction, NodeName, "ring-ref", "%d", Dev->RingRef); if (Status != XENSTORE_STATUS_SUCCESS) { DEBUG ((EFI_D_ERROR, "XenPvBlk: Failed to write ring-ref.\n")); goto AbortTransaction; } - Status = XenBusIo->XsPrintf (XenBusIo, xbt, NodeName, + Status = XenBusIo->XsPrintf (XenBusIo, &Transaction, NodeName, "event-channel", "%d", Dev->EventChannel); if (Status != XENSTORE_STATUS_SUCCESS) { DEBUG ((EFI_D_ERROR, "XenPvBlk: Failed to write event-channel.\n")); goto AbortTransaction; } - Status = XenBusIo->XsPrintf (XenBusIo, xbt, NodeName, + Status = XenBusIo->XsPrintf (XenBusIo, &Transaction, NodeName, "protocol", "%a", XEN_IO_PROTO_ABI_NATIVE); if (Status != XENSTORE_STATUS_SUCCESS) { DEBUG ((EFI_D_ERROR, "XenPvBlk: Failed to write protocol.\n")); goto AbortTransaction; } - Status = XenBusIo->SetState (XenBusIo, xbt, XenbusStateConnected); + Status = XenBusIo->SetState (XenBusIo, &Transaction, XenbusStateConnected); if (Status != XENSTORE_STATUS_SUCCESS) { DEBUG ((EFI_D_ERROR, "XenPvBlk: Failed to switch state.\n")); goto AbortTransaction; } - Status = XenBusIo->XsTransactionEnd (XenBusIo, xbt, FALSE); + Status = XenBusIo->XsTransactionEnd (XenBusIo, &Transaction, FALSE); if (Status == XENSTORE_STATUS_EAGAIN) { goto Again; } @@ -319,7 +319,7 @@ Error2: XenBusIo->XsRemove (XenBusIo, XST_NIL, "protocol"); goto Error; AbortTransaction: - XenBusIo->XsTransactionEnd (XenBusIo, xbt, TRUE); + XenBusIo->XsTransactionEnd (XenBusIo, &Transaction, TRUE); Error: XenPvBlockFree (Dev); return EFI_DEVICE_ERROR; -- cgit v1.2.3