ReactOS  0.4.12-dev-409-g9f418243
nfs41_driver.c File Reference
#include <rx.h>
#include <windef.h>
#include <winerror.h>
#include <ntstrsafe.h>
#include "nfs41_driver.h"
#include "nfs41_np.h"
#include "nfs41_debug.h"
Include dependency graph for nfs41_driver.c:

Go to the source code of this file.

Classes

struct  _nfs3_attrs
 
struct  _updowncall_entry
 
struct  _updowncall_list
 
struct  _nfs41_mount_entry
 
struct  _nfs41_mount_list
 
struct  _NFS41_MOUNT_CONFIG
 
struct  _NFS41_NETROOT_EXTENSION
 
struct  _NFS41_V_NET_ROOT_EXTENSION
 
struct  _NFS41_FCB
 
struct  _NFS41_FOBX
 
struct  _NFS41_SERVER_ENTRY
 
struct  _NFS41_DEVICE_EXTENSION
 
struct  _nfs41_fcb_list_entry
 
struct  _nfs41_fcb_list
 

Macros

#define MINIRDR__NAME   "Value is ignored, only fact of definition"
 
#define USE_MOUNT_SEC_CONTEXT
 
#define DEBUG_MARSHAL_HEADER
 
#define DEBUG_MARSHAL_DETAIL
 
#define DEBUG_INVALIDATE_CACHE
 
#define DEBUG_TIME_BASED_COHERENCY
 
#define DEBUG_MOUNT
 
#define DISABLE_CACHING   0
 
#define ENABLE_READ_CACHING   1
 
#define ENABLE_WRITE_CACHING   2
 
#define ENABLE_READWRITE_CACHING   3
 
#define NFS41_MM_POOLTAG   ('nfs4')
 
#define NFS41_MM_POOLTAG_ACL   ('acls')
 
#define NFS41_MM_POOLTAG_MOUNT   ('mnts')
 
#define NFS41_MM_POOLTAG_OPEN   ('open')
 
#define NFS41_MM_POOLTAG_UP   ('upca')
 
#define NFS41_MM_POOLTAG_DOWN   ('down')
 
#define DECLARE_CONST_ANSI_STRING(_var, _string)
 
#define RELATIVE(wait)   (-(wait))
 
#define NANOSECONDS(nanos)   (((signed __int64)(nanos)) / 100L)
 
#define MICROSECONDS(micros)   (((signed __int64)(micros)) * NANOSECONDS(1000L))
 
#define MILLISECONDS(milli)   (((signed __int64)(milli)) * MICROSECONDS(1000L))
 
#define SECONDS(seconds)   (((signed __int64)(seconds)) * MILLISECONDS(1000L))
 
#define nfs41_AddEntry(lock, list, pEntry)
 
#define nfs41_RemoveFirst(lock, list, pEntry)
 
#define nfs41_RemoveEntry(lock, pEntry)
 
#define nfs41_IsListEmpty(lock, list, flag)
 
#define nfs41_GetFirstEntry(lock, list, pEntry)
 
#define nfs41_GetFirstMountEntry(lock, list, pEntry)
 
#define SERVER_NAME_BUFFER_SIZE   1024
 
#define MOUNT_CONFIG_RW_SIZE_MIN   1024
 
#define MOUNT_CONFIG_RW_SIZE_DEFAULT   1048576
 
#define MOUNT_CONFIG_RW_SIZE_MAX   1048576
 
#define MAX_SEC_FLAVOR_LEN   12
 
#define UPCALL_TIMEOUT_DEFAULT   50 /* in seconds */
 
#define NFS41GetNetRootExtension(pNetRoot)
 
#define FS_NAME   L"NFS"
 
#define FS_NAME_LEN   (sizeof(FS_NAME) - sizeof(WCHAR))
 
#define FS_ATTR_LEN   (sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + FS_NAME_LEN)
 
#define VOL_NAME   L"PnfsVolume"
 
#define VOL_NAME_LEN   (sizeof(VOL_NAME) - sizeof(WCHAR))
 
#define VOL_ATTR_LEN   (sizeof(FILE_FS_VOLUME_INFORMATION) + VOL_NAME_LEN)
 
#define STORE_MOUNT_SEC_CONTEXT
 
#define NFS41GetVNetRootExtension(pVNetRoot)
 
#define NFS41GetFcbExtension(pFcb)   (((pFcb) == NULL) ? NULL : (PNFS41_FCB)((pFcb)->Context))
 
#define NFS41GetFobxExtension(pFobx)   (((pFobx) == NULL) ? NULL : (PNFS41_FOBX)((pFobx)->Context))
 
#define NFS41GetDeviceExtension(RxContext, pExt)
 
#define RxDefineNode(node, type)
 
#define RDR_NULL_STATE   0
 
#define RDR_UNLOADED   1
 
#define RDR_UNLOADING   2
 
#define RDR_LOADING   3
 
#define RDR_LOADED   4
 
#define RDR_STOPPED   5
 
#define RDR_STOPPING   6
 
#define RDR_STARTING   7
 
#define RDR_STARTED   8
 
#define MAKE_WAITONCLOSE_NONITERRUPTABLE
 
#define MSEC_TO_RELATIVE_WAIT   (-10000)
 
#define MIN_LOCK_POLL_WAIT   (500 * MSEC_TO_RELATIVE_WAIT) /* 500ms */
 
#define MAX_LOCK_POLL_WAIT   (30000 * MSEC_TO_RELATIVE_WAIT) /* 30s */
 

Typedefs

typedef struct _nfs3_attrs nfs3_attrs
 
typedef enum _nfs41_updowncall_state nfs41_updowncall_state
 
typedef struct _updowncall_entry nfs41_updowncall_entry
 
typedef struct _updowncall_list nfs41_updowncall_list
 
typedef struct _nfs41_mount_entry nfs41_mount_entry
 
typedef struct _nfs41_mount_list nfs41_mount_list
 
typedef struct _NFS41_MOUNT_CONFIG NFS41_MOUNT_CONFIG
 
typedef struct _NFS41_MOUNT_CONFIGPNFS41_MOUNT_CONFIG
 
typedef struct _NFS41_NETROOT_EXTENSION NFS41_NETROOT_EXTENSION
 
typedef struct _NFS41_NETROOT_EXTENSIONPNFS41_NETROOT_EXTENSION
 
typedef struct _NFS41_V_NET_ROOT_EXTENSION NFS41_V_NET_ROOT_EXTENSION
 
typedef struct _NFS41_V_NET_ROOT_EXTENSIONPNFS41_V_NET_ROOT_EXTENSION
 
typedef struct _NFS41_FCB NFS41_FCB
 
typedef struct _NFS41_FCBPNFS41_FCB
 
typedef struct _NFS41_FOBX NFS41_FOBX
 
typedef struct _NFS41_FOBXPNFS41_FOBX
 
typedef struct _NFS41_SERVER_ENTRY NFS41_SERVER_ENTRY
 
typedef struct _NFS41_SERVER_ENTRYPNFS41_SERVER_ENTRY
 
typedef struct _NFS41_DEVICE_EXTENSION NFS41_DEVICE_EXTENSION
 
typedef struct _NFS41_DEVICE_EXTENSIONPNFS41_DEVICE_EXTENSION
 
typedef struct _nfs41_fcb_list_entry nfs41_fcb_list_entry
 
typedef struct _nfs41_fcb_list nfs41_fcb_list
 
typedef enum _NULMRX_STORAGE_TYPE_CODES NFS41_STORAGE_TYPE_CODES
 

Enumerations

enum  ftype3 {
  NF3REG = 1, NF3DIR, NF3BLK, NF3CHR,
  NF3LNK, NF3SOCK, NF3FIFO
}
 
enum  _nfs41_updowncall_state { NFS41_WAITING_FOR_UPCALL, NFS41_WAITING_FOR_DOWNCALL, NFS41_DONE_PROCESSING, NFS41_NOT_WAITING }
 
enum  _NULMRX_STORAGE_TYPE_CODES { NTC_NFS41_DEVICE_EXTENSION = (NODE_TYPE_CODE)0xFC00 }
 

Functions

 DRIVER_DISPATCH (nfs41_FsdDispatch)
 
 DECLARE_CONST_ANSI_STRING (NfsV3Attributes, "NfsV3Attributes")
 
 DECLARE_CONST_ANSI_STRING (NfsSymlinkTargetName, "NfsSymlinkTargetName")
 
 DECLARE_CONST_ANSI_STRING (NfsActOnLink, "NfsActOnLink")
 
INLINE BOOL AnsiStrEq (IN const ANSI_STRING *lhs, IN const CHAR *rhs, IN const UCHAR rhs_len)
 
 DECLARE_CONST_UNICODE_STRING (NfsPrefix, L"\\nfs4")
 
 DECLARE_CONST_UNICODE_STRING (AUTH_SYS_NAME, L"sys")
 
 DECLARE_CONST_UNICODE_STRING (AUTHGSS_KRB5_NAME, L"krb5")
 
 DECLARE_CONST_UNICODE_STRING (AUTHGSS_KRB5I_NAME, L"krb5i")
 
 DECLARE_CONST_UNICODE_STRING (AUTHGSS_KRB5P_NAME, L"krb5p")
 
 DECLARE_CONST_UNICODE_STRING (SLASH, L"\\")
 
 DECLARE_CONST_UNICODE_STRING (EMPTY_STRING, L"")
 
NTSTATUS map_readwrite_errors (DWORD status)
 
void print_debug_header (PRX_CONTEXT RxContext)
 
INLINE ULONG length_as_utf8 (PCUNICODE_STRING str)
 
NTSTATUS marshall_unicode_as_utf8 (IN OUT unsigned char **pos, IN PCUNICODE_STRING str)
 
NTSTATUS marshal_nfs41_header (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
const charsecflavorop2name (DWORD sec_flavor)
 
NTSTATUS marshal_nfs41_mount (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_unmount (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_open (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_rw (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_lock (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_unlock (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_close (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_dirquery (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_filequery (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_fileset (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_easet (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_eaget (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_symlink (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_volume (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_getacl (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_setacl (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
NTSTATUS marshal_nfs41_shutdown (nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
 
void nfs41_invalidate_cache (IN PRX_CONTEXT RxContext)
 
NTSTATUS handle_upcall (IN PRX_CONTEXT RxContext, IN nfs41_updowncall_entry *entry, OUT ULONG *len)
 
NTSTATUS nfs41_UpcallCreate (IN DWORD opcode, IN PSECURITY_CLIENT_CONTEXT clnt_sec_ctx, IN HANDLE session, IN HANDLE open_state, IN DWORD version, IN PUNICODE_STRING filename, OUT nfs41_updowncall_entry **entry_out)
 
NTSTATUS nfs41_UpcallWaitForReply (IN nfs41_updowncall_entry *entry, IN DWORD secs)
 
NTSTATUS nfs41_upcall (IN PRX_CONTEXT RxContext)
 
void unmarshal_nfs41_header (nfs41_updowncall_entry *tmp, unsigned char **buf)
 
void unmarshal_nfs41_mount (nfs41_updowncall_entry *cur, unsigned char **buf)
 
VOID unmarshal_nfs41_setattr (nfs41_updowncall_entry *cur, PULONGLONG dest_buf, unsigned char **buf)
 
NTSTATUS unmarshal_nfs41_rw (nfs41_updowncall_entry *cur, unsigned char **buf)
 
NTSTATUS unmarshal_nfs41_open (nfs41_updowncall_entry *cur, unsigned char **buf)
 
NTSTATUS unmarshal_nfs41_dirquery (nfs41_updowncall_entry *cur, unsigned char **buf)
 
void unmarshal_nfs41_attrget (nfs41_updowncall_entry *cur, PVOID attr_value, ULONG *attr_len, unsigned char **buf)
 
void unmarshal_nfs41_eaget (nfs41_updowncall_entry *cur, unsigned char **buf)
 
void unmarshal_nfs41_getattr (nfs41_updowncall_entry *cur, unsigned char **buf)
 
NTSTATUS unmarshal_nfs41_getacl (nfs41_updowncall_entry *cur, unsigned char **buf)
 
void unmarshal_nfs41_symlink (nfs41_updowncall_entry *cur, unsigned char **buf)
 
NTSTATUS nfs41_downcall (IN PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_shutdown_daemon (DWORD version)
 
NTSTATUS SharedMemoryInit (OUT PHANDLE phSection)
 
NTSTATUS SharedMemoryFree (IN HANDLE hSection)
 
NTSTATUS nfs41_Start (IN OUT PRX_CONTEXT RxContext, IN OUT PRDBSS_DEVICE_OBJECT dev)
 
NTSTATUS nfs41_Stop (IN OUT PRX_CONTEXT RxContext, IN OUT PRDBSS_DEVICE_OBJECT dev)
 
NTSTATUS GetConnectionHandle (IN PUNICODE_STRING ConnectionName, IN PVOID EaBuffer, IN ULONG EaLength, OUT PHANDLE Handle)
 
NTSTATUS nfs41_GetConnectionInfoFromBuffer (IN PVOID Buffer, IN ULONG BufferLen, OUT PUNICODE_STRING pConnectionName, OUT PVOID *ppEaBuffer, OUT PULONG pEaLength)
 
NTSTATUS nfs41_CreateConnection (IN PRX_CONTEXT RxContext, OUT PBOOLEAN PostToFsp)
 
NTSTATUS nfs41_unmount (HANDLE session, DWORD version, DWORD timeout)
 
NTSTATUS nfs41_DeleteConnection (IN PRX_CONTEXT RxContext, OUT PBOOLEAN PostToFsp)
 
NTSTATUS nfs41_DevFcbXXXControlFile (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS _nfs41_CreateSrvCall (PMRX_SRVCALL_CALLBACK_CONTEXT pCallbackContext)
 
NTSTATUS nfs41_CreateSrvCall (PMRX_SRV_CALL pSrvCall, PMRX_SRVCALL_CALLBACK_CONTEXT pCallbackContext)
 
NTSTATUS nfs41_SrvCallWinnerNotify (IN OUT PMRX_SRV_CALL pSrvCall, IN BOOLEAN ThisMinirdrIsTheWinner, IN OUT PVOID pSrvCallContext)
 
NTSTATUS map_mount_errors (DWORD status)
 
NTSTATUS nfs41_mount (PNFS41_MOUNT_CONFIG config, DWORD sec_flavor, PHANDLE session, DWORD *version, PFILE_FS_ATTRIBUTE_INFORMATION FsAttrs)
 
void nfs41_MountConfig_InitDefaults (OUT PNFS41_MOUNT_CONFIG Config)
 
NTSTATUS nfs41_MountConfig_ParseBoolean (IN PFILE_FULL_EA_INFORMATION Option, IN PUNICODE_STRING usValue, OUT PBOOLEAN Value)
 
NTSTATUS nfs41_MountConfig_ParseDword (IN PFILE_FULL_EA_INFORMATION Option, IN PUNICODE_STRING usValue, OUT PDWORD Value, IN DWORD Minimum, IN DWORD Maximum)
 
NTSTATUS nfs41_MountConfig_ParseOptions (IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, IN OUT PNFS41_MOUNT_CONFIG Config)
 
NTSTATUS has_nfs_prefix (IN PUNICODE_STRING SrvCallName, IN PUNICODE_STRING NetRootName)
 
NTSTATUS map_sec_flavor (IN PUNICODE_STRING sec_flavor_name, OUT PDWORD sec_flavor)
 
NTSTATUS nfs41_GetLUID (PLUID id)
 
NTSTATUS nfs41_get_sec_ctx (IN enum _SECURITY_IMPERSONATION_LEVEL level, OUT PSECURITY_CLIENT_CONTEXT out_ctx)
 
NTSTATUS nfs41_CreateVNetRoot (IN OUT PMRX_CREATENETROOT_CONTEXT pCreateNetRootContext)
 
VOID nfs41_ExtractNetRootName (IN PUNICODE_STRING FilePathName, IN PMRX_SRV_CALL SrvCall, OUT PUNICODE_STRING NetRootName, OUT PUNICODE_STRING RestOfName OPTIONAL)
 
NTSTATUS nfs41_FinalizeSrvCall (PMRX_SRV_CALL pSrvCall, BOOLEAN Force)
 
NTSTATUS nfs41_FinalizeNetRoot (IN OUT PMRX_NET_ROOT pNetRoot, IN PBOOLEAN ForceDisconnect)
 
NTSTATUS nfs41_FinalizeVNetRoot (IN OUT PMRX_V_NET_ROOT pVNetRoot, IN PBOOLEAN ForceDisconnect)
 
BOOLEAN isDataAccess (ACCESS_MASK mask)
 
BOOLEAN isOpen2Create (ULONG disposition)
 
BOOLEAN isFilenameTooLong (PUNICODE_STRING name, PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext)
 
BOOLEAN isStream (PUNICODE_STRING name)
 
BOOLEAN areOpenParamsValid (NT_CREATE_PARAMETERS *params)
 
NTSTATUS map_open_errors (DWORD status, USHORT len)
 
DWORD map_disposition_to_create_retval (DWORD disposition, DWORD errno)
 
static BOOLEAN create_should_pass_ea (IN PFILE_FULL_EA_INFORMATION ea, IN ULONG disposition)
 
NTSTATUS check_nfs41_create_args (IN PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_Create (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_CollapseOpen (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_ShouldTryToCollapseThisOpen (IN OUT PRX_CONTEXT RxContext)
 
ULONG nfs41_ExtendForCache (IN OUT PRX_CONTEXT RxContext, IN PLARGE_INTEGER pNewFileSize, OUT PLARGE_INTEGER pNewAllocationSize)
 
VOID nfs41_remove_fcb_entry (PMRX_FCB fcb)
 
NTSTATUS map_close_errors (DWORD status)
 
NTSTATUS nfs41_CloseSrvOpen (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_Flush (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_DeallocateForFcb (IN OUT PMRX_FCB pFcb)
 
NTSTATUS nfs41_DeallocateForFobx (IN OUT PMRX_FOBX pFobx)
 
void print_debug_filedirquery_header (PRX_CONTEXT RxContext)
 
void print_querydir_args (PRX_CONTEXT RxContext)
 
NTSTATUS map_querydir_errors (DWORD status)
 
NTSTATUS check_nfs41_dirquery_args (IN PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_QueryDirectory (IN OUT PRX_CONTEXT RxContext)
 
void print_queryvolume_args (PRX_CONTEXT RxContext)
 
NTSTATUS map_volume_errors (DWORD status)
 
void nfs41_create_volume_info (PFILE_FS_VOLUME_INFORMATION pVolInfo, DWORD *len)
 
static BOOLEAN is_root_directory (PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_QueryVolumeInformation (IN OUT PRX_CONTEXT RxContext)
 
VOID nfs41_update_fcb_list (PMRX_FCB fcb, ULONGLONG ChangeTime)
 
void print_nfs3_attrs (nfs3_attrs *attrs)
 
void file_time_to_nfs_time (IN const PLARGE_INTEGER file_time, OUT LONGLONG *nfs_time)
 
void create_nfs3_attrs (nfs3_attrs *attrs, PNFS41_FCB nfs41_fcb)
 
NTSTATUS map_setea_error (DWORD error)
 
NTSTATUS check_nfs41_setea_args (IN PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_SetEaInformation (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS check_nfs41_queryea_args (IN PRX_CONTEXT RxContext)
 
static NTSTATUS QueryCygwinSymlink (IN OUT PRX_CONTEXT RxContext, IN PFILE_GET_EA_INFORMATION query, OUT PFILE_FULL_EA_INFORMATION info)
 
static NTSTATUS QueryCygwinEA (IN OUT PRX_CONTEXT RxContext, IN PFILE_GET_EA_INFORMATION query, OUT PFILE_FULL_EA_INFORMATION info)
 
NTSTATUS nfs41_QueryEaInformation (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS map_query_acl_error (DWORD error)
 
NTSTATUS check_nfs41_getacl_args (PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_QuerySecurityInformation (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS check_nfs41_setacl_args (PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_SetSecurityInformation (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS map_queryfile_error (DWORD error)
 
NTSTATUS nfs41_QueryFileInformation (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS map_setfile_error (DWORD error)
 
NTSTATUS check_nfs41_setattr_args (IN PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_SetFileInformation (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_SetFileInformationAtCleanup (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_IsValidDirectory (IN OUT PRX_CONTEXT RxContext, IN PUNICODE_STRING DirectoryName)
 
NTSTATUS nfs41_ComputeNewBufferingState (IN OUT PMRX_SRV_OPEN pSrvOpen, IN PVOID pMRxContext, OUT ULONG *pNewBufferingState)
 
void print_readwrite_args (PRX_CONTEXT RxContext)
 
void enable_caching (PMRX_SRV_OPEN SrvOpen, PNFS41_FOBX nfs41_fobx, ULONGLONG ChangeTime, HANDLE session)
 
NTSTATUS check_nfs41_read_args (IN PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_Read (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS check_nfs41_write_args (IN PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_Write (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_IsLockRealizable (IN OUT PMRX_FCB pFcb, IN PLARGE_INTEGER ByteOffset, IN PLARGE_INTEGER Length, IN ULONG LowIoLockFlags)
 
NTSTATUS map_lock_errors (DWORD status)
 
void print_lock_args (PRX_CONTEXT RxContext)
 
void denied_lock_backoff (IN OUT PLARGE_INTEGER delay)
 
NTSTATUS nfs41_Lock (IN OUT PRX_CONTEXT RxContext)
 
void print_unlock_args (PRX_CONTEXT RxContext)
 
__inline ULONG unlock_list_count (PLOWIO_LOCK_LIST lock)
 
NTSTATUS nfs41_Unlock (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS map_symlink_errors (NTSTATUS status)
 
void print_reparse_buffer (PREPARSE_DATA_BUFFER Reparse)
 
NTSTATUS check_nfs41_setreparse_args (IN PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_SetReparsePoint (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS check_nfs41_getreparse_args (PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_GetReparsePoint (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_FsCtl (IN OUT PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_CompleteBufferingStateChangeRequest (IN OUT PRX_CONTEXT RxContext, IN OUT PMRX_SRV_OPEN SrvOpen, IN PVOID pContext)
 
NTSTATUS nfs41_FsdDispatch (IN PDEVICE_OBJECT dev, IN PIRP Irp)
 
NTSTATUS nfs41_Unimplemented (PRX_CONTEXT RxContext)
 
NTSTATUS nfs41_AreFilesAliased (PFCB a, PFCB b)
 
NTSTATUS nfs41_init_ops ()
 
VOID fcbopen_main (PVOID ctx)
 
NTSTATUS DriverEntry (IN PDRIVER_OBJECT drv, IN PUNICODE_STRING path)
 
VOID nfs41_driver_unload (IN PDRIVER_OBJECT drv)
 

Variables

DRIVER_INITIALIZE DriverEntry
 
DRIVER_UNLOAD nfs41_driver_unload
 
struct _MINIRDR_DISPATCH nfs41_ops
 
PRDBSS_DEVICE_OBJECT nfs41_dev
 
KEVENT upcallEvent
 
FAST_MUTEX upcallLock
 
FAST_MUTEX downcallLock
 
FAST_MUTEX fcblistLock
 
FAST_MUTEX xidLock
 
FAST_MUTEX openOwnerLock
 
LONGLONG xid = 0
 
LONG open_owner_id = 1
 
LARGE_INTEGER unix_time_diff
 
nfs41_updowncall_list upcall
 
nfs41_updowncall_list downcall
 
nfs41_fcb_list openlist
 
nfs41_init_driver_state nfs41_init_state = NFS41_INIT_DRIVER_STARTABLE
 
nfs41_start_driver_state nfs41_start_state = NFS41_START_DRIVER_STARTABLE
 
KSTART_ROUTINE fcbopen_main
 

Macro Definition Documentation

◆ DEBUG_INVALIDATE_CACHE

#define DEBUG_INVALIDATE_CACHE

Definition at line 55 of file nfs41_driver.c.

◆ DEBUG_MARSHAL_DETAIL

#define DEBUG_MARSHAL_DETAIL

Definition at line 51 of file nfs41_driver.c.

◆ DEBUG_MARSHAL_HEADER

#define DEBUG_MARSHAL_HEADER

Definition at line 50 of file nfs41_driver.c.

◆ DEBUG_MOUNT

#define DEBUG_MOUNT

Definition at line 68 of file nfs41_driver.c.

◆ DEBUG_TIME_BASED_COHERENCY

#define DEBUG_TIME_BASED_COHERENCY

Definition at line 67 of file nfs41_driver.c.

◆ DECLARE_CONST_ANSI_STRING

#define DECLARE_CONST_ANSI_STRING (   _var,
  _string 
)
Value:
const CHAR _var ## _buffer[] = _string; \
const ANSI_STRING _var = { sizeof(_string) - sizeof(CHAR), \
sizeof(_string), (PCH) _var ## _buffer }
char CHAR
Definition: xmlstorage.h:175
CHAR * PCH
Definition: ntbasedef.h:398

Definition at line 109 of file nfs41_driver.c.

◆ DISABLE_CACHING

#define DISABLE_CACHING   0

Definition at line 89 of file nfs41_driver.c.

◆ ENABLE_READ_CACHING

#define ENABLE_READ_CACHING   1

Definition at line 90 of file nfs41_driver.c.

◆ ENABLE_READWRITE_CACHING

#define ENABLE_READWRITE_CACHING   3

Definition at line 92 of file nfs41_driver.c.

◆ ENABLE_WRITE_CACHING

#define ENABLE_WRITE_CACHING   2

Definition at line 91 of file nfs41_driver.c.

◆ FS_ATTR_LEN

Definition at line 372 of file nfs41_driver.c.

◆ FS_NAME

#define FS_NAME   L"NFS"

Definition at line 370 of file nfs41_driver.c.

◆ FS_NAME_LEN

#define FS_NAME_LEN   (sizeof(FS_NAME) - sizeof(WCHAR))

Definition at line 371 of file nfs41_driver.c.

◆ MAKE_WAITONCLOSE_NONITERRUPTABLE

#define MAKE_WAITONCLOSE_NONITERRUPTABLE

◆ MAX_LOCK_POLL_WAIT

#define MAX_LOCK_POLL_WAIT   (30000 * MSEC_TO_RELATIVE_WAIT) /* 30s */

Definition at line 6332 of file nfs41_driver.c.

◆ MAX_SEC_FLAVOR_LEN

#define MAX_SEC_FLAVOR_LEN   12

Definition at line 339 of file nfs41_driver.c.

◆ MICROSECONDS

#define MICROSECONDS (   micros)    (((signed __int64)(micros)) * NANOSECONDS(1000L))

Definition at line 115 of file nfs41_driver.c.

◆ MILLISECONDS

#define MILLISECONDS (   milli)    (((signed __int64)(milli)) * MICROSECONDS(1000L))

Definition at line 116 of file nfs41_driver.c.

◆ MIN_LOCK_POLL_WAIT

#define MIN_LOCK_POLL_WAIT   (500 * MSEC_TO_RELATIVE_WAIT) /* 500ms */

Definition at line 6331 of file nfs41_driver.c.

◆ MINIRDR__NAME

#define MINIRDR__NAME   "Value is ignored, only fact of definition"

Definition at line 22 of file nfs41_driver.c.

◆ MOUNT_CONFIG_RW_SIZE_DEFAULT

#define MOUNT_CONFIG_RW_SIZE_DEFAULT   1048576

Definition at line 337 of file nfs41_driver.c.

◆ MOUNT_CONFIG_RW_SIZE_MAX

#define MOUNT_CONFIG_RW_SIZE_MAX   1048576

Definition at line 338 of file nfs41_driver.c.

◆ MOUNT_CONFIG_RW_SIZE_MIN

#define MOUNT_CONFIG_RW_SIZE_MIN   1024

Definition at line 336 of file nfs41_driver.c.

◆ MSEC_TO_RELATIVE_WAIT

#define MSEC_TO_RELATIVE_WAIT   (-10000)

Definition at line 6330 of file nfs41_driver.c.

◆ NANOSECONDS

#define NANOSECONDS (   nanos)    (((signed __int64)(nanos)) / 100L)

Definition at line 114 of file nfs41_driver.c.

◆ nfs41_AddEntry

#define nfs41_AddEntry (   lock,
  list,
  pEntry 
)
Value:
InsertTailList(&(list).head, &(pEntry)->next); \
ExReleaseFastMutex(&lock);
rwlock_t lock
Definition: tcpcore.h:1163
struct outqueuenode * head
Definition: adnsresfilter.c:66
Definition: _list.h:228
static unsigned __int64 next
Definition: rand_nt.c:6
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23

Definition at line 288 of file nfs41_driver.c.

◆ nfs41_GetFirstEntry

#define nfs41_GetFirstEntry (   lock,
  list,
  pEntry 
)
Value:
pEntry = (IsListEmpty(&(list).head) \
? NULL \
next))); \
ExReleaseFastMutex(&lock);
rwlock_t lock
Definition: tcpcore.h:1163
struct outqueuenode * head
Definition: adnsresfilter.c:66
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
Definition: nfs41_driver.c:166
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: _list.h:228
static unsigned __int64 next
Definition: rand_nt.c:6
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23

Definition at line 306 of file nfs41_driver.c.

◆ nfs41_GetFirstMountEntry

#define nfs41_GetFirstMountEntry (   lock,
  list,
  pEntry 
)
Value:
pEntry = (IsListEmpty(&(list).head) \
? NULL \
next))); \
ExReleaseFastMutex(&lock);
rwlock_t lock
Definition: tcpcore.h:1163
struct outqueuenode * head
Definition: adnsresfilter.c:66
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: _list.h:228
static unsigned __int64 next
Definition: rand_nt.c:6
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
Definition: nfs41_driver.c:275

Definition at line 315 of file nfs41_driver.c.

◆ nfs41_IsListEmpty

#define nfs41_IsListEmpty (   lock,
  list,
  flag 
)
Value:
flag = IsListEmpty(&(list).head); \
ExReleaseFastMutex(&lock);
rwlock_t lock
Definition: tcpcore.h:1163
struct outqueuenode * head
Definition: adnsresfilter.c:66
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
Definition: _list.h:228
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23

Definition at line 302 of file nfs41_driver.c.

◆ NFS41_MM_POOLTAG

#define NFS41_MM_POOLTAG   ('nfs4')

Definition at line 94 of file nfs41_driver.c.

◆ NFS41_MM_POOLTAG_ACL

#define NFS41_MM_POOLTAG_ACL   ('acls')

Definition at line 95 of file nfs41_driver.c.

◆ NFS41_MM_POOLTAG_DOWN

#define NFS41_MM_POOLTAG_DOWN   ('down')

Definition at line 99 of file nfs41_driver.c.

◆ NFS41_MM_POOLTAG_MOUNT

#define NFS41_MM_POOLTAG_MOUNT   ('mnts')

Definition at line 96 of file nfs41_driver.c.

◆ NFS41_MM_POOLTAG_OPEN

#define NFS41_MM_POOLTAG_OPEN   ('open')

Definition at line 97 of file nfs41_driver.c.

◆ NFS41_MM_POOLTAG_UP

#define NFS41_MM_POOLTAG_UP   ('upca')

Definition at line 98 of file nfs41_driver.c.

◆ nfs41_RemoveEntry

#define nfs41_RemoveEntry (   lock,
  pEntry 
)
Value:
RemoveEntryList(&pEntry->next); \
ExReleaseFastMutex(&lock);
rwlock_t lock
Definition: tcpcore.h:1163
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23

Definition at line 298 of file nfs41_driver.c.

◆ nfs41_RemoveFirst

#define nfs41_RemoveFirst (   lock,
  list,
  pEntry 
)
Value:
pEntry = (IsListEmpty(&(list).head) \
? NULL \
ExReleaseFastMutex(&lock);
rwlock_t lock
Definition: tcpcore.h:1163
struct outqueuenode * head
Definition: adnsresfilter.c:66
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
Definition: _list.h:228
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23

Definition at line 292 of file nfs41_driver.c.

◆ NFS41GetDeviceExtension

#define NFS41GetDeviceExtension (   RxContext,
  pExt 
)
Value:
((PBYTE)(RxContext->RxDeviceObject) + sizeof(RDBSS_DEVICE_OBJECT))
struct _NFS41_DEVICE_EXTENSION * PNFS41_DEVICE_EXTENSION
BYTE * PBYTE
Definition: pedump.c:66

Definition at line 446 of file nfs41_driver.c.

◆ NFS41GetFcbExtension

#define NFS41GetFcbExtension (   pFcb)    (((pFcb) == NULL) ? NULL : (PNFS41_FCB)((pFcb)->Context))

Definition at line 409 of file nfs41_driver.c.

◆ NFS41GetFobxExtension

#define NFS41GetFobxExtension (   pFobx)    (((pFobx) == NULL) ? NULL : (PNFS41_FOBX)((pFobx)->Context))

Definition at line 425 of file nfs41_driver.c.

◆ NFS41GetNetRootExtension

#define NFS41GetNetRootExtension (   pNetRoot)
Value:
(((pNetRoot) == NULL) ? NULL : \
(PNFS41_NETROOT_EXTENSION)((pNetRoot)->Context))
smooth NULL
Definition: ftsmooth.c:416
struct _NFS41_NETROOT_EXTENSION * PNFS41_NETROOT_EXTENSION

Definition at line 365 of file nfs41_driver.c.

◆ NFS41GetVNetRootExtension

#define NFS41GetVNetRootExtension (   pVNetRoot)
Value:
(((pVNetRoot) == NULL) ? NULL : \
(PNFS41_V_NET_ROOT_EXTENSION)((pVNetRoot)->Context))
struct _NFS41_V_NET_ROOT_EXTENSION * PNFS41_V_NET_ROOT_EXTENSION
smooth NULL
Definition: ftsmooth.c:416

Definition at line 395 of file nfs41_driver.c.

◆ RDR_LOADED

#define RDR_LOADED   4

Definition at line 475 of file nfs41_driver.c.

◆ RDR_LOADING

#define RDR_LOADING   3

Definition at line 474 of file nfs41_driver.c.

◆ RDR_NULL_STATE

#define RDR_NULL_STATE   0

Definition at line 471 of file nfs41_driver.c.

◆ RDR_STARTED

#define RDR_STARTED   8

Definition at line 479 of file nfs41_driver.c.

◆ RDR_STARTING

#define RDR_STARTING   7

Definition at line 478 of file nfs41_driver.c.

◆ RDR_STOPPED

#define RDR_STOPPED   5

Definition at line 476 of file nfs41_driver.c.

◆ RDR_STOPPING

#define RDR_STOPPING   6

Definition at line 477 of file nfs41_driver.c.

◆ RDR_UNLOADED

#define RDR_UNLOADED   1

Definition at line 472 of file nfs41_driver.c.

◆ RDR_UNLOADING

#define RDR_UNLOADING   2

Definition at line 473 of file nfs41_driver.c.

◆ RELATIVE

#define RELATIVE (   wait)    (-(wait))

Definition at line 113 of file nfs41_driver.c.

◆ RxDefineNode

#define RxDefineNode (   node,
  type 
)
Value:
node->NodeTypeCode = NTC_##type; \
node->NodeByteSize = sizeof(type);
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: dlist.c:348

Definition at line 467 of file nfs41_driver.c.

◆ SECONDS

#define SECONDS (   seconds)    (((signed __int64)(seconds)) * MILLISECONDS(1000L))

Definition at line 117 of file nfs41_driver.c.

◆ SERVER_NAME_BUFFER_SIZE

#define SERVER_NAME_BUFFER_SIZE   1024

Definition at line 335 of file nfs41_driver.c.

◆ STORE_MOUNT_SEC_CONTEXT

#define STORE_MOUNT_SEC_CONTEXT

Definition at line 390 of file nfs41_driver.c.

◆ UPCALL_TIMEOUT_DEFAULT

#define UPCALL_TIMEOUT_DEFAULT   50 /* in seconds */

Definition at line 340 of file nfs41_driver.c.

◆ USE_MOUNT_SEC_CONTEXT

#define USE_MOUNT_SEC_CONTEXT

Definition at line 46 of file nfs41_driver.c.

◆ VOL_ATTR_LEN

Definition at line 377 of file nfs41_driver.c.

◆ VOL_NAME

#define VOL_NAME   L"PnfsVolume"

Definition at line 375 of file nfs41_driver.c.

◆ VOL_NAME_LEN

#define VOL_NAME_LEN   (sizeof(VOL_NAME) - sizeof(WCHAR))

Definition at line 376 of file nfs41_driver.c.

Typedef Documentation

◆ nfs3_attrs

◆ NFS41_DEVICE_EXTENSION

◆ NFS41_FCB

◆ nfs41_fcb_list

◆ nfs41_fcb_list_entry

◆ NFS41_FOBX

◆ NFS41_MOUNT_CONFIG

◆ nfs41_mount_entry

◆ nfs41_mount_list

◆ NFS41_NETROOT_EXTENSION

◆ NFS41_SERVER_ENTRY

◆ NFS41_STORAGE_TYPE_CODES

◆ nfs41_updowncall_entry

◆ nfs41_updowncall_list

◆ nfs41_updowncall_state

◆ NFS41_V_NET_ROOT_EXTENSION

◆ PNFS41_DEVICE_EXTENSION

◆ PNFS41_FCB

◆ PNFS41_FOBX

◆ PNFS41_MOUNT_CONFIG

◆ PNFS41_NETROOT_EXTENSION

◆ PNFS41_SERVER_ENTRY

◆ PNFS41_V_NET_ROOT_EXTENSION

Enumeration Type Documentation

◆ _nfs41_updowncall_state

Enumerator
NFS41_WAITING_FOR_UPCALL 
NFS41_WAITING_FOR_DOWNCALL 
NFS41_DONE_PROCESSING 
NFS41_NOT_WAITING 

Definition at line 154 of file nfs41_driver.c.

◆ _NULMRX_STORAGE_TYPE_CODES

Enumerator
NTC_NFS41_DEVICE_EXTENSION 

Definition at line 464 of file nfs41_driver.c.

464  {
USHORT NODE_TYPE_CODE
Definition: nodetype.h:22
enum _NULMRX_STORAGE_TYPE_CODES NFS41_STORAGE_TYPE_CODES

◆ ftype3

Enumerator
NF3REG 
NF3DIR 
NF3BLK 
NF3CHR 
NF3LNK 
NF3SOCK 
NF3FIFO 

Definition at line 144 of file nfs41_driver.c.

144  {
145  NF3REG = 1,
146  NF3DIR,
147  NF3BLK,
148  NF3CHR,
149  NF3LNK,
150  NF3SOCK,
151  NF3FIFO
152 };

Function Documentation

◆ _nfs41_CreateSrvCall()

NTSTATUS _nfs41_CreateSrvCall ( PMRX_SRVCALL_CALLBACK_CONTEXT  pCallbackContext)

Definition at line 2572 of file nfs41_driver.c.

2574 {
2575 #else
2577  PVOID pContext)
2578 {
2579  PMRX_SRVCALL_CALLBACK_CONTEXT pCallbackContext = pContext;
2580 #endif
2582  PMRX_SRVCALL_CALLBACK_CONTEXT SCCBC = pCallbackContext;
2583  PMRX_SRV_CALL pSrvCall;
2584  PMRX_SRVCALLDOWN_STRUCTURE SrvCalldownStructure =
2586  PNFS41_SERVER_ENTRY pServerEntry = NULL;
2587 
2588 #ifdef DEBUG_MOUNT
2589  DbgEn();
2590 #endif
2591 
2592  pSrvCall = SrvCalldownStructure->SrvCall;
2593 
2594  ASSERT( pSrvCall );
2595  ASSERT( NodeType(pSrvCall) == RDBSS_NTC_SRVCALL );
2596  print_srv_call(0, pSrvCall);
2597 
2598  // validate the server name with the test name of 'pnfs'
2599 #ifdef DEBUG_MOUNT
2600  DbgP("SrvCall: Connection Name Length: %d %wZ\n",
2601  pSrvCall->pSrvCallName->Length, pSrvCall->pSrvCallName);
2602 #endif
2603 
2604  if (pSrvCall->pSrvCallName->Length > SERVER_NAME_BUFFER_SIZE) {
2605  print_error("Server name '%wZ' too long for server entry (max %u)\n",
2608  goto out;
2609  }
2610 
2611  /* Let's create our own representation of the server */
2614  if (pServerEntry == NULL) {
2616  goto out;
2617  }
2618  RtlZeroMemory(pServerEntry, sizeof(NFS41_SERVER_ENTRY));
2619 
2620  pServerEntry->Name.Buffer = pServerEntry->NameBuffer;
2621  pServerEntry->Name.Length = pSrvCall->pSrvCallName->Length;
2622  pServerEntry->Name.MaximumLength = SERVER_NAME_BUFFER_SIZE;
2623  RtlCopyMemory(pServerEntry->Name.Buffer, pSrvCall->pSrvCallName->Buffer,
2624  pServerEntry->Name.Length);
2625 
2626  pCallbackContext->RecommunicateContext = pServerEntry;
2627 #ifdef __REACTOS__
2628  InterlockedExchangePointer((void * volatile *)&pServerEntry->pRdbssSrvCall, pSrvCall);
2629 #else
2630  InterlockedExchangePointer(&pServerEntry->pRdbssSrvCall, pSrvCall);
2631 #endif
2632 
2633 out:
2634  SCCBC->Status = status;
2635  SrvCalldownStructure->CallBack(SCCBC);
2636 
2637 #ifdef DEBUG_MOUNT
2638  DbgEx();
2639 #endif
2640  return status;
2641 }
#define DbgEx()
Definition: nfs41_debug.h:61
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
USHORT MaximumLength
Definition: env_spec_w32.h:370
PUNICODE_STRING pSrvCallName
Definition: mrxfcb.h:22
PMRX_SRVCALL_CALLBACK CallBack
Definition: mrx.h:137
LONG NTSTATUS
Definition: precomp.h:26
WCHAR NameBuffer[SERVER_NAME_BUFFER_SIZE]
Definition: nfs41_driver.c:430
#define NFS41_MM_POOLTAG
Definition: nfs41_driver.c:94
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
UNICODE_STRING Name
Definition: nfs41_driver.c:431
PMRX_SRVCALLDOWN_STRUCTURE SrvCalldownStructure
Definition: mrx.h:119
smooth NULL
Definition: ftsmooth.c:416
#define DbgP(_x_)
Definition: nfs41_np.c:34
#define SERVER_NAME_BUFFER_SIZE
Definition: nfs41_driver.c:335
NodeType
Definition: Node.h:5
#define STATUS_NAME_TOO_LONG
Definition: ntstatus.h:484
struct _MRX_SRVCALLDOWN_STRUCTURE * PMRX_SRVCALLDOWN_STRUCTURE
#define RxAllocatePoolWithTag
Definition: ntrxdef.h:25
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
VOID print_srv_call(int on, IN PMRX_SRV_CALL p)
Definition: nfs41_debug.c:240
static FILE * out
Definition: regtests2xml.c:44
NTSTATUS _nfs41_CreateSrvCall(PMRX_SRVCALL_CALLBACK_CONTEXT pCallbackContext)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PMRX_SRV_CALL SrvCall
Definition: mrx.h:136
#define DbgEn()
Definition: nfs41_debug.h:57
#define RDBSS_NTC_SRVCALL
Definition: nodetype.h:48
Definition: nfs41_driver.c:428
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
PMRX_SRV_CALL pRdbssSrvCall
Definition: nfs41_driver.c:429
static SERVICE_STATUS status
Definition: service.c:31
struct _NFS41_SERVER_ENTRY * PNFS41_SERVER_ENTRY
Definition: ps.c:97

Referenced by nfs41_CreateSrvCall().

◆ AnsiStrEq()

INLINE BOOL AnsiStrEq ( IN const ANSI_STRING lhs,
IN const CHAR rhs,
IN const UCHAR  rhs_len 
)

Definition at line 123 of file nfs41_driver.c.

127 {
128  return lhs->Length == rhs_len &&
129  RtlCompareMemory(lhs->Buffer, rhs, rhs_len) == rhs_len;
130 }
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

Referenced by check_nfs41_create_args(), check_nfs41_queryea_args(), check_nfs41_setea_args(), create_should_pass_ea(), nfs41_Create(), nfs41_SetEaInformation(), and QueryCygwinEA().

◆ areOpenParamsValid()

BOOLEAN areOpenParamsValid ( NT_CREATE_PARAMETERS params)

Definition at line 3526 of file nfs41_driver.c.

3527 {
3528  /* from ms-fsa page 52 */
3529  if ((params->CreateOptions & FILE_DELETE_ON_CLOSE) &&
3530  !(params->DesiredAccess & DELETE))
3531  return FALSE;
3532  if ((params->CreateOptions & FILE_DIRECTORY_FILE) &&
3533  (params->Disposition == FILE_SUPERSEDE ||
3534  params->Disposition == FILE_OVERWRITE ||
3535  params->Disposition == FILE_OVERWRITE_IF))
3536  return FALSE;
3537  if ((params->CreateOptions & FILE_NO_INTERMEDIATE_BUFFERING) &&
3538  (params->DesiredAccess & FILE_APPEND_DATA) &&
3539  !(params->DesiredAccess & FILE_WRITE_DATA))
3540  return FALSE;
3541  /* from ms-fsa 3.1.5.1.1 page 56 */
3542  if ((params->CreateOptions & FILE_DIRECTORY_FILE) &&
3543  (params->FileAttributes & FILE_ATTRIBUTE_TEMPORARY))
3544  return FALSE;
3545  return TRUE;
3546 }
#define TRUE
Definition: types.h:120
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
#define FILE_OVERWRITE
Definition: from_kernel.h:57
#define FILE_APPEND_DATA
Definition: nt_native.h:634
#define FILE_NO_INTERMEDIATE_BUFFERING
Definition: from_kernel.h:28
GLenum const GLfloat * params
Definition: glext.h:5645
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
#define DELETE
Definition: nt_native.h:57

Referenced by check_nfs41_create_args().

◆ check_nfs41_create_args()

NTSTATUS check_nfs41_create_args ( IN PRX_CONTEXT  RxContext)

Definition at line 3616 of file nfs41_driver.c.

3618 {
3620  PNT_CREATE_PARAMETERS params = &RxContext->Create.NtCreateParameters;
3621  __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen;
3622  __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
3623  NFS41GetVNetRootExtension(SrvOpen->pVNetRoot);
3625  &pVNetRootContext->FsAttrs;
3626  __notnull PNFS41_NETROOT_EXTENSION pNetRootContext =
3627  NFS41GetNetRootExtension(SrvOpen->pVNetRoot->pNetRoot);
3628  __notnull PMRX_FCB Fcb = RxContext->pFcb;
3629  __notnull PNFS41_FCB nfs41_fcb = (PNFS41_FCB)Fcb->Context;
3631  RxContext->CurrentIrp->AssociatedIrp.SystemBuffer;
3632 
3633  if (Fcb->pNetRoot->Type != NET_ROOT_DISK &&
3634  Fcb->pNetRoot->Type != NET_ROOT_WILD) {
3635  print_error("nfs41_Create: Unsupported NetRoot Type %u\n",
3636  Fcb->pNetRoot->Type);
3638  goto out;
3639  }
3640 
3642  print_error("FCB_STATE_PAGING_FILE not implemented\n");
3644  goto out;
3645  }
3646 
3647  if (!pNetRootContext->mounts_init) {
3648  print_error("nfs41_Create: No valid session established\n");
3650  goto out;
3651  }
3652 
3653  if (isStream(SrvOpen->pAlreadyPrefixedName)) {
3655  goto out;
3656  }
3657 
3658  if (pVNetRootContext->read_only &&
3659  (params->DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA))) {
3661  goto out;
3662  }
3663 
3664  /* if FCB was marked for deletion and opened multiple times, as soon
3665  * as first close happen, FCB transitions into delete_pending state
3666  * no more opens allowed
3667  */
3668  if (Fcb->OpenCount && nfs41_fcb->DeletePending) {
3670  goto out;
3671  }
3672 
3673  /* ms-fsa: 3.1.5.1.2.1 page 68 */
3674  if (Fcb->OpenCount && nfs41_fcb->StandardInfo.DeletePending &&
3675  !(params->ShareAccess & FILE_SHARE_DELETE) &&
3676  (params->DesiredAccess & (FILE_EXECUTE | FILE_READ_DATA |
3679  goto out;
3680  }
3681 
3682  /* rdbss seems miss this sharing_violation check */
3683  if (Fcb->OpenCount && params->Disposition == FILE_SUPERSEDE) {
3684 #ifdef __REACTOS__
3685  if ((!RxContext->CurrentIrpSp->FileObject->SharedRead &&
3686  (params->DesiredAccess & FILE_READ_DATA)) ||
3687  ((!RxContext->CurrentIrpSp->FileObject->SharedWrite &&
3688  (params->DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA |
3689  FILE_WRITE_ATTRIBUTES))) ||
3690  (!RxContext->CurrentIrpSp->FileObject->SharedDelete &&
3691  (params->DesiredAccess & DELETE)))) {
3692 #else
3693  if ((!RxContext->CurrentIrpSp->FileObject->SharedRead &&
3694  (params->DesiredAccess & FILE_READ_DATA)) ||
3695  (!RxContext->CurrentIrpSp->FileObject->SharedWrite &&
3696  (params->DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA |
3698  (!RxContext->CurrentIrpSp->FileObject->SharedDelete &&
3699  (params->DesiredAccess & DELETE)))) {
3700 #endif
3702  goto out;
3703  }
3704  }
3705  if (isFilenameTooLong(SrvOpen->pAlreadyPrefixedName, pVNetRootContext)) {
3707  goto out;
3708  }
3709 
3710  if (!areOpenParamsValid(params)) {
3712  goto out;
3713  }
3714 
3715  /* from ms-fsa 3.1.5.1.1 page 56 */
3716  if ((params->CreateOptions & FILE_DELETE_ON_CLOSE) &&
3717  (params->FileAttributes & FILE_ATTRIBUTE_READONLY)) {
3719  goto out;
3720  }
3721 
3722  if (ea) {
3723  /* ignore cygwin EAs when checking support and access */
3724  if (!AnsiStrEq(&NfsV3Attributes, ea->EaName, ea->EaNameLength) &&
3725  !AnsiStrEq(&NfsActOnLink, ea->EaName, ea->EaNameLength) &&
3726  !AnsiStrEq(&NfsSymlinkTargetName, ea->EaName, ea->EaNameLength)) {
3727  if (!(FsAttrs->FileSystemAttributes & FILE_SUPPORTS_EXTENDED_ATTRIBUTES)) {
3729  goto out;
3730  }
3731  }
3732  } else if (RxContext->CurrentIrpSp->Parameters.Create.EaLength) {
3734  goto out;
3735  }
3736 
3737 out:
3738  return status;
3739 }
#define NFS41GetNetRootExtension(pNetRoot)
Definition: nfs41_driver.c:365
#define __notnull
Definition: sal_old.h:93
#define STATUS_EAS_NOT_SUPPORTED
Definition: ntstatus.h:301
BOOLEAN areOpenParamsValid(NT_CREATE_PARAMETERS *params)
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:308
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
INLINE BOOL AnsiStrEq(IN const ANSI_STRING *lhs, IN const CHAR *rhs, IN const UCHAR rhs_len)
Definition: nfs41_driver.c:123
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN isFilenameTooLong(PUNICODE_STRING name, PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext)
#define FILE_APPEND_DATA
Definition: nt_native.h:634
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define STATUS_SHARING_VIOLATION
Definition: udferr_usr.h:154
GLenum const GLfloat * params
Definition: glext.h:5645
#define FCB_STATE_PAGING_FILE
Definition: fatstruc.h:1191
#define FILE_READ_DATA
Definition: nt_native.h:628
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
static FILE * out
Definition: regtests2xml.c:44
#define STATUS_CANNOT_DELETE
Definition: shellext.h:66
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define FILE_EXECUTE
Definition: nt_native.h:642
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define NFS41GetVNetRootExtension(pVNetRoot)
Definition: nfs41_driver.c:395
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
CLONG OpenCount
Definition: fatstruc.h:877
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES
Definition: from_kernel.h:250
#define NET_ROOT_DISK
Definition: mrxfcb.h:30
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
struct _NFS41_FCB * PNFS41_FCB
#define STATUS_NETWORK_ACCESS_DENIED
Definition: ntstatus.h:424
BOOLEAN isStream(PUNICODE_STRING name)
#define NET_ROOT_WILD
Definition: mrxfcb.h:33
_In_ PFCB Fcb
Definition: cdprocs.h:151
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
ULONG FcbState
Definition: cdstruc.h:977
#define DELETE
Definition: nt_native.h:57
Definition: ps.c:97

Referenced by nfs41_Create().

◆ check_nfs41_dirquery_args()

NTSTATUS check_nfs41_dirquery_args ( IN PRX_CONTEXT  RxContext)

Definition at line 4349 of file nfs41_driver.c.

4351 {
4352  if (RxContext->Info.Buffer == NULL)
4354  return STATUS_SUCCESS;
4355 }
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
smooth NULL
Definition: ftsmooth.c:416
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by check_nfs41_queryea_args(), check_nfs41_setattr_args(), check_nfs41_setea_args(), nfs41_QueryDirectory(), nfs41_QueryFileInformation(), and nfs41_QueryVolumeInformation().

◆ check_nfs41_getacl_args()

NTSTATUS check_nfs41_getacl_args ( PRX_CONTEXT  RxContext)

Definition at line 5186 of file nfs41_driver.c.

5188 {
5191  RxContext->CurrentIrpSp->Parameters.QuerySecurity.SecurityInformation;
5192 
5193  /* we don't support sacls */
5197  goto out;
5198  }
5199  if (RxContext->CurrentIrp->UserBuffer == NULL &&
5200  RxContext->CurrentIrpSp->Parameters.QuerySecurity.Length)
5202 out:
5203  return status;
5204 }
static PIO_STATUS_BLOCK void ULONG FS_INFORMATION_CLASS info_class
Definition: pipe.c:76
LONG NTSTATUS
Definition: precomp.h:26
PIRP CurrentIrp
Definition: rxcontx.h:110
DWORD SECURITY_INFORMATION
Definition: ms-dtyp.idl:311
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
smooth NULL
Definition: ftsmooth.c:416
static FILE * out
Definition: regtests2xml.c:44
#define SACL_SECURITY_INFORMATION
Definition: setypes.h:126
#define LABEL_SECURITY_INFORMATION
Definition: setypes.h:127
PIO_STACK_LOCATION CurrentIrpSp
Definition: rxcontx.h:111
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by nfs41_QuerySecurityInformation().

◆ check_nfs41_getreparse_args()

NTSTATUS check_nfs41_getreparse_args ( PRX_CONTEXT  RxContext)

Definition at line 6689 of file nfs41_driver.c.

6691 {
6693  XXCTL_LOWIO_COMPONENT *FsCtl = &RxContext->LowIoContext.ParamsFor.FsCtl;
6694  const USHORT HeaderLen = FIELD_OFFSET(REPARSE_DATA_BUFFER,
6695  SymbolicLinkReparseBuffer.PathBuffer);
6696 
6697  /* must have a filename longer than vnetroot name,
6698  * or it's trying to operate on the volume itself */
6699  if (is_root_directory(RxContext)) {
6701  goto out;
6702  }
6703  /* ifs reparse tests expect STATUS_INVALID_PARAMETER,
6704  * but 'dir' passes a buffer here when querying symlinks
6705  if (FsCtl->pInputBuffer != NULL) {
6706  status = STATUS_INVALID_PARAMETER;
6707  goto out;
6708  } */
6709  if (!FsCtl->pOutputBuffer) {
6711  goto out;
6712  }
6713  if (!BooleanFlagOn(RxContext->pFcb->Attributes,
6716  DbgP("FILE_ATTRIBUTE_REPARSE_POINT is not set!\n");
6717  goto out;
6718  }
6719 
6720  if (FsCtl->OutputBufferLength < HeaderLen) {
6721  RxContext->InformationToReturn = HeaderLen;
6723  goto out;
6724  }
6725 out:
6726  return status;
6727 }
PVOID pOutputBuffer
Definition: mrx.h:275
XXCTL_LOWIO_COMPONENT FsCtl
Definition: mrx.h:308
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PMRX_FCB pFcb
Definition: rxcontx.h:112
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
LONG NTSTATUS
Definition: precomp.h:26
static BOOLEAN is_root_directory(PRX_CONTEXT RxContext)
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
ULONG Attributes
Definition: mrxfcb.h:121
WCHAR PathBuffer[1]
Definition: shellext.h:152
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
ULONG OutputBufferLength
Definition: mrx.h:274
#define DbgP(_x_)
Definition: nfs41_np.c:34
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
union _LOWIO_CONTEXT::@1969 ParamsFor
static FILE * out
Definition: regtests2xml.c:44
ULONG_PTR InformationToReturn
Definition: rxcontx.h:137
#define STATUS_NOT_A_REPARSE_POINT
Definition: ntstatus.h:739
unsigned short USHORT
Definition: pedump.c:61
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
LOWIO_CONTEXT LowIoContext
Definition: rxcontx.h:263
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by nfs41_GetReparsePoint().

◆ check_nfs41_queryea_args()

NTSTATUS check_nfs41_queryea_args ( IN PRX_CONTEXT  RxContext)

Definition at line 4900 of file nfs41_driver.c.

4902 {
4903  NTSTATUS status;
4904  __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
4905  NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
4907  &pVNetRootContext->FsAttrs;
4909  RxContext->CurrentIrpSp->Parameters.QueryEa.EaList;
4910 
4911  status = check_nfs41_dirquery_args(RxContext);
4912  if (status) goto out;
4913 
4914  if (!(FsAttrs->FileSystemAttributes & FILE_SUPPORTS_EXTENDED_ATTRIBUTES)) {
4915  if (ea == NULL) {
4917  goto out;
4918  }
4919  /* ignore cygwin EAs when checking support */
4920  if (!AnsiStrEq(&NfsV3Attributes, ea->EaName, ea->EaNameLength) &&
4921  !AnsiStrEq(&NfsActOnLink, ea->EaName, ea->EaNameLength) &&
4922  !AnsiStrEq(&NfsSymlinkTargetName, ea->EaName, ea->EaNameLength)) {
4924  goto out;
4925  }
4926  }
4927  if ((RxContext->pRelevantSrvOpen->DesiredAccess & FILE_READ_EA) == 0) {
4929  goto out;
4930  }
4931 out:
4932  return status;
4933 }
#define __notnull
Definition: sal_old.h:93
#define STATUS_EAS_NOT_SUPPORTED
Definition: ntstatus.h:301
INLINE BOOL AnsiStrEq(IN const ANSI_STRING *lhs, IN const CHAR *rhs, IN const UCHAR rhs_len)
Definition: nfs41_driver.c:123
LONG NTSTATUS
Definition: precomp.h:26
struct _FILE_GET_EA_INFORMATION * PFILE_GET_EA_INFORMATION
smooth NULL
Definition: ftsmooth.c:416
static FILE * out
Definition: regtests2xml.c:44
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
NTSTATUS check_nfs41_dirquery_args(IN PRX_CONTEXT RxContext)
#define NFS41GetVNetRootExtension(pVNetRoot)
Definition: nfs41_driver.c:395
#define FILE_READ_EA
Definition: nt_native.h:638
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES
Definition: from_kernel.h:250
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by nfs41_QueryEaInformation().

◆ check_nfs41_read_args()

NTSTATUS check_nfs41_read_args ( IN PRX_CONTEXT  RxContext)

Definition at line 6024 of file nfs41_driver.c.

6026 {
6027  if (!RxContext->LowIoContext.ParamsFor.ReadWrite.Buffer)
6029  return STATUS_SUCCESS;
6030 }
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by nfs41_Read().

◆ check_nfs41_setacl_args()

NTSTATUS check_nfs41_setacl_args ( PRX_CONTEXT  RxContext)

Definition at line 5328 of file nfs41_driver.c.

5330 {
5332  __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
5335  RxContext->CurrentIrpSp->Parameters.SetSecurity.SecurityInformation;
5336 
5337  if (pVNetRootContext->read_only) {
5338  print_error("check_nfs41_setacl_args: Read-only mount\n");
5340  goto out;
5341  }
5342  /* we don't support sacls */
5346  goto out;
5347  }
5348 out:
5349  return status;
5350 }
#define __notnull
Definition: sal_old.h:93
static PIO_STATUS_BLOCK void ULONG FS_INFORMATION_CLASS info_class
Definition: pipe.c:76
LONG NTSTATUS
Definition: precomp.h:26
DWORD SECURITY_INFORMATION
Definition: ms-dtyp.idl:311
static FILE * out
Definition: regtests2xml.c:44
#define SACL_SECURITY_INFORMATION
Definition: setypes.h:126
#define LABEL_SECURITY_INFORMATION
Definition: setypes.h:127
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
PIO_STACK_LOCATION CurrentIrpSp
Definition: rxcontx.h:111
#define NFS41GetVNetRootExtension(pVNetRoot)
Definition: nfs41_driver.c:395
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
PMRX_V_NET_ROOT pVNetRoot
Definition: mrxfcb.h:162
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
PMRX_SRV_OPEN pRelevantSrvOpen
Definition: rxcontx.h:114
Definition: ps.c:97

Referenced by nfs41_SetSecurityInformation().

◆ check_nfs41_setattr_args()

NTSTATUS check_nfs41_setattr_args ( IN PRX_CONTEXT  RxContext)

Definition at line 5624 of file nfs41_driver.c.

5626 {
5628  FILE_INFORMATION_CLASS InfoClass = RxContext->Info.FileInformationClass;
5629  __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
5630  NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
5631 
5632  if (pVNetRootContext->read_only) {
5633  print_error("check_nfs41_setattr_args: Read-only mount\n");
5635  goto out;
5636  }
5637 
5638  /* http://msdn.microsoft.com/en-us/library/ff469355(v=PROT.10).aspx
5639  * http://msdn.microsoft.com/en-us/library/ff469424(v=PROT.10).aspx
5640  * If Open.GrantedAccess does not contain FILE_WRITE_DATA, the operation
5641  * MUST be failed with STATUS_ACCESS_DENIED.
5642  */
5643  if (InfoClass == FileAllocationInformation ||
5644  InfoClass == FileEndOfFileInformation) {
5645  if (!(RxContext->pRelevantSrvOpen->DesiredAccess & FILE_WRITE_DATA)) {
5647  goto out;
5648  }
5649  }
5650  status = check_nfs41_dirquery_args(RxContext);
5651  if (status) goto out;
5652 
5653  switch (InfoClass) {
5654  case FileRenameInformation:
5655  {
5656  PFILE_RENAME_INFORMATION rinfo =
5657  (PFILE_RENAME_INFORMATION)RxContext->Info.Buffer;
5659  (USHORT)rinfo->FileNameLength, rinfo->FileName };
5660 #ifdef DEBUG_FILE_SET
5661  DbgP("Attempting to rename to '%wZ'\n", &dst);
5662 #endif
5663  if (isFilenameTooLong(&dst, pVNetRootContext)) {
5665  goto out;
5666  }
5667  if (rinfo->RootDirectory) {
5669  goto out;
5670  }
5671  break;
5672  }
5673  case FileLinkInformation:
5674  {
5675  PFILE_LINK_INFORMATION linfo =
5676  (PFILE_LINK_INFORMATION)RxContext->Info.Buffer;
5678  (USHORT)linfo->FileNameLength, linfo->FileName };
5679 #ifdef DEBUG_FILE_SET
5680  DbgP("Attempting to add link as '%wZ'\n", &dst);
5681 #endif
5682  if (isFilenameTooLong(&dst, pVNetRootContext)) {
5684  goto out;
5685  }
5686  if (linfo->RootDirectory) {
5688  goto out;
5689  }
5690  break;
5691  }
5693  {
5695  (PFILE_DISPOSITION_INFORMATION)RxContext->Info.Buffer;
5696  __notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb);
5697  if (dinfo->DeleteFile && nfs41_fcb->DeletePending) {
5699  goto out;
5700  }
5701  break;
5702  }
5703  case FileBasicInformation:
5706  break;
5707  default:
5708  print_error("nfs41_SetFileInformation: unhandled class %d\n", InfoClass);
5710  }
5711 
5712 out:
5713  return status;
5714 }
#define __notnull
Definition: sal_old.h:93
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:308
struct _FILE_DISPOSITION_INFORMATION * PFILE_DISPOSITION_INFORMATION
#define NFS41GetFcbExtension(pFcb)
Definition: nfs41_driver.c:409
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN isFilenameTooLong(PUNICODE_STRING name, PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext)
#define DbgP(_x_)
Definition: nfs41_np.c:34
#define FILE_WRITE_DATA
Definition: nt_native.h:631
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
static FILE * out
Definition: regtests2xml.c:44
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
struct _FILE_RENAME_INFORMATION * PFILE_RENAME_INFORMATION
NTSTATUS check_nfs41_dirquery_args(IN PRX_CONTEXT RxContext)
unsigned short USHORT
Definition: pedump.c:61
struct _FILE_LINK_INFORMATION * PFILE_LINK_INFORMATION
#define NFS41GetVNetRootExtension(pVNetRoot)
Definition: nfs41_driver.c:395
GLenum GLenum dst
Definition: glext.h:6340
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by nfs41_SetFileInformation().

◆ check_nfs41_setea_args()

NTSTATUS check_nfs41_setea_args ( IN PRX_CONTEXT  RxContext)

Definition at line 4767 of file nfs41_driver.c.

4769 {
4770  NTSTATUS status;
4771  __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
4772  NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
4774  &pVNetRootContext->FsAttrs;
4776  (PFILE_FULL_EA_INFORMATION)RxContext->Info.Buffer;
4777 
4778  status = check_nfs41_dirquery_args(RxContext);
4779  if (status) goto out;
4780 
4781  if (ea == NULL) {
4783  goto out;
4784  }
4785  if (AnsiStrEq(&NfsActOnLink, ea->EaName, ea->EaNameLength) ||
4786  AnsiStrEq(&NfsSymlinkTargetName, ea->EaName, ea->EaNameLength)) {
4787  status = STATUS_INVALID_PARAMETER; /* only allowed on create */
4788  goto out;
4789  }
4790  /* ignore cygwin EAs when checking support */
4791  if (!(FsAttrs->FileSystemAttributes & FILE_SUPPORTS_EXTENDED_ATTRIBUTES)
4792  && !AnsiStrEq(&NfsV3Attributes, ea->EaName, ea->EaNameLength)) {
4794  goto out;
4795  }
4796  if ((RxContext->pRelevantSrvOpen->DesiredAccess & FILE_WRITE_EA) == 0) {
4798  goto out;
4799  }
4800  if (pVNetRootContext->read_only) {
4801  print_error("check_nfs41_setattr_args: Read-only mount\n");
4803  goto out;
4804  }
4805 out:
4806  return status;
4807 }
#define __notnull
Definition: sal_old.h:93
#define STATUS_EAS_NOT_SUPPORTED
Definition: ntstatus.h:301
#define FILE_WRITE_EA
Definition: nt_native.h:640
struct _FILE_FULL_EA_INFORMATION * PFILE_FULL_EA_INFORMATION
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
INLINE BOOL AnsiStrEq(IN const ANSI_STRING *lhs, IN const CHAR *rhs, IN const UCHAR rhs_len)
Definition: nfs41_driver.c:123
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
static FILE * out
Definition: regtests2xml.c:44
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
NTSTATUS check_nfs41_dirquery_args(IN PRX_CONTEXT RxContext)
#define NFS41GetVNetRootExtension(pVNetRoot)
Definition: nfs41_driver.c:395
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES
Definition: from_kernel.h:250
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by nfs41_SetEaInformation().

◆ check_nfs41_setreparse_args()

NTSTATUS check_nfs41_setreparse_args ( IN PRX_CONTEXT  RxContext)

Definition at line 6580 of file nfs41_driver.c.

6582 {
6584  __notnull XXCTL_LOWIO_COMPONENT *FsCtl = &RxContext->LowIoContext.ParamsFor.FsCtl;
6585  __notnull PREPARSE_DATA_BUFFER Reparse = (PREPARSE_DATA_BUFFER)FsCtl->pInputBuffer;
6586  __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen;
6587  __notnull PNFS41_V_NET_ROOT_EXTENSION VNetRootContext =
6588  NFS41GetVNetRootExtension(SrvOpen->pVNetRoot);
6589  const ULONG HeaderLen = REPARSE_DATA_BUFFER_HEADER_SIZE;
6590 
6591  /* access checks */
6592  if (VNetRootContext->read_only) {
6594  goto out;
6595  }
6596  if (!(SrvOpen->DesiredAccess & (FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES))) {
6598  goto out;
6599  }
6600 
6601  /* must have a filename longer than vnetroot name,
6602  * or it's trying to operate on the volume itself */
6603  if (is_root_directory(RxContext)) {
6605  goto out;
6606  }
6607  if (FsCtl->pOutputBuffer != NULL) {
6609  goto out;
6610  }
6611 
6612  /* validate input buffer and length */
6613  if (!Reparse) {
6615  goto out;
6616  }
6617 
6618  if (FsCtl->InputBufferLength < HeaderLen ||
6619  FsCtl->InputBufferLength > MAXIMUM_REPARSE_DATA_BUFFER_SIZE) {
6621  goto out;
6622  }
6623  if (FsCtl->InputBufferLength != HeaderLen + Reparse->ReparseDataLength) {
6625  goto out;
6626  }
6627 
6628  /* validate reparse tag */
6629  if (!IsReparseTagValid(Reparse->ReparseTag)) {
6631  goto out;
6632  }
6633  if (Reparse->ReparseTag != IO_REPARSE_TAG_SYMLINK) {
6635  goto out;
6636  }
6637 out:
6638  return status;
6639 }
#define IsReparseTagValid(tag)
Definition: iotypes.h:6868
#define __notnull
Definition: sal_old.h:93
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
static BOOLEAN is_root_directory(PRX_CONTEXT RxContext)
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define STATUS_IO_REPARSE_TAG_MISMATCH
Definition: ntstatus.h:741
#define STATUS_IO_REPARSE_DATA_INVALID
Definition: ntstatus.h:742
smooth NULL
Definition: ftsmooth.c:416
#define STATUS_MEDIA_WRITE_PROTECTED
Definition: udferr_usr.h:161
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:636
static FILE * out
Definition: regtests2xml.c:44
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define REPARSE_DATA_BUFFER_HEADER_SIZE
Definition: iotypes.h:6842
#define NFS41GetVNetRootExtension(pVNetRoot)
Definition: nfs41_driver.c:395
#define STATUS_IO_REPARSE_TAG_INVALID
Definition: ntstatus.h:740
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE
Definition: iotypes.h:6856
static SERVICE_STATUS status
Definition: service.c:31
#define IO_REPARSE_TAG_SYMLINK
Definition: iotypes.h:6883
struct _REPARSE_DATA_BUFFER * PREPARSE_DATA_BUFFER
Definition: ps.c:97

Referenced by nfs41_SetReparsePoint().

◆ check_nfs41_write_args()

NTSTATUS check_nfs41_write_args ( IN PRX_CONTEXT  RxContext)

Definition at line 6132 of file nfs41_driver.c.

6134 {
6136  __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
6137  NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
6138 
6139  if (!RxContext->LowIoContext.ParamsFor.ReadWrite.Buffer) {
6141  goto out;
6142  }
6143 
6144  if (pVNetRootContext->read_only) {
6145  print_error("check_nfs41_write_args: Read-only mount\n");
6147  goto out;
6148  }
6149 out:
6150  return status;
6151 }
#define __notnull
Definition: sal_old.h:93
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
static FILE * out
Definition: regtests2xml.c:44
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define NFS41GetVNetRootExtension(pVNetRoot)
Definition: nfs41_driver.c:395
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by nfs41_Write().

◆ create_nfs3_attrs()

void create_nfs3_attrs ( nfs3_attrs attrs,
PNFS41_FCB  nfs41_fcb 
)

Definition at line 4723 of file nfs41_driver.c.

4726 {
4727  RtlZeroMemory(attrs, sizeof(nfs3_attrs));
4729  attrs->type = NF3LNK;
4730  else if (nfs41_fcb->StandardInfo.Directory)
4731  attrs->type = NF3DIR;
4732  else
4733  attrs->type = NF3REG;
4734  attrs->mode = nfs41_fcb->mode;
4735  attrs->nlink = nfs41_fcb->StandardInfo.NumberOfLinks;
4736  attrs->size.QuadPart = attrs->used.QuadPart =
4737  nfs41_fcb->StandardInfo.EndOfFile.QuadPart;
4738  file_time_to_nfs_time(&nfs41_fcb->BasicInfo.LastAccessTime, &attrs->atime);
4739  file_time_to_nfs_time(&nfs41_fcb->BasicInfo.ChangeTime, &attrs->mtime);
4740  file_time_to_nfs_time(&nfs41_fcb->BasicInfo.CreationTime, &attrs->ctime);
4741 }
LARGE_INTEGER LastAccessTime
Definition: nt_native.h:940
FILE_STANDARD_INFORMATION StandardInfo
Definition: nfs41_driver.c:403
LONGLONG ctime
Definition: nfs41_driver.c:140
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
LARGE_INTEGER used
Definition: nfs41_driver.c:134
LARGE_INTEGER CreationTime
Definition: nt_native.h:939
LONGLONG mtime
Definition: nfs41_driver.c:140
LARGE_INTEGER ChangeTime
Definition: nt_native.h:942
LONGLONG atime
Definition: nfs41_driver.c:140
FILE_BASIC_INFORMATION BasicInfo
Definition: nfs41_driver.c:402
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
LARGE_INTEGER size
Definition: nfs41_driver.c:134
void file_time_to_nfs_time(IN const PLARGE_INTEGER file_time, OUT LONGLONG *nfs_time)
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by QueryCygwinEA().

◆ create_should_pass_ea()

static BOOLEAN create_should_pass_ea ( IN PFILE_FULL_EA_INFORMATION  ea,
IN ULONG  disposition 
)
static

Definition at line 3601 of file nfs41_driver.c.

3604 {
3605  /* don't pass cygwin EAs */
3606  if (AnsiStrEq(&NfsV3Attributes, ea->EaName, ea->EaNameLength)
3607  || AnsiStrEq(&NfsActOnLink, ea->EaName, ea->EaNameLength)
3608  || AnsiStrEq(&NfsSymlinkTargetName, ea->EaName, ea->EaNameLength))
3609  return FALSE;
3610  /* only set EAs on file creation */
3611  return disposition == FILE_SUPERSEDE || disposition == FILE_CREATE
3612  || disposition == FILE_OPEN_IF || disposition == FILE_OVERWRITE
3613  || disposition == FILE_OVERWRITE_IF;
3614 }
#define FILE_OPEN_IF
Definition: from_kernel.h:56
INLINE BOOL AnsiStrEq(IN const ANSI_STRING *lhs, IN const CHAR *rhs, IN const UCHAR rhs_len)
Definition: nfs41_driver.c:123
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_OVERWRITE
Definition: from_kernel.h:57
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
#define FILE_SUPERSEDE
Definition: from_kernel.h:53

◆ DECLARE_CONST_ANSI_STRING() [1/3]

DECLARE_CONST_ANSI_STRING ( NfsV3Attributes  ,
"NfsV3Attributes"   
)

◆ DECLARE_CONST_ANSI_STRING() [2/3]

DECLARE_CONST_ANSI_STRING ( NfsSymlinkTargetName  ,
"NfsSymlinkTargetName"   
)

◆ DECLARE_CONST_ANSI_STRING() [3/3]

DECLARE_CONST_ANSI_STRING ( NfsActOnLink  ,
"NfsActOnLink"   
)

◆ DECLARE_CONST_UNICODE_STRING() [1/7]

DECLARE_CONST_UNICODE_STRING ( NfsPrefix  ,
L"\\nfs4"   
)

◆ DECLARE_CONST_UNICODE_STRING() [2/7]

DECLARE_CONST_UNICODE_STRING ( AUTH_SYS_NAME  ,
L"sys"   
)

◆ DECLARE_CONST_UNICODE_STRING() [3/7]

DECLARE_CONST_UNICODE_STRING ( AUTHGSS_KRB5_NAME  ,
L"krb5"   
)

◆ DECLARE_CONST_UNICODE_STRING() [4/7]

DECLARE_CONST_UNICODE_STRING ( AUTHGSS_KRB5I_NAME  ,
L"krb5i"   
)

◆ DECLARE_CONST_UNICODE_STRING() [5/7]

DECLARE_CONST_UNICODE_STRING ( AUTHGSS_KRB5P_NAME  ,
L"krb5p"   
)

◆ DECLARE_CONST_UNICODE_STRING() [6/7]

DECLARE_CONST_UNICODE_STRING ( SLASH  ,
L"\\"   
)

◆ DECLARE_CONST_UNICODE_STRING() [7/7]

DECLARE_CONST_UNICODE_STRING ( EMPTY_STRING  ,
L""   
)

◆ denied_lock_backoff()

void denied_lock_backoff ( IN OUT PLARGE_INTEGER  delay)

Definition at line 6334 of file nfs41_driver.c.

6336 {
6337  if (delay->QuadPart == 0)
6338  delay->QuadPart = MIN_LOCK_POLL_WAIT;
6339  else
6340  delay->QuadPart <<= 1;
6341 
6342  if (delay->QuadPart < MAX_LOCK_POLL_WAIT)
6343  delay->QuadPart = MAX_LOCK_POLL_WAIT;
6344 }
#define MAX_LOCK_POLL_WAIT
void delay(unsigned msec)
Definition: i386rtl.c:32
#define MIN_LOCK_POLL_WAIT

Referenced by nfs41_Lock().

◆ DRIVER_DISPATCH()

DRIVER_DISPATCH ( nfs41_FsdDispatch  )

◆ DriverEntry()

NTSTATUS DriverEntry ( IN PDRIVER_OBJECT  drv,
IN PUNICODE_STRING  path 
)

Definition at line 7114 of file nfs41_driver.c.

7118 {
7119  NTSTATUS status;
7120  ULONG flags = 0, i;
7121  UNICODE_STRING dev_name, user_dev_name;
7122  PNFS41_DEVICE_EXTENSION dev_exts;
7123  TIME_FIELDS jan_1_1970 = {1970, 1, 1, 0, 0, 0, 0, 0};
7124  ACCESS_MASK mask = 0;
7125  OBJECT_ATTRIBUTES oattrs;
7126 
7127  DbgEn();
7128 
7129  status = RxDriverEntry(drv, path);
7130  if (status != STATUS_SUCCESS) {
7131  print_error("RxDriverEntry failed: %08lx\n", status);
7132  goto out;
7133  }
7134 
7137 
7138  status = nfs41_init_ops();
7139  if (status != STATUS_SUCCESS) {
7140  print_error("nfs41_init_ops failed to initialize dispatch table\n");
7141  goto out;
7142  }
7143 
7144  DbgP("calling RxRegisterMinirdr\n");
7146  sizeof(NFS41_DEVICE_EXTENSION),
7148  if (status != STATUS_SUCCESS) {
7149  print_error("RxRegisterMinirdr failed: %08lx\n", status);
7150  goto out;
7151  }
7152 #ifndef __REACTOS__
7153  nfs41_dev->Flags |= DO_BUFFERED_IO;
7154 #endif
7155 
7156  dev_exts = (PNFS41_DEVICE_EXTENSION)
7157  ((PBYTE)(nfs41_dev) + sizeof(RDBSS_DEVICE_OBJECT));
7158 
7160  dev_exts->DeviceObject = nfs41_dev;
7162  &dev_exts->VolAttrsLen);
7163 
7165  DbgP("calling IoCreateSymbolicLink %wZ %wZ\n", &user_dev_name, &dev_name);
7166  status = IoCreateSymbolicLink(&user_dev_name, &dev_name);
7167  if (status != STATUS_SUCCESS) {
7168  print_error("Device name IoCreateSymbolicLink failed: %08lx\n", status);
7169  goto out_unregister;
7170  }
7171 
7183  &oattrs, NULL, NULL, &fcbopen_main, NULL);
7184  if (status != STATUS_SUCCESS)
7185  goto out_unregister;
7186 
7187  drv->DriverUnload = nfs41_driver_unload;
7188 
7189  for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
7190  drv->MajorFunction[i] = (PDRIVER_DISPATCH)nfs41_FsdDispatch;
7191 
7192  RtlTimeFieldsToTime(&jan_1_1970, &unix_time_diff);
7193 
7194 out_unregister:
7195  if (status != STATUS_SUCCESS)
7197 out:
7198  DbgEx();
7199  return status;
7200 }
#define DbgEx()
Definition: nfs41_debug.h:61
void nfs41_create_volume_info(PFILE_FS_VOLUME_INFORMATION pVolInfo, DWORD *len)
PRDBSS_DEVICE_OBJECT nfs41_dev
Definition: nfs41_driver.c:87
LIST_ENTRY head
Definition: nfs41_driver.c:271
FAST_MUTEX fcblistLock
Definition: nfs41_driver.c:102
#define IRP_MJ_MAXIMUM_FUNCTION
LONG NTSTATUS
Definition: precomp.h:26
#define NFS41_SHADOW_DEVICE_NAME
Definition: nfs41_driver.h:26
DRIVER_UNLOAD nfs41_driver_unload
Definition: nfs41_driver.c:83
NTSTATUS NTAPI RxDriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
const char * dev_name(int device)
Definition: wave.c:211
nfs41_fcb_list openlist
Definition: nfs41_driver.c:462
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
NTSTATUS NTAPI RxRegisterMinirdr(_Out_ PRDBSS_DEVICE_OBJECT *DeviceObject, _Inout_ PDRIVER_OBJECT DriverObject, _In_ PMINIRDR_DISPATCH MrdrDispatch, _In_ ULONG Controls, _In_ PUNICODE_STRING DeviceName, _In_ ULONG DeviceExtensionSize, _In_ DEVICE_TYPE DeviceType, _In_ ULONG DeviceCharacteristics)
PRDBSS_DEVICE_OBJECT DeviceObject
Definition: nfs41_driver.c:437
FAST_MUTEX downcallLock
Definition: nfs41_driver.c:102
smooth NULL
Definition: ftsmooth.c:416
#define RX_REGISTERMINI_FLAG_DONT_PROVIDE_MAILSLOTS
Definition: mrx.h:10
#define DbgP(_x_)
Definition: nfs41_np.c:34
FORCEINLINE VOID NTAPI RxUnregisterMinirdr(_In_ PRDBSS_DEVICE_OBJECT RxDeviceObject)
Definition: rxstruc.h:136
#define NFS41_DEVICE_NAME
Definition: nfs41_driver.h:25
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
KSTART_ROUTINE fcbopen_main
static FILE * out
Definition: regtests2xml.c:44
FAST_MUTEX upcallLock
Definition: nfs41_driver.c:102
GLbitfield flags
Definition: glext.h:7161
NTSTATUS nfs41_init_ops()
LARGE_INTEGER unix_time_diff
Definition: nfs41_driver.c:142
#define FILE_REMOTE_DEVICE
Definition: nt_native.h:811
struct _NFS41_DEVICE_EXTENSION * PNFS41_DEVICE_EXTENSION
#define DbgEn()
Definition: nfs41_debug.h:57
#define RxDefineNode(node, type)
Definition: nfs41_driver.c:467
FAST_MUTEX openOwnerLock
Definition: nfs41_driver.c:104
nfs41_updowncall_list downcall
Definition: nfs41_driver.c:273
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
DRIVER_DISPATCH * PDRIVER_DISPATCH
Definition: iotypes.h:2153
FAST_MUTEX xidLock
Definition: nfs41_driver.c:103
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
Definition: services.c:325
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
#define FILE_DEVICE_NETWORK_FILE_SYSTEM
Definition: winioctl.h:125
nfs41_updowncall_list upcall
Definition: nfs41_driver.c:273
BYTE VolAttrs[VOL_ATTR_LEN]
Definition: nfs41_driver.c:441
LIST_ENTRY head
Definition: nfs41_driver.c:460
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
KEVENT upcallEvent
Definition: nfs41_driver.c:101
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
struct _MINIRDR_DISPATCH nfs41_ops
Definition: nfs41_driver.c:86
static SERVICE_STATUS status
Definition: service.c:31
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
BYTE * PBYTE
Definition: pedump.c:66
ULONG ACCESS_MASK
Definition: nt_native.h:40
NTSTATUS nfs41_FsdDispatch(IN PDEVICE_OBJECT dev, IN PIRP Irp)
Definition: ps.c:97

◆ enable_caching()

void enable_caching ( PMRX_SRV_OPEN  SrvOpen,
PNFS41_FOBX  nfs41_fobx,
ULONGLONG  ChangeTime,
HANDLE  session 
)

Definition at line 5933 of file nfs41_driver.c.

5938 {
5939  ULONG flag = 0;
5940  PLIST_ENTRY pEntry;
5941  nfs41_fcb_list_entry *cur;
5942  BOOLEAN found = FALSE;
5943 
5944  if (SrvOpen->DesiredAccess & FILE_READ_DATA)
5946  if ((SrvOpen->DesiredAccess & FILE_WRITE_DATA) &&
5947  !nfs41_fobx->write_thru)
5949  if ((SrvOpen->DesiredAccess & FILE_READ_DATA) &&
5950  (SrvOpen->DesiredAccess & FILE_WRITE_DATA) &&
5951  !nfs41_fobx->write_thru)
5953 
5954 #if defined(DEBUG_TIME_BASED_COHERENCY) || \
5955  defined(DEBUG_WRITE) || defined(DEBUG_READ)
5957 #endif
5958 
5959  if (!flag)
5960  return;
5961 
5963 
5965  pEntry = openlist.head.Flink;
5966  while (!IsListEmpty(&openlist.head)) {
5967  cur = (nfs41_fcb_list_entry *)CONTAINING_RECORD(pEntry,
5969  if (cur->fcb == SrvOpen->pFcb) {
5970 #ifdef DEBUG_TIME_BASED_COHERENCY
5971  DbgP("enable_caching: Looked&Found match for fcb=%p %wZ\n",
5972  SrvOpen->pFcb, SrvOpen->pAlreadyPrefixedName);
5973 #endif
5974  cur->skip = FALSE;
5975  found = TRUE;
5976  break;
5977  }
5978  if (pEntry->Flink == &openlist.head) {
5979 #ifdef DEBUG_TIME_BASED_COHERENCY
5980  DbgP("enable_caching: reached EOL looking for fcb=%p %wZ\n",
5981  SrvOpen->pFcb, SrvOpen->pAlreadyPrefixedName);
5982 #endif
5983  break;
5984  }
5985  pEntry = pEntry->Flink;
5986  }
5987  if (!found && nfs41_fobx->deleg_type) {
5988  nfs41_fcb_list_entry *oentry;
5989 #ifdef DEBUG_TIME_BASED_COHERENCY
5990  DbgP("enable_caching: delegation recalled: srv_open=%p\n", SrvOpen);
5991 #endif
5994  if (oentry == NULL) return;
5995  oentry->fcb = SrvOpen->pFcb;
5996  oentry->session = session;
5997  oentry->nfs41_fobx = nfs41_fobx;
5998  oentry->ChangeTime = ChangeTime;
5999  oentry->skip = FALSE;
6000  InsertTailList(&openlist.head, &oentry->next);
6001  nfs41_fobx->deleg_type = 0;
6002  }
6004 }
#define TRUE
Definition: types.h:120
#define ULongToPtr(ul)
Definition: basetsd.h:92
PMRX_FCB fcb
Definition: nfs41_driver.c:452
FAST_MUTEX fcblistLock
Definition: nfs41_driver.c:102
#define ENABLE_WRITE_CACHING
Definition: nfs41_driver.c:91
NTSTATUS NTAPI RxChangeBufferingState(PSRV_OPEN SrvOpen, PVOID Context, BOOLEAN ComputeNewState)
Definition: rxce.c:783
ACCESS_MASK DesiredAccess
Definition: mrxfcb.h:173
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
nfs41_fcb_list openlist
Definition: nfs41_driver.c:462
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
ULONGLONG ChangeTime
Definition: nfs41_driver.c:455
#define FILE_READ_DATA
Definition: nt_native.h:628
Definition: nfs41_driver.c:450
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define DbgP(_x_)
Definition: nfs41_np.c:34
#define FILE_WRITE_DATA
Definition: nt_native.h:631
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
DWORD deleg_type
Definition: nfs41_driver.c:421
#define RxAllocatePoolWithTag
Definition: ntrxdef.h:25
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
PUNICODE_STRING pAlreadyPrefixedName
Definition: mrxfcb.h:169
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
Definition: typedefs.h:117
Definition: fcb.h:260
#define ENABLE_READ_CACHING
Definition: nfs41_driver.c:90
void print_caching_level(int on, ULONG flag, PUNICODE_STRING name)
Definition: nfs41_debug.c:582
static unsigned __int64 next
Definition: rand_nt.c:6
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
BOOLEAN skip
Definition: nfs41_driver.c:456
LIST_ENTRY head
Definition: nfs41_driver.c:460
LIST_ENTRY next
Definition: nfs41_driver.c:451
unsigned int ULONG
Definition: retypes.h:1
#define NFS41_MM_POOLTAG_OPEN
Definition: nfs41_driver.c:97
PNFS41_FOBX nfs41_fobx
Definition: nfs41_driver.c:454
HANDLE session
Definition: nfs41_driver.c:453
#define ENABLE_READWRITE_CACHING
Definition: nfs41_driver.c:92
BOOLEAN write_thru
Definition: nfs41_driver.c:422

Referenced by nfs41_Read(), and nfs41_Write().

◆ fcbopen_main()

VOID fcbopen_main ( PVOID  ctx)

Definition at line 7015 of file nfs41_driver.c.

7017 {
7018  NTSTATUS status;
7020 
7021  DbgEn();
7022  timeout.QuadPart = RELATIVE(SECONDS(30));
7023  while(1) {
7024  PLIST_ENTRY pEntry;
7025  nfs41_fcb_list_entry *cur;
7028  pEntry = openlist.head.Flink;
7029  while (!IsListEmpty(&openlist.head)) {
7030  PNFS41_NETROOT_EXTENSION pNetRootContext;
7032  FILE_BASIC_INFORMATION binfo;
7033  PNFS41_FCB nfs41_fcb;
7034  cur = (nfs41_fcb_list_entry *)CONTAINING_RECORD(pEntry,
7036 
7037 #ifdef DEBUG_TIME_BASED_COHERENCY
7038  DbgP("fcbopen_main: Checking attributes for fcb=%p "
7039  "change_time=%llu skipping=%d\n", cur->fcb,
7040  cur->ChangeTime, cur->skip);
7041 #endif
7042  if (cur->skip) goto out;
7043  pNetRootContext =
7045  /* place an upcall for this srv_open */
7047  &cur->nfs41_fobx->sec_ctx, cur->session,
7049  pNetRootContext->nfs41d_version, NULL, &entry);
7050  if (status) goto out;
7051 
7052  entry->u.QueryFile.InfoClass = FileBasicInformation;
7053  entry->buf = &binfo;
7054  entry->buf_len = sizeof(binfo);
7055 
7057  if (status) goto out;
7058 
7059  if (cur->ChangeTime != entry->ChangeTime) {
7061  PMRX_SRV_OPEN srv_open;
7062  PLIST_ENTRY psrvEntry;
7063 #ifdef DEBUG_TIME_BASED_COHERENCY
7064  DbgP("fcbopen_main: old ctime=%llu new_ctime=%llu\n",
7065  cur->ChangeTime, entry->ChangeTime);
7066 #endif
7067  cur->ChangeTime = entry->ChangeTime;
7068  cur->skip = TRUE;
7069  psrvEntry = &cur->fcb->SrvOpenList;
7070  psrvEntry = psrvEntry->Flink;
7071  while (!IsListEmpty(&cur->fcb->SrvOpenList)) {
7072  srv_open = (PMRX_SRV_OPEN)CONTAINING_RECORD(psrvEntry,
7073  MRX_SRV_OPEN, SrvOpenQLinks);
7074  if (srv_open->DesiredAccess &
7076 #ifdef DEBUG_TIME_BASED_COHERENCY
7077  DbgP("fcbopen_main: ************ Invalidate the cache %wZ"
7078  "************\n", srv_open->pAlreadyPrefixedName);
7079 #endif
7081  cur->fcb->pNetRoot->pSrvCall, srv_open,
7082  srv_open->Key, ULongToPtr(flag));
7083  }
7084  if (psrvEntry->Flink == &cur->fcb->SrvOpenList) {
7085 #ifdef DEBUG_TIME_BASED_COHERENCY
7086  DbgP("fcbopen_main: reached end of srvopen for fcb %p\n",
7087  cur->fcb);
7088 #endif
7089  break;
7090  }
7091  psrvEntry = psrvEntry->Flink;
7092  };
7093  }
7094  nfs41_fcb = (PNFS41_FCB)cur->fcb->Context;
7095  nfs41_fcb->changeattr = entry->ChangeTime;
7096  RxFreePool(entry);
7097 out:
7098  if (pEntry->Flink == &openlist.head) {
7099 #ifdef DEBUG_TIME_BASED_COHERENCY
7100  DbgP("fcbopen_main: reached end of the fcb list\n");
7101 #endif
7102  break;
7103  }
7104  pEntry = pEntry->Flink;
7105  }
7107  }
7108  DbgEx();
7109 }
#define NFS41GetNetRootExtension(pNetRoot)
Definition: nfs41_driver.c:365
#define DbgEx()
Definition: nfs41_debug.h:61
HANDLE nfs41_open_state
Definition: nfs41_driver.c:416
#define TRUE
Definition: types.h:120
#define ULongToPtr(ul)
Definition: basetsd.h:92
PMRX_FCB fcb
Definition: nfs41_driver.c:452
FAST_MUTEX fcblistLock
Definition: nfs41_driver.c:102
PVOID Context
Definition: mrxfcb.h:112
ACCESS_MASK DesiredAccess
Definition: mrxfcb.h:173
uint8_t entry
Definition: isohybrid.c:63
LONG NTSTATUS
Definition: precomp.h:26
ULONGLONG changeattr
Definition: nfs41_driver.c:407
Definition: dhcpd.h:245
#define FILE_APPEND_DATA
Definition: nt_native.h:634
NTSTATUS nfs41_UpcallWaitForReply(IN nfs41_updowncall_entry *entry, IN DWORD secs)
#define RELATIVE(wait)
Definition: nfs41_driver.c:113
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
nfs41_fcb_list openlist
Definition: nfs41_driver.c:462
#define RxFreePool
Definition: ntrxdef.h:26
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
GLbitfield GLuint64 timeout
Definition: glext.h:7164
#define DISABLE_CACHING
Definition: nfs41_driver.c:89
ULONGLONG ChangeTime
Definition: nfs41_driver.c:455
NTSTATUS nfs41_UpcallCreate(IN DWORD opcode, IN PSECURITY_CLIENT_CONTEXT clnt_sec_ctx, IN HANDLE session, IN HANDLE open_state, IN DWORD version, IN PUNICODE_STRING filename, OUT nfs41_updowncall_entry **entry_out)
#define FILE_READ_DATA
Definition: nt_native.h:628
Definition: nfs41_driver.c:450
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
smooth NULL
Definition: ftsmooth.c:416
#define DbgP(_x_)
Definition: nfs41_np.c:34
Definition: nfs41_driver.c:166
#define FILE_WRITE_DATA
Definition: nt_native.h:631
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
VOID NTAPI RxIndicateChangeOfBufferingStateForSrvOpen(PMRX_SRV_CALL SrvCall, PMRX_SRV_OPEN SrvOpen, PVOID SrvOpenKey, PVOID Context)
Definition: rdbss.c:6880
static FILE * out
Definition: regtests2xml.c:44
PUNICODE_STRING pAlreadyPrefixedName
Definition: mrxfcb.h:169
PMRX_NET_ROOT pNetRoot
Definition: mrxfcb.h:111
SECURITY_CLIENT_CONTEXT sec_ctx
Definition: nfs41_driver.c:417
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
struct _MRX_SRV_OPEN_ * PMRX_SRV_OPEN
#define DbgEn()
Definition: nfs41_debug.h:57
#define UPCALL_TIMEOUT_DEFAULT
Definition: nfs41_driver.c:340
Definition: typedefs.h:117
static unsigned __int64 next
Definition: rand_nt.c:6
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
BOOLEAN skip
Definition: nfs41_driver.c:456
PMRX_SRV_CALL pSrvCall
Definition: mrxfcb.h:56
LIST_ENTRY head
Definition: nfs41_driver.c:460
unsigned int ULONG
Definition: retypes.h:1
struct _NFS41_FCB * PNFS41_FCB
LIST_ENTRY SrvOpenList
Definition: mrxfcb.h:126
#define SECONDS(seconds)
Definition: nfs41_driver.c:117
static SERVICE_STATUS status
Definition: service.c:31
PNFS41_FOBX nfs41_fobx
Definition: nfs41_driver.c:454
HANDLE session
Definition: nfs41_driver.c:453
PVOID Key
Definition: mrxfcb.h:172
Definition: ps.c:97

◆ file_time_to_nfs_time()

void file_time_to_nfs_time ( IN const PLARGE_INTEGER  file_time,
OUT LONGLONG nfs_time 
)

Definition at line 4714 of file nfs41_driver.c.

4717 {
4719  diff.QuadPart = file_time->QuadPart - diff.QuadPart;
4720  *nfs_time = diff.QuadPart / 10000000;
4721 }
LARGE_INTEGER unix_time_diff
Definition: nfs41_driver.c:142
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by create_nfs3_attrs(), and get_nfs_time().

◆ GetConnectionHandle()

NTSTATUS GetConnectionHandle ( IN PUNICODE_STRING  ConnectionName,
IN PVOID  EaBuffer,
IN ULONG  EaLength,
OUT PHANDLE  Handle 
)

Definition at line 2088 of file nfs41_driver.c.

2093 {
2094  NTSTATUS status;
2097 
2098 #ifdef DEBUG_MOUNT
2099  DbgEn();
2100 #endif
2103 
2104  print_error("Len %d Buf %p\n", EaLength, EaBuffer);
2105 
2106  status = ZwCreateFile(Handle, SYNCHRONIZE, &ObjectAttributes,
2109  FILE_OPEN_IF,
2111  EaBuffer, EaLength);
2112 
2113 #ifdef DEBUG_MOUNT
2114  DbgEx();
2115 #endif
2116  return status;
2117 }
#define DbgEx()
Definition: nfs41_debug.h:61
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define FILE_OPEN_IF
Definition: from_kernel.h:56
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG _In_opt_ PVOID EaBuffer
Definition: iofuncs.h:835
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE Handle
Definition: extypes.h:390
IN PVCB IN PDIRENT OUT PULONG EaLength
Definition: fatprocs.h:866
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define DbgEn()
Definition: nfs41_debug.h:57
#define SYNCHRONIZE
Definition: nt_native.h:61
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define FILE_CREATE_TREE_CONNECTION
Definition: from_kernel.h:33
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
static SERVICE_STATUS status
Definition: service.c:31
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
Definition: ps.c:97

Referenced by nfs41_CreateConnection(), and nfs41_DeleteConnection().

◆ handle_upcall()

NTSTATUS handle_upcall ( IN PRX_CONTEXT  RxContext,
IN nfs41_updowncall_entry entry,
OUT ULONG len 
)

Definition at line 1324 of file nfs41_driver.c.

1328 {
1330  PLOWIO_CONTEXT LowIoContext = &RxContext->LowIoContext;
1331  ULONG cbOut = LowIoContext->ParamsFor.IoCtl.OutputBufferLength;
1332  unsigned char *pbOut = LowIoContext->ParamsFor.IoCtl.pOutputBuffer;
1333 
1334  status = SeImpersonateClientEx(entry->psec_ctx, NULL);
1335  if (status != STATUS_SUCCESS) {
1336  print_error("SeImpersonateClientEx failed %x\n", status);
1337  goto out;
1338  }
1339 
1340  switch(entry->opcode) {
1341  case NFS41_SHUTDOWN:
1342  status = marshal_nfs41_shutdown(entry, pbOut, cbOut, len);
1343  KeSetEvent(&entry->cond, 0, FALSE);
1344  break;
1345  case NFS41_MOUNT:
1346  status = marshal_nfs41_mount(entry, pbOut, cbOut, len);
1347  break;
1348  case NFS41_UNMOUNT:
1349  status = marshal_nfs41_unmount(entry, pbOut, cbOut, len);
1350  break;
1351  case NFS41_OPEN:
1352  status = marshal_nfs41_open(entry, pbOut, cbOut, len);
1353  break;
1354  case NFS41_READ:
1355  status = marshal_nfs41_rw(entry, pbOut, cbOut, len);
1356  break;
1357  case NFS41_WRITE:
1358  status = marshal_nfs41_rw(entry, pbOut, cbOut, len);
1359  break;
1360  case NFS41_LOCK:
1361  status = marshal_nfs41_lock(entry, pbOut, cbOut, len);
1362  break;
1363  case NFS41_UNLOCK:
1364  status = marshal_nfs41_unlock(entry, pbOut, cbOut, len);
1365  break;
1366  case NFS41_CLOSE:
1367  status = marshal_nfs41_close(entry, pbOut, cbOut, len);
1368  break;
1369  case NFS41_DIR_QUERY:
1370  status = marshal_nfs41_dirquery(entry, pbOut, cbOut, len);
1371  break;
1372  case NFS41_FILE_QUERY:
1373  status = marshal_nfs41_filequery(entry, pbOut, cbOut, len);
1374  break;
1375  case NFS41_FILE_SET:
1376  status = marshal_nfs41_fileset(entry, pbOut, cbOut, len);
1377  break;
1378  case NFS41_EA_SET:
1379  status = marshal_nfs41_easet(entry, pbOut, cbOut, len);
1380  break;
1381  case NFS41_EA_GET:
1382  status = marshal_nfs41_eaget(entry, pbOut, cbOut, len);
1383  break;
1384  case NFS41_SYMLINK:
1385  status = marshal_nfs41_symlink(entry, pbOut, cbOut, len);
1386  break;
1387  case NFS41_VOLUME_QUERY:
1388  status = marshal_nfs41_volume(entry, pbOut, cbOut, len);
1389  break;
1390  case NFS41_ACL_QUERY:
1391  status = marshal_nfs41_getacl(entry, pbOut, cbOut, len);
1392  break;
1393  case NFS41_ACL_SET:
1394  status = marshal_nfs41_setacl(entry, pbOut, cbOut, len);
1395  break;
1396  default:
1398  print_error("Unknown nfs41 ops %d\n", entry->opcode);
1399  }
1400 
1401  if (status == STATUS_SUCCESS)
1402  print_hexbuf(0, (unsigned char *)"upcall buffer", pbOut, *len);
1403 
1404 out:
1405  return status;
1406 }
NTSTATUS marshal_nfs41_eaget(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
PVOID pOutputBuffer
Definition: mrx.h:275
NTSTATUS marshal_nfs41_shutdown(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
NTSTATUS marshal_nfs41_volume(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSTATUS marshal_nfs41_unlock(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:849
NTSTATUS marshal_nfs41_dirquery(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:933
uint8_t entry
Definition: isohybrid.c:63
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS marshal_nfs41_symlink(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
NTSTATUS marshal_nfs41_setacl(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS marshal_nfs41_filequery(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
NTSTATUS marshal_nfs41_open(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:673
NTSTATUS marshal_nfs41_mount(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:616
ULONG OutputBufferLength
Definition: mrx.h:274
smooth NULL
Definition: ftsmooth.c:416
union _LOWIO_CONTEXT::@1969 ParamsFor
static FILE * out
Definition: regtests2xml.c:44
NTSTATUS marshal_nfs41_fileset(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
NTSTATUS marshal_nfs41_lock(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:812
NTSTATUS marshal_nfs41_close(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:890
GLenum GLsizei len
Definition: glext.h:6722
NTSTATUS NTAPI SeImpersonateClientEx(IN PSECURITY_CLIENT_CONTEXT ClientContext, IN PETHREAD ServerThread OPTIONAL)
Definition: access.c:589
XXCTL_LOWIO_COMPONENT IoCtl
Definition: mrx.h:309
NTSTATUS marshal_nfs41_unmount(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:664
NTSTATUS marshal_nfs41_rw(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:753
NTSTATUS marshal_nfs41_getacl(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
unsigned int ULONG
Definition: retypes.h:1
void print_hexbuf(int level, unsigned char *title, unsigned char *buf, int len)
Definition: daemon_debug.c:98
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
NTSTATUS marshal_nfs41_easet(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: ps.c:97

Referenced by nfs41_upcall().

◆ has_nfs_prefix()

NTSTATUS has_nfs_prefix ( IN PUNICODE_STRING  SrvCallName,
IN PUNICODE_STRING  NetRootName 
)

Definition at line 2927 of file nfs41_driver.c.

2930 {
2932 
2933  if (NetRootName->Length == SrvCallName->Length + NfsPrefix.Length) {
2934  const UNICODE_STRING NetRootPrefix = {
2935  NfsPrefix.Length,
2936  NetRootName->MaximumLength - SrvCallName->Length,
2937  &NetRootName->Buffer[SrvCallName->Length/2]
2938  };
2939  if (RtlCompareUnicodeString(&NetRootPrefix, &NfsPrefix, FALSE) == 0)
2941  }
2942  return status;
2943 }
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_BAD_NETWORK_NAME
Definition: ntstatus.h:426
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by nfs41_CreateVNetRoot().

◆ is_root_directory()

static BOOLEAN is_root_directory ( PRX_CONTEXT  RxContext)
static

Definition at line 4501 of file nfs41_driver.c.

4503 {
4504  __notnull PV_NET_ROOT VNetRoot = (PV_NET_ROOT)
4505  RxContext->pRelevantSrvOpen->pVNetRoot;
4506  __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
4508 
4509  /* calculate the root directory's length, including vnetroot prefix,
4510  * mount path, and a trailing \ */
4511  const USHORT RootPathLen = VNetRoot->PrefixEntry.Prefix.Length +
4512  pVNetRootContext->MountPathLen + sizeof(WCHAR);
4513 
4514  return RxContext->CurrentIrpSp->FileObject->FileName.Length <= RootPathLen;
4515 }
#define __notnull
Definition: sal_old.h:93
#define WCHAR
Definition: msvc.h:43
struct _V_NET_ROOT * PV_NET_ROOT
PIO_STACK_LOCATION CurrentIrpSp
Definition: rxcontx.h:111
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
unsigned short USHORT
Definition: pedump.c:61
#define NFS41GetVNetRootExtension(pVNetRoot)
Definition: nfs41_driver.c:395
PMRX_V_NET_ROOT pVNetRoot
Definition: mrxfcb.h:162
PMRX_SRV_OPEN pRelevantSrvOpen
Definition: rxcontx.h:114

Referenced by check_nfs41_getreparse_args(), check_nfs41_setreparse_args(), and nfs41_QueryVolumeInformation().

◆ isDataAccess()

BOOLEAN isDataAccess ( ACCESS_MASK  mask)

Definition at line 3477 of file nfs41_driver.c.

3479 {
3481  return TRUE;
3482  return FALSE;
3483 }
#define TRUE
Definition: types.h:120
#define FILE_APPEND_DATA
Definition: nt_native.h:634
GLenum GLint GLuint mask
Definition: glext.h:6028
#define FILE_READ_DATA
Definition: nt_native.h:628
#define FILE_WRITE_DATA
Definition: nt_native.h:631

Referenced by nfs41_Create().

◆ isFilenameTooLong()

BOOLEAN isFilenameTooLong ( PUNICODE_STRING  name,
PNFS41_V_NET_ROOT_EXTENSION  pVNetRootContext 
)

Definition at line 3494 of file nfs41_driver.c.

3497 {
3498  PFILE_FS_ATTRIBUTE_INFORMATION attrs = &pVNetRootContext->FsAttrs;
3499  LONG len = attrs->MaximumComponentNameLength, count = 1, i;
3500  PWCH p = name->Buffer;
3501  for (i = 0; i < name->Length / 2; i++) {
3502  if (p[0] == L'\\') count = 1;
3503  else {
3504  if (p[0] == L'\0') return FALSE;
3505  if (count > len) return TRUE;
3506  count++;
3507  }
3508  p++;
3509  }
3510  return FALSE;
3511 }
#define TRUE
Definition: types.h:120
FILE_FS_ATTRIBUTE_INFORMATION FsAttrs
Definition: nfs41_driver.c:383
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
WCHAR * PWCH
Definition: ntbasedef.h:417
static const WCHAR L[]
Definition: oid.c:1087
GLenum GLsizei len
Definition: glext.h:6722
Definition: name.c:36
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by check_nfs41_create_args(), and check_nfs41_setattr_args().

◆ isOpen2Create()

BOOLEAN isOpen2Create ( ULONG  disposition)

Definition at line 3485 of file nfs41_driver.c.

3487 {
3488  if (disposition == FILE_CREATE || disposition == FILE_OPEN_IF ||
3489  disposition == FILE_OVERWRITE_IF || disposition == FILE_SUPERSEDE)
3490  return TRUE;
3491  return FALSE;
3492 }
#define TRUE
Definition: types.h:120
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
#define FILE_SUPERSEDE
Definition: from_kernel.h:53

Referenced by nfs41_Create().

◆ isStream()

BOOLEAN isStream ( PUNICODE_STRING  name)

Definition at line 3513 of file nfs41_driver.c.

3515 {
3516  LONG i;
3517  PWCH p = name->Buffer;
3518  for (i = 0; i < name->Length / 2; i++) {
3519  if (p[0] == L':') return TRUE;
3520  else if (p[0] == L'\0') return FALSE;
3521  p++;
3522  }
3523  return FALSE;
3524 }
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
WCHAR * PWCH
Definition: ntbasedef.h:417
static const WCHAR L[]
Definition: oid.c:1087
Definition: name.c:36
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by check_nfs41_create_args().

◆ length_as_utf8()

INLINE ULONG length_as_utf8 ( PCUNICODE_STRING  str)

Definition at line 510 of file nfs41_driver.c.

512 {
513  ULONG ActualCount = 0;
514  RtlUnicodeToUTF8N(NULL, 0xffff, &ActualCount, str->Buffer, str->Length);
515  return sizeof(str->MaximumLength) + ActualCount + sizeof(UNICODE_NULL);
516 }
#define UNICODE_NULL
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI RtlUnicodeToUTF8N(PCHAR UTF8StringDestination, ULONG UTF8StringMaxByteCount, PULONG UTF8StringActualByteCount, PCWCH UnicodeStringSource, ULONG UnicodeStringByteCount)

Referenced by marshal_nfs41_close(), marshal_nfs41_dirquery(), marshal_nfs41_eaget(), marshal_nfs41_easet(), marshal_nfs41_fileset(), marshal_nfs41_mount(), marshal_nfs41_open(), and marshal_nfs41_symlink().

◆ map_close_errors()

NTSTATUS map_close_errors ( DWORD  status)

Definition at line 4189 of file nfs41_driver.c.

4191 {
4192  switch (status) {
4193  case NO_ERROR: return STATUS_SUCCESS;
4197  default:
4198  print_error("failed to map windows error %d to NTSTATUS; "
4199  "defaulting to STATUS_INTERNAL_ERROR\n", status);
4201  }
4202 }
#define ERROR_NETNAME_DELETED
Definition: winerror.h:156
#define STATUS_NETWORK_NAME_DELETED
Definition: ntstatus.h:423
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
#define STATUS_DIRECTORY_NOT_EMPTY
Definition: udferr_usr.h:167
#define STATUS_FILE_INVALID
Definition: ntstatus.h:374
#define NO_ERROR
Definition: dderror.h:5
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:451
#define ERROR_NOT_EMPTY
Definition: winerror.h:1251
#define ERROR_FILE_INVALID
Definition: winerror.h:585
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
Definition: ps.c:97

Referenced by nfs41_CloseSrvOpen().

◆ map_disposition_to_create_retval()

DWORD map_disposition_to_create_retval ( DWORD  disposition,
DWORD  errno 
)

Definition at line 3578 of file nfs41_driver.c.

3581 {
3582  switch(disposition) {
3583  case FILE_SUPERSEDE:
3584  if (errno == ERROR_FILE_NOT_FOUND) return FILE_CREATED;
3585  else return FILE_SUPERSEDED;
3586  case FILE_CREATE: return FILE_CREATED;
3587  case FILE_OPEN: return FILE_OPENED;
3588  case FILE_OPEN_IF:
3589  if (errno == ERROR_FILE_NOT_FOUND) return FILE_CREATED;
3590  else return FILE_OPENED;
3591  case FILE_OVERWRITE: return FILE_OVERWRITTEN;
3592  case FILE_OVERWRITE_IF:
3593  if (errno == ERROR_FILE_NOT_FOUND) return FILE_CREATED;
3594  else return FILE_OVERWRITTEN;
3595  default:
3596  print_error("unknown disposition %d\n", disposition);
3597  return FILE_OPENED;
3598  }
3599 }
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define FILE_OVERWRITTEN
Definition: nt_native.h:771
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_OPENED
Definition: nt_native.h:769
#define FILE_SUPERSEDED
Definition: nt_native.h:768
#define FILE_OVERWRITE
Definition: from_kernel.h:57
int errno
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FILE_OPEN
Definition: from_kernel.h:54
#define FILE_CREATED
Definition: nt_native.h:770
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75

◆ map_lock_errors()

NTSTATUS map_lock_errors ( DWORD  status)

Definition at line 6293 of file nfs41_driver.c.

6295 {
6296  switch (status) {
6297  case NO_ERROR: return STATUS_SUCCESS;
6305  /* if we return ERROR_INVALID_PARAMETER, Windows translates that to
6306  * success!! */
6308  default:
6309  print_error("failed to map windows error %d to NTSTATUS; "
6310  "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
6312  }
6313 }
#define ERROR_NETNAME_DELETED
Definition: winerror.h:156
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define STATUS_NETWORK_NAME_DELETED
Definition: ntstatus.h:423
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_RANGE_NOT_LOCKED
Definition: ntstatus.h:348
#define STATUS_FILE_INVALID
Definition: ntstatus.h:374
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_BAD_NET_RESP
Definition: winerror.h:150
#define STATUS_SHARING_VIOLATION
Definition: udferr_usr.h:154
#define STATUS_LOCK_NOT_GRANTED
Definition: ntstatus.h:307
#define ERROR_LOCK_FAILED
Definition: winerror.h:236
#define ERROR_ATOMIC_LOCKS_NOT_SUPPORTED
Definition: winerror.h:240
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
#define ERROR_FILE_INVALID
Definition: winerror.h:585
#define ERROR_NOT_LOCKED
Definition: winerror.h:230
#define STATUS_INVALID_NETWORK_RESPONSE
Definition: ntstatus.h:417
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
Definition: ps.c:97

Referenced by nfs41_Lock(), and nfs41_Unlock().

◆ map_mount_errors()

NTSTATUS map_mount_errors ( DWORD  status)

Definition at line 2713 of file nfs41_driver.c.

2715 {
2716  switch (status) {
2717  case NO_ERROR: return STATUS_SUCCESS;
2722  default:
2723  print_error("failed to map windows error %d to NTSTATUS; "
2724  "defaulting to STATUS_INSUFFICIENT_RESOURCES\n", status);
2726  }
2727 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define ERROR_BAD_NET_NAME
Definition: winerror.h:159
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_BAD_NETPATH
Definition: winerror.h:145
#define ERROR_BAD_NET_RESP
Definition: winerror.h:150
#define STATUS_BAD_NETWORK_PATH
Definition: ntstatus.h:412
#define STATUS_BAD_NETWORK_NAME
Definition: ntstatus.h:426
#define ERROR_NETWORK_UNREACHABLE
Definition: winerror.h:734
#define STATUS_UNEXPECTED_NETWORK_ERROR
Definition: ntstatus.h:418
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define STATUS_NETWORK_UNREACHABLE
Definition: ntstatus.h:690
Definition: ps.c:97

Referenced by nfs41_mount().

◆ map_open_errors()

NTSTATUS map_open_errors ( DWORD  status,
USHORT  len 
)

Definition at line 3548 of file nfs41_driver.c.

3551 {
3552  switch (status) {
3553  case NO_ERROR: return STATUS_SUCCESS;
3554  case ERROR_ACCESS_DENIED:
3555  if (len > 0) return STATUS_ACCESS_DENIED;
3556  else return STATUS_SUCCESS;
3567  case ERROR_REPARSE: return STATUS_REPARSE;
3571  default:
3572  print_error("[ERROR] nfs41_Create: upcall returned %d returning "
3573  "STATUS_INSUFFICIENT_RESOURCES\n", status);
3575  }
3576 }
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define STATUS_FILE_IS_A_DIRECTORY
Definition: udferr_usr.h:164
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_FILE_INVALID
Definition: ntstatus.h:374
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_DIRECTORY
Definition: winerror.h:295
#define ERROR_BAD_NETPATH
Definition: winerror.h:145
#define ERROR_BAD_FILE_TYPE
Definition: winerror.h:277
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
#define STATUS_SHARING_VIOLATION
Definition: udferr_usr.h:154
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define ERROR_INVALID_REPARSE_DATA
Definition: winerror.h:1290
#define STATUS_BAD_NETWORK_PATH
Definition: ntstatus.h:412
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define STATUS_NAME_TOO_LONG
Definition: ntstatus.h:484
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_TOO_MANY_LINKS
Definition: udferr_usr.h:184
#define ERROR_TOO_MANY_LINKS
Definition: winerror.h:671
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
#define ERROR_REPARSE
Definition: winerror.h:522
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define ERROR_NETWORK_ACCESS_DENIED
Definition: winerror.h:157
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
#define STATUS_REPARSE
Definition: ntstatus.h:83
#define ERROR_FILE_INVALID
Definition: winerror.h:585
#define STATUS_NETWORK_ACCESS_DENIED
Definition: ntstatus.h:424
#define ERROR_INVALID_NAME
Definition: compat.h:93
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:263
Definition: ps.c:97

◆ map_query_acl_error()

NTSTATUS map_query_acl_error ( DWORD  error)

Definition at line 5170 of file nfs41_driver.c.

5172 {
5173  switch (error) {
5174  case NO_ERROR: return STATUS_SUCCESS;
5179  default:
5180  print_error("failed to map windows error %d to NTSTATUS; "
5181  "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
5183  }
5184 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define error(str)
Definition: mkdosfs.c:1605
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_BAD_NET_RESP
Definition: winerror.h:150
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
#define STATUS_INVALID_NETWORK_RESPONSE
Definition: ntstatus.h:417
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by nfs41_QuerySecurityInformation(), and nfs41_SetSecurityInformation().

◆ map_querydir_errors()

NTSTATUS map_querydir_errors ( DWORD  status)

Definition at line 4330 of file nfs41_driver.c.

4332 {
4333  switch (status) {
4342  default:
4343  print_error("failed to map windows error %d to NTSTATUS; "
4344  "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
4346  }
4347 }
#define ERROR_NETNAME_DELETED
Definition: winerror.h:156
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define STATUS_NETWORK_NAME_DELETED
Definition: ntstatus.h:423
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define ERROR_BAD_NET_RESP
Definition: winerror.h:150
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define ERROR_NO_MORE_FILES
Definition: winerror.h:121
#define STATUS_NAME_TOO_LONG
Definition: ntstatus.h:484
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define STATUS_NO_SUCH_FILE
Definition: udferr_usr.h:137
#define STATUS_INVALID_NETWORK_RESPONSE
Definition: ntstatus.h:417
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:263
Definition: ps.c:97

Referenced by nfs41_QueryDirectory().

◆ map_queryfile_error()

NTSTATUS map_queryfile_error ( DWORD  error)

Definition at line 5443 of file nfs41_driver.c.

5445 {
5446  switch (error) {
5450  default:
5451  print_error("failed to map windows error %d to NTSTATUS; "
5452  "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
5454  }
5455 }
#define ERROR_NETNAME_DELETED
Definition: winerror.h:156
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define STATUS_NETWORK_NAME_DELETED
Definition: ntstatus.h:423
#define error(str)
Definition: mkdosfs.c:1605
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_BAD_NET_RESP
Definition: winerror.h:150
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_INVALID_NETWORK_RESPONSE
Definition: ntstatus.h:417
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75

Referenced by nfs41_QueryFileInformation().

◆ map_readwrite_errors()

NTSTATUS map_readwrite_errors ( DWORD  status)

Definition at line 6006 of file nfs41_driver.c.

6008 {
6009  switch (status) {
6011  case ERROR_HANDLE_EOF: return STATUS_END_OF_FILE;
6017  default:
6018  print_error("failed to map windows error %d to NTSTATUS; "
6019  "defaulting to STATUS_NET_WRITE_FAULT\n", status);
6021  }
6022 }
#define ERROR_NETNAME_DELETED
Definition: winerror.h:156
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define STATUS_NETWORK_NAME_DELETED
Definition: ntstatus.h:423
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_FILE_INVALID
Definition: ntstatus.h:374
#define STATUS_END_OF_FILE
Definition: shellext.h:62
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define ERROR_NETWORK_ACCESS_DENIED
Definition: winerror.h:157
#define ERROR_FILE_INVALID
Definition: winerror.h:585
#define STATUS_FILE_LOCK_CONFLICT
Definition: ntstatus.h:306
#define ERROR_LOCK_VIOLATION
Definition: winerror.h:136
#define ERROR_HANDLE_EOF
Definition: winerror.h:140
#define STATUS_NETWORK_ACCESS_DENIED
Definition: ntstatus.h:424
#define ERROR_NET_WRITE_FAULT
Definition: winerror.h:172
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
#define STATUS_NET_WRITE_FAULT
Definition: ntstatus.h:432
Definition: ps.c:97

Referenced by nfs41_downcall(), nfs41_Read(), and nfs41_Write().

◆ map_sec_flavor()

NTSTATUS map_sec_flavor ( IN PUNICODE_STRING  sec_flavor_name,
OUT PDWORD  sec_flavor 
)

Definition at line 2945 of file nfs41_driver.c.

2948 {
2949  if (RtlCompareUnicodeString(sec_flavor_name, &AUTH_SYS_NAME, FALSE) == 0)
2951  else if (RtlCompareUnicodeString(sec_flavor_name, &AUTHGSS_KRB5_NAME, FALSE) == 0)
2953  else if (RtlCompareUnicodeString(sec_flavor_name, &AUTHGSS_KRB5I_NAME, FALSE) == 0)
2955  else if (RtlCompareUnicodeString(sec_flavor_name, &AUTHGSS_KRB5P_NAME, FALSE) == 0)
2957  else return STATUS_INVALID_PARAMETER;
2958  return STATUS_SUCCESS;
2959 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
sec_flavor
Definition: nfs41_ops.h:861
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by nfs41_CreateVNetRoot().

◆ map_setea_error()

NTSTATUS map_setea_error ( DWORD  error)

Definition at line 4744 of file nfs41_driver.c.

4746 {
4747  switch (error) {
4748  case NO_ERROR: return STATUS_SUCCESS;
4760  default:
4761  print_error("failed to map windows error %d to NTSTATUS; "
4762  "defaulting to STATUS_INVALID_PARAMETER\n", error);
4764  }
4765 }
#define ERROR_NETNAME_DELETED
Definition: winerror.h:156
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define STATUS_NETWORK_NAME_DELETED
Definition: ntstatus.h:423
#define error(str)
Definition: mkdosfs.c:1605
#define ERROR_INVALID_EA_HANDLE
Definition: winerror.h:299
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define STATUS_NO_EAS_ON_FILE
Definition: ntstatus.h:304
#define ERROR_FILE_TOO_LARGE
Definition: winerror.h:278
#define NO_ERROR
Definition: dderror.h:5
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define STATUS_EA_TOO_LARGE
Definition: ntstatus.h:302
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define ERROR_NO_MORE_FILES
Definition: winerror.h:121
#define STATUS_NO_MORE_EAS
Definition: ntstatus.h:186
#define STATUS_NONEXISTENT_EA_ENTRY
Definition: ntstatus.h:303
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define ERROR_EA_FILE_CORRUPT
Definition: winerror.h:297
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define ERROR_NETWORK_ACCESS_DENIED
Definition: winerror.h:157
#define STATUS_NETWORK_ACCESS_DENIED
Definition: ntstatus.h:424
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define STATUS_EA_CORRUPT_ERROR
Definition: ntstatus.h:305
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by nfs41_QueryEaInformation(), nfs41_SetEaInformation(), and QueryCygwinSymlink().

◆ map_setfile_error()

NTSTATUS map_setfile_error ( DWORD  error)

Definition at line 5601 of file nfs41_driver.c.

5603 {
5604  switch (error) {
5605  case NO_ERROR: return STATUS_SUCCESS;
5617  default:
5618  print_error("failed to map windows error %d to NTSTATUS; "
5619  "defaulting to STATUS_INVALID_PARAMETER\n", error);
5621  }
5622 }
#define ERROR_NETNAME_DELETED
Definition: winerror.h:156
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define STATUS_NETWORK_NAME_DELETED
Definition: ntstatus.h:423
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_NOT_SAME_DEVICE
Definition: ntstatus.h:434
#define error(str)
Definition: mkdosfs.c:1605
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define STATUS_DIRECTORY_NOT_EMPTY
Definition: udferr_usr.h:167
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define STATUS_FILE_INVALID
Definition: ntstatus.h:374
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define ERROR_NOT_EMPTY
Definition: winerror.h:1251
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define ERROR_NETWORK_ACCESS_DENIED
Definition: winerror.h:157
#define ERROR_FILE_INVALID
Definition: winerror.h:585
#define ERROR_NOT_SAME_DEVICE
Definition: winerror.h:120
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define STATUS_NETWORK_ACCESS_DENIED
Definition: ntstatus.h:424
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ map_symlink_errors()

NTSTATUS map_symlink_errors ( NTSTATUS  status)

Definition at line 6529 of file nfs41_driver.c.

6531 {
6532  switch (status) {
6533  case NO_ERROR: return STATUS_SUCCESS;
6542  default:
6543  print_error("failed to map windows error %d to NTSTATUS; "
6544  "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
6546  }