From 7fc480a7c162c5635bb69bf068bfe3f597f0aaf4 Mon Sep 17 00:00:00 2001 From: Stefan Ginsberg Date: Thu, 10 Sep 2015 12:00:28 +0000 Subject: [PATCH] Fix the FSDs to use the INIT_SECTION-style and add the alloc_text-s required for MSVC. Please make sure to add section declarations for both compilers for any new functions! svn path=/trunk/; revision=69170 --- reactos/drivers/filesystems/cdfs/cdfs.c | 6 +++- reactos/drivers/filesystems/cdfs/cdfs.h | 2 -- reactos/drivers/filesystems/fastfat/iface.c | 7 +++- reactos/drivers/filesystems/fastfat/vfat.h | 2 -- reactos/drivers/filesystems/mup/mup.c | 40 ++++++++++++++++++--- reactos/drivers/filesystems/mup/mup.h | 2 -- reactos/drivers/filesystems/ntfs/ntfs.c | 9 +++-- reactos/drivers/filesystems/ntfs/ntfs.h | 2 -- 8 files changed, 53 insertions(+), 17 deletions(-) diff --git a/reactos/drivers/filesystems/cdfs/cdfs.c b/reactos/drivers/filesystems/cdfs/cdfs.c index 8ae777800af..9f364fe686c 100644 --- a/reactos/drivers/filesystems/cdfs/cdfs.c +++ b/reactos/drivers/filesystems/cdfs/cdfs.c @@ -32,6 +32,10 @@ #define NDEBUG #include +#if defined(ALLOC_PRAGMA) +#pragma alloc_text(INIT, DriverEntry) +#endif + /* GLOBALS ******************************************************************/ PCDFS_GLOBAL_DATA CdfsGlobalData; @@ -39,7 +43,7 @@ PCDFS_GLOBAL_DATA CdfsGlobalData; /* FUNCTIONS ****************************************************************/ -INIT_FUNCTION +INIT_SECTION NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) diff --git a/reactos/drivers/filesystems/cdfs/cdfs.h b/reactos/drivers/filesystems/cdfs/cdfs.h index e60e7c84f1b..77b5c7ca6b6 100644 --- a/reactos/drivers/filesystems/cdfs/cdfs.h +++ b/reactos/drivers/filesystems/cdfs/cdfs.h @@ -7,10 +7,8 @@ #ifdef __GNUC__ #define INIT_SECTION __attribute__((section ("INIT"))) -#define INIT_FUNCTION INIT_SECTION #else #define INIT_SECTION /* Done via alloc_text for MSC */ -#define INIT_FUNCTION INIT_SECTION #endif #define CDFS_BASIC_SECTOR 2048 diff --git a/reactos/drivers/filesystems/fastfat/iface.c b/reactos/drivers/filesystems/fastfat/iface.c index 0a509b37f57..5ed678db212 100644 --- a/reactos/drivers/filesystems/fastfat/iface.c +++ b/reactos/drivers/filesystems/fastfat/iface.c @@ -30,6 +30,11 @@ #define NDEBUG #include +#if defined(ALLOC_PRAGMA) +#pragma alloc_text(INIT, DriverEntry) +#endif + + /* GLOBALS *****************************************************************/ PVFAT_GLOBAL_DATA VfatGlobalData; @@ -43,7 +48,7 @@ PVFAT_GLOBAL_DATA VfatGlobalData; * RegistryPath = path to our configuration entries * RETURNS: Success or failure */ -INIT_FUNCTION +INIT_SECTION NTSTATUS NTAPI DriverEntry( diff --git a/reactos/drivers/filesystems/fastfat/vfat.h b/reactos/drivers/filesystems/fastfat/vfat.h index 20f13b92e59..a1e37aead97 100644 --- a/reactos/drivers/filesystems/fastfat/vfat.h +++ b/reactos/drivers/filesystems/fastfat/vfat.h @@ -8,10 +8,8 @@ #ifdef __GNUC__ #define INIT_SECTION __attribute__((section ("INIT"))) -#define INIT_FUNCTION INIT_SECTION #else #define INIT_SECTION /* Done via alloc_text for MSC */ -#define INIT_FUNCTION INIT_SECTION #endif #define USE_ROS_CC_AND_FS diff --git a/reactos/drivers/filesystems/mup/mup.c b/reactos/drivers/filesystems/mup/mup.c index c1535a3ec55..b0c7599d860 100644 --- a/reactos/drivers/filesystems/mup/mup.c +++ b/reactos/drivers/filesystems/mup/mup.c @@ -32,6 +32,36 @@ #define NDEBUG #include +NTSTATUS +NTAPI +DriverEntry( + PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath +); + +NTSTATUS +DfsDriverEntry( + PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath +); + +VOID +MupInitializeData( + VOID +); + +VOID +MupInitializeVcb( + PMUP_VCB Vcb +); + +#if defined(ALLOC_PRAGMA) +#pragma alloc_text(INIT, DriverEntry) +#pragma alloc_text(INIT, DfsDriverEntry) +#pragma alloc_text(INIT, MupInitializeData) +#pragma alloc_text(INIT, MupInitializeVcb) +#endif + ERESOURCE MupGlobalLock; ERESOURCE MupPrefixTableLock; ERESOURCE MupCcbListLock; @@ -53,9 +83,9 @@ NTSTATUS MupOrderedErrorList[] = { STATUS_UNSUCCESSFUL, /* FUNCTIONS ****************************************************************/ -INIT_FUNCTION +INIT_SECTION VOID -MupInitializeData() +MupInitializeData(VOID) { ExInitializeResourceLite(&MupGlobalLock); ExInitializeResourceLite(&MupPrefixTableLock); @@ -79,7 +109,7 @@ MupUninitializeData() ExDeleteResourceLite(&MupVcbLock); } -INIT_FUNCTION +INIT_SECTION VOID MupInitializeVcb(PMUP_VCB Vcb) { @@ -2522,7 +2552,7 @@ MupUnload(PDRIVER_OBJECT DriverObject) MupUninitializeData(); } -INIT_FUNCTION +INIT_SECTION NTSTATUS DfsDriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) @@ -2541,7 +2571,7 @@ DfsDriverEntry(PDRIVER_OBJECT DriverObject, * RegistryPath = path to our configuration entries * RETURNS: Success or failure */ -INIT_FUNCTION +INIT_SECTION NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, diff --git a/reactos/drivers/filesystems/mup/mup.h b/reactos/drivers/filesystems/mup/mup.h index 0b43541a5a5..ad43af63a4a 100644 --- a/reactos/drivers/filesystems/mup/mup.h +++ b/reactos/drivers/filesystems/mup/mup.h @@ -8,10 +8,8 @@ #ifdef __GNUC__ #define INIT_SECTION __attribute__((section ("INIT"))) -#define INIT_FUNCTION INIT_SECTION #else #define INIT_SECTION /* Done via alloc_text for MSC */ -#define INIT_FUNCTION INIT_SECTION #endif #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S)) diff --git a/reactos/drivers/filesystems/ntfs/ntfs.c b/reactos/drivers/filesystems/ntfs/ntfs.c index 51d62a2b7ee..d4bbb84ddcd 100644 --- a/reactos/drivers/filesystems/ntfs/ntfs.c +++ b/reactos/drivers/filesystems/ntfs/ntfs.c @@ -31,6 +31,11 @@ #define NDEBUG #include +#if defined(ALLOC_PRAGMA) +#pragma alloc_text(INIT, DriverEntry) +#pragma alloc_text(INIT, NtfsInitializeFunctionPointers) +#endif + /* GLOBALS *****************************************************************/ PNTFS_GLOBAL_DATA NtfsGlobalData = NULL; @@ -44,7 +49,7 @@ PNTFS_GLOBAL_DATA NtfsGlobalData = NULL; * RegistryPath = path to our configuration entries * RETURNS: Success or failure */ -INIT_FUNCTION +INIT_SECTION NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, @@ -123,7 +128,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject, * DriverObject = object describing this driver * RETURNS: Nothing */ -INIT_FUNCTION +INIT_SECTION VOID NTAPI NtfsInitializeFunctionPointers(PDRIVER_OBJECT DriverObject) diff --git a/reactos/drivers/filesystems/ntfs/ntfs.h b/reactos/drivers/filesystems/ntfs/ntfs.h index d162c59da38..037bbe4e999 100644 --- a/reactos/drivers/filesystems/ntfs/ntfs.h +++ b/reactos/drivers/filesystems/ntfs/ntfs.h @@ -6,10 +6,8 @@ #ifdef __GNUC__ #define INIT_SECTION __attribute__((section ("INIT"))) -#define INIT_FUNCTION INIT_SECTION #else #define INIT_SECTION /* Done via alloc_text for MSC */ -#define INIT_FUNCTION INIT_SECTION #endif #define CACHEPAGESIZE(pDeviceExt) \