From 15a7b9dd2f302061f20efa4bbf1fdfd2c8bd2216 Mon Sep 17 00:00:00 2001 From: Victor Perevertkin Date: Sat, 5 Dec 2020 20:52:13 +0300 Subject: [PATCH] [CLASSPNP][CDROM_NEW][DISK_NEW] Fix clang build CORE-17129 --- drivers/storage/class/cdrom_new/cdrom.h | 24 +++++------ drivers/storage/class/cdrom_new/ioctl.c | 4 +- drivers/storage/class/cdrom_new/scratch.h | 6 +-- drivers/storage/class/classpnp/autorun.c | 2 +- drivers/storage/class/classpnp/classp.h | 52 +++++++++++------------ drivers/storage/class/classpnp/debug.c | 2 +- drivers/storage/class/classpnp/utils.c | 8 ++-- drivers/storage/class/disk_new/disk.h | 4 +- drivers/storage/class/disk_new/diskwmi.c | 10 ++--- sdk/include/ddk/storduid.h | 4 +- 10 files changed, 59 insertions(+), 57 deletions(-) diff --git a/drivers/storage/class/cdrom_new/cdrom.h b/drivers/storage/class/cdrom_new/cdrom.h index f9c0f43e818..e0dd90b9e00 100644 --- a/drivers/storage/class/cdrom_new/cdrom.h +++ b/drivers/storage/class/cdrom_new/cdrom.h @@ -807,7 +807,7 @@ VOID #define CLEAR_FLAG(Flags, Bit) ((Flags) &= ~(Bit)) #define TEST_FLAG(Flags, Bit) (((Flags) & (Bit)) != 0) -__inline +FORCEINLINE // __REACTOS__ BOOLEAN ValidChar(UCHAR Ch) { @@ -821,7 +821,7 @@ ValidChar(UCHAR Ch) } // could be #define, but this allows typechecking -__inline +FORCEINLINE // __REACTOS__ BOOLEAN PORT_ALLOCATED_SENSE( _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, @@ -834,7 +834,7 @@ PORT_ALLOCATED_SENSE( ); } -__inline +FORCEINLINE // __REACTOS__ VOID FREE_PORT_ALLOCATED_SENSE_BUFFER( _In_ PCDROM_DEVICE_EXTENSION DeviceExtension, @@ -1497,19 +1497,19 @@ DvdSendKey( // // neat little hacks to count number of bits set efficiently // -__inline ULONG CountOfSetBitsUChar(UCHAR _X) +FORCEINLINE ULONG CountOfSetBitsUChar(UCHAR _X) { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsULong(ULONG _X) +FORCEINLINE ULONG CountOfSetBitsULong(ULONG _X) { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsULong32(ULONG32 _X) +FORCEINLINE ULONG CountOfSetBitsULong32(ULONG32 _X) { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsULong64(ULONG64 _X) +FORCEINLINE ULONG CountOfSetBitsULong64(ULONG64 _X) { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline ULONG CountOfSetBitsUlongPtr(ULONG_PTR _X) +FORCEINLINE ULONG CountOfSetBitsUlongPtr(ULONG_PTR _X) { ULONG i = 0; while (_X) { _X &= _X - 1; i++; } return i; } -__inline +FORCEINLINE // __REACTOS__ BOOLEAN IsVolumeMounted( _In_ PDEVICE_OBJECT DeviceObject @@ -1523,7 +1523,7 @@ IsVolumeMounted( } -__inline _Ret_range_(0,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) +FORCEINLINE _Ret_range_(0,MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG ConvertSectorsPerSecondTo100nsUnitsFor64kWrite( _In_range_(1,0xFFFFFFFF) ULONG SectorsPerSecond // zero would cause divide-by-zero @@ -1549,7 +1549,7 @@ ConvertSectorsPerSecondTo100nsUnitsFor64kWrite( return 320000000 / SectorsPerSecond; } -__inline +FORCEINLINE // __REACTOS__ UCHAR RequestGetCurrentStackLocationFlags( _In_ WDFREQUEST Request @@ -1564,7 +1564,7 @@ RequestGetCurrentStackLocationFlags( return currentStack->Flags; } -__inline +FORCEINLINE // __REACTOS__ ULONG TimeOutValueGetCapValue( _In_ ULONG TimeOutValue, diff --git a/drivers/storage/class/cdrom_new/ioctl.c b/drivers/storage/class/cdrom_new/ioctl.c index f1db7724a86..e9971a7ee8d 100644 --- a/drivers/storage/class/cdrom_new/ioctl.c +++ b/drivers/storage/class/cdrom_new/ioctl.c @@ -6675,7 +6675,7 @@ Return Value: return status; } // end RequestHandleReserveRelease() -__inline +static // __REACTOS__ BOOLEAN ValidPersistentReserveScope( UCHAR Scope) @@ -6692,7 +6692,7 @@ ValidPersistentReserveScope( } } -__inline +static // __REACTOS__ BOOLEAN ValidPersistentReserveType( UCHAR Type) diff --git a/drivers/storage/class/cdrom_new/scratch.h b/drivers/storage/class/cdrom_new/scratch.h index 92d75328f0a..f142589e296 100644 --- a/drivers/storage/class/cdrom_new/scratch.h +++ b/drivers/storage/class/cdrom_new/scratch.h @@ -87,7 +87,7 @@ ScratchBuffer_PerformNextReadWrite( #define ScratchBuffer_BeginUse(context) ScratchBuffer_BeginUseX((context), NULL, (ULONG)-1) #endif -__inline VOID ScratchBuffer_BeginUseX(_Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_opt_ LPCSTR File, ULONG Line) +FORCEINLINE VOID ScratchBuffer_BeginUseX(_Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_opt_ LPCSTR File, ULONG Line) { // NOTE: these are not "real" locks. They are simply to help // avoid multiple uses of the scratch buffer. Thus, it @@ -101,7 +101,7 @@ __inline VOID ScratchBuffer_BeginUseX(_Inout_ PCDROM_DEVICE_EXTENSION DeviceExte RequestClearSendTime(DeviceExtension->ScratchContext.ScratchRequest); return; } -__inline VOID ScratchBuffer_EndUse(_Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension) +FORCEINLINE VOID ScratchBuffer_EndUse(_Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension) { // NOTE: these are not "real" locks. They are simply to help // avoid multiple uses of the scratch buffer. Thus, it @@ -162,7 +162,7 @@ ScratchBuffer_ExecuteCdbEx( ); _IRQL_requires_max_(APC_LEVEL) -__inline +FORCEINLINE // __REACTOS__ NTSTATUS ScratchBuffer_ExecuteCdb( _Inout_ PCDROM_DEVICE_EXTENSION DeviceExtension, diff --git a/drivers/storage/class/classpnp/autorun.c b/drivers/storage/class/classpnp/autorun.c index 8791764915e..6500b4c998f 100644 --- a/drivers/storage/class/classpnp/autorun.c +++ b/drivers/storage/class/classpnp/autorun.c @@ -56,7 +56,7 @@ const GUID StoragePredictFailureEventGuid = WMI_STORAGE_PREDICT_FAILURE_EVENT_GU // would be to serialize the polling and power down irps so that // only one of them is sent to the device at a time. // -__inline +static BOOLEAN ClasspCanSendPollingIrp( _In_ PFUNCTIONAL_DEVICE_EXTENSION fdoExtension diff --git a/drivers/storage/class/classpnp/classp.h b/drivers/storage/class/classpnp/classp.h index dace321951d..81e47b2c66f 100644 --- a/drivers/storage/class/classpnp/classp.h +++ b/drivers/storage/class/classpnp/classp.h @@ -1208,16 +1208,16 @@ typedef struct _IO_RETRIED_LOG_MESSAGE_CONTEXT { /* * Simple singly-linked-list queuing macros, with no synchronization. */ -__inline VOID SimpleInitSlistHdr(SINGLE_LIST_ENTRY *SListHdr) +FORCEINLINE VOID SimpleInitSlistHdr(SINGLE_LIST_ENTRY *SListHdr) { SListHdr->Next = NULL; } -__inline VOID SimplePushSlist(SINGLE_LIST_ENTRY *SListHdr, SINGLE_LIST_ENTRY *SListEntry) +FORCEINLINE VOID SimplePushSlist(SINGLE_LIST_ENTRY *SListHdr, SINGLE_LIST_ENTRY *SListEntry) { SListEntry->Next = SListHdr->Next; SListHdr->Next = SListEntry; } -__inline SINGLE_LIST_ENTRY *SimplePopSlist(SINGLE_LIST_ENTRY *SListHdr) +FORCEINLINE SINGLE_LIST_ENTRY *SimplePopSlist(SINGLE_LIST_ENTRY *SListHdr) { SINGLE_LIST_ENTRY *sListEntry = SListHdr->Next; if (sListEntry){ @@ -1226,12 +1226,12 @@ __inline SINGLE_LIST_ENTRY *SimplePopSlist(SINGLE_LIST_ENTRY *SListHdr) } return sListEntry; } -__inline BOOLEAN SimpleIsSlistEmpty(SINGLE_LIST_ENTRY *SListHdr) +FORCEINLINE BOOLEAN SimpleIsSlistEmpty(SINGLE_LIST_ENTRY *SListHdr) { return (SListHdr->Next == NULL); } -__inline +FORCEINLINE BOOLEAN ClasspIsIdleRequestSupported( PCLASS_PRIVATE_FDO_DATA FdoData, @@ -1246,7 +1246,7 @@ ClasspIsIdleRequestSupported( #endif } -__inline +FORCEINLINE VOID ClasspMarkIrpAsIdle( PIRP Irp, @@ -1263,7 +1263,7 @@ ClasspMarkIrpAsIdle( #endif } -__inline +FORCEINLINE BOOLEAN ClasspIsIdleRequest( PIRP Irp @@ -1275,7 +1275,7 @@ ClasspIsIdleRequest( return ((BOOLEAN)Irp->Tail.Overlay.DriverContext[1]); } -__inline +FORCEINLINE LARGE_INTEGER ClasspGetCurrentTime( VOID @@ -1292,7 +1292,7 @@ ClasspGetCurrentTime( return currentTime; } -__inline +FORCEINLINE ULONGLONG ClasspTimeDiffToMs( ULONGLONG TimeDiff @@ -1303,7 +1303,7 @@ ClasspTimeDiffToMs( return TimeDiff; } -__inline +FORCEINLINE BOOLEAN ClasspSupportsUnmap( _In_ PCLASS_FUNCTION_SUPPORT_INFO SupportInfo @@ -1312,7 +1312,7 @@ ClasspSupportsUnmap( return SupportInfo->LBProvisioningData.LBPU; } -__inline +FORCEINLINE BOOLEAN ClasspIsThinProvisioned( _In_ PCLASS_FUNCTION_SUPPORT_INFO SupportInfo @@ -1330,7 +1330,7 @@ ClasspIsThinProvisioned( return FALSE; } -__inline +FORCEINLINE BOOLEAN ClasspIsObsoletePortDriver( _In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension @@ -2018,7 +2018,7 @@ ClasspBinaryToAscii( _Inout_ PULONG UpdateLength ); -__inline +FORCEINLINE BOOLEAN ClasspIsTokenOperationComplete( _In_ ULONG CurrentStatus @@ -2039,7 +2039,7 @@ ClasspIsTokenOperationComplete( return operationCompleted; } -__inline +FORCEINLINE BOOLEAN ClasspIsTokenOperation( _In_ PCDB Cdb @@ -2061,7 +2061,7 @@ ClasspIsTokenOperation( return tokenOperation; } -__inline +FORCEINLINE BOOLEAN ClasspIsReceiveTokenInformation( _In_ PCDB Cdb @@ -2082,7 +2082,7 @@ ClasspIsReceiveTokenInformation( return receiveTokenInformation; } -__inline +FORCEINLINE BOOLEAN ClasspIsOffloadDataTransferCommand( _In_ PCDB Cdb @@ -2441,7 +2441,7 @@ ClasspConvertToScsiRequestBlock( _In_ PSTORAGE_REQUEST_BLOCK SrbEx ); -__inline PCDB +FORCEINLINE PCDB ClasspTransferPacketGetCdb( _In_ PTRANSFER_PACKET Pkt ) @@ -2455,7 +2455,7 @@ ClasspTransferPacketGetCdb( // // For unknown operation codes this function will return false and will set TimesAlreadyRetried with zero // -__inline BOOLEAN +FORCEINLINE BOOLEAN ClasspTransferPacketGetNumberOfRetriesDone( _In_ PTRANSFER_PACKET Pkt, _In_ PCDB Cdb, @@ -2509,7 +2509,7 @@ ClasspTransferPacketGetNumberOfRetriesDone( } -__inline PVOID +FORCEINLINE PVOID ClasspTransferPacketGetSenseInfoBuffer( _In_ PTRANSFER_PACKET Pkt ) @@ -2517,7 +2517,7 @@ ClasspTransferPacketGetSenseInfoBuffer( return SrbGetSenseInfoBuffer(Pkt->Srb); } -__inline UCHAR +FORCEINLINE UCHAR ClasspTransferPacketGetSenseInfoBufferLength( _In_ PTRANSFER_PACKET Pkt ) @@ -2526,7 +2526,7 @@ ClasspTransferPacketGetSenseInfoBufferLength( } -__inline VOID +FORCEINLINE VOID ClasspSrbSetOriginalIrp( _In_ PSTORAGE_REQUEST_BLOCK_HEADER Srb, _In_ PIRP Irp @@ -2542,7 +2542,7 @@ ClasspSrbSetOriginalIrp( } } -__inline +FORCEINLINE BOOLEAN PORT_ALLOCATED_SENSE_EX( _In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, @@ -2555,7 +2555,7 @@ PORT_ALLOCATED_SENSE_EX( ); } -__inline +FORCEINLINE VOID FREE_PORT_ALLOCATED_SENSE_BUFFER_EX( _In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, @@ -2580,7 +2580,7 @@ ClasspFailurePredictionPeriodMissed( _In_ PFUNCTIONAL_DEVICE_EXTENSION FdoExtension ); -__inline +FORCEINLINE ULONG ClasspGetMaxUsableBufferLengthFromOffset( _In_ PVOID BaseAddress, @@ -2633,7 +2633,7 @@ ClasspIsThinProvisioningError ( _In_ PSCSI_REQUEST_BLOCK _Srb ); -__inline +FORCEINLINE BOOLEAN ClasspLowerLayerNotSupport ( _In_ NTSTATUS Status @@ -2646,7 +2646,7 @@ ClasspLowerLayerNotSupport ( } #if defined(__REACTOS__) && (NTDDI_VERSION >= NTDDI_WINBLUE) -__inline +FORCEINLINE BOOLEAN ClasspSrbTimeOutStatus ( _In_ PSTORAGE_REQUEST_BLOCK_HEADER Srb diff --git a/drivers/storage/class/classpnp/debug.c b/drivers/storage/class/classpnp/debug.c index b39f1e9db48..45902a8933e 100644 --- a/drivers/storage/class/classpnp/debug.c +++ b/drivers/storage/class/classpnp/debug.c @@ -422,7 +422,7 @@ Revision History: A pointer to the value to be incremented. --*/ - __inline VOID DbgSafeInc(PULONG pValue) + static VOID DbgSafeInc(PULONG pValue) { ULONG incrementResult; if(NT_SUCCESS(RtlULongAdd(*pValue, 1, &incrementResult))) { diff --git a/drivers/storage/class/classpnp/utils.c b/drivers/storage/class/classpnp/utils.c index ee7593c2f5d..37aeddaf41d 100644 --- a/drivers/storage/class/classpnp/utils.c +++ b/drivers/storage/class/classpnp/utils.c @@ -1883,7 +1883,7 @@ Exit: return status; } -__inline +static NTSTATUS IncursSeekPenalty ( _In_ USHORT MediumRotationRate, @@ -6147,7 +6147,7 @@ __ClasspQueueLogIOEventWithContextWorker_Exit: } } -__inline +static BOOLEAN ValidPersistentReserveScope( UCHAR Scope) @@ -6166,7 +6166,7 @@ ValidPersistentReserveScope( return FALSE; } -__inline +static BOOLEAN ValidPersistentReserveType( UCHAR Type) @@ -8324,6 +8324,7 @@ retry: #endif // #if (NTDDI_VERSION >= NTDDI_WINTHRESHOLD) +#ifndef __REACTOS__ // the functions is not used __inline BOOLEAN ClassDeviceHwFirmwareIsPortDriverSupported( @@ -8359,6 +8360,7 @@ Return Value: return isSupported; } +#endif NTSTATUS ClassDeviceHwFirmwareGetInfoProcess( diff --git a/drivers/storage/class/disk_new/disk.h b/drivers/storage/class/disk_new/disk.h index 3ba2bf2ac15..7954cb0eb1e 100644 --- a/drivers/storage/class/disk_new/disk.h +++ b/drivers/storage/class/disk_new/disk.h @@ -985,7 +985,7 @@ DiskIoctlSmartSendDriveCommand( IN OUT PIRP Irp ); -__inline +FORCEINLINE // __REACTOS__ PCDB GetSrbScsiData( _In_ PSTORAGE_REQUEST_BLOCK SrbEx, @@ -1175,7 +1175,7 @@ Return Value: return Cdb; } -__inline +FORCEINLINE // __REACTOS__ VOID SetSrbScsiData( _In_ PSTORAGE_REQUEST_BLOCK SrbEx, diff --git a/drivers/storage/class/disk_new/diskwmi.c b/drivers/storage/class/disk_new/diskwmi.c index 449d3e16b38..ad022975ee1 100644 --- a/drivers/storage/class/disk_new/diskwmi.c +++ b/drivers/storage/class/disk_new/diskwmi.c @@ -267,7 +267,7 @@ GUID DiskPredictFailureEventGuid = WMI_STORAGE_PREDICT_FAILURE_EVENT_GUID; // // Enable SMART // -_inline NTSTATUS +static NTSTATUS DiskEnableSmart( PFUNCTIONAL_DEVICE_EXTENSION FdoExtension ) @@ -289,7 +289,7 @@ DiskEnableSmart( // // Disable SMART // -_inline NTSTATUS +static NTSTATUS DiskDisableSmart( PFUNCTIONAL_DEVICE_EXTENSION FdoExtension ) @@ -307,7 +307,7 @@ DiskDisableSmart( &bufferSize); } - +#ifndef __REACTOS__ // functions are not used // // Enable Attribute Autosave // @@ -350,12 +350,12 @@ DiskDisableSmartAttributeAutosave( (PSRB_IO_CONTROL)srbControl, &bufferSize); } - +#endif // // Initialize execution of SMART online diagnostics // -_inline NTSTATUS +static NTSTATUS DiskExecuteSmartDiagnostics( PFUNCTIONAL_DEVICE_EXTENSION FdoExtension, UCHAR Subcommand diff --git a/sdk/include/ddk/storduid.h b/sdk/include/ddk/storduid.h index fa8d89eb751..cba21bb42f1 100644 --- a/sdk/include/ddk/storduid.h +++ b/sdk/include/ddk/storduid.h @@ -45,13 +45,13 @@ typedef struct _STORAGE_DEVICE_LAYOUT_SIGNATURE } DeviceSpecific; } STORAGE_DEVICE_LAYOUT_SIGNATURE, *PSTORAGE_DEVICE_LAYOUT_SIGNATURE; -inline +FORCEINLINE DUID_MATCH_STATUS CompareStorageDuids( _In_ PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid1, _In_ PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid2); -inline +FORCEINLINE DUID_MATCH_STATUS CompareStorageDuids( _In_ PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid1,