- From e18952b1ac72ad15e9433791102729bbe933f787 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 30 Oct 2024 11:24:59 +0100
- Subject: [PATCH 1/3] build.vc19,daemon: Move |nfs41_file_info| utility
- functions to their own source file
- Move |nfs41_file_info| utility functions to their own source file
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- build.vc19/nfsd/nfsd.vcxproj | 1 +
- build.vc19/nfsd/nfsd.vcxproj.filters | 3 +
- daemon/fileinfoutil.c | 197 +++++++++++++++++++++++++++
- daemon/util.c | 156 ---------------------
- 4 files changed, 201 insertions(+), 156 deletions(-)
- create mode 100644 daemon/fileinfoutil.c
- diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
- index dff2257..0c3b2bd 100644
- --- a/build.vc19/nfsd/nfsd.vcxproj
- +++ b/build.vc19/nfsd/nfsd.vcxproj
- @@ -261,6 +261,7 @@
- <ClCompile Include="..\..\daemon\daemon_debug.c" />
- <ClCompile Include="..\..\daemon\delegation.c" />
- <ClCompile Include="..\..\daemon\ea.c" />
- + <ClCompile Include="..\..\daemon\fileinfoutil.c" />
- <ClCompile Include="..\..\daemon\getattr.c" />
- <ClCompile Include="..\..\daemon\idmap.c" />
- <ClCompile Include="..\..\daemon\idmap_cygwin.c" />
- diff --git a/build.vc19/nfsd/nfsd.vcxproj.filters b/build.vc19/nfsd/nfsd.vcxproj.filters
- index dd45092..46a6b34 100644
- --- a/build.vc19/nfsd/nfsd.vcxproj.filters
- +++ b/build.vc19/nfsd/nfsd.vcxproj.filters
- @@ -36,6 +36,9 @@
- <ClCompile Include="..\..\daemon\ea.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- + <ClCompile Include="..\..\daemon\fileinfoutil.c">
- + <Filter>Source Files</Filter>
- + </ClCompile>
- <ClCompile Include="..\..\daemon\getattr.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- diff --git a/daemon/fileinfoutil.c b/daemon/fileinfoutil.c
- new file mode 100644
- index 0000000..24d547b
- --- /dev/null
- +++ b/daemon/fileinfoutil.c
- @@ -0,0 +1,197 @@
- +/* NFSv4.1 client for Windows
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + * Copyright (C) 2023-2024 Roland Mainz <roland.mainz@nrubsig.org>
- + *
- + * Olga Kornievskaia <aglo@umich.edu>
- + * Casey Bodley <cbodley@umich.edu>
- + * Roland Mainz <roland.mainz@nrubsig.org>
- + *
- + * This library is free software; you can redistribute it and/or modify it
- + * under the terms of the GNU Lesser General Public License as published by
- + * the Free Software Foundation; either version 2.1 of the License, or (at
- + * your option) any later version.
- + *
- + * This library is distributed in the hope that it will be useful, but
- + * without any warranty; without even the implied warranty of merchantability
- + * or fitness for a particular purpose. See the GNU Lesser General Public
- + * License for more details.
- + *
- + * You should have received a copy of the GNU Lesser General Public License
- + * along with this library; if not, write to the Free Software Foundation,
- + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- + */
- +
- +#include <Windows.h>
- +#include <strsafe.h>
- +#include <stdio.h>
- +#include <stdlib.h>
- +
- +#include "daemon_debug.h"
- +#include "util.h"
- +#include "nfs41_ops.h"
- +
- +
- +ULONG nfs_file_info_to_attributes(
- + IN const nfs41_file_info *info)
- +{
- + ULONG attrs = 0;
- +
- + if (info->type == NF4DIR)
- + attrs |= FILE_ATTRIBUTE_DIRECTORY;
- + else if (info->type == NF4LNK) {
- + attrs |= FILE_ATTRIBUTE_REPARSE_POINT;
- + if (info->symlink_dir)
- + attrs |= FILE_ATTRIBUTE_DIRECTORY;
- + }
- + else if (info->type != NF4REG) {
- + DPRINTF(1,
- + ("nfs_file_info_to_attributes: "
- + "unhandled file type %d, defaulting to NF4REG\n",
- + info->type));
- + }
- +
- + EASSERT((info->attrmask.count > 0) &&
- + (info->attrmask.arr[1] & FATTR4_WORD1_MODE));
- + if (info->mode == 0444) /* XXX: 0444 for READONLY */
- + attrs |= FILE_ATTRIBUTE_READONLY;
- +
- + if (info->hidden)
- + attrs |= FILE_ATTRIBUTE_HIDDEN;
- + if (info->system)
- + attrs |= FILE_ATTRIBUTE_SYSTEM;
- + if (info->archive)
- + attrs |= FILE_ATTRIBUTE_ARCHIVE;
- +
- + /*
- + * |FILE_ATTRIBUTE_NORMAL| attribute is only set if no other
- + * attributes are present.
- + * all other override this value.
- + */
- + return attrs ? attrs : FILE_ATTRIBUTE_NORMAL;
- +}
- +
- +void nfs_to_basic_info(
- + IN const char *name,
- + IN const nfs41_file_info *info,
- + OUT PFILE_BASIC_INFO basic_out)
- +{
- + EASSERT(info->attrmask.count > 0);
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
- + nfs_time_to_file_time(&info->time_create, &basic_out->CreationTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_basic_info(name='%s'): "
- + "time_create not set\n", name));
- + basic_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
- + nfs_time_to_file_time(&info->time_access, &basic_out->LastAccessTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_basic_info(name='%s'): "
- + "time_access not set\n", name));
- + basic_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- + nfs_time_to_file_time(&info->time_modify, &basic_out->LastWriteTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_basic_info(name='%s'): "
- + "time_modify not set\n", name));
- + basic_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + /* XXX: was using 'change' attr, but that wasn't giving a time */
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- + nfs_time_to_file_time(&info->time_modify, &basic_out->ChangeTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_basic_info(name='%s'): "
- + "time_modify2 not set\n", name));
- + basic_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + basic_out->FileAttributes = nfs_file_info_to_attributes(info);
- +}
- +
- +void nfs_to_standard_info(
- + IN const nfs41_file_info *info,
- + OUT PFILE_STANDARD_INFO std_out)
- +{
- + const ULONG FileAttributes = nfs_file_info_to_attributes(info);
- +
- + EASSERT(info->attrmask.arr[0] & FATTR4_WORD0_SIZE);
- + EASSERT((info->attrmask.count > 0) &&
- + (info->attrmask.arr[1] & FATTR4_WORD1_NUMLINKS));
- +
- + std_out->AllocationSize.QuadPart =
- + std_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + std_out->NumberOfLinks = info->numlinks;
- + std_out->DeletePending = FALSE;
- + std_out->Directory = FileAttributes & FILE_ATTRIBUTE_DIRECTORY ?
- + TRUE : FALSE;
- +}
- +
- +void nfs_to_network_openinfo(
- + IN const char *name,
- + IN const nfs41_file_info *info,
- + OUT PFILE_NETWORK_OPEN_INFORMATION net_out)
- +{
- + EASSERT(info->attrmask.count > 0);
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
- + nfs_time_to_file_time(&info->time_create, &net_out->CreationTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_network_openinfo(name='%s'): "
- + "time_create not set\n", name));
- + net_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
- + nfs_time_to_file_time(&info->time_access, &net_out->LastAccessTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_network_openinfo(name='%s'): "
- + "time_access not set\n", name));
- + net_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- + nfs_time_to_file_time(&info->time_modify, &net_out->LastWriteTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_network_openinfo(name='%s'): "
- + "time_modify not set\n", name));
- + net_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + /* XXX: was using 'change' attr, but that wasn't giving a time */
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- + nfs_time_to_file_time(&info->time_modify, &net_out->ChangeTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_network_openinfo(name='%s'): "
- + "time_modify2 not set\n", name));
- + net_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + net_out->AllocationSize.QuadPart =
- + net_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- + net_out->FileAttributes = nfs_file_info_to_attributes(info);
- +}
- +
- +/* copy |nfs41_file_info| */
- +void nfs41_file_info_cpy(
- + OUT nfs41_file_info *dest,
- + IN const nfs41_file_info *src)
- +{
- + (void)memcpy(dest, src, sizeof(nfs41_file_info));
- + if (src->owner != NULL)
- + dest->owner = dest->owner_buf;
- + if (src->owner_group != NULL)
- + dest->owner_group = dest->owner_group_buf;
- +}
- diff --git a/daemon/util.c b/daemon/util.c
- index 399fb95..ef41a30 100644
- --- a/daemon/util.c
- +++ b/daemon/util.c
- @@ -142,162 +142,6 @@ bool_t verify_commit(
- return 0;
- }
- -ULONG nfs_file_info_to_attributes(
- - IN const nfs41_file_info *info)
- -{
- - ULONG attrs = 0;
- - if (info->type == NF4DIR)
- - attrs |= FILE_ATTRIBUTE_DIRECTORY;
- - else if (info->type == NF4LNK) {
- - attrs |= FILE_ATTRIBUTE_REPARSE_POINT;
- - if (info->symlink_dir)
- - attrs |= FILE_ATTRIBUTE_DIRECTORY;
- - }
- - else if (info->type != NF4REG) {
- - DPRINTF(1, ("unhandled file type %d, defaulting to NF4REG\n",
- - info->type));
- - }
- -
- - EASSERT((info->attrmask.count > 0) &&
- - (info->attrmask.arr[1] & FATTR4_WORD1_MODE));
- - if (info->mode == 0444) /* XXX: 0444 for READONLY */
- - attrs |= FILE_ATTRIBUTE_READONLY;
- -
- - if (info->hidden) attrs |= FILE_ATTRIBUTE_HIDDEN;
- - if (info->system) attrs |= FILE_ATTRIBUTE_SYSTEM;
- - if (info->archive) attrs |= FILE_ATTRIBUTE_ARCHIVE;
- -
- - // FILE_ATTRIBUTE_NORMAL attribute is only set if no other attributes are present.
- - // all other override this value.
- - return attrs ? attrs : FILE_ATTRIBUTE_NORMAL;
- -}
- -
- -void nfs_to_basic_info(
- - IN const char *name,
- - IN const nfs41_file_info *info,
- - OUT PFILE_BASIC_INFO basic_out)
- -{
- - EASSERT(info->attrmask.count > 0);
- -
- - if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
- - nfs_time_to_file_time(&info->time_create, &basic_out->CreationTime);
- - }
- - else {
- - DPRINTF(1, ("nfs_to_basic_info(name='%s'): "
- - "time_create not set\n", name));
- - basic_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- - }
- -
- - if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
- - nfs_time_to_file_time(&info->time_access, &basic_out->LastAccessTime);
- - }
- - else {
- - DPRINTF(1, ("nfs_to_basic_info(name='%s'): "
- - "time_access not set\n", name));
- - basic_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- - }
- -
- - if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- - nfs_time_to_file_time(&info->time_modify, &basic_out->LastWriteTime);
- - }
- - else {
- - DPRINTF(1, ("nfs_to_basic_info(name='%s'): "
- - "time_modify not set\n", name));
- - basic_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- - }
- -
- - /* XXX: was using 'change' attr, but that wasn't giving a time */
- - if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- - nfs_time_to_file_time(&info->time_modify, &basic_out->ChangeTime);
- - }
- - else {
- - DPRINTF(1, ("nfs_to_basic_info(name='%s'): "
- - "time_modify2 not set\n", name));
- - basic_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- - }
- -
- - basic_out->FileAttributes = nfs_file_info_to_attributes(info);
- -}
- -
- -void nfs_to_standard_info(
- - IN const nfs41_file_info *info,
- - OUT PFILE_STANDARD_INFO std_out)
- -{
- - const ULONG FileAttributes = nfs_file_info_to_attributes(info);
- -
- - EASSERT(info->attrmask.arr[0] & FATTR4_WORD0_SIZE);
- - EASSERT((info->attrmask.count > 0) &&
- - (info->attrmask.arr[1] & FATTR4_WORD1_NUMLINKS));
- -
- - std_out->AllocationSize.QuadPart =
- - std_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- - std_out->NumberOfLinks = info->numlinks;
- - std_out->DeletePending = FALSE;
- - std_out->Directory = FileAttributes & FILE_ATTRIBUTE_DIRECTORY ?
- - TRUE : FALSE;
- -}
- -
- -void nfs_to_network_openinfo(
- - IN const char *name,
- - IN const nfs41_file_info *info,
- - OUT PFILE_NETWORK_OPEN_INFORMATION net_out)
- -{
- - EASSERT(info->attrmask.count > 0);
- -
- - if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
- - nfs_time_to_file_time(&info->time_create, &net_out->CreationTime);
- - }
- - else {
- - DPRINTF(1, ("nfs_to_network_openinfo(name='%s'): "
- - "time_create not set\n", name));
- - net_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- - }
- -
- - if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
- - nfs_time_to_file_time(&info->time_access, &net_out->LastAccessTime);
- - }
- - else {
- - DPRINTF(1, ("nfs_to_network_openinfo(name='%s'): "
- - "time_access not set\n", name));
- - net_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- - }
- -
- - if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- - nfs_time_to_file_time(&info->time_modify, &net_out->LastWriteTime);
- - }
- - else {
- - DPRINTF(1, ("nfs_to_network_openinfo(name='%s'): "
- - "time_modify not set\n", name));
- - net_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- - }
- -
- - /* XXX: was using 'change' attr, but that wasn't giving a time */
- - if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- - nfs_time_to_file_time(&info->time_modify, &net_out->ChangeTime);
- - }
- - else {
- - DPRINTF(1, ("nfs_to_network_openinfo(name='%s'): "
- - "time_modify2 not set\n", name));
- - net_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- - }
- -
- - net_out->AllocationSize.QuadPart =
- - net_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- - net_out->FileAttributes = nfs_file_info_to_attributes(info);
- -}
- -
- -/* copy |nfs41_file_info| */
- -void nfs41_file_info_cpy(
- - OUT nfs41_file_info *dest,
- - IN const nfs41_file_info *src)
- -{
- - (void)memcpy(dest, src, sizeof(nfs41_file_info));
- - if (src->owner != NULL)
- - dest->owner = dest->owner_buf;
- - if (src->owner_group != NULL)
- - dest->owner_group = dest->owner_group_buf;
- -}
- -
- void get_file_time(
- OUT PLARGE_INTEGER file_time)
- {
- --
- 2.45.1
- From 9ca1d4cddd88b71a7a731ade31ead8ce4afcd56b Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 30 Oct 2024 13:07:06 +0100
- Subject: [PATCH 2/3] sys: Add new Win10 file/fs info classes to debug
- functions
- Update |print_file_information_class()| and |print_fs_information_class()|
- to include new Windows 10 SDK file/fs info classes.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- sys/nfs41sys_debug.c | 169 ++++++++++++++++++++++++-------------------
- 1 file changed, 95 insertions(+), 74 deletions(-)
- diff --git a/sys/nfs41sys_debug.c b/sys/nfs41sys_debug.c
- index d19a1f2..e6b22e6 100644
- --- a/sys/nfs41sys_debug.c
- +++ b/sys/nfs41sys_debug.c
- @@ -528,88 +528,109 @@ void print_nt_create_params(int on, NT_CREATE_PARAMETERS params)
- (params.DesiredAccess & SYNCHRONIZE)?"SYNCHRONIZE":"");
- }
- -const char *print_file_information_class(int InfoClass)
- +const char *print_file_information_class(int fic)
- {
- - switch(InfoClass) {
- - case FileBothDirectoryInformation:
- - return "FileBothDirectoryInformation";
- - case FileDirectoryInformation:
- - return "FileDirectoryInformation";
- - case FileFullDirectoryInformation:
- - return "FileFullDirectoryInformation";
- - case FileIdBothDirectoryInformation:
- - return "FileIdBothDirectoryInformation";
- - case FileIdFullDirectoryInformation:
- - return "FileIdFullDirectoryInformation";
- - case FileNamesInformation:
- - return "FileNamesInformation";
- - case FileObjectIdInformation:
- - return "FileObjectIdInformation";
- - case FileQuotaInformation:
- - return "FileQuotaInformation";
- - case FileReparsePointInformation:
- - return "FileReparsePointInformation";
- - case FileAllInformation:
- - return "FileAllInformation";
- - case FileAttributeTagInformation:
- - return "FileAttributeTagInformation";
- - case FileBasicInformation:
- - return "FileBasicInformation";
- - case FileCompressionInformation:
- - return "FileCompressionInformation";
- - case FileEaInformation:
- - return "FileEaInformation";
- - case FileInternalInformation:
- - return "FileInternalInformation";
- - case FileNameInformation:
- - return "FileNameInformation";
- - case FileNetworkOpenInformation:
- - return "FileNetworkOpenInformation";
- - case FilePositionInformation:
- - return "FilePositionInformation";
- - case FileStandardInformation:
- - return "FileStandardInformation";
- - case FileStreamInformation:
- - return "FileStreamInformation";
- - case FileAllocationInformation:
- - return "FileAllocationInformation";
- - case FileDispositionInformation:
- - return "FileDispositionInformation";
- - case FileEndOfFileInformation:
- - return "FileEndOfFileInformation";
- - case FileLinkInformation:
- - return "FileLinkInformation";
- - case FileRenameInformation:
- - return "FileRenameInformation";
- - case FileValidDataLengthInformation:
- - return "FileValidDataLengthInformation";
- - default:
- - return "UNKNOWN_InfoClass";
- + switch(fic) {
- +#define FIC_TO_STRLITERAL(e) case e: return #e;
- + FIC_TO_STRLITERAL(FileDirectoryInformation)
- + FIC_TO_STRLITERAL(FileFullDirectoryInformation)
- + FIC_TO_STRLITERAL(FileBothDirectoryInformation)
- + FIC_TO_STRLITERAL(FileBasicInformation)
- + FIC_TO_STRLITERAL(FileStandardInformation)
- + FIC_TO_STRLITERAL(FileInternalInformation)
- + FIC_TO_STRLITERAL(FileEaInformation)
- + FIC_TO_STRLITERAL(FileAccessInformation)
- + FIC_TO_STRLITERAL(FileNameInformation)
- + FIC_TO_STRLITERAL(FileRenameInformation)
- + FIC_TO_STRLITERAL(FileLinkInformation)
- + FIC_TO_STRLITERAL(FileNamesInformation)
- + FIC_TO_STRLITERAL(FileDispositionInformation)
- + FIC_TO_STRLITERAL(FilePositionInformation)
- + FIC_TO_STRLITERAL(FileFullEaInformation)
- + FIC_TO_STRLITERAL(FileModeInformation)
- + FIC_TO_STRLITERAL(FileAlignmentInformation)
- + FIC_TO_STRLITERAL(FileAllInformation)
- + FIC_TO_STRLITERAL(FileAllocationInformation)
- + FIC_TO_STRLITERAL(FileEndOfFileInformation)
- + FIC_TO_STRLITERAL(FileAlternateNameInformation)
- + FIC_TO_STRLITERAL(FileStreamInformation)
- + FIC_TO_STRLITERAL(FilePipeInformation)
- + FIC_TO_STRLITERAL(FilePipeLocalInformation)
- + FIC_TO_STRLITERAL(FilePipeRemoteInformation)
- + FIC_TO_STRLITERAL(FileMailslotQueryInformation)
- + FIC_TO_STRLITERAL(FileMailslotSetInformation)
- + FIC_TO_STRLITERAL(FileCompressionInformation)
- + FIC_TO_STRLITERAL(FileObjectIdInformation)
- + FIC_TO_STRLITERAL(FileCompletionInformation)
- + FIC_TO_STRLITERAL(FileMoveClusterInformation)
- + FIC_TO_STRLITERAL(FileQuotaInformation)
- + FIC_TO_STRLITERAL(FileReparsePointInformation)
- + FIC_TO_STRLITERAL(FileNetworkOpenInformation)
- + FIC_TO_STRLITERAL(FileAttributeTagInformation)
- + FIC_TO_STRLITERAL(FileTrackingInformation)
- + FIC_TO_STRLITERAL(FileIdBothDirectoryInformation)
- + FIC_TO_STRLITERAL(FileIdFullDirectoryInformation)
- + FIC_TO_STRLITERAL(FileValidDataLengthInformation)
- + FIC_TO_STRLITERAL(FileShortNameInformation)
- + FIC_TO_STRLITERAL(FileIoCompletionNotificationInformation)
- + FIC_TO_STRLITERAL(FileIoStatusBlockRangeInformation)
- + FIC_TO_STRLITERAL(FileIoPriorityHintInformation)
- + FIC_TO_STRLITERAL(FileSfioReserveInformation)
- + FIC_TO_STRLITERAL(FileSfioVolumeInformation)
- + FIC_TO_STRLITERAL(FileHardLinkInformation)
- + FIC_TO_STRLITERAL(FileProcessIdsUsingFileInformation)
- + FIC_TO_STRLITERAL(FileNormalizedNameInformation)
- + FIC_TO_STRLITERAL(FileNetworkPhysicalNameInformation)
- + FIC_TO_STRLITERAL(FileIdGlobalTxDirectoryInformation)
- + FIC_TO_STRLITERAL(FileIsRemoteDeviceInformation)
- + FIC_TO_STRLITERAL(FileUnusedInformation)
- + FIC_TO_STRLITERAL(FileNumaNodeInformation)
- + FIC_TO_STRLITERAL(FileStandardLinkInformation)
- + FIC_TO_STRLITERAL(FileRemoteProtocolInformation)
- + FIC_TO_STRLITERAL(FileRenameInformationBypassAccessCheck)
- + FIC_TO_STRLITERAL(FileLinkInformationBypassAccessCheck)
- + FIC_TO_STRLITERAL(FileVolumeNameInformation)
- + FIC_TO_STRLITERAL(FileIdInformation)
- + FIC_TO_STRLITERAL(FileIdExtdDirectoryInformation)
- + FIC_TO_STRLITERAL(FileReplaceCompletionInformation)
- + FIC_TO_STRLITERAL(FileHardLinkFullIdInformation)
- + FIC_TO_STRLITERAL(FileIdExtdBothDirectoryInformation)
- + FIC_TO_STRLITERAL(FileDispositionInformationEx)
- + FIC_TO_STRLITERAL(FileRenameInformationEx)
- + FIC_TO_STRLITERAL(FileRenameInformationExBypassAccessCheck)
- + FIC_TO_STRLITERAL(FileDesiredStorageClassInformation)
- + FIC_TO_STRLITERAL(FileStatInformation)
- + FIC_TO_STRLITERAL(FileMemoryPartitionInformation)
- + FIC_TO_STRLITERAL(FileStatLxInformation)
- + FIC_TO_STRLITERAL(FileCaseSensitiveInformation)
- + FIC_TO_STRLITERAL(FileLinkInformationEx)
- + FIC_TO_STRLITERAL(FileLinkInformationExBypassAccessCheck)
- + FIC_TO_STRLITERAL(FileStorageReserveIdInformation)
- + FIC_TO_STRLITERAL(FileCaseSensitiveInformationForceAccessCheck)
- }
- + return "<unknown FILE_INFORMATION_CLASS>";
- }
- const char *print_fs_information_class(int InfoClass)
- {
- +#define FSIC_TO_STRLITERAL(e) case e: return #e;
- switch (InfoClass) {
- - case FileFsAttributeInformation:
- - return "FileFsAttributeInformation";
- - case FileFsControlInformation:
- - return "FileFsControlInformation";
- - case FileFsDeviceInformation:
- - return "FileFsDeviceInformation";
- - case FileFsDriverPathInformation:
- - return "FileFsDriverPathInformation";
- - case FileFsFullSizeInformation:
- - return "FileFsFullSizeInformation";
- - case FileFsObjectIdInformation:
- - return "FileFsObjectIdInformation";
- - case FileFsSizeInformation:
- - return "FileFsSizeInformation";
- - case FileFsVolumeInformation:
- - return "FileFsVolumeInformation";
- - default:
- - return "UNKNOWN_FsInfoClass";
- + FSIC_TO_STRLITERAL(FileFsVolumeInformation)
- + FSIC_TO_STRLITERAL(FileFsLabelInformation)
- + FSIC_TO_STRLITERAL(FileFsSizeInformation)
- + FSIC_TO_STRLITERAL(FileFsDeviceInformation)
- + FSIC_TO_STRLITERAL(FileFsAttributeInformation)
- + FSIC_TO_STRLITERAL(FileFsControlInformation)
- + FSIC_TO_STRLITERAL(FileFsFullSizeInformation)
- + FSIC_TO_STRLITERAL(FileFsObjectIdInformation)
- + FSIC_TO_STRLITERAL(FileFsDriverPathInformation)
- + FSIC_TO_STRLITERAL(FileFsVolumeFlagsInformation)
- + FSIC_TO_STRLITERAL(FileFsSectorSizeInformation)
- + FSIC_TO_STRLITERAL(FileFsDataCopyInformation)
- + FSIC_TO_STRLITERAL(FileFsMetadataSizeInformation)
- + FSIC_TO_STRLITERAL(FileFsFullSizeInformationEx)
- }
- + return "<unknown FS_INFORMATION_CLASS>";
- }
- void print_caching_level(int on, ULONG flag, PUNICODE_STRING name)
- --
- 2.45.1
- From a999a662190dbb7fe14979c7b93ed5a036619758 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Wed, 30 Oct 2024 15:20:23 +0100
- Subject: [PATCH 3/3] cygwin,daemon,include,nfs41_build_features.h,sys: WSL:
- Add |FileStatInformation|+|FileStatLxInformation|
- Add WSL support by implementing the |FileStatInformation|
- and |FileStatLxInformation| queryinfo classes.
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/README.bintarball.txt | 40 ++++
- daemon/fileinfoutil.c | 258 ++++++++++++++++++++
- daemon/getattr.c | 25 ++
- daemon/nfs41_const.h | 14 ++
- daemon/upcall.h | 6 +-
- daemon/util.h | 12 +
- include/from_kernel.h | 442 ++++++++++++++++++++---------------
- nfs41_build_features.h | 5 +
- sys/nfs41sys_fileinfo.c | 8 +
- 9 files changed, 617 insertions(+), 193 deletions(-)
- diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
- index 2613d29..1d24dec 100644
- --- a/cygwin/README.bintarball.txt
- +++ b/cygwin/README.bintarball.txt
- @@ -49,6 +49,11 @@ NFSv4.1 filesystem driver for Windows 10/11&Windows Server 2019
- - Cygwin bash+ksh93 support UNC paths, e.g.
- cd //derfwnb4966@2049/nfs4/bigdisk/mysqldb4/
- +- WSL support
- + - Mount Windows NFSv4.1 shares via driver letter or UNC path
- + in WSL via mount -t drvfs
- + - Supports NFS owner/group to WSL uid/gid mapping
- +
- - IPv6 support
- - IPv6 address within '[', ']'
- (will be converted to *.ipv6-literal.net)
- @@ -311,6 +316,41 @@ BUG: Note that "ms-nfs41-client-globalmountall-service" currently
- does not wait until nfsd*.exe is available for accepting mounts.
- +# WSL usage:
- +Example 1: Mount Windows NFSv4.1 share via Windows driver letter
- +# Mount NFSv4.1 share in Windows to driver letter 'N':
- +---- snip ----
- +$ /sbin/nfs_mount -o rw 'N' nfs://10.49.202.230//bigdisk
- +Successfully mounted '10.49.202.230@2049' to drive 'N:'
- +---- snip ----
- +
- +# Within WSL mount driver letter 'N' to /mnt/n
- +---- snip ----
- +$ sudo bash
- +$ mkdir /mnt/n
- +$ mount -t drvfs N: /mnt/n
- +---- snip ----
- +
- +Example 2: Mount Windows NFSv4.1 share via UNC path:
- +# Mount NFSv4.1 share in Windows
- +---- snip ----
- +$ /sbin/nfs_mount -o rw nfs://10.49.202.230//bigdisk
- +Successfully mounted '10.49.202.230@2049' to drive '\0.49.202.230@2049\nfs4\bigdisk'
- +---- snip ----
- +
- +# Within WSL mount UNC path returned by /sbin/nfs_mount
- +---- snip ----
- +$ sudo bash
- +$ mkdir /mnt/bigdisk
- +$ mount -t drvfs '\0.49.202.230@2049\nfs4\bigdisk' /mnt/bigdisk
- +---- snip ----
- +
- +* Known issues with WSL:
- +- Softlinks do not work yet
- +- Creating a hard link returns "Invalid Argument", maybe drvfs
- + limitation
- +- Not all POSIX file types (e.g. block devices) etc. are supported
- +
- #
- # 9. Notes:
- #
- diff --git a/daemon/fileinfoutil.c b/daemon/fileinfoutil.c
- index 24d547b..29f9b4d 100644
- --- a/daemon/fileinfoutil.c
- +++ b/daemon/fileinfoutil.c
- @@ -26,7 +26,9 @@
- #include <stdio.h>
- #include <stdlib.h>
- +#include "nfs41_build_features.h"
- #include "daemon_debug.h"
- +#include "nfs41_daemon.h"
- #include "util.h"
- #include "nfs41_ops.h"
- @@ -184,6 +186,262 @@ void nfs_to_network_openinfo(
- net_out->FileAttributes = nfs_file_info_to_attributes(info);
- }
- +#ifdef NFS41_DRIVER_WSL_SUPPORT
- +void nfs_to_stat_info(
- + IN const char *name,
- + IN const nfs41_file_info *info,
- + OUT PFILE_STAT_INFORMATION stat_out)
- +{
- + EASSERT(info->attrmask.count > 0);
- +
- + stat_out->FileId.QuadPart = info->fileid;
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
- + nfs_time_to_file_time(&info->time_create, &stat_out->CreationTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_stat_info(name='%s'): "
- + "time_create not set\n", name));
- + stat_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
- + nfs_time_to_file_time(&info->time_access, &stat_out->LastAccessTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_stat_info(name='%s'): "
- + "time_access not set\n", name));
- + stat_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- + nfs_time_to_file_time(&info->time_modify, &stat_out->LastWriteTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_stat_info(name='%s'): "
- + "time_modify not set\n", name));
- + stat_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + /* XXX: was using 'change' attr, but that wasn't giving a time */
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- + nfs_time_to_file_time(&info->time_modify, &stat_out->ChangeTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_stat_info(name='%s'): "
- + "time_modify2 not set\n", name));
- + stat_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + stat_out->AllocationSize.QuadPart =
- + stat_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- +
- + stat_out->FileAttributes = nfs_file_info_to_attributes(info);
- +
- + stat_out->ReparseTag = (info->type == NF4LNK)?
- + IO_REPARSE_TAG_SYMLINK : 0;
- +
- + stat_out->NumberOfLinks = info->numlinks;
- + stat_out->EffectiveAccess =
- + GENERIC_EXECUTE|GENERIC_WRITE|GENERIC_READ; /* FIXME */
- +}
- +
- +void nfs_to_stat_lx_info(
- + IN void *daemon_context,
- + IN const char *name,
- + IN const nfs41_file_info *info,
- + OUT PFILE_STAT_LX_INFORMATION stat_lx_out)
- +{
- + nfs41_daemon_globals *nfs41_dg =
- + (nfs41_daemon_globals *)daemon_context;
- +
- + EASSERT(info->attrmask.count > 0);
- +
- + stat_lx_out->FileId.QuadPart = info->fileid;
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_CREATE) {
- + nfs_time_to_file_time(&info->time_create,
- + &stat_lx_out->CreationTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_stat_lx_info(name='%s'): "
- + "time_create not set\n", name));
- + stat_lx_out->CreationTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_ACCESS) {
- + nfs_time_to_file_time(&info->time_access,
- + &stat_lx_out->LastAccessTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_stat_lx_info(name='%s'): "
- + "time_access not set\n", name));
- + stat_lx_out->LastAccessTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- + nfs_time_to_file_time(&info->time_modify,
- + &stat_lx_out->LastWriteTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_stat_lx_info(name='%s'): "
- + "time_modify not set\n", name));
- + stat_lx_out->LastWriteTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + /* XXX: was using 'change' attr, but that wasn't giving a time */
- + if (info->attrmask.arr[1] & FATTR4_WORD1_TIME_MODIFY) {
- + nfs_time_to_file_time(&info->time_modify, &stat_lx_out->ChangeTime);
- + }
- + else {
- + DPRINTF(1, ("nfs_to_stat_lx_info(name='%s'): "
- + "time_modify2 not set\n", name));
- + stat_lx_out->ChangeTime.QuadPart = FILE_INFO_TIME_NOT_SET;
- + }
- +
- + stat_lx_out->AllocationSize.QuadPart =
- + stat_lx_out->EndOfFile.QuadPart = (LONGLONG)info->size;
- +
- + stat_lx_out->FileAttributes = nfs_file_info_to_attributes(info);
- +
- + stat_lx_out->ReparseTag = (info->type == NF4LNK)?
- + IO_REPARSE_TAG_SYMLINK : 0;
- +
- + stat_lx_out->NumberOfLinks = info->numlinks;
- + stat_lx_out->EffectiveAccess =
- + GENERIC_EXECUTE|GENERIC_WRITE|GENERIC_READ; /* FIXME */
- +
- + stat_lx_out->LxFlags = 0UL;
- +
- + if (!info->case_insensitive) {
- + stat_lx_out->LxFlags |= LX_FILE_CASE_SENSITIVE_DIR;
- + }
- +
- + stat_lx_out->LxFlags |= LX_FILE_METADATA_HAS_MODE;
- +
- + stat_lx_out->LxMode = 0UL;
- + switch(info->type) {
- + case NF4REG:
- + stat_lx_out->LxMode |= LX_MODE_S_IFREG;
- + break;
- + case NF4DIR:
- + stat_lx_out->LxMode |= LX_MODE_S_IFDIR;
- + break;
- + case NF4BLK:
- + /* Map block dev to WSL char dev */
- + stat_lx_out->LxMode |= LX_MODE_S_IFCHR;
- + break;
- + case NF4CHR:
- + stat_lx_out->LxMode |= LX_MODE_S_IFCHR;
- + break;
- + case NF4LNK:
- + /*
- + * gisburn: Is this really correct to do nothing here,
- + * or is |stat_lx_out->ReparseTag| enough ?
- + */
- + if (info->symlink_dir)
- + stat_lx_out->LxMode |= LX_MODE_S_IFDIR;
- + break;
- + case NF4SOCK:
- + /* Map socket dev to WSL char dev */
- + stat_lx_out->LxMode |= LX_MODE_S_IFCHR;
- + break;
- + case NF4FIFO:
- + stat_lx_out->LxMode |= LX_MODE_S_IFIFO;
- + break;
- + default:
- + DPRINTF(0,
- + ("nfs_to_stat_lx_info: "
- + "unhandled file type %d, defaulting to NF4REG\n",
- + info->type));
- + stat_lx_out->LxMode |= LX_MODE_S_IFREG;
- + break;
- + }
- +
- + EASSERT((info->attrmask.count > 0) &&
- + (info->attrmask.arr[1] & FATTR4_WORD1_MODE));
- + if (info->mode & MODE4_RUSR)
- + stat_lx_out->LxMode |= LX_MODE_S_IREAD;
- + if (info->mode & MODE4_WUSR)
- + stat_lx_out->LxMode |= LX_MODE_S_IWRITE;
- + if (info->mode & MODE4_XUSR)
- + stat_lx_out->LxMode |= LX_MODE_S_IEXEC;
- +
- + char owner[NFS4_FATTR4_OWNER_LIMIT+1];
- + char owner_group[NFS4_FATTR4_OWNER_LIMIT+1];
- + uid_t map_uid = ~0UL;
- + gid_t map_gid = ~0UL;
- + char *at_ch; /* pointer to '@' */
- +
- + EASSERT((info->attrmask.arr[1] & FATTR4_WORD1_OWNER) != 0);
- + EASSERT((info->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) != 0);
- +
- + /* Make copies as we will modify them */
- + (void)strcpy(owner, info->owner);
- + (void)strcpy(owner_group, info->owner_group);
- +
- + /*
- + * Map owner to local uid
- + *
- + * |owner| can be numeric string ("1616"), plain username
- + * ("gisburn") or username@domain ("gisburn@sun.com")
- + */
- + /* stomp over '@' */
- + at_ch = strchr(owner, '@');
- + if (at_ch)
- + *at_ch = '\0';
- +
- + if (!nfs41_idmap_name_to_uid(
- + nfs41_dg->idmapper,
- + owner,
- + &map_uid)) {
- + stat_lx_out->LxFlags |= LX_FILE_METADATA_HAS_UID;
- + stat_lx_out->LxUid = map_uid;
- + }
- + else {
- + /*
- + * No mapping --> Use |NFS NFS_USER_NOBODY_UID| and set
- + * |LX_FILE_METADATA_HAS_UID|, because we have an user
- + * name, but just no name2uid mapping
- + */
- + stat_lx_out->LxFlags |= LX_FILE_METADATA_HAS_UID;
- + stat_lx_out->LxUid = NFS_USER_NOBODY_UID;
- + }
- +
- + /*
- + * Map owner_group to local gid
- + *
- + * |owner_group| can be numeric string ("1616"), plain username
- + * ("gisgrp") or username@domain ("gisgrp@sun.com")
- + */
- + /* stomp over '@' */
- + at_ch = strchr(owner_group, '@');
- + if (at_ch)
- + *at_ch = '\0';
- +
- + if (!nfs41_idmap_group_to_gid(
- + nfs41_dg->idmapper,
- + owner_group,
- + &map_gid)) {
- + stat_lx_out->LxFlags |= LX_FILE_METADATA_HAS_GID;
- + stat_lx_out->LxGid = map_gid;
- + }
- + else {
- + /*
- + * No mapping --> Use |NFS NFS_GROUP_NOGROUP_GID| and set
- + * |LX_FILE_METADATA_HAS_GID|, because we have a group
- + * name, but just no name2gid mapping
- + */
- + stat_lx_out->LxFlags |= LX_FILE_METADATA_HAS_GID;
- + stat_lx_out->LxUid = NFS_GROUP_NOGROUP_GID;
- + }
- +
- + /* FIXME: |LX_FILE_METADATA_HAS_DEVICE_ID| not implemented yet */
- + stat_lx_out->LxDeviceIdMajor = 0UL;
- + stat_lx_out->LxDeviceIdMinor = 0UL;
- +}
- +#endif /* NFS41_DRIVER_WSL_SUPPORT */
- +
- /* copy |nfs41_file_info| */
- void nfs41_file_info_cpy(
- OUT nfs41_file_info *dest,
- diff --git a/daemon/getattr.c b/daemon/getattr.c
- index 3d0dabf..642f84e 100644
- --- a/daemon/getattr.c
- +++ b/daemon/getattr.c
- @@ -187,6 +187,15 @@ static int handle_getattr(void *daemon_context, nfs41_upcall *upcall)
- case FileNetworkOpenInformation:
- nfs_to_network_openinfo(state->file.name.name, &info, &args->network_info);
- break;
- +#ifdef NFS41_DRIVER_WSL_SUPPORT
- + case FileStatInformation:
- + nfs_to_stat_info(state->file.name.name, &info, &args->stat_info);
- + break;
- + case FileStatLxInformation:
- + nfs_to_stat_lx_info(daemon_context,
- + state->file.name.name, &info, &args->stat_lx_info);
- + break;
- +#endif /* NFS41_DRIVER_WSL_SUPPORT */
- default:
- eprintf("unhandled file query class %d\n", args->query_class);
- status = ERROR_INVALID_PARAMETER;
- @@ -238,6 +247,22 @@ static int marshall_getattr(unsigned char *buffer, uint32_t *length, nfs41_upcal
- status = safe_write(&buffer, length, &args->network_info, info_len);
- if (status) goto out;
- break;
- +#ifdef NFS41_DRIVER_WSL_SUPPORT
- + case FileStatInformation:
- + info_len = sizeof(args->stat_info);
- + status = safe_write(&buffer, length, &info_len, sizeof(info_len));
- + if (status) goto out;
- + status = safe_write(&buffer, length, &args->stat_info, info_len);
- + if (status) goto out;
- + break;
- + case FileStatLxInformation:
- + info_len = sizeof(args->stat_lx_info);
- + status = safe_write(&buffer, length, &info_len, sizeof(info_len));
- + if (status) goto out;
- + status = safe_write(&buffer, length, &args->stat_lx_info, info_len);
- + if (status) goto out;
- + break;
- +#endif /* NFS41_DRIVER_WSL_SUPPORT */
- default:
- eprintf("unknown file query class %d\n", args->query_class);
- status = 103;
- diff --git a/daemon/nfs41_const.h b/daemon/nfs41_const.h
- index 8a0c259..0738241 100644
- --- a/daemon/nfs41_const.h
- +++ b/daemon/nfs41_const.h
- @@ -443,4 +443,18 @@ enum nfs_ftype4 {
- #define NFS_USER_NOBODY_UID 65534
- #define NFS_GROUP_NOGROUP_GID 65534
- +/* Mode bits */
- +#define MODE4_SUID 0x800 /* set user id on execution */
- +#define MODE4_SGID 0x400 /* set group id on execution */
- +#define MODE4_SVTX 0x200 /* save text even after use */
- +#define MODE4_RUSR 0x100 /* read permission: owner */
- +#define MODE4_WUSR 0x080 /* write permission: owner */
- +#define MODE4_XUSR 0x040 /* execute permission: owner */
- +#define MODE4_RGRP 0x020 /* read permission: group */
- +#define MODE4_WGRP 0x010 /* write permission: group */
- +#define MODE4_XGRP 0x008 /* execute permission: group */
- +#define MODE4_ROTH 0x004 /* read permission: other */
- +#define MODE4_WOTH 0x002 /* write permission: other */
- +#define MODE4_XOTH 0x001 /* execute permission: other */
- +
- #endif /* !__NFS41_NFS_CONST_H__ */
- diff --git a/daemon/upcall.h b/daemon/upcall.h
- index a01898a..deeac9e 100644
- --- a/daemon/upcall.h
- +++ b/daemon/upcall.h
- @@ -23,8 +23,8 @@
- #ifndef __NFS41_DAEMON_UPCALL_H__
- #define __NFS41_DAEMON_UPCALL_H__
- -#include "nfs41_ops.h"
- #include "nfs41_build_features.h"
- +#include "nfs41_ops.h"
- #include "from_kernel.h"
- #define NFSD_VERSION_MISMATCH 116
- @@ -100,6 +100,10 @@ typedef struct __getattr_upcall_args {
- FILE_ATTRIBUTE_TAG_INFO tag_info;
- FILE_INTERNAL_INFORMATION intr_info;
- FILE_NETWORK_OPEN_INFORMATION network_info;
- +#ifdef NFS41_DRIVER_WSL_SUPPORT
- + FILE_STAT_INFORMATION stat_info;
- + FILE_STAT_LX_INFORMATION stat_lx_info;
- +#endif /* NFS41_DRIVER_WSL_SUPPORT */
- int query_class;
- int buf_len;
- int query_reply_len;
- diff --git a/daemon/util.h b/daemon/util.h
- index 2b13d06..37d50a7 100644
- --- a/daemon/util.h
- +++ b/daemon/util.h
- @@ -26,6 +26,7 @@
- #include <stdlib.h>
- #include <stdbool.h>
- +#include "nfs41_build_features.h"
- #include "nfs41_types.h"
- #include "from_kernel.h"
- @@ -184,6 +185,17 @@ void nfs_to_network_openinfo(
- IN const char *name,
- IN const nfs41_file_info *info,
- OUT PFILE_NETWORK_OPEN_INFORMATION std_out);
- +#ifdef NFS41_DRIVER_WSL_SUPPORT
- +void nfs_to_stat_info(
- + IN const char *name,
- + IN const nfs41_file_info *info,
- + OUT PFILE_STAT_INFORMATION stat_out);
- +void nfs_to_stat_lx_info(
- + IN void *daemon_context,
- + IN const char *name,
- + IN const nfs41_file_info *info,
- + OUT PFILE_STAT_LX_INFORMATION stat_lx_out);
- +#endif /* NFS41_DRIVER_WSL_SUPPORT */
- void nfs41_file_info_cpy(
- OUT nfs41_file_info *dest,
- IN const nfs41_file_info *src);
- diff --git a/include/from_kernel.h b/include/from_kernel.h
- index b395112..b4ff4cc 100644
- --- a/include/from_kernel.h
- +++ b/include/from_kernel.h
- @@ -1,44 +1,44 @@
- -/* NFSv4.1 client for Windows
- - * Copyright (C) 2012 The Regents of the University of Michigan
- - *
- - * Olga Kornievskaia <aglo@umich.edu>
- - * Casey Bodley <cbodley@umich.edu>
- - *
- - * This library is free software; you can redistribute it and/or modify it
- - * under the terms of the GNU Lesser General Public License as published by
- - * the Free Software Foundation; either version 2.1 of the License, or (at
- - * your option) any later version.
- - *
- - * This library is distributed in the hope that it will be useful, but
- - * without any warranty; without even the implied warranty of merchantability
- - * or fitness for a particular purpose. See the GNU Lesser General Public
- - * License for more details.
- - *
- - * You should have received a copy of the GNU Lesser General Public License
- - * along with this library; if not, write to the Free Software Foundation,
- - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- - */
- -
- -#ifndef _NFS41_DAEMON_
- -#define _NFS41_DAEMON_
- -
- -#define FILE_DIRECTORY_FILE 0x00000001
- -#define FILE_WRITE_THROUGH 0x00000002
- -#define FILE_SEQUENTIAL_ONLY 0x00000004
- -#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
- -
- -#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
- -#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
- -#define FILE_NON_DIRECTORY_FILE 0x00000040
- -#define FILE_CREATE_TREE_CONNECTION 0x00000080
- -
- -#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
- -#define FILE_NO_EA_KNOWLEDGE 0x00000200
- -#define FILE_OPEN_REMOTE_INSTANCE 0x00000400
- -#define FILE_RANDOM_ACCESS 0x00000800
- -
- -#define FILE_DELETE_ON_CLOSE 0x00001000
- -#define FILE_OPEN_BY_FILE_ID 0x00002000
- +/* NFSv4.1 client for Windows
- + * Copyright (C) 2012 The Regents of the University of Michigan
- + *
- + * Olga Kornievskaia <aglo@umich.edu>
- + * Casey Bodley <cbodley@umich.edu>
- + *
- + * This library is free software; you can redistribute it and/or modify it
- + * under the terms of the GNU Lesser General Public License as published by
- + * the Free Software Foundation; either version 2.1 of the License, or (at
- + * your option) any later version.
- + *
- + * This library is distributed in the hope that it will be useful, but
- + * without any warranty; without even the implied warranty of merchantability
- + * or fitness for a particular purpose. See the GNU Lesser General Public
- + * License for more details.
- + *
- + * You should have received a copy of the GNU Lesser General Public License
- + * along with this library; if not, write to the Free Software Foundation,
- + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- + */
- +
- +#ifndef _NFS41_DAEMON_
- +#define _NFS41_DAEMON_
- +
- +#define FILE_DIRECTORY_FILE 0x00000001
- +#define FILE_WRITE_THROUGH 0x00000002
- +#define FILE_SEQUENTIAL_ONLY 0x00000004
- +#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
- +
- +#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
- +#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
- +#define FILE_NON_DIRECTORY_FILE 0x00000040
- +#define FILE_CREATE_TREE_CONNECTION 0x00000080
- +
- +#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
- +#define FILE_NO_EA_KNOWLEDGE 0x00000200
- +#define FILE_OPEN_REMOTE_INSTANCE 0x00000400
- +#define FILE_RANDOM_ACCESS 0x00000800
- +
- +#define FILE_DELETE_ON_CLOSE 0x00001000
- +#define FILE_OPEN_BY_FILE_ID 0x00002000
- #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
- #define FILE_NO_COMPRESSION 0x00008000
- @@ -49,17 +49,17 @@
- #define FILE_RESERVE_OPFILTER 0x00100000
- #define FILE_OPEN_REPARSE_POINT 0x00200000
- #define FILE_OPEN_NO_RECALL 0x00400000
- -#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
- -
- -#define FILE_COPY_STRUCTURED_STORAGE 0x00000041
- -#define FILE_STRUCTURED_STORAGE 0x00000441
- -
- -#define FILE_SUPERSEDE 0x00000000
- -#define FILE_OPEN 0x00000001
- -#define FILE_CREATE 0x00000002
- -#define FILE_OPEN_IF 0x00000003
- -#define FILE_OVERWRITE 0x00000004
- -#define FILE_OVERWRITE_IF 0x00000005
- +#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
- +
- +#define FILE_COPY_STRUCTURED_STORAGE 0x00000041
- +#define FILE_STRUCTURED_STORAGE 0x00000441
- +
- +#define FILE_SUPERSEDE 0x00000000
- +#define FILE_OPEN 0x00000001
- +#define FILE_CREATE 0x00000002
- +#define FILE_OPEN_IF 0x00000003
- +#define FILE_OVERWRITE 0x00000004
- +#define FILE_OVERWRITE_IF 0x00000005
- #define FILE_MAXIMUM_DISPOSITION 0x00000005
- typedef enum _FILE_INFORMATION_CLASS {
- @@ -142,109 +142,167 @@ typedef enum _FILE_INFORMATION_CLASS {
- FileMaximumInformation
- } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
- -
- -/* kernel structures for QueryDirectory results */
- -typedef struct _FILE_NAMES_INFORMATION {
- - ULONG NextEntryOffset;
- - ULONG FileIndex;
- - ULONG FileNameLength;
- - WCHAR FileName[1];
- -} FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
- -
- -typedef struct _FILE_DIRECTORY_INFO {
- - ULONG NextEntryOffset;
- - ULONG FileIndex;
- - LARGE_INTEGER CreationTime;
- - LARGE_INTEGER LastAccessTime;
- - LARGE_INTEGER LastWriteTime;
- - LARGE_INTEGER ChangeTime;
- - LARGE_INTEGER EndOfFile;
- - LARGE_INTEGER AllocationSize;
- - ULONG FileAttributes;
- - ULONG FileNameLength;
- - WCHAR FileName[1];
- -} FILE_DIRECTORY_INFO, *PFILE_DIRECTORY_INFO;
- -
- -typedef struct _FILE_BOTH_DIR_INFORMATION {
- - ULONG NextEntryOffset;
- - ULONG FileIndex;
- - LARGE_INTEGER CreationTime;
- - LARGE_INTEGER LastAccessTime;
- - LARGE_INTEGER LastWriteTime;
- - LARGE_INTEGER ChangeTime;
- - LARGE_INTEGER EndOfFile;
- - LARGE_INTEGER AllocationSize;
- - ULONG FileAttributes;
- - ULONG FileNameLength;
- - ULONG EaSize;
- - CCHAR ShortNameLength;
- - WCHAR ShortName[12];
- - WCHAR FileName[1];
- -} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
- -
- -#ifdef FIXME_OLD_DDK
- -typedef struct _FILE_FULL_DIR_INFO {
- - ULONG NextEntryOffset;
- - ULONG FileIndex;
- - LARGE_INTEGER CreationTime;
- - LARGE_INTEGER LastAccessTime;
- - LARGE_INTEGER LastWriteTime;
- - LARGE_INTEGER ChangeTime;
- - LARGE_INTEGER EndOfFile;
- - LARGE_INTEGER AllocationSize;
- - ULONG FileAttributes;
- - ULONG FileNameLength;
- - ULONG EaSize;
- - WCHAR FileName[1];
- -} FILE_FULL_DIR_INFO, *PFILE_FULL_DIR_INFO;
- -#endif /* FIXME_OLD_DDK */
- -
- -typedef struct _FILE_ID_FULL_DIR_INFO {
- - ULONG NextEntryOffset;
- - ULONG FileIndex;
- - LARGE_INTEGER CreationTime;
- - LARGE_INTEGER LastAccessTime;
- - LARGE_INTEGER LastWriteTime;
- - LARGE_INTEGER ChangeTime;
- - LARGE_INTEGER EndOfFile;
- - LARGE_INTEGER AllocationSize;
- - ULONG FileAttributes;
- - ULONG FileNameLength;
- - ULONG EaSize;
- - LARGE_INTEGER FileId;
- - WCHAR FileName[1];
- -} FILE_ID_FULL_DIR_INFO, *PFILE_ID_FULL_DIR_INFO;
- -
- -typedef struct _FILE_LINK_INFORMATION {
- - BOOLEAN ReplaceIfExists;
- - HANDLE RootDirectory;
- - ULONG FileNameLength;
- - WCHAR FileName[1];
- -} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
- -
- -typedef struct _FILE_FULL_EA_INFORMATION {
- - ULONG NextEntryOffset;
- - UCHAR Flags;
- - UCHAR EaNameLength;
- - USHORT EaValueLength;
- - CHAR EaName[1];
- -} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
- -
- -typedef struct _FILE_GET_EA_INFORMATION {
- - ULONG NextEntryOffset;
- - UCHAR EaNameLength;
- - CHAR EaName[1];
- -} FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION;
- -
- -typedef struct _FILE_NETWORK_OPEN_INFORMATION {
- - LARGE_INTEGER CreationTime;
- - LARGE_INTEGER LastAccessTime;
- - LARGE_INTEGER LastWriteTime;
- - LARGE_INTEGER ChangeTime;
- - LARGE_INTEGER AllocationSize;
- - LARGE_INTEGER EndOfFile;
- - ULONG FileAttributes;
- -} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
- +
- +/* kernel structures for QueryDirectory results */
- +typedef struct _FILE_NAMES_INFORMATION {
- + ULONG NextEntryOffset;
- + ULONG FileIndex;
- + ULONG FileNameLength;
- + WCHAR FileName[1];
- +} FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
- +
- +typedef struct _FILE_DIRECTORY_INFO {
- + ULONG NextEntryOffset;
- + ULONG FileIndex;
- + LARGE_INTEGER CreationTime;
- + LARGE_INTEGER LastAccessTime;
- + LARGE_INTEGER LastWriteTime;
- + LARGE_INTEGER ChangeTime;
- + LARGE_INTEGER EndOfFile;
- + LARGE_INTEGER AllocationSize;
- + ULONG FileAttributes;
- + ULONG FileNameLength;
- + WCHAR FileName[1];
- +} FILE_DIRECTORY_INFO, *PFILE_DIRECTORY_INFO;
- +
- +typedef struct _FILE_BOTH_DIR_INFORMATION {
- + ULONG NextEntryOffset;
- + ULONG FileIndex;
- + LARGE_INTEGER CreationTime;
- + LARGE_INTEGER LastAccessTime;
- + LARGE_INTEGER LastWriteTime;
- + LARGE_INTEGER ChangeTime;
- + LARGE_INTEGER EndOfFile;
- + LARGE_INTEGER AllocationSize;
- + ULONG FileAttributes;
- + ULONG FileNameLength;
- + ULONG EaSize;
- + CCHAR ShortNameLength;
- + WCHAR ShortName[12];
- + WCHAR FileName[1];
- +} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
- +
- +#ifdef FIXME_OLD_DDK
- +typedef struct _FILE_FULL_DIR_INFO {
- + ULONG NextEntryOffset;
- + ULONG FileIndex;
- + LARGE_INTEGER CreationTime;
- + LARGE_INTEGER LastAccessTime;
- + LARGE_INTEGER LastWriteTime;
- + LARGE_INTEGER ChangeTime;
- + LARGE_INTEGER EndOfFile;
- + LARGE_INTEGER AllocationSize;
- + ULONG FileAttributes;
- + ULONG FileNameLength;
- + ULONG EaSize;
- + WCHAR FileName[1];
- +} FILE_FULL_DIR_INFO, *PFILE_FULL_DIR_INFO;
- +#endif /* FIXME_OLD_DDK */
- +
- +typedef struct _FILE_ID_FULL_DIR_INFO {
- + ULONG NextEntryOffset;
- + ULONG FileIndex;
- + LARGE_INTEGER CreationTime;
- + LARGE_INTEGER LastAccessTime;
- + LARGE_INTEGER LastWriteTime;
- + LARGE_INTEGER ChangeTime;
- + LARGE_INTEGER EndOfFile;
- + LARGE_INTEGER AllocationSize;
- + ULONG FileAttributes;
- + ULONG FileNameLength;
- + ULONG EaSize;
- + LARGE_INTEGER FileId;
- + WCHAR FileName[1];
- +} FILE_ID_FULL_DIR_INFO, *PFILE_ID_FULL_DIR_INFO;
- +
- +typedef struct _FILE_LINK_INFORMATION {
- + BOOLEAN ReplaceIfExists;
- + HANDLE RootDirectory;
- + ULONG FileNameLength;
- + WCHAR FileName[1];
- +} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
- +
- +typedef struct _FILE_FULL_EA_INFORMATION {
- + ULONG NextEntryOffset;
- + UCHAR Flags;
- + UCHAR EaNameLength;
- + USHORT EaValueLength;
- + CHAR EaName[1];
- +} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
- +
- +typedef struct _FILE_GET_EA_INFORMATION {
- + ULONG NextEntryOffset;
- + UCHAR EaNameLength;
- + CHAR EaName[1];
- +} FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION;
- +
- +typedef struct _FILE_NETWORK_OPEN_INFORMATION {
- + LARGE_INTEGER CreationTime;
- + LARGE_INTEGER LastAccessTime;
- + LARGE_INTEGER LastWriteTime;
- + LARGE_INTEGER ChangeTime;
- + LARGE_INTEGER AllocationSize;
- + LARGE_INTEGER EndOfFile;
- + ULONG FileAttributes;
- +} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
- +
- +typedef struct _FILE_STAT_INFORMATION {
- + LARGE_INTEGER FileId;
- + LARGE_INTEGER CreationTime;
- + LARGE_INTEGER LastAccessTime;
- + LARGE_INTEGER LastWriteTime;
- + LARGE_INTEGER ChangeTime;
- + LARGE_INTEGER AllocationSize;
- + LARGE_INTEGER EndOfFile;
- + ULONG FileAttributes;
- + ULONG ReparseTag;
- + ULONG NumberOfLinks;
- + ACCESS_MASK EffectiveAccess;
- +} FILE_STAT_INFORMATION, *PFILE_STAT_INFORMATION;
- +
- +typedef struct _FILE_STAT_LX_INFORMATION {
- + LARGE_INTEGER FileId;
- + LARGE_INTEGER CreationTime;
- + LARGE_INTEGER LastAccessTime;
- + LARGE_INTEGER LastWriteTime;
- + LARGE_INTEGER ChangeTime;
- + LARGE_INTEGER AllocationSize;
- + LARGE_INTEGER EndOfFile;
- + ULONG FileAttributes;
- + ULONG ReparseTag;
- + ULONG NumberOfLinks;
- + ACCESS_MASK EffectiveAccess;
- + ULONG LxFlags;
- + ULONG LxUid;
- + ULONG LxGid;
- + ULONG LxMode;
- + ULONG LxDeviceIdMajor;
- + ULONG LxDeviceIdMinor;
- +} FILE_STAT_LX_INFORMATION, *PFILE_STAT_LX_INFORMATION;
- +
- +/* Flags for |LxFlags| field */
- +#define LX_FILE_METADATA_HAS_UID 0x1
- +#define LX_FILE_METADATA_HAS_GID 0x2
- +#define LX_FILE_METADATA_HAS_MODE 0x4
- +#define LX_FILE_METADATA_HAS_DEVICE_ID 0x8
- +#define LX_FILE_CASE_SENSITIVE_DIR 0x10
- +
- +/*
- + * Bits for |LxMode| field
- + * Notes:
- + * - |_S_I*| bits are not portable across platforms and protocols
- + * (e.g. Win32, Cygwin, Linux, NFSv4 etc.), and we always need
- + * to translate them.
- + * - NFSv4 has |MODE4_*| flags in "daemon/nfs41_const.h"
- + */
- +#define LX_MODE_S_IFMT 0xF000 /* file type mask */
- +#define LX_MODE_S_IFREG 0x8000 /* regular */
- +#define LX_MODE_S_IFDIR 0x4000 /* directory */
- +#define LX_MODE_S_IFCHR 0x2000 /* character special */
- +#define LX_MODE_S_IFIFO 0x1000 /* pipe */
- +#define LX_MODE_S_IREAD 0x0100 /* read permission, owner */
- +#define LX_MODE_S_IWRITE 0x0080 /* write permission, owner */
- +#define LX_MODE_S_IEXEC 0x0040 /* execute/search permission, owner */
- /* wdm.h */
- typedef enum _FSINFOCLASS {
- @@ -265,13 +323,13 @@ typedef enum _FSINFOCLASS {
- FileFsMaximumInformation
- } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
- -/* ntifs.h */
- -#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
- -#define FILE_CASE_PRESERVED_NAMES 0x00000002
- -#define FILE_UNICODE_ON_DISK 0x00000004
- -#define FILE_PERSISTENT_ACLS 0x00000008
- -#define FILE_FILE_COMPRESSION 0x00000010
- -#define FILE_VOLUME_QUOTAS 0x00000020
- +/* ntifs.h */
- +#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
- +#define FILE_CASE_PRESERVED_NAMES 0x00000002
- +#define FILE_UNICODE_ON_DISK 0x00000004
- +#define FILE_PERSISTENT_ACLS 0x00000008
- +#define FILE_FILE_COMPRESSION 0x00000010
- +#define FILE_VOLUME_QUOTAS 0x00000020
- #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
- #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
- #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
- @@ -280,11 +338,11 @@ typedef enum _FSINFOCLASS {
- #define FILE_VOLUME_IS_COMPRESSED 0x00008000
- #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
- #define FILE_SUPPORTS_ENCRYPTION 0x00020000
- -#define FILE_NAMED_STREAMS 0x00040000
- -#define FILE_READ_ONLY_VOLUME 0x00080000
- -#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
- -#define FILE_SUPPORTS_TRANSACTIONS 0x00200000
- -#define FILE_SUPPORTS_HARD_LINKS 0x00400000
- +#define FILE_NAMED_STREAMS 0x00040000
- +#define FILE_READ_ONLY_VOLUME 0x00080000
- +#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
- +#define FILE_SUPPORTS_TRANSACTIONS 0x00200000
- +#define FILE_SUPPORTS_HARD_LINKS 0x00400000
- #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
- #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
- #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
- @@ -296,28 +354,28 @@ typedef enum _FSINFOCLASS {
- typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
- ULONG FileSystemAttributes;
- - LONG MaximumComponentNameLength;
- - ULONG FileSystemNameLength;
- - WCHAR FileSystemName[1];
- -} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
- -
- -/* ntddk.h */
- -typedef struct _FILE_FS_SIZE_INFORMATION {
- - LARGE_INTEGER TotalAllocationUnits;
- - LARGE_INTEGER AvailableAllocationUnits;
- - ULONG SectorsPerAllocationUnit;
- - ULONG BytesPerSector;
- -} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
- -
- -typedef struct _FILE_FS_FULL_SIZE_INFORMATION {
- - LARGE_INTEGER TotalAllocationUnits;
- - LARGE_INTEGER CallerAvailableAllocationUnits;
- - LARGE_INTEGER ActualAvailableAllocationUnits;
- - ULONG SectorsPerAllocationUnit;
- - ULONG BytesPerSector;
- -} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
- -
- -typedef struct _FILE_INTERNAL_INFORMATION {
- - LARGE_INTEGER IndexNumber;
- -} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
- -#endif
- + LONG MaximumComponentNameLength;
- + ULONG FileSystemNameLength;
- + WCHAR FileSystemName[1];
- +} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
- +
- +/* ntddk.h */
- +typedef struct _FILE_FS_SIZE_INFORMATION {
- + LARGE_INTEGER TotalAllocationUnits;
- + LARGE_INTEGER AvailableAllocationUnits;
- + ULONG SectorsPerAllocationUnit;
- + ULONG BytesPerSector;
- +} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
- +
- +typedef struct _FILE_FS_FULL_SIZE_INFORMATION {
- + LARGE_INTEGER TotalAllocationUnits;
- + LARGE_INTEGER CallerAvailableAllocationUnits;
- + LARGE_INTEGER ActualAvailableAllocationUnits;
- + ULONG SectorsPerAllocationUnit;
- + ULONG BytesPerSector;
- +} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
- +
- +typedef struct _FILE_INTERNAL_INFORMATION {
- + LARGE_INTEGER IndexNumber;
- +} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
- +#endif
- diff --git a/nfs41_build_features.h b/nfs41_build_features.h
- index 02f2840..dfb144f 100644
- --- a/nfs41_build_features.h
- +++ b/nfs41_build_features.h
- @@ -160,4 +160,9 @@
- */
- #define NFS41_DRIVER_ACLS_SETACL_SKIP_WINNULLSID_ACES 1
- +/*
- + * NFS41_DRIVER_WSL_SUPPORT - Enable WSL support
- + */
- +#define NFS41_DRIVER_WSL_SUPPORT 1
- +
- #endif /* !_NFS41_DRIVER_BUILDFEATURES_ */
- diff --git a/sys/nfs41sys_fileinfo.c b/sys/nfs41sys_fileinfo.c
- index 0f7ca82..5a21916 100644
- --- a/sys/nfs41sys_fileinfo.c
- +++ b/sys/nfs41sys_fileinfo.c
- @@ -306,6 +306,10 @@ NTSTATUS nfs41_QueryFileInformation(
- case FileInternalInformation:
- case FileAttributeTagInformation:
- case FileNetworkOpenInformation:
- +#ifdef NFS41_DRIVER_WSL_SUPPORT
- + case FileStatInformation:
- + case FileStatLxInformation:
- +#endif /* NFS41_DRIVER_WSL_SUPPORT */
- break;
- default:
- print_error("nfs41_QueryFileInformation: unhandled class %d\n", InfoClass);
- @@ -399,6 +403,10 @@ NTSTATUS nfs41_QueryFileInformation(
- case FileNetworkOpenInformation:
- case FileInternalInformation:
- case FileAttributeTagInformation:
- +#ifdef NFS41_DRIVER_WSL_SUPPORT
- + case FileStatInformation:
- + case FileStatLxInformation:
- +#endif /* NFS41_DRIVER_WSL_SUPPORT */
- break;
- default:
- print_error("Unhandled/unsupported InfoClass(%d)\n", (int)InfoClass);
- --
- 2.45.1
msnfs41client: Add WSL support+misc, 2024-10-30
Posted by Anonymous on Wed 30th Oct 2024 15:06
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.