Commit d7363a19 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: clean up vstorage.h

Lots of coding style cleanups in vstorage.h

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent aded7165
...@@ -22,88 +22,51 @@ ...@@ -22,88 +22,51 @@
*/ */
#pragma once
/* #include <vmbuspacketformat.h> */
/* #include <ntddscsi.h> */
#define C_ASSERT(x)
/* public interface to the server */
/* Storvsp device interface guid */
/* Protocol versions. */
/* vstorage.w revision number. This is used in the case of a version match, */ /* vstorage.w revision number. This is used in the case of a version match, */
/* to alert the user that structure sizes may be mismatched even though the */ /* to alert the user that structure sizes may be mismatched even though the */
/* protocol versions match. */ /* protocol versions match. */
#define REVISION_STRING(REVISION_) #REVISION_ #define REVISION_STRING(REVISION_) #REVISION_
#define FILL_VMSTOR_REVISION(RESULT_LVALUE_) \ #define FILL_VMSTOR_REVISION(RESULT_LVALUE_) \
{ \ { \
char *revisionString = REVISION_STRING($Revision: 6 $) + 11; \ char *revisionString = REVISION_STRING($Revision: 6 $) + 11; \
RESULT_LVALUE_ = 0; \ RESULT_LVALUE_ = 0; \
while (*revisionString >= '0' && *revisionString <= '9') \ while (*revisionString >= '0' && *revisionString <= '9') { \
{ \
RESULT_LVALUE_ *= 10; \ RESULT_LVALUE_ *= 10; \
RESULT_LVALUE_ += *revisionString - '0'; \ RESULT_LVALUE_ += *revisionString - '0'; \
revisionString++; \ revisionString++; \
} \ } \
} }
/* Major/minor macros. Minor version is in LSB, meaning that earlier flat */ /* Major/minor macros. Minor version is in LSB, meaning that earlier flat */
/* version numbers will be interpreted as "0.x" (i.e., 1 becomes 0.1). */ /* version numbers will be interpreted as "0.x" (i.e., 1 becomes 0.1). */
#define VMSTOR_PROTOCOL_MAJOR(VERSION_) (((VERSION_) >> 8) & 0xff) #define VMSTOR_PROTOCOL_MAJOR(VERSION_) (((VERSION_) >> 8) & 0xff)
#define VMSTOR_PROTOCOL_MINOR(VERSION_) (((VERSION_) ) & 0xff) #define VMSTOR_PROTOCOL_MINOR(VERSION_) (((VERSION_)) & 0xff)
#define VMSTOR_PROTOCOL_VERSION(MAJOR_, MINOR_) ((((MAJOR_) & 0xff) << 8) | \ #define VMSTOR_PROTOCOL_VERSION(MAJOR_, MINOR_) ((((MAJOR_) & 0xff) << 8) | \
(((MINOR_) & 0xff) )) (((MINOR_) & 0xff)))
#define VMSTOR_INVALID_PROTOCOL_VERSION (-1)
/* Invalid version. */
#define VMSTOR_INVALID_PROTOCOL_VERSION -1
/* Version history: */ /* Version history: */
/* V1 Beta 0.1 */ /* V1 Beta 0.1 */
/* V1 RC < 2008/1/31 1.0 */ /* V1 RC < 2008/1/31 1.0 */
/* V1 RC > 2008/1/31 2.0 */ /* V1 RC > 2008/1/31 2.0 */
#define VMSTOR_PROTOCOL_VERSION_CURRENT VMSTOR_PROTOCOL_VERSION(2, 0) #define VMSTOR_PROTOCOL_VERSION_CURRENT VMSTOR_PROTOCOL_VERSION(2, 0)
/* This will get replaced with the max transfer length that is possible on */ /* This will get replaced with the max transfer length that is possible on */
/* the host adapter. */ /* the host adapter. */
/* The max transfer length will be published when we offer a vmbus channel. */ /* The max transfer length will be published when we offer a vmbus channel. */
#define MAX_TRANSFER_LENGTH 0x40000 #define MAX_TRANSFER_LENGTH 0x40000
#define DEFAULT_PACKET_SIZE (sizeof(VMDATA_GPA_DIRECT) + \ #define DEFAULT_PACKET_SIZE (sizeof(VMDATA_GPA_DIRECT) + \
sizeof(VSTOR_PACKET) + \ sizeof(VSTOR_PACKET) + \
(sizeof(u64) * (MAX_TRANSFER_LENGTH / PAGE_SIZE))) (sizeof(u64) * (MAX_TRANSFER_LENGTH / PAGE_SIZE)))
/* Packet structure describing virtual storage requests. */ /* Packet structure describing virtual storage requests. */
typedef enum {
typedef enum
{
VStorOperationCompleteIo = 1, VStorOperationCompleteIo = 1,
VStorOperationRemoveDevice = 2, VStorOperationRemoveDevice = 2,
VStorOperationExecuteSRB = 3, VStorOperationExecuteSRB = 3,
...@@ -115,32 +78,26 @@ typedef enum ...@@ -115,32 +78,26 @@ typedef enum
VStorOperationQueryProtocolVersion = 9, VStorOperationQueryProtocolVersion = 9,
VStorOperationQueryProperties = 10, VStorOperationQueryProperties = 10,
VStorOperationMaximum = 10 VStorOperationMaximum = 10
} VSTOR_PACKET_OPERATION; } VSTOR_PACKET_OPERATION;
/* Platform neutral description of a scsi request - */ /*
/* this remains the same across the write regardless of 32/64 bit */ * Platform neutral description of a scsi request -
/* note: it's patterned off the SCSI_PASS_THROUGH structure */ * this remains the same across the write regardless of 32/64 bit
* note: it's patterned off the SCSI_PASS_THROUGH structure
*/
#pragma pack(push,1)
#define CDB16GENERIC_LENGTH 0x10 #define CDB16GENERIC_LENGTH 0x10
#ifndef SENSE_BUFFER_SIZE #ifndef SENSE_BUFFER_SIZE
#define SENSE_BUFFER_SIZE 0x12 #define SENSE_BUFFER_SIZE 0x12
#endif #endif
C_ASSERT(SENSE_BUFFER_SIZE == 0x12);
#define MAX_DATA_BUFFER_LENGTH_WITH_PADDING 0x14 #define MAX_DATA_BUFFER_LENGTH_WITH_PADDING 0x14
typedef struct typedef struct {
{
unsigned short Length; unsigned short Length;
unsigned char SrbStatus; unsigned char SrbStatus;
unsigned char ScsiStatus; unsigned char ScsiStatus;
...@@ -157,151 +114,91 @@ typedef struct ...@@ -157,151 +114,91 @@ typedef struct
unsigned int DataTransferLength; unsigned int DataTransferLength;
union union {
{
unsigned char Cdb[CDB16GENERIC_LENGTH]; unsigned char Cdb[CDB16GENERIC_LENGTH];
unsigned char SenseData[SENSE_BUFFER_SIZE]; unsigned char SenseData[SENSE_BUFFER_SIZE];
unsigned char ReservedArray[MAX_DATA_BUFFER_LENGTH_WITH_PADDING]; unsigned char ReservedArray[MAX_DATA_BUFFER_LENGTH_WITH_PADDING];
}; };
} __attribute((packed)) VMSCSI_REQUEST, *PVMSCSI_REQUEST;
} VMSCSI_REQUEST, *PVMSCSI_REQUEST;
C_ASSERT((sizeof(VMSCSI_REQUEST) % 4) == 0);
/* This structure is sent during the intialization phase to get the different */ /*
/* properties of the channel. */ * This structure is sent during the intialization phase to get the different
* properties of the channel.
*/
typedef struct typedef struct {
{
unsigned short ProtocolVersion; unsigned short ProtocolVersion;
unsigned char PathId; unsigned char PathId;
unsigned char TargetId; unsigned char TargetId;
/* Note: port number is only really known on the client side */ /* Note: port number is only really known on the client side */
unsigned int PortNumber; unsigned int PortNumber;
unsigned int Flags; unsigned int Flags;
unsigned int MaxTransferBytes; unsigned int MaxTransferBytes;
/* This id is unique for each channel and will correspond with */ /* This id is unique for each channel and will correspond with */
/* vendor specific data in the inquirydata */ /* vendor specific data in the inquirydata */
unsigned long long UniqueId; unsigned long long UniqueId;
} __attribute__((packed)) VMSTORAGE_CHANNEL_PROPERTIES, *PVMSTORAGE_CHANNEL_PROPERTIES;
} VMSTORAGE_CHANNEL_PROPERTIES, *PVMSTORAGE_CHANNEL_PROPERTIES;
C_ASSERT((sizeof(VMSTORAGE_CHANNEL_PROPERTIES) % 4) == 0);
/* This structure is sent during the storage protocol negotiations. */ /* This structure is sent during the storage protocol negotiations. */
typedef struct {
typedef struct
{
/* Major (MSW) and minor (LSW) version numbers. */ /* Major (MSW) and minor (LSW) version numbers. */
unsigned short MajorMinor; unsigned short MajorMinor;
/*
* Revision number is auto-incremented whenever this file is changed
/* Revision number is auto-incremented whenever this file is changed */ * (See FILL_VMSTOR_REVISION macro above). Mismatch does not
/* (See FILL_VMSTOR_REVISION macro above). Mismatch does not definitely */ * definitely indicate incompatibility--but it does indicate mismatched
/* indicate incompatibility--but it does indicate mismatched builds. */ * builds.
*/
unsigned short Revision; unsigned short Revision;
} __attribute__((packed)) VMSTORAGE_PROTOCOL_VERSION, *PVMSTORAGE_PROTOCOL_VERSION;
} VMSTORAGE_PROTOCOL_VERSION, *PVMSTORAGE_PROTOCOL_VERSION;
C_ASSERT((sizeof(VMSTORAGE_PROTOCOL_VERSION) % 4) == 0);
/* Channel Property Flags */ /* Channel Property Flags */
#define STORAGE_CHANNEL_REMOVABLE_FLAG 0x1 #define STORAGE_CHANNEL_REMOVABLE_FLAG 0x1
#define STORAGE_CHANNEL_EMULATED_IDE_FLAG 0x2 #define STORAGE_CHANNEL_EMULATED_IDE_FLAG 0x2
typedef struct _VSTOR_PACKET {
typedef struct _VSTOR_PACKET
{
/* Requested operation type */ /* Requested operation type */
VSTOR_PACKET_OPERATION Operation; VSTOR_PACKET_OPERATION Operation;
/* Flags - see below for values */ /* Flags - see below for values */
unsigned int Flags; unsigned int Flags;
/* Status of the request returned from the server side. */ /* Status of the request returned from the server side. */
unsigned int Status; unsigned int Status;
/* Data payload area */ /* Data payload area */
union {
/*
union * Structure used to forward SCSI commands from the
{ * client to the server.
*/
/* Structure used to forward SCSI commands from the client to the server. */
VMSCSI_REQUEST VmSrb; VMSCSI_REQUEST VmSrb;
/* Structure used to query channel properties. */ /* Structure used to query channel properties. */
VMSTORAGE_CHANNEL_PROPERTIES StorageChannelProperties; VMSTORAGE_CHANNEL_PROPERTIES StorageChannelProperties;
/* Used during version negotiations. */ /* Used during version negotiations. */
VMSTORAGE_PROTOCOL_VERSION Version; VMSTORAGE_PROTOCOL_VERSION Version;
}; };
} VSTOR_PACKET, *PVSTOR_PACKET; } __attribute__((packed)) VSTOR_PACKET, *PVSTOR_PACKET;
C_ASSERT((sizeof(VSTOR_PACKET) % 4) == 0);
/* Packet flags */ /* Packet flags */
/*
/* This flag indicates that the server should send back a completion for this */ * This flag indicates that the server should send back a completion for this
/* packet. */ * packet.
*/
#define REQUEST_COMPLETION_FLAG 0x1 #define REQUEST_COMPLETION_FLAG 0x1
/* This is the set of flags that the vsc can set in any packets it sends */ /* This is the set of flags that the vsc can set in any packets it sends */
#define VSC_LEGAL_FLAGS (REQUEST_COMPLETION_FLAG) #define VSC_LEGAL_FLAGS (REQUEST_COMPLETION_FLAG)
#pragma pack(pop)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment