- From 95d1d4072d92109fa8a1e0b949bce4cfb637213d Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 8 Oct 2024 14:12:52 +0200
- Subject: [PATCH 1/5] tests: nfsbuildtest.ksh93 should test whether required
- packages are installed
- nfsbuildtest.ksh93 should test whether required Cygwin packages are
- installed
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/nfsbuildtest/nfsbuildtest.ksh93 | 74 ++++++++++++++++++++++++++-
- 1 file changed, 72 insertions(+), 2 deletions(-)
- diff --git a/tests/nfsbuildtest/nfsbuildtest.ksh93 b/tests/nfsbuildtest/nfsbuildtest.ksh93
- index e24618e..0a55c51 100644
- --- a/tests/nfsbuildtest/nfsbuildtest.ksh93
- +++ b/tests/nfsbuildtest/nfsbuildtest.ksh93
- @@ -414,20 +414,68 @@ function msnfs41client_clean
- return 0
- }
- -builtin id
- -builtin mkdir
- +
- +#
- +# Enumerate installed Cygwin packages and fill
- +# an associative array with the package names
- +#
- +function enumerate_cygwin_packages
- +{
- + nameref package_arr=$1
- + typeset i
- +
- + /usr/bin/cygcheck -n | while read i ; do
- + package_arr["$i"]='true'
- + done
- + return 0
- +}
- +
- +
- +#
- +# test if a Cygwin package is installed, based on
- +# the array of package names passed as $1
- +#
- +function is_cygwin_pkg_installed
- +{
- + nameref package_arr=$1
- + typeset package_name="$2"
- + if [[ ! -v package_arr["$package_name"] ]] ; then
- + print -u2 -f $"Cygwin package '%s' not installed.\n" "$package_name"
- + return 1
- + fi
- +
- + return 0
- +}
- +
- function main
- {
- + typeset -A icp # installed cygwin packages
- + integer errc=0 # error counter
- typeset target="$1"
- typeset subcmd="$2"
- + enumerate_cygwin_packages icp
- +
- case "${target}_${subcmd}" in
- 'gcc_createcache')
- + is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- gcc_createcache
- return $?
- ;;
- 'gcc_build')
- + is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'gcc-core' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'gcc-g++' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'make' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'flex' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'bison' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'libgmp-devel' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'libmpfr-devel' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'libmpc-devel' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'libintl-devel' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'libisl-devel' || (( errc++ ))
- + (( errc > 0 )) && return 1
- gcc_build
- return $?
- ;;
- @@ -436,10 +484,17 @@ function main
- return $?
- ;;
- 'bash_createcache')
- + is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- bash_createcache
- return $?
- ;;
- 'bash_build')
- + is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'gcc-core' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'gcc-g++' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'bmake' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'libncurses-devel' || (( errc++ ))
- + (( errc > 0 )) && return 1
- bash_build
- return $?
- ;;
- @@ -448,10 +503,21 @@ function main
- return $?
- ;;
- 'msnfs41client_createcache')
- + is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- msnfs41client_createcache
- return $?
- ;;
- 'msnfs41client_build')
- + is_cygwin_pkg_installed icp 'git' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'gcc-core' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'gcc-g++' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'mingw64-i686-clang' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'mingw64-x86_64-clang' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'make' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'tar' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'bzip2' || (( errc++ ))
- + is_cygwin_pkg_installed icp 'openssl' || (( errc++ ))
- + (( errc > 0 )) && return 1
- msnfs41client_build
- return $?
- ;;
- @@ -470,9 +536,13 @@ function main
- return 1
- }
- +
- #
- # main
- #
- +builtin id
- +builtin mkdir
- +
- main "$@"
- return $?
- --
- 2.45.1
- From 7726a8690ecaed6db8f6de432417d1f74521fcf5 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 8 Oct 2024 14:31:14 +0200
- Subject: [PATCH 2/5] sys: |nfs41_downcall()| should warn if async op is
- something else than r/w
- |nfs41_downcall()| should warn if async op is something else than
- |NFS41_READ|/|NFS41_WRITE|
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41_driver.c | 33 ++++++++++++++++++++++-----------
- 1 file changed, 22 insertions(+), 11 deletions(-)
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index e1ad810..b0c065f 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -2205,18 +2205,29 @@ static NTSTATUS nfs41_downcall(
- }
- ExReleaseFastMutex(&cur->lock);
- if (cur->async_op) {
- - if (cur->status == STATUS_SUCCESS) {
- - cur->u.ReadWrite.rxcontext->StoredStatus = STATUS_SUCCESS;
- - cur->u.ReadWrite.rxcontext->InformationToReturn =
- - cur->buf_len;
- - } else {
- - cur->u.ReadWrite.rxcontext->StoredStatus =
- - map_readwrite_errors(cur->status);
- - cur->u.ReadWrite.rxcontext->InformationToReturn = 0;
- + switch (cur->opcode) {
- + case NFS41_WRITE:
- + case NFS41_READ:
- + if (cur->status == STATUS_SUCCESS) {
- + cur->u.ReadWrite.rxcontext->StoredStatus =
- + STATUS_SUCCESS;
- + cur->u.ReadWrite.rxcontext->InformationToReturn =
- + cur->buf_len;
- + } else {
- + cur->u.ReadWrite.rxcontext->StoredStatus =
- + map_readwrite_errors(cur->status);
- + cur->u.ReadWrite.rxcontext->InformationToReturn = 0;
- + }
- + nfs41_RemoveEntry(downcallLock, cur);
- + RxLowIoCompletion(cur->u.ReadWrite.rxcontext);
- + nfs41_UpcallDestroy(cur);
- + break;
- + default:
- + print_error("##### nfs41_downcall: "
- + "unknown async opcode=%d ####\n",
- + (int)cur->opcode);
- + break;
- }
- - nfs41_RemoveEntry(downcallLock, cur);
- - RxLowIoCompletion(cur->u.ReadWrite.rxcontext);
- - nfs41_UpcallDestroy(cur);
- } else
- KeSetEvent(&cur->cond, 0, FALSE);
- --
- 2.45.1
- From e6c6daaa21cc8986a5162c9743aa00fbf370844c Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 8 Oct 2024 14:33:12 +0200
- Subject: [PATCH 3/5] cygwin: Install some test scripts in
- /usr/share/msnfs41client/tests/
- Install some test scripts in /usr/share/msnfs41client/tests/ so
- end-users+QA can run them
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/Makefile.install | 5 +++++
- 1 file changed, 5 insertions(+)
- diff --git a/cygwin/Makefile.install b/cygwin/Makefile.install
- index 8c31d71..dee542c 100644
- --- a/cygwin/Makefile.install
- +++ b/cygwin/Makefile.install
- @@ -33,6 +33,9 @@ installdest:
- mkdir -p $(DESTDIR)/$(CYGWIN_BASEPATH)/etc
- mkdir -p $(DESTDIR)/$(CYGWIN_BASEPATH)/usr/src/msnfs41client
- mkdir -p $(DESTDIR)/$(CYGWIN_BASEPATH)/usr/share/man/man1
- + mkdir -p $(DESTDIR)/$(CYGWIN_BASEPATH)/usr/share/msnfs41client
- + mkdir -p $(DESTDIR)/$(CYGWIN_BASEPATH)/usr/share/msnfs41client/tests
- + mkdir -p $(DESTDIR)/$(CYGWIN_BASEPATH)/usr/share/msnfs41client/tests/misc
- cp -r $(VS_BUILD_DIR)/nfsd.exe $(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/nfsd_debug.exe
- cp -r $(VS_BUILD_DIR)/nfsd.pdb $(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/nfsd_debug.pdb
- cp -r $(VS_BUILD_DIR)/nfs_mount.* $(DESTDIR)/$(CYGWIN_BASEPATH)/sbin/.
- @@ -90,6 +93,8 @@ installdest:
- else \
- cp "$(PROJECT_BASEDIR_DIR)/tests/ea/nfs_ea.i686.exe" $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/nfs_ea.exe ; \
- fi
- + cp $(PROJECT_BASEDIR_DIR)/tests/nfsbuildtest/nfsbuildtest.ksh93 $(DESTDIR)/$(CYGWIN_BASEPATH)/usr/share/msnfs41client/tests/misc/nfsbuildtest.ksh93
- + cp $(PROJECT_BASEDIR_DIR)/tests/fstest_make_numtree1/fstest_make_numtree1.ksh93 $(DESTDIR)/$(CYGWIN_BASEPATH)/usr/share/msnfs41client/tests/misc/fstest_make_numtree1.ksh93
- @ printf "# Package ksh93&co (if available) since Cygwin does not ship with it yet\n"
- [[ -x $(CYGWIN_BASEPATH)/bin/ksh93.exe ]] && cp -f $(CYGWIN_BASEPATH)/bin/ksh93.exe $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/ksh93.exe || true
- [[ -x $(CYGWIN_BASEPATH)/bin/shcomp.exe ]] && cp -f $(CYGWIN_BASEPATH)/bin/shcomp.exe $(DESTDIR)/$(CYGWIN_BASEPATH)/bin/shcomp.exe || true
- --
- 2.45.1
- From b9279059a5ee8dbbb5849c9dd8ac5b3f55da3125 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 8 Oct 2024 17:44:39 +0200
- Subject: [PATCH 4/5] tests: nfsbuildtest.ksh93: Workaround for ms-nfs41-client
- VC19 link.exe crash
- nfsbuildtest.ksh93: Add workaround for ms-nfs41-client VC19 link.exe
- incremantal linker crash
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- tests/nfsbuildtest/nfsbuildtest.ksh93 | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
- diff --git a/tests/nfsbuildtest/nfsbuildtest.ksh93 b/tests/nfsbuildtest/nfsbuildtest.ksh93
- index 0a55c51..96399b3 100644
- --- a/tests/nfsbuildtest/nfsbuildtest.ksh93
- +++ b/tests/nfsbuildtest/nfsbuildtest.ksh93
- @@ -347,7 +347,7 @@ function msnfs41client_build
- #
- # build config
- #
- - typeset config_cp_p_function_not_implemented_workaround=false
- + typeset config_vs_disable_incremental_linker=true
- compound gitdata=(
- typeset url='https://github.com/kofemann/ms-nfs41-client.git'
- @@ -392,6 +392,15 @@ function msnfs41client_build
- # patch sources and configure build
- #
- + #
- + # disable incremental linking, which causes VC19 link.exe to
- + # crash, resulting in a
- + # "LINK : fatal error LNK1000: Internal error during IMAGE::Pass1"
- + #
- + if $config_vs_disable_incremental_linker ; then
- + sed -i -E 's/<LinkIncremental>true<\/LinkIncremental>/<LinkIncremental>false<\/LinkIncremental>/g' $(find 'build.vc19' -name \*.vcxproj)
- + fi
- +
- #
- # build ms-nfs41-client
- #
- --
- 2.45.1
- From 628e9ecdc5c4e08574ea8df6f1825e67d16a88e4 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Tue, 8 Oct 2024 18:48:36 +0200
- Subject: [PATCH 5/5] build.vc19,cygwin,sys: Add Visual Studio 2022 support
- Add Visual Studio 2022 support.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- build.vc19/nfs41_driver/nfs41_driver.vcxproj | 16 +-
- cygwin/README.txt | 5 +-
- sys/copysup.c | 24 +++
- sys/nfs41_debug.c | 25 +++
- sys/nfs41_debug.h | 6 +-
- sys/nfs41_driver.c | 174 ++++++++++++++-----
- sys/wmlkm.c | 25 +++
- 7 files changed, 214 insertions(+), 61 deletions(-)
- diff --git a/build.vc19/nfs41_driver/nfs41_driver.vcxproj b/build.vc19/nfs41_driver/nfs41_driver.vcxproj
- index a786711..6463bbe 100644
- --- a/build.vc19/nfs41_driver/nfs41_driver.vcxproj
- +++ b/build.vc19/nfs41_driver/nfs41_driver.vcxproj
- @@ -135,7 +135,7 @@
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
- <ClCompile>
- - <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- + <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;$(WindowsSdkDir)Include0.0.19041.0\km;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>EXPLODE_POOLTAGS;MONOLITHIC_MINIRDR;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- @@ -149,7 +149,7 @@
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
- <ClCompile>
- - <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- + <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;$(WindowsSdkDir)Include0.0.19041.0\km;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <PreprocessorDefinitions>EXPLODE_POOLTAGS;MONOLITHIC_MINIRDR;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- @@ -163,7 +163,7 @@
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- - <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- + <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;$(WindowsSdkDir)Include0.0.19041.0\km;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>EXPLODE_POOLTAGS;MONOLITHIC_MINIRDR;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- @@ -177,7 +177,7 @@
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- - <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- + <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;$(WindowsSdkDir)Include0.0.19041.0\km;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <PreprocessorDefinitions>EXPLODE_POOLTAGS;MONOLITHIC_MINIRDR;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- @@ -191,7 +191,7 @@
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
- <ClCompile>
- - <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- + <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;$(WindowsSdkDir)Include0.0.19041.0\km;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>EXPLODE_POOLTAGS;MONOLITHIC_MINIRDR;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- @@ -205,7 +205,7 @@
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
- <ClCompile>
- - <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- + <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;$(WindowsSdkDir)Include0.0.19041.0\km;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <PreprocessorDefinitions>EXPLODE_POOLTAGS;MONOLITHIC_MINIRDR;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- @@ -219,7 +219,7 @@
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- - <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- + <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;$(WindowsSdkDir)Include0.0.19041.0\km;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>EXPLODE_POOLTAGS;MONOLITHIC_MINIRDR;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- @@ -233,7 +233,7 @@
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- - <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- + <AdditionalIncludeDirectories>..\..\include;..\..\dll;..\..;$(WindowsSdkDir)Include0.0.19041.0\km;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <WarningLevel>Level4</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <PreprocessorDefinitions>EXPLODE_POOLTAGS;MONOLITHIC_MINIRDR;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- diff --git a/cygwin/README.txt b/cygwin/README.txt
- index 1e34fdb..24f3342 100644
- --- a/cygwin/README.txt
- +++ b/cygwin/README.txt
- @@ -19,8 +19,9 @@
- (see "ms-nfs41-clientcygwin/README.bintarball.txt" for Cygwin 32bit
- and 64bit installation instructions)
- -** Build the project using Cygwin command line (bash/ksh93):
- -export PATH+=":/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/"
- +** Build the project using VS19/VS22+Cygwin command line (bash/ksh93):
- +export PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/:$PATH"
- +# VS22 use: $ export PATH="/cygdrive/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/:$PATH"
- git clone https://github.com/kofemann/ms-nfs41-client.git
- cd ms-nfs41-client
- cd cygwin
- diff --git a/sys/copysup.c b/sys/copysup.c
- index 799caf9..8e9b384 100644
- --- a/sys/copysup.c
- +++ b/sys/copysup.c
- @@ -26,6 +26,30 @@
- #error Code requires ISO C17
- #endif
- +/* FIXME: Why does VS22 need this, but not VC19 ? */
- +#if _MSC_VER >= 1900
- +#if defined(_WIN64) && defined(_M_X64)
- +#ifndef _AMD64_
- +#define _AMD64_
- +#endif
- +#elif defined(_WIN32) && defined(_M_IX86)
- +#ifndef _X86_
- +#define _X86_
- +#endif
- +#elif defined(_WIN64) && defined(_M_ARM64)
- +#ifndef _ARM64_
- +#define _ARM64_
- +#endif
- +#elif defined(_WIN32) && defined(_M_ARM)
- +#ifndef _ARM_
- +#define _ARM_
- +#endif
- +#else
- +#error Unsupported arch
- +#endif
- +#endif /* _MSC_VER >= 1900 */
- +
- +
- #include <rx.h>
- #include <windef.h>
- #include <winerror.h>
- diff --git a/sys/nfs41_debug.c b/sys/nfs41_debug.c
- index 603f397..7792da5 100644
- --- a/sys/nfs41_debug.c
- +++ b/sys/nfs41_debug.c
- @@ -21,6 +21,31 @@
- */
- #define MINIRDR__NAME "Value is ignored, only fact of definition"
- +
- +/* FIXME: Why does VS22 need this, but not VC19 ? */
- +#if _MSC_VER >= 1900
- +#if defined(_WIN64) && defined(_M_X64)
- +#ifndef _AMD64_
- +#define _AMD64_
- +#endif
- +#elif defined(_WIN32) && defined(_M_IX86)
- +#ifndef _X86_
- +#define _X86_
- +#endif
- +#elif defined(_WIN64) && defined(_M_ARM64)
- +#ifndef _ARM64_
- +#define _ARM64_
- +#endif
- +#elif defined(_WIN32) && defined(_M_ARM)
- +#ifndef _ARM_
- +#define _ARM_
- +#endif
- +#else
- +#error Unsupported arch
- +#endif
- +#endif /* _MSC_VER >= 1900 */
- +
- +
- #include <rx.h>
- #include "nfs41_driver.h"
- diff --git a/sys/nfs41_debug.h b/sys/nfs41_debug.h
- index 8f45e51..0c3f7c4 100644
- --- a/sys/nfs41_debug.h
- +++ b/sys/nfs41_debug.h
- @@ -63,18 +63,18 @@ const char *fsctl2string(ULONG fsctl);
- #define DbgEn() DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, \
- "--> [%s] [%04x] %s\n", _DRIVER_NAME_, PsGetCurrentProcessShortDebugId(), \
- - __func__); try {
- + __func__); __try {
- #define DbgEx() DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, \
- "<-- [%s] [%04x] %s status = %08lx\n", _DRIVER_NAME_, PsGetCurrentProcessShortDebugId(), \
- __func__, status); \
- - } except (EXCEPTION_EXECUTE_HANDLER) { \
- + } __except (EXCEPTION_EXECUTE_HANDLER) { \
- status = GetExceptionCode() ; \
- DbgP("Exception encountered with value = Ox%x\n", status); \
- }
- #define DbgR() DbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, \
- "<-- [%s] [%04x] %s\n", _DRIVER_NAME_, PsGetCurrentProcessShortDebugId(), __func__); \
- - } except (EXCEPTION_EXECUTE_HANDLER) { \
- + } __except (EXCEPTION_EXECUTE_HANDLER) { \
- NTSTATUS exc_status; \
- exc_status = GetExceptionCode() ; \
- DbgP("Exception encountered with value = Ox%x\n", (int)exc_status); \
- diff --git a/sys/nfs41_driver.c b/sys/nfs41_driver.c
- index b0c065f..2dd688e 100644
- --- a/sys/nfs41_driver.c
- +++ b/sys/nfs41_driver.c
- @@ -28,6 +28,30 @@
- #error Code requires ISO C17
- #endif
- +/* FIXME: Why does VS22 need this, but not VC19 ? */
- +#if _MSC_VER >= 1900
- +#if defined(_WIN64) && defined(_M_X64)
- +#ifndef _AMD64_
- +#define _AMD64_
- +#endif
- +#elif defined(_WIN32) && defined(_M_IX86)
- +#ifndef _X86_
- +#define _X86_
- +#endif
- +#elif defined(_WIN64) && defined(_M_ARM64)
- +#ifndef _ARM64_
- +#define _ARM64_
- +#endif
- +#elif defined(_WIN32) && defined(_M_ARM)
- +#ifndef _ARM_
- +#define _ARM_
- +#endif
- +#else
- +#error Unsupported arch
- +#endif
- +#endif /* _MSC_VER >= 1900 */
- +
- +
- #define MINIRDR__NAME "Value is ignored, only fact of definition"
- #include <rx.h>
- #include <windef.h>
- @@ -292,6 +316,18 @@ typedef struct _updowncall_list {
- nfs41_updowncall_list upcall, downcall;
- +#if _MSC_VER >= 1900
- +/*
- + * gisburn: VS22 chokes on the original define for
- + * |DECLARE_CONST_UNICODE_STRING|, so we use one
- + * without the offending stuff
- + */
- +#undef DECLARE_CONST_UNICODE_STRING
- +#define DECLARE_CONST_UNICODE_STRING(_var, _string) \
- + const WCHAR _var ## _buffer[] = _string; \
- + const UNICODE_STRING _var = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWCH) _var ## _buffer }
- +#endif /* _MSC_VER >= 1900 */
- +
- /*
- * In order to cooperate with other network providers,
- @@ -2816,7 +2852,7 @@ static NTSTATUS nfs41_CreateSrvCall(
- status = _nfs41_CreateSrvCall(pCallbackContext);
- } else {
- status = RxDispatchToWorkerThread(nfs41_dev, DelayedWorkQueue,
- - _nfs41_CreateSrvCall, pCallbackContext);
- + (PRX_WORKERTHREAD_ROUTINE)_nfs41_CreateSrvCall, pCallbackContext);
- if (status != STATUS_SUCCESS) {
- print_error("RxDispatchToWorkerThread returned status 0x%08lx\n",
- status);
- @@ -7636,83 +7672,125 @@ static NTSTATUS nfs41_init_ops()
- // while the others continue to operate.
- //
- - nfs41_ops.MRxStart = nfs41_Start;
- - nfs41_ops.MRxStop = nfs41_Stop;
- - nfs41_ops.MRxDevFcbXXXControlFile = nfs41_DevFcbXXXControlFile;
- + nfs41_ops.MRxStart = (PMRX_CALLDOWN_CTX)nfs41_Start;
- + nfs41_ops.MRxStop = (PMRX_CALLDOWN_CTX)nfs41_Stop;
- + nfs41_ops.MRxDevFcbXXXControlFile =
- + (PMRX_CALLDOWN)nfs41_DevFcbXXXControlFile;
- //
- // Mini redirector name resolution.
- //
- - nfs41_ops.MRxCreateSrvCall = nfs41_CreateSrvCall;
- - nfs41_ops.MRxSrvCallWinnerNotify = nfs41_SrvCallWinnerNotify;
- - nfs41_ops.MRxCreateVNetRoot = nfs41_CreateVNetRoot;
- - nfs41_ops.MRxExtractNetRootName = nfs41_ExtractNetRootName;
- - nfs41_ops.MRxFinalizeSrvCall = nfs41_FinalizeSrvCall;
- - nfs41_ops.MRxFinalizeNetRoot = nfs41_FinalizeNetRoot;
- - nfs41_ops.MRxFinalizeVNetRoot = nfs41_FinalizeVNetRoot;
- + nfs41_ops.MRxCreateSrvCall =
- + (PMRX_CREATE_SRVCALL)nfs41_CreateSrvCall;
- + nfs41_ops.MRxSrvCallWinnerNotify =
- + (PMRX_SRVCALL_WINNER_NOTIFY)nfs41_SrvCallWinnerNotify;
- + nfs41_ops.MRxCreateVNetRoot =
- + (PMRX_CREATE_V_NET_ROOT)nfs41_CreateVNetRoot;
- + nfs41_ops.MRxExtractNetRootName =
- + (PMRX_EXTRACT_NETROOT_NAME)nfs41_ExtractNetRootName;
- + nfs41_ops.MRxFinalizeSrvCall =
- + (PMRX_FINALIZE_SRVCALL_CALLDOWN)nfs41_FinalizeSrvCall;
- + nfs41_ops.MRxFinalizeNetRoot =
- + (PMRX_FINALIZE_NET_ROOT_CALLDOWN)nfs41_FinalizeNetRoot;
- + nfs41_ops.MRxFinalizeVNetRoot =
- + (PMRX_FINALIZE_V_NET_ROOT_CALLDOWN)nfs41_FinalizeVNetRoot;
- //
- // File System Object Creation/Deletion.
- //
- - nfs41_ops.MRxCreate = nfs41_Create;
- - nfs41_ops.MRxCollapseOpen = nfs41_CollapseOpen;
- - nfs41_ops.MRxShouldTryToCollapseThisOpen = nfs41_ShouldTryToCollapseThisOpen;
- - nfs41_ops.MRxExtendForCache = nfs41_ExtendForCache;
- - nfs41_ops.MRxExtendForNonCache = nfs41_ExtendForCache;
- - nfs41_ops.MRxCloseSrvOpen = nfs41_CloseSrvOpen;
- - nfs41_ops.MRxFlush = nfs41_Flush;
- - nfs41_ops.MRxDeallocateForFcb = nfs41_DeallocateForFcb;
- - nfs41_ops.MRxDeallocateForFobx = nfs41_DeallocateForFobx;
- - nfs41_ops.MRxIsLockRealizable = nfs41_IsLockRealizable;
- + nfs41_ops.MRxCreate =
- + (PMRX_CALLDOWN)nfs41_Create;
- + nfs41_ops.MRxCollapseOpen =
- + (PMRX_CALLDOWN)nfs41_CollapseOpen;
- + nfs41_ops.MRxShouldTryToCollapseThisOpen =
- + (PMRX_CALLDOWN)nfs41_ShouldTryToCollapseThisOpen;
- + nfs41_ops.MRxExtendForCache =
- + (PMRX_EXTENDFILE_CALLDOWN)nfs41_ExtendForCache;
- + nfs41_ops.MRxExtendForNonCache =
- + (PMRX_EXTENDFILE_CALLDOWN)nfs41_ExtendForCache;
- + nfs41_ops.MRxCloseSrvOpen =
- + (PMRX_CALLDOWN)nfs41_CloseSrvOpen;
- + nfs41_ops.MRxFlush =
- + (PMRX_CALLDOWN)nfs41_Flush;
- + nfs41_ops.MRxDeallocateForFcb =
- + (PMRX_DEALLOCATE_FOR_FCB)nfs41_DeallocateForFcb;
- + nfs41_ops.MRxDeallocateForFobx =
- + (PMRX_DEALLOCATE_FOR_FOBX)nfs41_DeallocateForFobx;
- + nfs41_ops.MRxIsLockRealizable =
- + (PMRX_IS_LOCK_REALIZABLE)nfs41_IsLockRealizable;
- //
- // File System Objects query/Set
- //
- - nfs41_ops.MRxQueryDirectory = nfs41_QueryDirectory;
- - nfs41_ops.MRxQueryVolumeInfo = nfs41_QueryVolumeInformation;
- - nfs41_ops.MRxQueryEaInfo = nfs41_QueryEaInformation;
- - nfs41_ops.MRxSetEaInfo = nfs41_SetEaInformation;
- - nfs41_ops.MRxQuerySdInfo = nfs41_QuerySecurityInformation;
- - nfs41_ops.MRxSetSdInfo = nfs41_SetSecurityInformation;
- - nfs41_ops.MRxQueryFileInfo = nfs41_QueryFileInformation;
- - nfs41_ops.MRxSetFileInfo = nfs41_SetFileInformation;
- + nfs41_ops.MRxQueryDirectory =
- + (PMRX_CALLDOWN)nfs41_QueryDirectory;
- + nfs41_ops.MRxQueryVolumeInfo =
- + (PMRX_CALLDOWN)nfs41_QueryVolumeInformation;
- + nfs41_ops.MRxSetVolumeInfo =
- + (PMRX_CALLDOWN)nfs41_Unimplemented;
- + nfs41_ops.MRxQueryEaInfo =
- + (PMRX_CALLDOWN)nfs41_QueryEaInformation;
- + nfs41_ops.MRxSetEaInfo =
- + (PMRX_CALLDOWN)nfs41_SetEaInformation;
- + nfs41_ops.MRxQuerySdInfo =
- + (PMRX_CALLDOWN)nfs41_QuerySecurityInformation;
- + nfs41_ops.MRxSetSdInfo =
- + (PMRX_CALLDOWN)nfs41_SetSecurityInformation;
- + nfs41_ops.MRxQueryFileInfo =
- + (PMRX_CALLDOWN)nfs41_QueryFileInformation;
- + nfs41_ops.MRxSetFileInfo =
- + (PMRX_CALLDOWN)nfs41_SetFileInformation;
- + nfs41_ops.MRxQueryQuotaInfo =
- + (PMRX_CALLDOWN)nfs41_Unimplemented;
- + nfs41_ops.MRxSetQuotaInfo =
- + (PMRX_CALLDOWN)nfs41_Unimplemented;
- //
- // Buffering state change
- //
- - nfs41_ops.MRxComputeNewBufferingState = nfs41_ComputeNewBufferingState;
- + nfs41_ops.MRxComputeNewBufferingState =
- + (PMRX_COMPUTE_NEW_BUFFERING_STATE)nfs41_ComputeNewBufferingState;
- //
- // File System Object I/O
- //
- - nfs41_ops.MRxLowIOSubmit[LOWIO_OP_READ] = nfs41_Read;
- - nfs41_ops.MRxLowIOSubmit[LOWIO_OP_WRITE] = nfs41_Write;
- - nfs41_ops.MRxLowIOSubmit[LOWIO_OP_SHAREDLOCK] = nfs41_Lock;
- - nfs41_ops.MRxLowIOSubmit[LOWIO_OP_EXCLUSIVELOCK] = nfs41_Lock;
- - nfs41_ops.MRxLowIOSubmit[LOWIO_OP_UNLOCK] = nfs41_Unlock;
- - nfs41_ops.MRxLowIOSubmit[LOWIO_OP_UNLOCK_MULTIPLE] = nfs41_Unlock;
- - nfs41_ops.MRxLowIOSubmit[LOWIO_OP_FSCTL] = nfs41_FsCtl;
- - nfs41_ops.MRxLowIOSubmit[LOWIO_OP_IOCTL] = nfs41_IoCtl;
- + nfs41_ops.MRxLowIOSubmit[LOWIO_OP_READ] =
- + (PMRX_CALLDOWN)nfs41_Read;
- + nfs41_ops.MRxLowIOSubmit[LOWIO_OP_WRITE] =
- + (PMRX_CALLDOWN)nfs41_Write;
- + nfs41_ops.MRxLowIOSubmit[LOWIO_OP_SHAREDLOCK] =
- + (PMRX_CALLDOWN)nfs41_Lock;
- + nfs41_ops.MRxLowIOSubmit[LOWIO_OP_EXCLUSIVELOCK] =
- + (PMRX_CALLDOWN)nfs41_Lock;
- + nfs41_ops.MRxLowIOSubmit[LOWIO_OP_UNLOCK] =
- + (PMRX_CALLDOWN)nfs41_Unlock;
- + nfs41_ops.MRxLowIOSubmit[LOWIO_OP_UNLOCK_MULTIPLE] =
- + (PMRX_CALLDOWN)nfs41_Unlock;
- + nfs41_ops.MRxLowIOSubmit[LOWIO_OP_FSCTL] =
- + (PMRX_CALLDOWN)nfs41_FsCtl;
- + nfs41_ops.MRxLowIOSubmit[LOWIO_OP_IOCTL] =
- + (PMRX_CALLDOWN)nfs41_IoCtl;
- //
- // Miscellanous
- //
- - nfs41_ops.MRxCompleteBufferingStateChangeRequest =
- - nfs41_CompleteBufferingStateChangeRequest;
- - nfs41_ops.MRxIsValidDirectory = nfs41_IsValidDirectory;
- -
- - nfs41_ops.MRxTruncate = nfs41_Unimplemented;
- - nfs41_ops.MRxZeroExtend = nfs41_Unimplemented;
- - nfs41_ops.MRxAreFilesAliased = nfs41_AreFilesAliased;
- - nfs41_ops.MRxQueryQuotaInfo = nfs41_Unimplemented;
- - nfs41_ops.MRxSetQuotaInfo = nfs41_Unimplemented;
- - nfs41_ops.MRxSetVolumeInfo = nfs41_Unimplemented;
- + nfs41_ops.MRxCompleteBufferingStateChangeRequest =
- + (PMRX_CHANGE_BUFFERING_STATE_CALLDOWN)nfs41_CompleteBufferingStateChangeRequest;
- + nfs41_ops.MRxIsValidDirectory =
- + (PMRX_CHKDIR_CALLDOWN)nfs41_IsValidDirectory;
- +
- + nfs41_ops.MRxTruncate =
- + (PMRX_CALLDOWN)nfs41_Unimplemented;
- + nfs41_ops.MRxZeroExtend =
- + (PMRX_CALLDOWN)nfs41_Unimplemented;
- + nfs41_ops.MRxAreFilesAliased =
- + (PMRX_CHKFCB_CALLDOWN)nfs41_AreFilesAliased;
- DbgR();
- return(STATUS_SUCCESS);
- diff --git a/sys/wmlkm.c b/sys/wmlkm.c
- index 6c7161c..3fb63bb 100644
- --- a/sys/wmlkm.c
- +++ b/sys/wmlkm.c
- @@ -23,6 +23,31 @@
- #pragma hdrstop
- +/* FIXME: Why does VS22 need this, but not VC19 ? */
- +#if _MSC_VER >= 1900
- +#if defined(_WIN64) && defined(_M_X64)
- +#ifndef _AMD64_
- +#define _AMD64_
- +#endif
- +#elif defined(_WIN32) && defined(_M_IX86)
- +#ifndef _X86_
- +#define _X86_
- +#endif
- +#elif defined(_WIN64) && defined(_M_ARM64)
- +#ifndef _ARM64_
- +#define _ARM64_
- +#endif
- +#elif defined(_WIN32) && defined(_M_ARM)
- +#ifndef _ARM_
- +#define _ARM_
- +#endif
- +#else
- +#error Unsupported arch
- +#endif
- +#endif /* _MSC_VER >= 1900 */
- +
- +
- +
- #include <ntddk.h>
- #include <ntdef.h>
- #define LPVOID PVOID64 // BUG - need to find include for this
- --
- 2.45.1
msnfs41client: Patches for VisualStudio2022 build support, tests+misc, 2024-10-08
Posted by Anonymous on Tue 8th Oct 2024 18:11
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.