staging: unisys: remove typedef for CHANNEL_HEADER

Switch everywhere that CHANNEL_HEADER, pCHANNEL_HEADER, or
ULTRA_CHANNEL_PROTOCOL was used, to struct channel_header.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Benjamin Romer 2014-10-23 14:29:55 -04:00 committed by Greg Kroah-Hartman
parent 82d72bee4b
commit 9fd1b95aab
14 changed files with 73 additions and 62 deletions

View File

@ -44,7 +44,8 @@
* 1 if the insertion succeeds, 0 if the queue was full. * 1 if the insertion succeeds, 0 if the queue was full.
*/ */
unsigned char unsigned char
visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue, void *pSignal) visor_signal_insert(struct channel_header __iomem *pChannel, u32 Queue,
void *pSignal)
{ {
void __iomem *psignal; void __iomem *psignal;
unsigned int head, tail, nof; unsigned int head, tail, nof;
@ -102,7 +103,8 @@ EXPORT_SYMBOL_GPL(visor_signal_insert);
* 1 if the removal succeeds, 0 if the queue was empty. * 1 if the removal succeeds, 0 if the queue was empty.
*/ */
unsigned char unsigned char
visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, void *pSignal) visor_signal_remove(struct channel_header __iomem *pChannel, u32 Queue,
void *pSignal)
{ {
void __iomem *psource; void __iomem *psource;
unsigned int head, tail; unsigned int head, tail;
@ -157,7 +159,7 @@ EXPORT_SYMBOL_GPL(visor_signal_remove);
* # of signals copied. * # of signals copied.
*/ */
unsigned int unsigned int
SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, void *pSignal) SignalRemoveAll(struct channel_header *pChannel, u32 Queue, void *pSignal)
{ {
void *psource; void *psource;
unsigned int head, tail, signalCount = 0; unsigned int head, tail, signalCount = 0;
@ -208,7 +210,7 @@ SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, void *pSignal)
* 1 if the signal queue is empty, 0 otherwise. * 1 if the signal queue is empty, 0 otherwise.
*/ */
unsigned char unsigned char
visor_signalqueue_empty(CHANNEL_HEADER __iomem *pChannel, u32 Queue) visor_signalqueue_empty(struct channel_header __iomem *pChannel, u32 Queue)
{ {
SIGNAL_QUEUE_HEADER __iomem *pqhdr = SIGNAL_QUEUE_HEADER __iomem *pqhdr =
(SIGNAL_QUEUE_HEADER __iomem *) ((char __iomem *) pChannel + (SIGNAL_QUEUE_HEADER __iomem *) ((char __iomem *) pChannel +

View File

@ -42,7 +42,7 @@ channel_mod_exit(void)
} }
unsigned char unsigned char
SignalInsert_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, SignalInsert_withLock(struct channel_header __iomem *pChannel, u32 Queue,
void *pSignal, spinlock_t *lock) void *pSignal, spinlock_t *lock)
{ {
unsigned char result; unsigned char result;
@ -55,7 +55,7 @@ SignalInsert_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue,
} }
unsigned char unsigned char
SignalRemove_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, SignalRemove_withLock(struct channel_header __iomem *pChannel, u32 Queue,
void *pSignal, spinlock_t *lock) void *pSignal, spinlock_t *lock)
{ {
unsigned char result; unsigned char result;

View File

@ -15,9 +15,9 @@
#ifndef __CHANSTUB_H__ #ifndef __CHANSTUB_H__
#define __CHANSTUB_H__ #define __CHANSTUB_H__
unsigned char SignalInsert_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, unsigned char SignalInsert_withLock(struct channel_header __iomem *pChannel,
void *pSignal, spinlock_t *lock); u32 Queue, void *pSignal, spinlock_t *lock);
unsigned char SignalRemove_withLock(CHANNEL_HEADER __iomem *pChannel, u32 Queue, unsigned char SignalRemove_withLock(struct channel_header __iomem *pChannel,
void *pSignal, spinlock_t *lock); u32 Queue, void *pSignal, spinlock_t *lock);
#endif #endif

View File

@ -133,21 +133,21 @@ ULTRA_CHANNELCLI_STRING(u32 v)
newstate, logCtx) \ newstate, logCtx) \
do { \ do { \
ULTRA_CHANNEL_CLIENT_CHK_TRANSITION( \ ULTRA_CHANNEL_CLIENT_CHK_TRANSITION( \
readl(&(((CHANNEL_HEADER __iomem *) \ readl(&(((struct channel_header __iomem *) \
(pChan))->CliStateOS)), \ (pChan))->CliStateOS)), \
newstate, \ newstate, \
chanId, logCtx, __FILE__, __LINE__); \ chanId, logCtx, __FILE__, __LINE__); \
pr_info("%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n", \ pr_info("%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n", \
chanId, "CliStateOS", \ chanId, "CliStateOS", \
ULTRA_CHANNELCLI_STRING( \ ULTRA_CHANNELCLI_STRING( \
readl(&((CHANNEL_HEADER __iomem *) \ readl(&((struct channel_header __iomem *)\
(pChan))->CliStateOS)), \ (pChan))->CliStateOS)), \
readl(&((CHANNEL_HEADER __iomem *) \ readl(&((struct channel_header __iomem *) \
(pChan))->CliStateOS), \ (pChan))->CliStateOS), \
ULTRA_CHANNELCLI_STRING(newstate), \ ULTRA_CHANNELCLI_STRING(newstate), \
newstate, \ newstate, \
PathName_Last_N_Nodes(__FILE__, 4), __LINE__); \ PathName_Last_N_Nodes(__FILE__, 4), __LINE__); \
writel(newstate, &((CHANNEL_HEADER __iomem *) \ writel(newstate, &((struct channel_header __iomem *) \
(pChan))->CliStateOS); \ (pChan))->CliStateOS); \
mb(); /* required for channel synch */ \ mb(); /* required for channel synch */ \
} while (0) } while (0)
@ -200,18 +200,18 @@ ULTRA_CHANNELCLI_STRING(u32 v)
#pragma pack(push, 1) /* both GCC and VC now allow this pragma */ #pragma pack(push, 1) /* both GCC and VC now allow this pragma */
/* Common Channel Header */ /* Common Channel Header */
typedef struct _CHANNEL_HEADER { struct channel_header {
u64 Signature; /* Signature */ u64 Signature; /* Signature */
u32 LegacyState; /* DEPRECATED - being replaced by */ u32 LegacyState; /* DEPRECATED - being replaced by */
/* / SrvState, CliStateBoot, and CliStateOS below */ /* / SrvState, CliStateBoot, and CliStateOS below */
u32 HeaderSize; /* sizeof(CHANNEL_HEADER) */ u32 HeaderSize; /* sizeof(struct channel_header) */
u64 Size; /* Total size of this channel in bytes */ u64 Size; /* Total size of this channel in bytes */
u64 Features; /* Flags to modify behavior */ u64 Features; /* Flags to modify behavior */
uuid_le Type; /* Channel type: data, bus, control, etc. */ uuid_le Type; /* Channel type: data, bus, control, etc. */
u64 PartitionHandle; /* ID of guest partition */ u64 PartitionHandle; /* ID of guest partition */
u64 Handle; /* Device number of this channel in client */ u64 Handle; /* Device number of this channel in client */
u64 oChannelSpace; /* Offset in bytes to channel specific area */ u64 oChannelSpace; /* Offset in bytes to channel specific area */
u32 VersionId; /* CHANNEL_HEADER Version ID */ u32 VersionId; /* struct channel_header Version ID */
u32 PartitionIndex; /* Index of guest partition */ u32 PartitionIndex; /* Index of guest partition */
uuid_le ZoneGuid; /* Guid of Channel's zone */ uuid_le ZoneGuid; /* Guid of Channel's zone */
u32 oClientString; /* offset from channel header to u32 oClientString; /* offset from channel header to
@ -238,7 +238,7 @@ typedef struct _CHANNEL_HEADER {
u8 Filler[1]; /* Pad out to 128 byte cacheline */ u8 Filler[1]; /* Pad out to 128 byte cacheline */
/* Please add all new single-byte values below here */ /* Please add all new single-byte values below here */
u8 RecoverChannel; u8 RecoverChannel;
} CHANNEL_HEADER, *pCHANNEL_HEADER, ULTRA_CHANNEL_PROTOCOL; };
#define ULTRA_CHANNEL_ENABLE_INTS (0x1ULL << 0) #define ULTRA_CHANNEL_ENABLE_INTS (0x1ULL << 0)
@ -312,7 +312,8 @@ ULTRA_check_channel_client(void __iomem *pChannel,
uuid_le guid; uuid_le guid;
memcpy_fromio(&guid, memcpy_fromio(&guid,
&((CHANNEL_HEADER __iomem *)(pChannel))->Type, &((struct channel_header __iomem *)
(pChannel))->Type,
sizeof(guid)); sizeof(guid));
/* caller wants us to verify type GUID */ /* caller wants us to verify type GUID */
if (uuid_le_cmp(guid, expectedTypeGuid) != 0) { if (uuid_le_cmp(guid, expectedTypeGuid) != 0) {
@ -324,7 +325,8 @@ ULTRA_check_channel_client(void __iomem *pChannel,
} }
if (expectedMinBytes > 0) { /* caller wants us to verify if (expectedMinBytes > 0) { /* caller wants us to verify
* channel size */ * channel size */
unsigned long long bytes = readq(&((CHANNEL_HEADER __iomem *) unsigned long long bytes =
readq(&((struct channel_header __iomem *)
(pChannel))->Size); (pChannel))->Size);
if (bytes < expectedMinBytes) { if (bytes < expectedMinBytes) {
pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n", pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
@ -335,7 +337,7 @@ ULTRA_check_channel_client(void __iomem *pChannel,
} }
if (expectedVersionId > 0) { /* caller wants us to verify if (expectedVersionId > 0) { /* caller wants us to verify
* channel version */ * channel version */
unsigned long ver = readl(&((CHANNEL_HEADER __iomem *) unsigned long ver = readl(&((struct channel_header __iomem *)
(pChannel))->VersionId); (pChannel))->VersionId);
if (ver != expectedVersionId) { if (ver != expectedVersionId) {
pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n", pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n",
@ -346,7 +348,8 @@ ULTRA_check_channel_client(void __iomem *pChannel,
} }
if (expectedSignature > 0) { /* caller wants us to verify if (expectedSignature > 0) { /* caller wants us to verify
* channel signature */ * channel signature */
unsigned long long sig = readq(&((CHANNEL_HEADER __iomem *) unsigned long long sig =
readq(&((struct channel_header __iomem *)
(pChannel))->Signature); (pChannel))->Signature);
if (sig != expectedSignature) { if (sig != expectedSignature) {
pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8llx actual=0x%-8.8llx\n", pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8llx actual=0x%-8.8llx\n",
@ -416,7 +419,7 @@ static inline int
ULTRA_channel_client_acquire_os(void __iomem *pChannel, u8 *chanId, ULTRA_channel_client_acquire_os(void __iomem *pChannel, u8 *chanId,
void *logCtx, char *file, int line, char *func) void *logCtx, char *file, int line, char *func)
{ {
CHANNEL_HEADER __iomem *pChan = pChannel; struct channel_header __iomem *pChan = pChannel;
if (readl(&pChan->CliStateOS) == CHANNELCLI_DISABLED) { if (readl(&pChan->CliStateOS) == CHANNELCLI_DISABLED) {
if ((readb(&pChan->CliErrorOS) if ((readb(&pChan->CliErrorOS)
@ -511,7 +514,7 @@ static inline void
ULTRA_channel_client_release_os(void __iomem *pChannel, u8 *chanId, ULTRA_channel_client_release_os(void __iomem *pChannel, u8 *chanId,
void *logCtx, char *file, int line, char *func) void *logCtx, char *file, int line, char *func)
{ {
CHANNEL_HEADER __iomem *pChan = pChannel; struct channel_header __iomem *pChan = pChannel;
if (readb(&pChan->CliErrorOS) != 0) { if (readb(&pChan->CliErrorOS) != 0) {
/* we are in an error msg throttling state; come out of it */ /* we are in an error msg throttling state; come out of it */
@ -552,8 +555,8 @@ ULTRA_channel_client_release_os(void __iomem *pChannel, u8 *chanId,
* full. * full.
*/ */
unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue, unsigned char visor_signal_insert(struct channel_header __iomem *pChannel,
void *pSignal); u32 Queue, void *pSignal);
/* /*
* Routine Description: * Routine Description:
@ -574,8 +577,8 @@ unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue,
* empty. * empty.
*/ */
unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue, unsigned char visor_signal_remove(struct channel_header __iomem *pChannel,
void *pSignal); u32 Queue, void *pSignal);
/* /*
* Routine Description: * Routine Description:
@ -596,7 +599,7 @@ unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue,
* Return value: * Return value:
* # of signals copied. * # of signals copied.
*/ */
unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue, unsigned int SignalRemoveAll(struct channel_header *pChannel, u32 Queue,
void *pSignal); void *pSignal);
/* /*
@ -610,7 +613,7 @@ unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue,
* Return value: * Return value:
* 1 if the signal queue is empty, 0 otherwise. * 1 if the signal queue is empty, 0 otherwise.
*/ */
unsigned char visor_signalqueue_empty(CHANNEL_HEADER __iomem *pChannel, unsigned char visor_signalqueue_empty(struct channel_header __iomem *pChannel,
u32 Queue); u32 Queue);
#endif #endif

View File

@ -470,7 +470,7 @@ typedef struct _GUEST_DEVICES {
} GUEST_DEVICES; } GUEST_DEVICES;
typedef struct _ULTRA_CONTROLVM_CHANNEL_PROTOCOL { typedef struct _ULTRA_CONTROLVM_CHANNEL_PROTOCOL {
CHANNEL_HEADER Header; struct channel_header Header;
GUEST_PHYSICAL_ADDRESS gpControlVm; /* guest physical address of GUEST_PHYSICAL_ADDRESS gpControlVm; /* guest physical address of
* this channel */ * this channel */
GUEST_PHYSICAL_ADDRESS gpPartitionTables; /* guest physical address of GUEST_PHYSICAL_ADDRESS gpPartitionTables; /* guest physical address of

View File

@ -383,7 +383,7 @@ typedef struct _DIAG_CHANNEL_PROTOCOL_HEADER {
/* ----------------------- */ /* ----------------------- */
/* Offsets/sizes for diagnostic channel attributes... */ /* Offsets/sizes for diagnostic channel attributes... */
#define DIAG_CH_QUEUE_HEADER_OFFSET (sizeof(ULTRA_CHANNEL_PROTOCOL)) #define DIAG_CH_QUEUE_HEADER_OFFSET (sizeof(struct channel_header))
#define DIAG_CH_QUEUE_HEADER_SIZE (sizeof(SIGNAL_QUEUE_HEADER)) #define DIAG_CH_QUEUE_HEADER_SIZE (sizeof(SIGNAL_QUEUE_HEADER))
#define DIAG_CH_PROTOCOL_HEADER_OFFSET \ #define DIAG_CH_PROTOCOL_HEADER_OFFSET \
(DIAG_CH_QUEUE_HEADER_OFFSET + DIAG_CH_QUEUE_HEADER_SIZE) (DIAG_CH_QUEUE_HEADER_OFFSET + DIAG_CH_QUEUE_HEADER_SIZE)
@ -416,7 +416,7 @@ typedef struct _DIAG_CHANNEL_PROTOCOL_HEADER {
*Reserved: Reserved area to allow for correct channel size padding. *Reserved: Reserved area to allow for correct channel size padding.
*/ */
typedef struct _ULTRA_DIAG_CHANNEL_PROTOCOL { typedef struct _ULTRA_DIAG_CHANNEL_PROTOCOL {
ULTRA_CHANNEL_PROTOCOL CommonChannelHeader; struct channel_header CommonChannelHeader;
SIGNAL_QUEUE_HEADER QueueHeader; SIGNAL_QUEUE_HEADER QueueHeader;
DIAG_CHANNEL_PROTOCOL_HEADER DiagChannelHeader; DIAG_CHANNEL_PROTOCOL_HEADER DiagChannelHeader;
DIAG_CHANNEL_EVENT Events[(DIAG_CH_SIZE - DIAG_CH_EVENT_OFFSET) / DIAG_CHANNEL_EVENT Events[(DIAG_CH_SIZE - DIAG_CH_EVENT_OFFSET) /

View File

@ -685,7 +685,7 @@ struct uiscmdrsp {
* this header there is a large region of memory which contains the command and * this header there is a large region of memory which contains the command and
* response queues as specified in cmdQ and rspQ SIGNAL_QUEUE_HEADERS. */ * response queues as specified in cmdQ and rspQ SIGNAL_QUEUE_HEADERS. */
typedef struct _ULTRA_IO_CHANNEL_PROTOCOL { typedef struct _ULTRA_IO_CHANNEL_PROTOCOL {
CHANNEL_HEADER ChannelHeader; struct channel_header ChannelHeader;
SIGNAL_QUEUE_HEADER cmdQ; SIGNAL_QUEUE_HEADER cmdQ;
SIGNAL_QUEUE_HEADER rspQ; SIGNAL_QUEUE_HEADER rspQ;
union { union {

View File

@ -76,7 +76,7 @@ typedef struct _ULTRA_VBUS_HEADERINFO {
} ULTRA_VBUS_HEADERINFO; } ULTRA_VBUS_HEADERINFO;
struct ultra_vbus_channel_protocol { struct ultra_vbus_channel_protocol {
ULTRA_CHANNEL_PROTOCOL ChannelHeader; /* initialized by server */ struct channel_header ChannelHeader; /* initialized by server */
ULTRA_VBUS_HEADERINFO HdrInfo; /* initialized by server */ ULTRA_VBUS_HEADERINFO HdrInfo; /* initialized by server */
/* the remainder of this channel is filled in by the client */ /* the remainder of this channel is filled in by the client */
struct ultra_vbus_deviceinfo ChpInfo; struct ultra_vbus_deviceinfo ChpInfo;

View File

@ -34,7 +34,7 @@
#include "controlvmcompletionstatus.h" #include "controlvmcompletionstatus.h"
struct uisqueue_info { struct uisqueue_info {
CHANNEL_HEADER __iomem *chan; struct channel_header __iomem *chan;
/* channel containing queues in which scsi commands & /* channel containing queues in which scsi commands &
* responses are queued * responses are queued
*/ */

View File

@ -444,7 +444,8 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
if (!uuid_le_cmp(dev->channel_uuid, if (!uuid_le_cmp(dev->channel_uuid,
spar_vhba_channel_protocol_uuid)) { spar_vhba_channel_protocol_uuid)) {
wait_for_valid_guid(&((CHANNEL_HEADER wait_for_valid_guid(&((
struct channel_header
__iomem *) (dev-> __iomem *) (dev->
chanptr))-> chanptr))->
Type); Type);
@ -469,7 +470,8 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
} else } else
if (!uuid_le_cmp(dev->channel_uuid, if (!uuid_le_cmp(dev->channel_uuid,
spar_vnic_channel_protocol_uuid)) { spar_vnic_channel_protocol_uuid)) {
wait_for_valid_guid(&((CHANNEL_HEADER wait_for_valid_guid(&((
struct channel_header
__iomem *) (dev-> __iomem *) (dev->
chanptr))-> chanptr))->
Type); Type);
@ -1565,7 +1567,7 @@ uislib_mod_init(void)
LOGINF("sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL):%lu bytes\n", LOGINF("sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL):%lu bytes\n",
(ulong) sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL)); (ulong) sizeof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL));
LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n", LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n",
(ulong) sizeof(CHANNEL_HEADER)); (ulong) sizeof(struct channel_header));
LOGINF("sizeof(ULTRA_IO_CHANNEL_PROTOCOL):%lu bytes\n", LOGINF("sizeof(ULTRA_IO_CHANNEL_PROTOCOL):%lu bytes\n",
(ulong) sizeof(ULTRA_IO_CHANNEL_PROTOCOL)); (ulong) sizeof(ULTRA_IO_CHANNEL_PROTOCOL));
LOGINF("SIZEOF_CMDRSP:%lu bytes\n", SIZEOF_CMDRSP); LOGINF("SIZEOF_CMDRSP:%lu bytes\n", SIZEOF_CMDRSP);

View File

@ -420,7 +420,7 @@ static irqreturn_t
virthba_ISR(int irq, void *dev_id) virthba_ISR(int irq, void *dev_id)
{ {
struct virthba_info *virthbainfo = (struct virthba_info *) dev_id; struct virthba_info *virthbainfo = (struct virthba_info *) dev_id;
CHANNEL_HEADER __iomem *pChannelHeader; struct channel_header __iomem *pChannelHeader;
SIGNAL_QUEUE_HEADER __iomem *pqhdr; SIGNAL_QUEUE_HEADER __iomem *pqhdr;
u64 mask; u64 mask;
unsigned long long rc1; unsigned long long rc1;
@ -461,7 +461,7 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id)
int rsp; int rsp;
int i; int i;
irq_handler_t handler = virthba_ISR; irq_handler_t handler = virthba_ISR;
CHANNEL_HEADER __iomem *pChannelHeader; struct channel_header __iomem *pChannelHeader;
SIGNAL_QUEUE_HEADER __iomem *pqhdr; SIGNAL_QUEUE_HEADER __iomem *pqhdr;
u64 mask; u64 mask;

View File

@ -195,7 +195,7 @@ static int write_vbus_chpInfo(struct ultra_vbus_channel_protocol *chan,
LOGERR("vbus channel not present"); LOGERR("vbus channel not present");
return -1; return -1;
} }
off = sizeof(ULTRA_CHANNEL_PROTOCOL) + chan->HdrInfo.chpInfoByteOffset; off = sizeof(struct channel_header) + chan->HdrInfo.chpInfoByteOffset;
if (chan->HdrInfo.chpInfoByteOffset == 0) { if (chan->HdrInfo.chpInfoByteOffset == 0) {
LOGERR("vbus channel not used, because chpInfoByteOffset == 0"); LOGERR("vbus channel not used, because chpInfoByteOffset == 0");
return -1; return -1;
@ -214,7 +214,7 @@ static int write_vbus_busInfo(struct ultra_vbus_channel_protocol *chan,
LOGERR("vbus channel not present"); LOGERR("vbus channel not present");
return -1; return -1;
} }
off = sizeof(ULTRA_CHANNEL_PROTOCOL) + chan->HdrInfo.busInfoByteOffset; off = sizeof(struct channel_header) + chan->HdrInfo.busInfoByteOffset;
if (chan->HdrInfo.busInfoByteOffset == 0) { if (chan->HdrInfo.busInfoByteOffset == 0) {
LOGERR("vbus channel not used, because busInfoByteOffset == 0"); LOGERR("vbus channel not used, because busInfoByteOffset == 0");
return -1; return -1;
@ -237,7 +237,7 @@ write_vbus_devInfo(struct ultra_vbus_channel_protocol *chan,
return -1; return -1;
} }
off = off =
(sizeof(ULTRA_CHANNEL_PROTOCOL) + (sizeof(struct channel_header) +
chan->HdrInfo.devInfoByteOffset) + chan->HdrInfo.devInfoByteOffset) +
(chan->HdrInfo.deviceInfoStructBytes * devix); (chan->HdrInfo.deviceInfoStructBytes * devix);
if (chan->HdrInfo.devInfoByteOffset == 0) { if (chan->HdrInfo.devInfoByteOffset == 0) {

View File

@ -30,7 +30,7 @@
struct VISORCHANNEL_Tag { struct VISORCHANNEL_Tag {
MEMREGION *memregion; /* from visor_memregion_create() */ MEMREGION *memregion; /* from visor_memregion_create() */
CHANNEL_HEADER chan_hdr; struct channel_header chan_hdr;
uuid_le guid; uuid_le guid;
ulong size; ulong size;
BOOL needs_lock; BOOL needs_lock;
@ -70,19 +70,19 @@ visorchannel_create_guts(HOSTADDRESS physaddr, ulong channelBytes,
/* prepare chan_hdr (abstraction to read/write channel memory) */ /* prepare chan_hdr (abstraction to read/write channel memory) */
if (parent == NULL) if (parent == NULL)
p->memregion = p->memregion =
visor_memregion_create(physaddr, sizeof(CHANNEL_HEADER)); visor_memregion_create(physaddr,
sizeof(struct channel_header));
else else
p->memregion = p->memregion =
visor_memregion_create_overlapped(parent->memregion, visor_memregion_create_overlapped(parent->memregion,
off, off, sizeof(struct channel_header));
sizeof(CHANNEL_HEADER));
if (p->memregion == NULL) { if (p->memregion == NULL) {
ERRDRV("visor_memregion_create failed failed: (status=0)\n"); ERRDRV("visor_memregion_create failed failed: (status=0)\n");
rc = NULL; rc = NULL;
goto Away; goto Away;
} }
if (visor_memregion_read(p->memregion, 0, &p->chan_hdr, if (visor_memregion_read(p->memregion, 0, &p->chan_hdr,
sizeof(CHANNEL_HEADER)) < 0) { sizeof(struct channel_header)) < 0) {
ERRDRV("visor_memregion_read failed: (status=0)\n"); ERRDRV("visor_memregion_read failed: (status=0)\n");
rc = NULL; rc = NULL;
goto Away; goto Away;
@ -225,8 +225,11 @@ visorchannel_read(VISORCHANNEL *channel, ulong offset,
{ {
int rc = visor_memregion_read(channel->memregion, offset, int rc = visor_memregion_read(channel->memregion, offset,
local, nbytes); local, nbytes);
if ((rc >= 0) && (offset == 0) && (nbytes >= sizeof(CHANNEL_HEADER))) if ((rc >= 0) && (offset == 0) &&
memcpy(&channel->chan_hdr, local, sizeof(CHANNEL_HEADER)); (nbytes >= sizeof(struct channel_header))) {
memcpy(&channel->chan_hdr, local,
sizeof(struct channel_header));
}
return rc; return rc;
} }
EXPORT_SYMBOL_GPL(visorchannel_read); EXPORT_SYMBOL_GPL(visorchannel_read);
@ -235,8 +238,9 @@ int
visorchannel_write(VISORCHANNEL *channel, ulong offset, visorchannel_write(VISORCHANNEL *channel, ulong offset,
void *local, ulong nbytes) void *local, ulong nbytes)
{ {
if (offset == 0 && nbytes >= sizeof(CHANNEL_HEADER)) if (offset == 0 && nbytes >= sizeof(struct channel_header))
memcpy(&channel->chan_hdr, local, sizeof(CHANNEL_HEADER)); memcpy(&channel->chan_hdr, local,
sizeof(struct channel_header));
return visor_memregion_write(channel->memregion, offset, local, nbytes); return visor_memregion_write(channel->memregion, offset, local, nbytes);
} }
EXPORT_SYMBOL_GPL(visorchannel_write); EXPORT_SYMBOL_GPL(visorchannel_write);
@ -316,7 +320,7 @@ sig_read_header(VISORCHANNEL *channel, u32 queue,
{ {
BOOL rc = FALSE; BOOL rc = FALSE;
if (channel->chan_hdr.oChannelSpace < sizeof(CHANNEL_HEADER)) { if (channel->chan_hdr.oChannelSpace < sizeof(struct channel_header)) {
ERRDRV("oChannelSpace too small: (status=%d)\n", rc); ERRDRV("oChannelSpace too small: (status=%d)\n", rc);
goto Away; goto Away;
} }
@ -559,8 +563,8 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues,
HOSTADDRESS addr = 0; HOSTADDRESS addr = 0;
ulong nbytes = 0, nbytes_region = 0; ulong nbytes = 0, nbytes_region = 0;
MEMREGION *memregion = NULL; MEMREGION *memregion = NULL;
CHANNEL_HEADER hdr; struct channel_header hdr;
CHANNEL_HEADER *phdr = &hdr; struct channel_header *phdr = &hdr;
int i = 0; int i = 0;
int errcode = 0; int errcode = 0;
@ -576,7 +580,7 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues,
addr = visor_memregion_get_physaddr(memregion); addr = visor_memregion_get_physaddr(memregion);
nbytes_region = visor_memregion_get_nbytes(memregion); nbytes_region = visor_memregion_get_nbytes(memregion);
errcode = visorchannel_read(channel, off, errcode = visorchannel_read(channel, off,
phdr, sizeof(CHANNEL_HEADER)); phdr, sizeof(struct channel_header));
if (errcode < 0) { if (errcode < 0) {
seq_printf(seq, seq_printf(seq,
"Read of channel header failed with errcode=%d)\n", "Read of channel header failed with errcode=%d)\n",

View File

@ -114,7 +114,7 @@ typedef struct {
/* Manages the request payload in the controlvm channel */ /* Manages the request payload in the controlvm channel */
static CONTROLVM_PAYLOAD_INFO ControlVm_payload_info; static CONTROLVM_PAYLOAD_INFO ControlVm_payload_info;
static pCHANNEL_HEADER Test_Vnic_channel; static struct channel_header *Test_Vnic_channel;
typedef struct { typedef struct {
CONTROLVM_MESSAGE_HEADER Dumpcapture_header; CONTROLVM_MESSAGE_HEADER Dumpcapture_header;