ReactOS 0.4.16-dev-258-g81860b4
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 * PCH
Definition: ntbasedef.h:399
char CHAR
Definition: xmlstorage.h:175

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 6336 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 6335 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 6334 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);
struct outqueuenode * head
Definition: adnsresfilter.c:66
Definition: list.h:37
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
static unsigned __int64 next
Definition: rand_nt.c:6
rwlock_t lock
Definition: tcpcore.h:0

Definition at line 288 of file nfs41_driver.c.

◆ nfs41_GetFirstEntry

#define nfs41_GetFirstEntry (   lock,
  list,
  pEntry 
)
Value:
? NULL \
next))); \
ExReleaseFastMutex(&lock);
#define NULL
Definition: types.h:112
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
Definition: nfs41_driver.c:166
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Definition at line 306 of file nfs41_driver.c.

◆ nfs41_GetFirstMountEntry

#define nfs41_GetFirstMountEntry (   lock,
  list,
  pEntry 
)
Value:

Definition at line 315 of file nfs41_driver.c.

◆ nfs41_IsListEmpty

#define nfs41_IsListEmpty (   lock,
  list,
  flag 
)
Value:
ExReleaseFastMutex(&lock);
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 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);

Definition at line 298 of file nfs41_driver.c.

◆ nfs41_RemoveFirst

#define nfs41_RemoveFirst (   lock,
  list,
  pEntry 
)
Value:
? NULL \
ExReleaseFastMutex(&lock);
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964

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))
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

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.

154 {
@ NFS41_WAITING_FOR_DOWNCALL
Definition: nfs41_driver.c:156
@ NFS41_DONE_PROCESSING
Definition: nfs41_driver.c:157
@ NFS41_WAITING_FOR_UPCALL
Definition: nfs41_driver.c:155
@ NFS41_NOT_WAITING
Definition: nfs41_driver.c:158
enum _nfs41_updowncall_state nfs41_updowncall_state

◆ _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
@ NTC_NFS41_DEVICE_EXTENSION
Definition: nfs41_driver.c:465

◆ 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};
@ NF3LNK
Definition: nfs41_driver.c:149
@ NF3DIR
Definition: nfs41_driver.c:146
@ NF3FIFO
Definition: nfs41_driver.c:151
@ NF3SOCK
Definition: nfs41_driver.c:150
@ NF3REG
Definition: nfs41_driver.c:145
@ NF3CHR
Definition: nfs41_driver.c:148
@ NF3BLK
Definition: nfs41_driver.c:147

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;
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
2633out:
2634 SCCBC->Status = status;
2635 SrvCalldownStructure->CallBack(SCCBC);
2636
2637#ifdef DEBUG_MOUNT
2638 DbgEx();
2639#endif
2640 return status;
2641}
LONG NTSTATUS
Definition: precomp.h:26
#define NodeType(P)
Definition: nodetype.h:51
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
#define PagedPool
Definition: env_spec_w32.h:308
#define ASSERT(a)
Definition: mode.c:44
struct _MRX_SRVCALLDOWN_STRUCTURE * PMRX_SRVCALLDOWN_STRUCTURE
VOID print_srv_call(int on, IN PMRX_SRV_CALL p)
Definition: nfs41_debug.c:240
ULONG __cdecl print_error(IN PCCH fmt,...)
Definition: nfs41_debug.c:75
#define DbgEn()
Definition: nfs41_debug.h:57
#define DbgEx()
Definition: nfs41_debug.h:61
struct _NFS41_SERVER_ENTRY * PNFS41_SERVER_ENTRY
NTSTATUS _nfs41_CreateSrvCall(PMRX_SRVCALL_CALLBACK_CONTEXT pCallbackContext)
#define SERVER_NAME_BUFFER_SIZE
Definition: nfs41_driver.c:335
#define NFS41_MM_POOLTAG
Definition: nfs41_driver.c:94
#define DbgP(_x_)
Definition: nfs41_np.c:36
#define RxAllocatePoolWithTag
Definition: ntrxdef.h:25
#define STATUS_NAME_TOO_LONG
Definition: ntstatus.h:498
static FILE * out
Definition: regtests2xml.c:44
#define RDBSS_NTC_SRVCALL
Definition: nodetype.h:48
#define STATUS_SUCCESS
Definition: shellext.h:65
PMRX_SRV_CALL SrvCall
Definition: mrx.h:136
PMRX_SRVCALL_CALLBACK CallBack
Definition: mrx.h:137
PMRX_SRVCALLDOWN_STRUCTURE SrvCalldownStructure
Definition: mrx.h:119
PUNICODE_STRING pSrvCallName
Definition: mrxfcb.h:22
Definition: nfs41_driver.c:428
UNICODE_STRING Name
Definition: nfs41_driver.c:431
PMRX_SRV_CALL pRdbssSrvCall
Definition: nfs41_driver.c:429
WCHAR NameBuffer[SERVER_NAME_BUFFER_SIZE]
Definition: nfs41_driver.c:430
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: ps.c:97
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by _nfs41_CreateSrvCall(), and 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 FILE_DIRECTORY_FILE
Definition: constants.h:491
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
#define FILE_NO_INTERMEDIATE_BUFFERING
Definition: from_kernel.h:28
#define FILE_OVERWRITE
Definition: from_kernel.h:57
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
GLenum const GLfloat * params
Definition: glext.h:5645
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_APPEND_DATA
Definition: nt_native.h:634
#define DELETE
Definition: nt_native.h:57
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708

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 |
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
3737out:
3738 return status;
3739}
_In_ PFCB Fcb
Definition: cdprocs.h:159
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define FCB_STATE_PAGING_FILE
Definition: fatstruc.h:1195
#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES
Definition: from_kernel.h:250
#define NET_ROOT_WILD
Definition: mrxfcb.h:33
#define NET_ROOT_DISK
Definition: mrxfcb.h:30
#define NFS41GetVNetRootExtension(pVNetRoot)
Definition: nfs41_driver.c:395
INLINE BOOL AnsiStrEq(IN const ANSI_STRING *lhs, IN const CHAR *rhs, IN const UCHAR rhs_len)
Definition: nfs41_driver.c:123
#define NFS41GetNetRootExtension(pNetRoot)
Definition: nfs41_driver.c:365
BOOLEAN areOpenParamsValid(NT_CREATE_PARAMETERS *params)
BOOLEAN isFilenameTooLong(PUNICODE_STRING name, PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext)
struct _NFS41_FCB * PNFS41_FCB
BOOLEAN isStream(PUNICODE_STRING name)
#define __notnull
Definition: no_sal2.h:36
#define FILE_READ_DATA
Definition: nt_native.h:628
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define FILE_EXECUTE
Definition: nt_native.h:642
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:322
#define STATUS_NETWORK_ACCESS_DENIED
Definition: ntstatus.h:438
#define STATUS_EAS_NOT_SUPPORTED
Definition: ntstatus.h:315
#define STATUS_CANNOT_DELETE
Definition: shellext.h:71
CLONG OpenCount
Definition: fatstruc.h:881
ULONG FcbState
Definition: cdstruc.h:971
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_SHARING_VIOLATION
Definition: udferr_usr.h:154
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148

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

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 5190 of file nfs41_driver.c.

5192{
5195 RxContext->CurrentIrpSp->Parameters.QuerySecurity.SecurityInformation;
5196
5197 /* we don't support sacls */
5201 goto out;
5202 }
5203 if (RxContext->CurrentIrp->UserBuffer == NULL &&
5204 RxContext->CurrentIrpSp->Parameters.QuerySecurity.Length)
5206out:
5207 return status;
5208}
static PIO_STATUS_BLOCK void ULONG FS_INFORMATION_CLASS info_class
Definition: pipe.c:76
DWORD SECURITY_INFORMATION
Definition: ms-dtyp.idl:311
struct _IO_STACK_LOCATION::@3978::@3996 QuerySecurity
union _IO_STACK_LOCATION::@1579 Parameters
PIRP CurrentIrp
Definition: rxcontx.h:110
PIO_STACK_LOCATION CurrentIrpSp
Definition: rxcontx.h:111
#define LABEL_SECURITY_INFORMATION
Definition: setypes.h:127
#define SACL_SECURITY_INFORMATION
Definition: setypes.h:126

Referenced by nfs41_QuerySecurityInformation().

◆ check_nfs41_getreparse_args()

NTSTATUS check_nfs41_getreparse_args ( PRX_CONTEXT  RxContext)

Definition at line 6693 of file nfs41_driver.c.

6695{
6698 const USHORT HeaderLen = FIELD_OFFSET(REPARSE_DATA_BUFFER,
6699 SymbolicLinkReparseBuffer.PathBuffer);
6700
6701 /* must have a filename longer than vnetroot name,
6702 * or it's trying to operate on the volume itself */
6703 if (is_root_directory(RxContext)) {
6705 goto out;
6706 }
6707 /* ifs reparse tests expect STATUS_INVALID_PARAMETER,
6708 * but 'dir' passes a buffer here when querying symlinks
6709 if (FsCtl->pInputBuffer != NULL) {
6710 status = STATUS_INVALID_PARAMETER;
6711 goto out;
6712 } */
6713 if (!FsCtl->pOutputBuffer) {
6715 goto out;
6716 }
6717 if (!BooleanFlagOn(RxContext->pFcb->Attributes,
6720 DbgP("FILE_ATTRIBUTE_REPARSE_POINT is not set!\n");
6721 goto out;
6722 }
6723
6724 if (FsCtl->OutputBufferLength < HeaderLen) {
6725 RxContext->InformationToReturn = HeaderLen;
6727 goto out;
6728 }
6729out:
6730 return status;
6731}
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
static BOOLEAN is_root_directory(PRX_CONTEXT RxContext)
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
#define STATUS_NOT_A_REPARSE_POINT
Definition: ntstatus.h:753
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
XXCTL_LOWIO_COMPONENT FsCtl
Definition: mrx.h:308
union _LOWIO_CONTEXT::@2072 ParamsFor
ULONG Attributes
Definition: mrxfcb.h:121
WCHAR PathBuffer[1]
Definition: shellext.h:176
ULONG_PTR InformationToReturn
Definition: rxcontx.h:137
LOWIO_CONTEXT LowIoContext
Definition: rxcontx.h:263
PMRX_FCB pFcb
Definition: rxcontx.h:112
ULONG OutputBufferLength
Definition: mrx.h:274
PVOID pOutputBuffer
Definition: mrx.h:275
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by nfs41_GetReparsePoint().

◆ check_nfs41_queryea_args()

NTSTATUS check_nfs41_queryea_args ( IN PRX_CONTEXT  RxContext)

Definition at line 4904 of file nfs41_driver.c.

4906{
4908 __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
4909 NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
4911 &pVNetRootContext->FsAttrs;
4913 RxContext->CurrentIrpSp->Parameters.QueryEa.EaList;
4914
4915 status = check_nfs41_dirquery_args(RxContext);
4916 if (status) goto out;
4917
4918 if (!(FsAttrs->FileSystemAttributes & FILE_SUPPORTS_EXTENDED_ATTRIBUTES)) {
4919 if (ea == NULL) {
4921 goto out;
4922 }
4923 /* ignore cygwin EAs when checking support */
4924 if (!AnsiStrEq(&NfsV3Attributes, ea->EaName, ea->EaNameLength) &&
4925 !AnsiStrEq(&NfsActOnLink, ea->EaName, ea->EaNameLength) &&
4926 !AnsiStrEq(&NfsSymlinkTargetName, ea->EaName, ea->EaNameLength)) {
4928 goto out;
4929 }
4930 }
4931 if ((RxContext->pRelevantSrvOpen->DesiredAccess & FILE_READ_EA) == 0) {
4933 goto out;
4934 }
4935out:
4936 return status;
4937}
struct _FILE_GET_EA_INFORMATION * PFILE_GET_EA_INFORMATION
NTSTATUS check_nfs41_dirquery_args(IN PRX_CONTEXT RxContext)
#define FILE_READ_EA
Definition: nt_native.h:638
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145

Referenced by nfs41_QueryEaInformation().

◆ check_nfs41_read_args()

NTSTATUS check_nfs41_read_args ( IN PRX_CONTEXT  RxContext)

Definition at line 6028 of file nfs41_driver.c.

6030{
6031 if (!RxContext->LowIoContext.ParamsFor.ReadWrite.Buffer)
6033 return STATUS_SUCCESS;
6034}

Referenced by nfs41_Read().

◆ check_nfs41_setacl_args()

NTSTATUS check_nfs41_setacl_args ( PRX_CONTEXT  RxContext)

Definition at line 5332 of file nfs41_driver.c.

5334{
5336 __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
5339 RxContext->CurrentIrpSp->Parameters.SetSecurity.SecurityInformation;
5340
5341 if (pVNetRootContext->read_only) {
5342 print_error("check_nfs41_setacl_args: Read-only mount\n");
5344 goto out;
5345 }
5346 /* we don't support sacls */
5350 goto out;
5351 }
5352out:
5353 return status;
5354}
struct _IO_STACK_LOCATION::@3978::@3997 SetSecurity
PMRX_V_NET_ROOT pVNetRoot
Definition: mrxfcb.h:162
PMRX_SRV_OPEN pRelevantSrvOpen
Definition: rxcontx.h:114

Referenced by nfs41_SetSecurityInformation().

◆ check_nfs41_setattr_args()

NTSTATUS check_nfs41_setattr_args ( IN PRX_CONTEXT  RxContext)

Definition at line 5628 of file nfs41_driver.c.

5630{
5632 FILE_INFORMATION_CLASS InfoClass = RxContext->Info.FileInformationClass;
5633 __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
5634 NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
5635
5636 if (pVNetRootContext->read_only) {
5637 print_error("check_nfs41_setattr_args: Read-only mount\n");
5639 goto out;
5640 }
5641
5642 /* http://msdn.microsoft.com/en-us/library/ff469355(v=PROT.10).aspx
5643 * http://msdn.microsoft.com/en-us/library/ff469424(v=PROT.10).aspx
5644 * If Open.GrantedAccess does not contain FILE_WRITE_DATA, the operation
5645 * MUST be failed with STATUS_ACCESS_DENIED.
5646 */
5647 if (InfoClass == FileAllocationInformation ||
5648 InfoClass == FileEndOfFileInformation) {
5649 if (!(RxContext->pRelevantSrvOpen->DesiredAccess & FILE_WRITE_DATA)) {
5651 goto out;
5652 }
5653 }
5654 status = check_nfs41_dirquery_args(RxContext);
5655 if (status) goto out;
5656
5657 switch (InfoClass) {
5659 {
5661 (PFILE_RENAME_INFORMATION)RxContext->Info.Buffer;
5663 (USHORT)rinfo->FileNameLength, rinfo->FileName };
5664#ifdef DEBUG_FILE_SET
5665 DbgP("Attempting to rename to '%wZ'\n", &dst);
5666#endif
5667 if (isFilenameTooLong(&dst, pVNetRootContext)) {
5669 goto out;
5670 }
5671 if (rinfo->RootDirectory) {
5673 goto out;
5674 }
5675 break;
5676 }
5678 {
5680 (PFILE_LINK_INFORMATION)RxContext->Info.Buffer;
5682 (USHORT)linfo->FileNameLength, linfo->FileName };
5683#ifdef DEBUG_FILE_SET
5684 DbgP("Attempting to add link as '%wZ'\n", &dst);
5685#endif
5686 if (isFilenameTooLong(&dst, pVNetRootContext)) {
5688 goto out;
5689 }
5690 if (linfo->RootDirectory) {
5692 goto out;
5693 }
5694 break;
5695 }
5697 {
5699 (PFILE_DISPOSITION_INFORMATION)RxContext->Info.Buffer;
5700 __notnull PNFS41_FCB nfs41_fcb = NFS41GetFcbExtension(RxContext->pFcb);
5701 if (dinfo->DeleteFile && nfs41_fcb->DeletePending) {
5703 goto out;
5704 }
5705 break;
5706 }
5710 break;
5711 default:
5712 print_error("nfs41_SetFileInformation: unhandled class %d\n", InfoClass);
5714 }
5715
5716out:
5717 return status;
5718}
@ FileEndOfFileInformation
Definition: from_kernel.h:81
@ FileRenameInformation
Definition: from_kernel.h:71
@ FileLinkInformation
Definition: from_kernel.h:72
@ FileAllocationInformation
Definition: from_kernel.h:80
@ FileBasicInformation
Definition: from_kernel.h:65
@ FileDispositionInformation
Definition: from_kernel.h:74
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
struct _FILE_LINK_INFORMATION * PFILE_LINK_INFORMATION
GLenum GLenum dst
Definition: glext.h:6340
struct _FILE_RENAME_INFORMATION * PFILE_RENAME_INFORMATION
#define NFS41GetFcbExtension(pFcb)
Definition: nfs41_driver.c:409
struct _FILE_DISPOSITION_INFORMATION * PFILE_DISPOSITION_INFORMATION

Referenced by nfs41_SetFileInformation().

◆ check_nfs41_setea_args()

NTSTATUS check_nfs41_setea_args ( IN PRX_CONTEXT  RxContext)

Definition at line 4771 of file nfs41_driver.c.

4773{
4775 __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
4776 NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
4778 &pVNetRootContext->FsAttrs;
4780 (PFILE_FULL_EA_INFORMATION)RxContext->Info.Buffer;
4781
4782 status = check_nfs41_dirquery_args(RxContext);
4783 if (status) goto out;
4784
4785 if (ea == NULL) {
4787 goto out;
4788 }
4789 if (AnsiStrEq(&NfsActOnLink, ea->EaName, ea->EaNameLength) ||
4790 AnsiStrEq(&NfsSymlinkTargetName, ea->EaName, ea->EaNameLength)) {
4791 status = STATUS_INVALID_PARAMETER; /* only allowed on create */
4792 goto out;
4793 }
4794 /* ignore cygwin EAs when checking support */
4795 if (!(FsAttrs->FileSystemAttributes & FILE_SUPPORTS_EXTENDED_ATTRIBUTES)
4796 && !AnsiStrEq(&NfsV3Attributes, ea->EaName, ea->EaNameLength)) {
4798 goto out;
4799 }
4800 if ((RxContext->pRelevantSrvOpen->DesiredAccess & FILE_WRITE_EA) == 0) {
4802 goto out;
4803 }
4804 if (pVNetRootContext->read_only) {
4805 print_error("check_nfs41_setattr_args: Read-only mount\n");
4807 goto out;
4808 }
4809out:
4810 return status;
4811}
struct _FILE_FULL_EA_INFORMATION * PFILE_FULL_EA_INFORMATION
#define FILE_WRITE_EA
Definition: nt_native.h:640

Referenced by nfs41_SetEaInformation().

◆ check_nfs41_setreparse_args()

NTSTATUS check_nfs41_setreparse_args ( IN PRX_CONTEXT  RxContext)

Definition at line 6584 of file nfs41_driver.c.

6586{
6588 __notnull XXCTL_LOWIO_COMPONENT *FsCtl = &RxContext->LowIoContext.ParamsFor.FsCtl;
6589 __notnull PREPARSE_DATA_BUFFER Reparse = (PREPARSE_DATA_BUFFER)FsCtl->pInputBuffer;
6590 __notnull PMRX_SRV_OPEN SrvOpen = RxContext->pRelevantSrvOpen;
6591 __notnull PNFS41_V_NET_ROOT_EXTENSION VNetRootContext =
6592 NFS41GetVNetRootExtension(SrvOpen->pVNetRoot);
6593 const ULONG HeaderLen = REPARSE_DATA_BUFFER_HEADER_SIZE;
6594
6595 /* access checks */
6596 if (VNetRootContext->read_only) {
6598 goto out;
6599 }
6600 if (!(SrvOpen->DesiredAccess & (FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES))) {
6602 goto out;
6603 }
6604
6605 /* must have a filename longer than vnetroot name,
6606 * or it's trying to operate on the volume itself */
6607 if (is_root_directory(RxContext)) {
6609 goto out;
6610 }
6611 if (FsCtl->pOutputBuffer != NULL) {
6613 goto out;
6614 }
6615
6616 /* validate input buffer and length */
6617 if (!Reparse) {
6619 goto out;
6620 }
6621
6622 if (FsCtl->InputBufferLength < HeaderLen ||
6623 FsCtl->InputBufferLength > MAXIMUM_REPARSE_DATA_BUFFER_SIZE) {
6625 goto out;
6626 }
6627 if (FsCtl->InputBufferLength != HeaderLen + Reparse->ReparseDataLength) {
6629 goto out;
6630 }
6631
6632 /* validate reparse tag */
6633 if (!IsReparseTagValid(Reparse->ReparseTag)) {
6635 goto out;
6636 }
6637 if (Reparse->ReparseTag != IO_REPARSE_TAG_SYMLINK) {
6639 goto out;
6640 }
6641out:
6642 return status;
6643}
#define REPARSE_DATA_BUFFER_HEADER_SIZE
Definition: vista.c:17
#define STATUS_IO_REPARSE_TAG_INVALID
Definition: ntstatus.h:754
#define STATUS_IO_REPARSE_TAG_MISMATCH
Definition: ntstatus.h:755
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:650
#define STATUS_IO_REPARSE_DATA_INVALID
Definition: ntstatus.h:756
struct _REPARSE_DATA_BUFFER * PREPARSE_DATA_BUFFER
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_MEDIA_WRITE_PROTECTED
Definition: udferr_usr.h:161
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE
Definition: iotypes.h:7213
#define IsReparseTagValid(tag)
Definition: iotypes.h:7225
#define IO_REPARSE_TAG_SYMLINK
Definition: iotypes.h:7240

Referenced by nfs41_SetReparsePoint().

◆ check_nfs41_write_args()

NTSTATUS check_nfs41_write_args ( IN PRX_CONTEXT  RxContext)

Definition at line 6136 of file nfs41_driver.c.

6138{
6140 __notnull PNFS41_V_NET_ROOT_EXTENSION pVNetRootContext =
6141 NFS41GetVNetRootExtension(RxContext->pRelevantSrvOpen->pVNetRoot);
6142
6143 if (!RxContext->LowIoContext.ParamsFor.ReadWrite.Buffer) {
6145 goto out;
6146 }
6147
6148 if (pVNetRootContext->read_only) {
6149 print_error("check_nfs41_write_args: Read-only mount\n");
6151 goto out;
6152 }
6153out:
6154 return status;
6155}

Referenced by nfs41_Write().

◆ create_nfs3_attrs()

void create_nfs3_attrs ( nfs3_attrs attrs,
PNFS41_FCB  nfs41_fcb 
)

Definition at line 4727 of file nfs41_driver.c.

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

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_CREATE
Definition: from_kernel.h:55
#define FILE_OPEN_IF
Definition: from_kernel.h:56

◆ DECLARE_CONST_ANSI_STRING() [1/3]

DECLARE_CONST_ANSI_STRING ( NfsActOnLink  ,
"NfsActOnLink"   
)

◆ DECLARE_CONST_ANSI_STRING() [2/3]

DECLARE_CONST_ANSI_STRING ( NfsSymlinkTargetName  ,
"NfsSymlinkTargetName"   
)

◆ DECLARE_CONST_ANSI_STRING() [3/3]

DECLARE_CONST_ANSI_STRING ( NfsV3Attributes  ,
"NfsV3Attributes"   
)

◆ DECLARE_CONST_UNICODE_STRING() [1/7]

DECLARE_CONST_UNICODE_STRING ( AUTH_SYS_NAME  ,
L"sys"   
)

◆ DECLARE_CONST_UNICODE_STRING() [2/7]

DECLARE_CONST_UNICODE_STRING ( AUTHGSS_KRB5_NAME  ,
L"krb5"   
)

◆ DECLARE_CONST_UNICODE_STRING() [3/7]

DECLARE_CONST_UNICODE_STRING ( AUTHGSS_KRB5I_NAME  ,
L"krb5i"   
)

◆ DECLARE_CONST_UNICODE_STRING() [4/7]

DECLARE_CONST_UNICODE_STRING ( AUTHGSS_KRB5P_NAME  ,
L"krb5p"   
)

◆ DECLARE_CONST_UNICODE_STRING() [5/7]

DECLARE_CONST_UNICODE_STRING ( EMPTY_STRING  ,
L""   
)

◆ DECLARE_CONST_UNICODE_STRING() [6/7]

DECLARE_CONST_UNICODE_STRING ( NfsPrefix  ,
L"\\nfs4"   
)

◆ DECLARE_CONST_UNICODE_STRING() [7/7]

DECLARE_CONST_UNICODE_STRING ( SLASH  ,
L"\\"   
)

◆ denied_lock_backoff()

void denied_lock_backoff ( IN OUT PLARGE_INTEGER  delay)

Definition at line 6338 of file nfs41_driver.c.

6340{
6341 if (delay->QuadPart == 0)
6342 delay->QuadPart = MIN_LOCK_POLL_WAIT;
6343 else
6344 delay->QuadPart <<= 1;
6345
6346 if (delay->QuadPart < MAX_LOCK_POLL_WAIT)
6347 delay->QuadPart = MAX_LOCK_POLL_WAIT;
6348}
#define MIN_LOCK_POLL_WAIT
#define MAX_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 7118 of file nfs41_driver.c.

7122{
7124 ULONG flags = 0, i;
7125 UNICODE_STRING dev_name, user_dev_name;
7126 PNFS41_DEVICE_EXTENSION dev_exts;
7127 TIME_FIELDS jan_1_1970 = {1970, 1, 1, 0, 0, 0, 0, 0};
7128 ACCESS_MASK mask = 0;
7129 OBJECT_ATTRIBUTES oattrs;
7130
7131 DbgEn();
7132
7133 status = RxDriverEntry(drv, path);
7134 if (status != STATUS_SUCCESS) {
7135 print_error("RxDriverEntry failed: %08lx\n", status);
7136 goto out;
7137 }
7138
7141
7143 if (status != STATUS_SUCCESS) {
7144 print_error("nfs41_init_ops failed to initialize dispatch table\n");
7145 goto out;
7146 }
7147
7148 DbgP("calling RxRegisterMinirdr\n");
7150 sizeof(NFS41_DEVICE_EXTENSION),
7152 if (status != STATUS_SUCCESS) {
7153 print_error("RxRegisterMinirdr failed: %08lx\n", status);
7154 goto out;
7155 }
7156#ifndef __REACTOS__
7157 nfs41_dev->Flags |= DO_BUFFERED_IO;
7158#endif
7159
7160 dev_exts = (PNFS41_DEVICE_EXTENSION)
7161 ((PBYTE)(nfs41_dev) + sizeof(RDBSS_DEVICE_OBJECT));
7162
7164 dev_exts->DeviceObject = nfs41_dev;
7166 &dev_exts->VolAttrsLen);
7167
7169 DbgP("calling IoCreateSymbolicLink %wZ %wZ\n", &user_dev_name, &dev_name);
7170 status = IoCreateSymbolicLink(&user_dev_name, &dev_name);
7171 if (status != STATUS_SUCCESS) {
7172 print_error("Device name IoCreateSymbolicLink failed: %08lx\n", status);
7173 goto out_unregister;
7174 }
7175
7187 &oattrs, NULL, NULL, &fcbopen_main, NULL);
7188 if (status != STATUS_SUCCESS)
7189 goto out_unregister;
7190
7191 drv->DriverUnload = nfs41_driver_unload;
7192
7193 for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
7194 drv->MajorFunction[i] = (PDRIVER_DISPATCH)nfs41_FsdDispatch;
7195
7196 RtlTimeFieldsToTime(&jan_1_1970, &unix_time_diff);
7197
7198out_unregister:
7199 if (status != STATUS_SUCCESS)
7201out:
7202 DbgEx();
7203 return status;
7204}
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
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
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
const char * dev_name(int device)
Definition: wave.c:211
#define RX_REGISTERMINI_FLAG_DONT_PROVIDE_MAILSLOTS
Definition: mrx.h:10
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)
FAST_MUTEX xidLock
Definition: nfs41_driver.c:103
PRDBSS_DEVICE_OBJECT nfs41_dev
Definition: nfs41_driver.c:87
DRIVER_UNLOAD nfs41_driver_unload
Definition: nfs41_driver.c:83
FAST_MUTEX fcblistLock
Definition: nfs41_driver.c:102
NTSTATUS nfs41_init_ops()
void nfs41_create_volume_info(PFILE_FS_VOLUME_INFORMATION pVolInfo, DWORD *len)
nfs41_updowncall_list upcall
Definition: nfs41_driver.c:273
FAST_MUTEX downcallLock
Definition: nfs41_driver.c:102
#define RxDefineNode(node, type)
Definition: nfs41_driver.c:467
nfs41_updowncall_list downcall
Definition: nfs41_driver.c:273
NTSTATUS nfs41_FsdDispatch(IN PDEVICE_OBJECT dev, IN PIRP Irp)
KEVENT upcallEvent
Definition: nfs41_driver.c:101
struct _MINIRDR_DISPATCH nfs41_ops
Definition: nfs41_driver.c:86
FAST_MUTEX openOwnerLock
Definition: nfs41_driver.c:104
KSTART_ROUTINE fcbopen_main
nfs41_fcb_list openlist
Definition: nfs41_driver.c:462
FAST_MUTEX upcallLock
Definition: nfs41_driver.c:102
LARGE_INTEGER unix_time_diff
Definition: nfs41_driver.c:142
#define NFS41_DEVICE_NAME
Definition: nfs41_driver.h:25
#define NFS41_SHADOW_DEVICE_NAME
Definition: nfs41_driver.h:26
#define FILE_REMOTE_DEVICE
Definition: nt_native.h:811
ULONG ACCESS_MASK
Definition: nt_native.h:40
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
@ SynchronizationEvent
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:65
NTSTATUS NTAPI RxDriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
FORCEINLINE VOID NTAPI RxUnregisterMinirdr(_In_ PRDBSS_DEVICE_OBJECT RxDeviceObject)
Definition: rxstruc.h:136
BYTE VolAttrs[VOL_ATTR_LEN]
Definition: nfs41_driver.c:441
PRDBSS_DEVICE_OBJECT DeviceObject
Definition: nfs41_driver.c:437
LIST_ENTRY head
Definition: nfs41_driver.c:460
LIST_ENTRY head
Definition: nfs41_driver.c:271
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
DRIVER_DISPATCH * PDRIVER_DISPATCH
Definition: iotypes.h:2262
#define IRP_MJ_MAXIMUM_FUNCTION

◆ enable_caching()

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

Definition at line 5937 of file nfs41_driver.c.

5942{
5943 ULONG flag = 0;
5946 BOOLEAN found = FALSE;
5947
5948 if (SrvOpen->DesiredAccess & FILE_READ_DATA)
5950 if ((SrvOpen->DesiredAccess & FILE_WRITE_DATA) &&
5951 !nfs41_fobx->write_thru)
5953 if ((SrvOpen->DesiredAccess & FILE_READ_DATA) &&
5954 (SrvOpen->DesiredAccess & FILE_WRITE_DATA) &&
5955 !nfs41_fobx->write_thru)
5957
5958#if defined(DEBUG_TIME_BASED_COHERENCY) || \
5959 defined(DEBUG_WRITE) || defined(DEBUG_READ)
5961#endif
5962
5963 if (!flag)
5964 return;
5965
5967
5970 while (!IsListEmpty(&openlist.head)) {
5973 if (cur->fcb == SrvOpen->pFcb) {
5974#ifdef DEBUG_TIME_BASED_COHERENCY
5975 DbgP("enable_caching: Looked&Found match for fcb=%p %wZ\n",
5976 SrvOpen->pFcb, SrvOpen->pAlreadyPrefixedName);
5977#endif
5978 cur->skip = FALSE;
5979 found = TRUE;
5980 break;
5981 }
5982 if (pEntry->Flink == &openlist.head) {
5983#ifdef DEBUG_TIME_BASED_COHERENCY
5984 DbgP("enable_caching: reached EOL looking for fcb=%p %wZ\n",
5985 SrvOpen->pFcb, SrvOpen->pAlreadyPrefixedName);
5986#endif
5987 break;
5988 }
5989 pEntry = pEntry->Flink;
5990 }
5991 if (!found && nfs41_fobx->deleg_type) {
5992 nfs41_fcb_list_entry *oentry;
5993#ifdef DEBUG_TIME_BASED_COHERENCY
5994 DbgP("enable_caching: delegation recalled: srv_open=%p\n", SrvOpen);
5995#endif
5998 if (oentry == NULL) return;
5999 oentry->fcb = SrvOpen->pFcb;
6000 oentry->session = session;
6001 oentry->nfs41_fobx = nfs41_fobx;
6002 oentry->ChangeTime = ChangeTime;
6003 oentry->skip = FALSE;
6004 InsertTailList(&openlist.head, &oentry->next);
6005 nfs41_fobx->deleg_type = 0;
6006 }
6008}
unsigned char BOOLEAN
#define ULongToPtr(ul)
Definition: basetsd.h:92
#define InsertTailList(ListHead, Entry)
#define NonPagedPool
Definition: env_spec_w32.h:307
FxCollectionEntry * cur
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
void print_caching_level(int on, ULONG flag, PUNICODE_STRING name)
Definition: nfs41_debug.c:582
#define ENABLE_READ_CACHING
Definition: nfs41_driver.c:90
#define ENABLE_READWRITE_CACHING
Definition: nfs41_driver.c:92
#define NFS41_MM_POOLTAG_OPEN
Definition: nfs41_driver.c:97
#define ENABLE_WRITE_CACHING
Definition: nfs41_driver.c:91
NTSTATUS NTAPI RxChangeBufferingState(PSRV_OPEN SrvOpen, PVOID Context, BOOLEAN ComputeNewState)
Definition: rxce.c:783
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ACCESS_MASK DesiredAccess
Definition: mrxfcb.h:173
PUNICODE_STRING pAlreadyPrefixedName
Definition: mrxfcb.h:169
DWORD deleg_type
Definition: nfs41_driver.c:421
BOOLEAN write_thru
Definition: nfs41_driver.c:422
Definition: fcb.h:261
Definition: nfs41_driver.c:450
BOOLEAN skip
Definition: nfs41_driver.c:456
ULONGLONG ChangeTime
Definition: nfs41_driver.c:455
LIST_ENTRY next
Definition: nfs41_driver.c:451
PNFS41_FOBX nfs41_fobx
Definition: nfs41_driver.c:454
HANDLE session
Definition: nfs41_driver.c:453
PMRX_FCB fcb
Definition: nfs41_driver.c:452

Referenced by nfs41_Read(), and nfs41_Write().

◆ fcbopen_main()

VOID fcbopen_main ( PVOID  ctx)

Definition at line 7019 of file nfs41_driver.c.

7021{
7024
7025 DbgEn();
7026 timeout.QuadPart = RELATIVE(SECONDS(30));
7027 while(1) {
7033 while (!IsListEmpty(&openlist.head)) {
7034 PNFS41_NETROOT_EXTENSION pNetRootContext;
7037 PNFS41_FCB nfs41_fcb;
7040
7041#ifdef DEBUG_TIME_BASED_COHERENCY
7042 DbgP("fcbopen_main: Checking attributes for fcb=%p "
7043 "change_time=%llu skipping=%d\n", cur->fcb,
7044 cur->ChangeTime, cur->skip);
7045#endif
7046 if (cur->skip) goto out;
7047 pNetRootContext =
7048 NFS41GetNetRootExtension(cur->fcb->pNetRoot);
7049 /* place an upcall for this srv_open */
7051 &cur->nfs41_fobx->sec_ctx, cur->session,
7052 cur->nfs41_fobx->nfs41_open_state,
7053 pNetRootContext->nfs41d_version, NULL, &entry);
7054 if (status) goto out;
7055
7056 entry->u.QueryFile.InfoClass = FileBasicInformation;
7057 entry->buf = &binfo;
7058 entry->buf_len = sizeof(binfo);
7059
7061 if (status) goto out;
7062
7063 if (cur->ChangeTime != entry->ChangeTime) {
7065 PMRX_SRV_OPEN srv_open;
7066 PLIST_ENTRY psrvEntry;
7067#ifdef DEBUG_TIME_BASED_COHERENCY
7068 DbgP("fcbopen_main: old ctime=%llu new_ctime=%llu\n",
7069 cur->ChangeTime, entry->ChangeTime);
7070#endif
7071 cur->ChangeTime = entry->ChangeTime;
7072 cur->skip = TRUE;
7073 psrvEntry = &cur->fcb->SrvOpenList;
7074 psrvEntry = psrvEntry->Flink;
7075 while (!IsListEmpty(&cur->fcb->SrvOpenList)) {
7076 srv_open = (PMRX_SRV_OPEN)CONTAINING_RECORD(psrvEntry,
7077 MRX_SRV_OPEN, SrvOpenQLinks);
7078 if (srv_open->DesiredAccess &
7080#ifdef DEBUG_TIME_BASED_COHERENCY
7081 DbgP("fcbopen_main: ************ Invalidate the cache %wZ"
7082 "************\n", srv_open->pAlreadyPrefixedName);
7083#endif
7085 cur->fcb->pNetRoot->pSrvCall, srv_open,
7086 srv_open->Key, ULongToPtr(flag));
7087 }
7088 if (psrvEntry->Flink == &cur->fcb->SrvOpenList) {
7089#ifdef DEBUG_TIME_BASED_COHERENCY
7090 DbgP("fcbopen_main: reached end of srvopen for fcb %p\n",
7091 cur->fcb);
7092#endif
7093 break;
7094 }
7095 psrvEntry = psrvEntry->Flink;
7096 };
7097 }
7098 nfs41_fcb = (PNFS41_FCB)cur->fcb->Context;
7099 nfs41_fcb->changeattr = entry->ChangeTime;
7101out:
7102 if (pEntry->Flink == &openlist.head) {
7103#ifdef DEBUG_TIME_BASED_COHERENCY
7104 DbgP("fcbopen_main: reached end of the fcb list\n");
7105#endif
7106 break;
7107 }
7108 pEntry = pEntry->Flink;
7109 }
7111 }
7112 DbgEx();
7113}
#define KeDelayExecutionThread(mode, foo, t)
Definition: env_spec_w32.h:484
uint32_t entry
Definition: isohybrid.c:63
struct _MRX_SRV_OPEN_ * PMRX_SRV_OPEN
#define KernelMode
Definition: asm.h:34
#define DISABLE_CACHING
Definition: nfs41_driver.c:89
#define SECONDS(seconds)
Definition: nfs41_driver.c:117
#define RELATIVE(wait)
Definition: nfs41_driver.c:113
NTSTATUS nfs41_UpcallWaitForReply(IN nfs41_updowncall_entry *entry, IN DWORD secs)
#define UPCALL_TIMEOUT_DEFAULT
Definition: nfs41_driver.c:340
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)
@ NFS41_FILE_QUERY
Definition: nfs41_driver.h:62
#define RxFreePool
Definition: ntrxdef.h:26
VOID NTAPI RxIndicateChangeOfBufferingStateForSrvOpen(PMRX_SRV_CALL SrvCall, PMRX_SRV_OPEN SrvOpen, PVOID SrvOpenKey, PVOID Context)
Definition: rdbss.c:6880
PVOID Key
Definition: mrxfcb.h:172
ULONGLONG changeattr
Definition: nfs41_driver.c:407
Definition: dhcpd.h:245

◆ file_time_to_nfs_time()

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

Definition at line 4718 of file nfs41_driver.c.

4721{
4723 diff.QuadPart = file_time->QuadPart - diff.QuadPart;
4724 *nfs_time = diff.QuadPart / 10000000;
4725}

Referenced by create_nfs3_attrs().

◆ 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{
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,
2112
2113#ifdef DEBUG_MOUNT
2114 DbgEx();
2115#endif
2116 return status;
2117}
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
IN PVCB IN PDIRENT OUT PULONG EaLength
Definition: fatprocs.h:879
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define FILE_CREATE_TREE_CONNECTION
Definition: from_kernel.h:33
ULONG Handle
Definition: gdb_input.c:15
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
_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:845

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
1404out:
1405 return status;
1406}
void print_hexbuf(int level, unsigned char *title, unsigned char *buf, int len)
Definition: daemon_debug.c:98
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
GLenum GLsizei len
Definition: glext.h:6722
NTSTATUS marshal_nfs41_easet(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_eaget(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_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
NTSTATUS marshal_nfs41_dirquery(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:933
NTSTATUS marshal_nfs41_setacl(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_lock(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:812
NTSTATUS marshal_nfs41_unmount(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:664
NTSTATUS marshal_nfs41_close(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:890
NTSTATUS marshal_nfs41_symlink(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)
NTSTATUS marshal_nfs41_unlock(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:849
NTSTATUS marshal_nfs41_volume(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)
Definition: nfs41_driver.c:753
@ NFS41_READ
Definition: nfs41_driver.h:57
@ NFS41_CLOSE
Definition: nfs41_driver.h:56
@ NFS41_WRITE
Definition: nfs41_driver.h:58
@ NFS41_FILE_SET
Definition: nfs41_driver.h:63
@ NFS41_SYMLINK
Definition: nfs41_driver.h:66
@ NFS41_EA_GET
Definition: nfs41_driver.h:64
@ NFS41_EA_SET
Definition: nfs41_driver.h:65
@ NFS41_ACL_QUERY
Definition: nfs41_driver.h:68
@ NFS41_SHUTDOWN
Definition: nfs41_driver.h:70
@ NFS41_MOUNT
Definition: nfs41_driver.h:53
@ NFS41_UNMOUNT
Definition: nfs41_driver.h:54
@ NFS41_DIR_QUERY
Definition: nfs41_driver.h:61
@ NFS41_LOCK
Definition: nfs41_driver.h:59
@ NFS41_UNLOCK
Definition: nfs41_driver.h:60
@ NFS41_OPEN
Definition: nfs41_driver.h:55
@ NFS41_VOLUME_QUERY
Definition: nfs41_driver.h:67
@ NFS41_ACL_SET
Definition: nfs41_driver.h:69
NTSTATUS NTAPI SeImpersonateClientEx(_In_ PSECURITY_CLIENT_CONTEXT ClientContext, _In_opt_ PETHREAD ServerThread)
Extended function that impersonates a client.
Definition: client.c:276
XXCTL_LOWIO_COMPONENT IoCtl
Definition: mrx.h:309

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}
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
#define STATUS_BAD_NETWORK_NAME
Definition: ntstatus.h:440

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}
struct _V_NET_ROOT * PV_NET_ROOT
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
__wchar_t WCHAR
Definition: xmlstorage.h:180

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}

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}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * PWCH
Definition: ntbasedef.h:418
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
FILE_FS_ATTRIBUTE_INFORMATION FsAttrs
Definition: nfs41_driver.c:383
Definition: name.c:39

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}

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}

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}
NTSTATUS NTAPI RtlUnicodeToUTF8N(CHAR *utf8_dest, ULONG utf8_bytes_max, ULONG *utf8_bytes_written, const WCHAR *uni_src, ULONG uni_bytes)
Definition: utf8.c:20
#define UNICODE_NULL
const WCHAR * str

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 NO_ERROR
Definition: dderror.h:5
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define STATUS_NETWORK_NAME_DELETED
Definition: ntstatus.h:437
#define STATUS_FILE_INVALID
Definition: ntstatus.h:388
#define STATUS_DIRECTORY_NOT_EMPTY
Definition: udferr_usr.h:167
#define ERROR_NOT_EMPTY
Definition: winerror.h:1251
#define ERROR_FILE_INVALID
Definition: winerror.h:585
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
#define ERROR_NETNAME_DELETED
Definition: winerror.h:156

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:
3585 else return FILE_SUPERSEDED;
3586 case FILE_CREATE: return FILE_CREATED;
3587 case FILE_OPEN: return FILE_OPENED;
3588 case FILE_OPEN_IF:
3590 else return FILE_OPENED;
3591 case FILE_OVERWRITE: return FILE_OVERWRITTEN;
3592 case FILE_OVERWRITE_IF:
3594 else return FILE_OVERWRITTEN;
3595 default:
3596 print_error("unknown disposition %d\n", disposition);
3597 return FILE_OPENED;
3598 }
3599}
#define FILE_OPEN
Definition: from_kernel.h:54
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FILE_CREATED
Definition: nt_native.h:770
#define FILE_OVERWRITTEN
Definition: nt_native.h:771
#define FILE_SUPERSEDED
Definition: nt_native.h:768
#define FILE_OPENED
Definition: nt_native.h:769
#define errno
Definition: errno.h:18

◆ map_lock_errors()

NTSTATUS map_lock_errors ( DWORD  status)

Definition at line 6297 of file nfs41_driver.c.

6299{
6300 switch (status) {
6301 case NO_ERROR: return STATUS_SUCCESS;
6309 /* if we return ERROR_INVALID_PARAMETER, Windows translates that to
6310 * success!! */
6312 default:
6313 print_error("failed to map windows error %d to NTSTATUS; "
6314 "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
6316 }
6317}
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define STATUS_INVALID_NETWORK_RESPONSE
Definition: ntstatus.h:431
#define STATUS_RANGE_NOT_LOCKED
Definition: ntstatus.h:362
#define STATUS_LOCK_NOT_GRANTED
Definition: ntstatus.h:321
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
#define ERROR_NOT_LOCKED
Definition: winerror.h:230
#define ERROR_BAD_NET_RESP
Definition: winerror.h:150
#define ERROR_LOCK_FAILED
Definition: winerror.h:236
#define ERROR_ATOMIC_LOCKS_NOT_SUPPORTED
Definition: winerror.h:240

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_NETWORK_UNREACHABLE
Definition: ntstatus.h:704
#define STATUS_BAD_NETWORK_PATH
Definition: ntstatus.h:426
#define STATUS_UNEXPECTED_NETWORK_ERROR
Definition: ntstatus.h:432
#define ERROR_BAD_NETPATH
Definition: winerror.h:145
#define ERROR_NETWORK_UNREACHABLE
Definition: winerror.h:734
#define ERROR_BAD_NET_NAME
Definition: winerror.h:159

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;
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 ERROR_ACCESS_DENIED
Definition: compat.h:97
#define ERROR_INVALID_NAME
Definition: compat.h:103
#define STATUS_REPARSE
Definition: ntstatus.h:83
#define STATUS_FILE_IS_A_DIRECTORY
Definition: udferr_usr.h:164
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define STATUS_TOO_MANY_LINKS
Definition: udferr_usr.h:184
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define ERROR_REPARSE
Definition: winerror.h:522
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_DIRECTORY
Definition: winerror.h:295
#define ERROR_TOO_MANY_LINKS
Definition: winerror.h:671
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define ERROR_BAD_FILE_TYPE
Definition: winerror.h:277
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:263
#define ERROR_NETWORK_ACCESS_DENIED
Definition: winerror.h:157
#define ERROR_INVALID_REPARSE_DATA
Definition: winerror.h:1290

◆ map_query_acl_error()

NTSTATUS map_query_acl_error ( DWORD  error)

Definition at line 5174 of file nfs41_driver.c.

5176{
5177 switch (error) {
5178 case NO_ERROR: return STATUS_SUCCESS;
5183 default:
5184 print_error("failed to map windows error %d to NTSTATUS; "
5185 "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
5187 }
5188}
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
#define error(str)
Definition: mkdosfs.c:1605

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 STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define STATUS_NO_SUCH_FILE
Definition: udferr_usr.h:137
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define ERROR_NO_MORE_FILES
Definition: winerror.h:121

Referenced by nfs41_QueryDirectory().

◆ map_queryfile_error()

NTSTATUS map_queryfile_error ( DWORD  error)

Definition at line 5447 of file nfs41_driver.c.

5449{
5450 switch (error) {
5454 default:
5455 print_error("failed to map windows error %d to NTSTATUS; "
5456 "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", error);
5458 }
5459}

Referenced by nfs41_QueryFileInformation().

◆ map_readwrite_errors()

NTSTATUS map_readwrite_errors ( DWORD  status)

Definition at line 6010 of file nfs41_driver.c.

6012{
6013 switch (status) {
6021 default:
6022 print_error("failed to map windows error %d to NTSTATUS; "
6023 "defaulting to STATUS_NET_WRITE_FAULT\n", status);
6025 }
6026}
#define STATUS_FILE_LOCK_CONFLICT
Definition: ntstatus.h:320
#define STATUS_NET_WRITE_FAULT
Definition: ntstatus.h:446
#define STATUS_END_OF_FILE
Definition: shellext.h:67
#define ERROR_NET_WRITE_FAULT
Definition: winerror.h:172
#define ERROR_HANDLE_EOF
Definition: winerror.h:140
#define ERROR_LOCK_VIOLATION
Definition: winerror.h:136

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}
@ RPCSEC_AUTH_SYS
Definition: nfs41_driver.h:75
@ RPCSEC_AUTHGSS_KRB5P
Definition: nfs41_driver.h:78
@ RPCSEC_AUTHGSS_KRB5
Definition: nfs41_driver.h:76
@ RPCSEC_AUTHGSS_KRB5I
Definition: nfs41_driver.h:77
sec_flavor
Definition: nfs41_ops.h:861

Referenced by nfs41_CreateVNetRoot().

◆ map_setea_error()

NTSTATUS map_setea_error ( DWORD  error)

Definition at line 4748 of file nfs41_driver.c.

4750{
4751 switch (error) {
4752 case NO_ERROR: return STATUS_SUCCESS;
4764 default:
4765 print_error("failed to map windows error %d to NTSTATUS; "
4766 "defaulting to STATUS_INVALID_PARAMETER\n", error);
4768 }
4769}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define STATUS_NONEXISTENT_EA_ENTRY
Definition: ntstatus.h:317
#define STATUS_EA_CORRUPT_ERROR
Definition: ntstatus.h:319
#define STATUS_NO_EAS_ON_FILE
Definition: ntstatus.h:318
#define STATUS_EA_TOO_LARGE
Definition: ntstatus.h:316
#define STATUS_NO_MORE_EAS
Definition: ntstatus.h:198
#define ERROR_INVALID_EA_HANDLE
Definition: winerror.h:299
#define ERROR_EA_FILE_CORRUPT
Definition: winerror.h:297
#define ERROR_FILE_TOO_LARGE
Definition: winerror.h:278

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

◆ map_setfile_error()

NTSTATUS map_setfile_error ( DWORD  error)

Definition at line 5605 of file nfs41_driver.c.

5607{
5608 switch (error) {
5609 case NO_ERROR: return STATUS_SUCCESS;
5621 default:
5622 print_error("failed to map windows error %d to NTSTATUS; "
5623 "defaulting to STATUS_INVALID_PARAMETER\n", error);
5625 }
5626}
#define STATUS_NOT_SAME_DEVICE
Definition: ntstatus.h:448
#define ERROR_NOT_SAME_DEVICE
Definition: winerror.h:120

◆ map_symlink_errors()

NTSTATUS map_symlink_errors ( NTSTATUS  status)

Definition at line 6533 of file nfs41_driver.c.

6535{
6536 switch (status) {
6537 case NO_ERROR: return STATUS_SUCCESS;
6546 default:
6547 print_error("failed to map windows error %d to NTSTATUS; "
6548 "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
6550 }
6551}
#define ERROR_NOT_A_REPARSE_POINT
Definition: winerror.h:1288

Referenced by nfs41_GetReparsePoint(), and nfs41_SetReparsePoint().

◆ map_volume_errors()

NTSTATUS map_volume_errors ( DWORD  status)

Definition at line 4473 of file nfs41_driver.c.

4475{
4476 switch (status) {
4482 default:
4483 print_error("failed to map windows error %d to NTSTATUS; "
4484 "defaulting to STATUS_INVALID_NETWORK_RESPONSE\n", status);
4486 }
4487}
#define STATUS_CONNECTION_DISCONNECTED
Definition: ntstatus.h:656
#define ERROR_VC_DISCONNECTED
Definition: winerror.h:287

Referenced by nfs41_QueryVolumeInformation().

◆ marshal_nfs41_close()

NTSTATUS marshal_nfs41_close ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 890 of file nfs41_driver.c.

895{
897 ULONG header_len = 0;
898 unsigned char *tmp = buf;
899
900 status = marshal_nfs41_header(entry, tmp, buf_len, len);
901 if (status) goto out;
902 else tmp += *len;
903
904 header_len = *len + sizeof(BOOLEAN) + sizeof(HANDLE);
905 if (entry->u.Close.remove)
906 header_len += length_as_utf8(entry->filename) +
907 sizeof(BOOLEAN);
908
909 if (header_len > buf_len) {
911 goto out;
912 }
913 RtlCopyMemory(tmp, &entry->u.Close.remove, sizeof(BOOLEAN));
914 tmp += sizeof(BOOLEAN);
915 RtlCopyMemory(tmp, &entry->u.Close.srv_open, sizeof(HANDLE));
916 if (entry->u.Close.remove) {
917 tmp += sizeof(HANDLE);
918 status = marshall_unicode_as_utf8(&tmp, entry->filename);
919 if (status) goto out;
920 RtlCopyMemory(tmp, &entry->u.Close.renamed, sizeof(BOOLEAN));
921 }
922 *len = header_len;
923
924#ifdef DEBUG_MARSHAL_DETAIL
925 DbgP("marshal_nfs41_close: name=%wZ remove=%d srv_open=%p renamed=%d\n",
926 entry->filename->Length?entry->filename:&SLASH,
927 entry->u.Close.remove, entry->u.Close.srv_open, entry->u.Close.renamed);
928#endif
929out:
930 return status;
931}
#define SLASH(w)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
INLINE ULONG length_as_utf8(PCUNICODE_STRING str)
Definition: nfs41_driver.c:510
NTSTATUS marshall_unicode_as_utf8(IN OUT unsigned char **pos, IN PCUNICODE_STRING str)
Definition: nfs41_driver.c:518
NTSTATUS marshal_nfs41_header(nfs41_updowncall_entry *entry, unsigned char *buf, ULONG buf_len, ULONG *len)
Definition: nfs41_driver.c:562
#define BOOLEAN
Definition: pedump.c:73
PVOID HANDLE
Definition: typedefs.h:73

Referenced by handle_upcall().

◆ marshal_nfs41_dirquery()

NTSTATUS marshal_nfs41_dirquery ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 933 of file nfs41_driver.c.

938{
940 ULONG header_len = 0;
941 unsigned char *tmp = buf;
942
943 status = marshal_nfs41_header(entry, tmp, buf_len, len);
944 if (status) goto out;
945 else tmp += *len;
946
947 header_len = *len + 2 * sizeof(ULONG) + sizeof(HANDLE) +
948 length_as_utf8(entry->u.QueryFile.filter) + 3 * sizeof(BOOLEAN);
949 if (header_len > buf_len) {
951 goto out;
952 }
953
954 RtlCopyMemory(tmp, &entry->u.QueryFile.InfoClass, sizeof(ULONG));
955 tmp += sizeof(ULONG);
956 RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
957 tmp += sizeof(ULONG);
958 status = marshall_unicode_as_utf8(&tmp, entry->u.QueryFile.filter);
959 if (status) goto out;
960 RtlCopyMemory(tmp, &entry->u.QueryFile.initial_query, sizeof(BOOLEAN));
961 tmp += sizeof(BOOLEAN);
962 RtlCopyMemory(tmp, &entry->u.QueryFile.restart_scan, sizeof(BOOLEAN));
963 tmp += sizeof(BOOLEAN);
964 RtlCopyMemory(tmp, &entry->u.QueryFile.return_single, sizeof(BOOLEAN));
965 tmp += sizeof(BOOLEAN);
966 _SEH2_TRY {
967 entry->u.QueryFile.mdl_buf =
968 MmMapLockedPagesSpecifyCache(entry->u.QueryFile.mdl,
969#ifndef __REACTOS__
971#else
973#endif
974 if (entry->u.QueryFile.mdl_buf == NULL) {
975 print_error("MmMapLockedPagesSpecifyCache failed to map pages\n");
977 goto out;
978 }
982 print_error("Call to MmMapLocked failed due to exception 0x%x\n", code);
984 goto out;
985 } _SEH2_END;
986 RtlCopyMemory(tmp, &entry->u.QueryFile.mdl_buf, sizeof(HANDLE));
987 *len = header_len;
988
989#ifdef DEBUG_MARSHAL_DETAIL
990 DbgP("marshal_nfs41_dirquery: filter='%wZ'class=%d len=%d "
991 "1st\\restart\\single=%d\\%d\\%d\n", entry->u.QueryFile.filter,
992 entry->u.QueryFile.InfoClass, entry->buf_len,
993 entry->u.QueryFile.initial_query, entry->u.QueryFile.restart_scan,
994 entry->u.QueryFile.return_single);
995#endif
996out:
997 return status;
998}
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
PVOID NTAPI MmMapLockedPagesSpecifyCache(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN MEMORY_CACHING_TYPE CacheType, IN PVOID BaseAddress, IN ULONG BugCheckOnFailure, IN ULONG Priority)
Definition: mdlsup.c:660
@ NormalPagePriority
Definition: imports.h:54
#define UserMode
Definition: asm.h:35
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
Definition: inflate.c:139
@ MmCached
Definition: mmtypes.h:130
@ MmNonCached
Definition: mmtypes.h:129

Referenced by handle_upcall().

◆ marshal_nfs41_eaget()

NTSTATUS marshal_nfs41_eaget ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 1110 of file nfs41_driver.c.

1115{
1117 ULONG header_len = 0;
1118 unsigned char *tmp = buf;
1119
1120 status = marshal_nfs41_header(entry, tmp, buf_len, len);
1121 if (status) goto out;
1122 else tmp += *len;
1123
1124 header_len = *len + length_as_utf8(entry->filename) +
1125 3 * sizeof(ULONG) + entry->u.QueryEa.EaListLength + 2 * sizeof(BOOLEAN);
1126
1127 if (header_len > buf_len) {
1129 goto out;
1130 }
1131
1132 status = marshall_unicode_as_utf8(&tmp, entry->filename);
1133 if (status) goto out;
1134 RtlCopyMemory(tmp, &entry->u.QueryEa.EaIndex, sizeof(ULONG));
1135 tmp += sizeof(ULONG);
1136 RtlCopyMemory(tmp, &entry->u.QueryEa.RestartScan, sizeof(BOOLEAN));
1137 tmp += sizeof(BOOLEAN);
1138 RtlCopyMemory(tmp, &entry->u.QueryEa.ReturnSingleEntry, sizeof(BOOLEAN));
1139 tmp += sizeof(BOOLEAN);
1140 RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
1141 tmp += sizeof(ULONG);
1142 RtlCopyMemory(tmp, &entry->u.QueryEa.EaListLength, sizeof(ULONG));
1143 tmp += sizeof(ULONG);
1144 if (entry->u.QueryEa.EaList && entry->u.QueryEa.EaListLength)
1145 RtlCopyMemory(tmp, entry->u.QueryEa.EaList,
1146 entry->u.QueryEa.EaListLength);
1147 *len = header_len;
1148
1149#ifdef DEBUG_MARSHAL_DETAIL
1150 DbgP("marshal_nfs41_eaget: filename=%wZ, index=%d list_len=%d "
1151 "rescan=%d single=%d\n", entry->filename,
1152 entry->u.QueryEa.EaIndex, entry->u.QueryEa.EaListLength,
1153 entry->u.QueryEa.RestartScan, entry->u.QueryEa.ReturnSingleEntry);
1154#endif
1155out:
1156 return status;
1157}

Referenced by handle_upcall().

◆ marshal_nfs41_easet()

NTSTATUS marshal_nfs41_easet ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 1072 of file nfs41_driver.c.

1077{
1079 ULONG header_len = 0;
1080 unsigned char *tmp = buf;
1081
1082 status = marshal_nfs41_header(entry, tmp, buf_len, len);
1083 if (status) goto out;
1084 else tmp += *len;
1085
1086 header_len = *len + length_as_utf8(entry->filename) +
1087 sizeof(ULONG) + entry->buf_len + sizeof(DWORD);
1088 if (header_len > buf_len) {
1090 goto out;
1091 }
1092
1093 status = marshall_unicode_as_utf8(&tmp, entry->filename);
1094 if (status) goto out;
1095 RtlCopyMemory(tmp, &entry->u.SetEa.mode, sizeof(DWORD));
1096 tmp += sizeof(DWORD);
1097 RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
1098 tmp += sizeof(ULONG);
1099 RtlCopyMemory(tmp, entry->buf, entry->buf_len);
1100 *len = header_len;
1101
1102#ifdef DEBUG_MARSHAL_DETAIL
1103 DbgP("marshal_nfs41_easet: filename=%wZ, buflen=%d mode=0x%x\n",
1104 entry->filename, entry->buf_len, entry->u.SetEa.mode);
1105#endif
1106out:
1107 return status;
1108}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DWORD
Definition: nt_native.h:44

Referenced by handle_upcall().

◆ marshal_nfs41_filequery()

NTSTATUS marshal_nfs41_filequery ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 1000 of file nfs41_driver.c.

1005{
1007 ULONG header_len = 0;
1008 unsigned char *tmp = buf;
1009
1010 status = marshal_nfs41_header(entry, tmp, buf_len, len);
1011 if (status) goto out;
1012 else tmp += *len;
1013
1014 header_len = *len + 2 * sizeof(ULONG);
1015 if (header_len > buf_len) {
1017 goto out;
1018 }
1019 RtlCopyMemory(tmp, &entry->u.QueryFile.InfoClass, sizeof(ULONG));
1020 tmp += sizeof(ULONG);
1021 RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
1022 tmp += sizeof(ULONG);
1023 RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
1024 tmp += sizeof(HANDLE);
1025 RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
1026 *len = header_len;
1027
1028#ifdef DEBUG_MARSHAL_DETAIL
1029 DbgP("marshal_nfs41_filequery: class=%d\n", entry->u.QueryFile.InfoClass);
1030#endif
1031out:
1032 return status;
1033}

Referenced by handle_upcall().

◆ marshal_nfs41_fileset()

NTSTATUS marshal_nfs41_fileset ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 1035 of file nfs41_driver.c.

1040{
1042 ULONG header_len = 0;
1043 unsigned char *tmp = buf;
1044
1045 status = marshal_nfs41_header(entry, tmp, buf_len, len);
1046 if (status) goto out;
1047 else tmp += *len;
1048
1049 header_len = *len + length_as_utf8(entry->filename) +
1050 2 * sizeof(ULONG) + entry->buf_len;
1051 if (header_len > buf_len) {
1053 goto out;
1054 }
1055 status = marshall_unicode_as_utf8(&tmp, entry->filename);
1056 if (status) goto out;
1057 RtlCopyMemory(tmp, &entry->u.SetFile.InfoClass, sizeof(ULONG));
1058 tmp += sizeof(ULONG);
1059 RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
1060 tmp += sizeof(ULONG);
1061 RtlCopyMemory(tmp, entry->buf, entry->buf_len);
1062 *len = header_len;
1063
1064#ifdef DEBUG_MARSHAL_DETAIL
1065 DbgP("marshal_nfs41_fileset: filename='%wZ' class=%d\n",
1066 entry->filename, entry->u.SetFile.InfoClass);
1067#endif
1068out:
1069 return status;
1070}
if(dx< 0)
Definition: linetemp.h:194

Referenced by handle_upcall().

◆ marshal_nfs41_getacl()

NTSTATUS marshal_nfs41_getacl ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 1230 of file nfs41_driver.c.

1235{
1237 ULONG header_len = 0;
1238 unsigned char *tmp = buf;
1239
1240 status = marshal_nfs41_header(entry, tmp, buf_len, len);
1241 if (status) goto out;
1242 else tmp += *len;
1243
1244 header_len = *len + sizeof(SECURITY_INFORMATION);
1245 if (header_len > buf_len) {
1247 goto out;
1248 }
1249
1250 RtlCopyMemory(tmp, &entry->u.Acl.query, sizeof(SECURITY_INFORMATION));
1251 *len = header_len;
1252
1253#ifdef DEBUG_MARSHAL_DETAIL
1254 DbgP("marshal_nfs41_getacl: class=0x%x\n", entry->u.Acl.query);
1255#endif
1256out:
1257 return status;
1258}

Referenced by handle_upcall().

◆ marshal_nfs41_header()

NTSTATUS marshal_nfs41_header ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 562 of file nfs41_driver.c.

567{
569 ULONG header_len = 0;
570 unsigned char *tmp = buf;
571
572 header_len = sizeof(entry->version) + sizeof(entry->xid) +
573 sizeof(entry->opcode) + 2 * sizeof(HANDLE);
574 if (header_len > buf_len) {
576 goto out;
577 }
578 else
579 *len = header_len;
580 RtlCopyMemory(tmp, &entry->version, sizeof(entry->version));
581 tmp += sizeof(entry->version);
582 RtlCopyMemory(tmp, &entry->xid, sizeof(entry->xid));
583 tmp += sizeof(entry->xid);
584 RtlCopyMemory(tmp, &entry->opcode, sizeof(entry->opcode));
585 tmp += sizeof(entry->opcode);
586 RtlCopyMemory(tmp, &entry->session, sizeof(HANDLE));
587 tmp += sizeof(HANDLE);
588 RtlCopyMemory(tmp, &entry->open_state, sizeof(HANDLE));
589 tmp += sizeof(HANDLE);
590
591#ifdef DEBUG_MARSHAL_HEADER
592 if (MmIsAddressValid(entry->filename))
593 DbgP("[upcall header] xid=%lld opcode=%s filename=%wZ version=%d "
594 "session=0x%x open_state=0x%x\n", entry->xid,
595 opcode2string(entry->opcode), entry->filename,
596 entry->version, entry->session, entry->open_state);
597 else
599#endif
600out:
601 return status;
602}
const char * opcode2string(DWORD opcode)
Definition: daemon_debug.c:280
BOOLEAN NTAPI MmIsAddressValid(IN PVOID VirtualAddress)
Definition: mmsup.c:174

Referenced by marshal_nfs41_close(), marshal_nfs41_dirquery(), marshal_nfs41_eaget(), marshal_nfs41_easet(), marshal_nfs41_filequery(), marshal_nfs41_fileset(), marshal_nfs41_getacl(), marshal_nfs41_lock(), marshal_nfs41_mount(), marshal_nfs41_open(), marshal_nfs41_rw(), marshal_nfs41_setacl(), marshal_nfs41_shutdown(), marshal_nfs41_symlink(), marshal_nfs41_unlock(), marshal_nfs41_unmount(), and marshal_nfs41_volume().

◆ marshal_nfs41_lock()

NTSTATUS marshal_nfs41_lock ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 812 of file nfs41_driver.c.

817{
819 ULONG header_len = 0;
820 unsigned char *tmp = buf;
821
822 status = marshal_nfs41_header(entry, tmp, buf_len, len);
823 if (status) goto out;
824 else tmp += *len;
825
826 header_len = *len + 2 * sizeof(LONGLONG) + 2 * sizeof(BOOLEAN);
827 if (header_len > buf_len) {
829 goto out;
830 }
831 RtlCopyMemory(tmp, &entry->u.Lock.offset, sizeof(LONGLONG));
832 tmp += sizeof(LONGLONG);
833 RtlCopyMemory(tmp, &entry->u.Lock.length, sizeof(LONGLONG));
834 tmp += sizeof(LONGLONG);
835 RtlCopyMemory(tmp, &entry->u.Lock.exclusive, sizeof(BOOLEAN));
836 tmp += sizeof(BOOLEAN);
837 RtlCopyMemory(tmp, &entry->u.Lock.blocking, sizeof(BOOLEAN));
838 *len = header_len;
839
840#ifdef DEBUG_MARSHAL_DETAIL
841 DbgP("marshal_nfs41_lock: offset=%llx length=%llx exclusive=%u "
842 "blocking=%u\n", entry->u.Lock.offset, entry->u.Lock.length,
843 entry->u.Lock.exclusive, entry->u.Lock.blocking);
844#endif
845out:
846 return status;
847}
int64_t LONGLONG
Definition: typedefs.h:68

Referenced by handle_upcall().

◆ marshal_nfs41_mount()

NTSTATUS marshal_nfs41_mount ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 616 of file nfs41_driver.c.

621{
623 ULONG header_len = 0;
624 unsigned char *tmp = buf;
625
626 status = marshal_nfs41_header(entry, tmp, buf_len, len);
627 if (status) goto out;
628 else tmp += *len;
629
630 /* 03/25/2011: Kernel crash to nfsd not running but mount upcall cued up */
631 if (!MmIsAddressValid(entry->u.Mount.srv_name) ||
632 !MmIsAddressValid(entry->u.Mount.root)) {
634 goto out;
635 }
636 header_len = *len + length_as_utf8(entry->u.Mount.srv_name) +
637 length_as_utf8(entry->u.Mount.root) + 3 * sizeof(DWORD);
638 if (header_len > buf_len) {
640 goto out;
641 }
642 status = marshall_unicode_as_utf8(&tmp, entry->u.Mount.srv_name);
643 if (status) goto out;
644 status = marshall_unicode_as_utf8(&tmp, entry->u.Mount.root);
645 if (status) goto out;
646 RtlCopyMemory(tmp, &entry->u.Mount.sec_flavor, sizeof(DWORD));
647 tmp += sizeof(DWORD);
648 RtlCopyMemory(tmp, &entry->u.Mount.rsize, sizeof(DWORD));
649 tmp += sizeof(DWORD);
650 RtlCopyMemory(tmp, &entry->u.Mount.wsize, sizeof(DWORD));
651
652 *len = header_len;
653
654#ifdef DEBUG_MARSHAL_DETAIL
655 DbgP("marshal_nfs41_mount: server name=%wZ mount point=%wZ sec_flavor=%s "
656 "rsize=%d wsize=%d\n", entry->u.Mount.srv_name, entry->u.Mount.root,
657 secflavorop2name(entry->u.Mount.sec_flavor), entry->u.Mount.rsize,
658 entry->u.Mount.wsize);
659#endif
660out:
661 return status;
662}
const char * secflavorop2name(DWORD sec_flavor)
Definition: nfs41_driver.c:604

Referenced by handle_upcall().

◆ marshal_nfs41_open()

NTSTATUS marshal_nfs41_open ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 673 of file nfs41_driver.c.

678{
680 ULONG header_len = 0;
681 unsigned char *tmp = buf;
682
683 status = marshal_nfs41_header(entry, tmp, buf_len, len);
684 if (status) goto out;
685 else tmp += *len;
686
687 header_len = *len + length_as_utf8(entry->filename) +
688 7 * sizeof(ULONG) + 2 * sizeof(HANDLE) +
689 length_as_utf8(&entry->u.Open.symlink);
690 if (header_len > buf_len) {
692 goto out;
693 }
694 status = marshall_unicode_as_utf8(&tmp, entry->filename);
695 if (status) goto out;
696 RtlCopyMemory(tmp, &entry->u.Open.access_mask,
697 sizeof(entry->u.Open.access_mask));
698 tmp += sizeof(entry->u.Open.access_mask);
699 RtlCopyMemory(tmp, &entry->u.Open.access_mode,
700 sizeof(entry->u.Open.access_mode));
701 tmp += sizeof(entry->u.Open.access_mode);
702 RtlCopyMemory(tmp, &entry->u.Open.attrs, sizeof(entry->u.Open.attrs));
703 tmp += sizeof(entry->u.Open.attrs);
704 RtlCopyMemory(tmp, &entry->u.Open.copts, sizeof(entry->u.Open.copts));
705 tmp += sizeof(entry->u.Open.copts);
706 RtlCopyMemory(tmp, &entry->u.Open.disp, sizeof(entry->u.Open.disp));
707 tmp += sizeof(entry->u.Open.disp);
708 RtlCopyMemory(tmp, &entry->u.Open.open_owner_id,
709 sizeof(entry->u.Open.open_owner_id));
710 tmp += sizeof(entry->u.Open.open_owner_id);
711 RtlCopyMemory(tmp, &entry->u.Open.mode, sizeof(DWORD));
712 tmp += sizeof(DWORD);
713 RtlCopyMemory(tmp, &entry->u.Open.srv_open, sizeof(HANDLE));
714 tmp += sizeof(HANDLE);
715 status = marshall_unicode_as_utf8(&tmp, &entry->u.Open.symlink);
716 if (status) goto out;
717
718 _SEH2_TRY {
719 if (entry->u.Open.EaMdl) {
720 entry->u.Open.EaBuffer =
722#ifndef __REACTOS__
724#else
726#endif
727 if (entry->u.Open.EaBuffer == NULL) {
728 print_error("MmMapLockedPagesSpecifyCache failed to map pages\n");
730 goto out;
731 }
732 }
734 print_error("Call to MmMapLocked failed due to exception 0x%x\n", _SEH2_GetExceptionCode());
736 goto out;
737 } _SEH2_END;
738 RtlCopyMemory(tmp, &entry->u.Open.EaBuffer, sizeof(HANDLE));
739 *len = header_len;
740
741#ifdef DEBUG_MARSHAL_DETAIL
742 DbgP("marshal_nfs41_open: name=%wZ mask=0x%x access=0x%x attrs=0x%x "
743 "opts=0x%x dispo=0x%x open_owner_id=0x%x mode=%o srv_open=%p ea=%p\n",
744 entry->filename, entry->u.Open.access_mask,
745 entry->u.Open.access_mode, entry->u.Open.attrs, entry->u.Open.copts,
746 entry->u.Open.disp, entry->u.Open.open_owner_id, entry->u.Open.mode,
747 entry->u.Open.srv_open, entry->u.Open.EaBuffer);
748#endif
749out:
750 return status;
751}

Referenced by handle_upcall().

◆ marshal_nfs41_rw()

NTSTATUS marshal_nfs41_rw ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 753 of file nfs41_driver.c.

758{
760 ULONG header_len = 0;
761 unsigned char *tmp = buf;
762
763 status = marshal_nfs41_header(entry, tmp, buf_len, len);
764 if (status) goto out;
765 else tmp += *len;
766
767 header_len = *len + sizeof(entry->buf_len) +
768 sizeof(entry->u.ReadWrite.offset) + sizeof(HANDLE);
769 if (header_len > buf_len) {
771 goto out;
772 }
773
774 RtlCopyMemory(tmp, &entry->buf_len, sizeof(entry->buf_len));
775 tmp += sizeof(entry->buf_len);
776 RtlCopyMemory(tmp, &entry->u.ReadWrite.offset,
777 sizeof(entry->u.ReadWrite.offset));
778 tmp += sizeof(entry->u.ReadWrite.offset);
779 _SEH2_TRY {
780 entry->u.ReadWrite.MdlAddress->MdlFlags |= MDL_MAPPING_CAN_FAIL;
781 entry->buf =
782 MmMapLockedPagesSpecifyCache(entry->u.ReadWrite.MdlAddress,
783#ifndef __REACTOS__
785#else
787#endif
788 if (entry->buf == NULL) {
789 print_error("MmMapLockedPagesSpecifyCache failed to map pages\n");
791 goto out;
792 }
796 print_error("Call to MmMapLocked failed due to exception 0x%x\n", code);
798 goto out;
799 } _SEH2_END;
800 RtlCopyMemory(tmp, &entry->buf, sizeof(HANDLE));
801 *len = header_len;
802
803#ifdef DEBUG_MARSHAL_DETAIL
804 DbgP("marshal_nfs41_rw: len=%lu offset=%llu MdlAddress=%p Userspace=%p\n",
805 entry->buf_len, entry->u.ReadWrite.offset,
806 entry->u.ReadWrite.MdlAddress, entry->buf);
807#endif
808out:
809 return status;
810}
#define MDL_MAPPING_CAN_FAIL
Definition: mmtypes.h:31

Referenced by handle_upcall().

◆ marshal_nfs41_setacl()

NTSTATUS marshal_nfs41_setacl ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 1260 of file nfs41_driver.c.

1265{
1267 ULONG header_len = 0;
1268 unsigned char *tmp = buf;
1269
1270 status = marshal_nfs41_header(entry, tmp, buf_len, len);
1271 if (status) goto out;
1272 else tmp += *len;
1273
1274 header_len = *len + sizeof(SECURITY_INFORMATION) +
1275 sizeof(ULONG) + entry->buf_len;
1276 if (header_len > buf_len) {
1278 goto out;
1279 }
1280
1281 RtlCopyMemory(tmp, &entry->u.Acl.query, sizeof(SECURITY_INFORMATION));
1282 tmp += sizeof(SECURITY_INFORMATION);
1283 RtlCopyMemory(tmp, &entry->buf_len, sizeof(ULONG));
1284 tmp += sizeof(ULONG);
1285 RtlCopyMemory(tmp, entry->buf, entry->buf_len);
1286 *len = header_len;
1287
1288#ifdef DEBUG_MARSHAL_DETAIL
1289 DbgP("marshal_nfs41_setacl: class=0x%x sec_desc_len=%lu\n",
1290 entry->u.Acl.query, entry->buf_len);
1291#endif
1292out:
1293 return status;
1294}

Referenced by handle_upcall().

◆ marshal_nfs41_shutdown()

NTSTATUS marshal_nfs41_shutdown ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 1296 of file nfs41_driver.c.

1301{
1302 return marshal_nfs41_header(entry, buf, buf_len, len);
1303}

Referenced by handle_upcall().

◆ marshal_nfs41_symlink()

NTSTATUS marshal_nfs41_symlink ( nfs41_updowncall_entry entry,
unsigned char buf,
ULONG  buf_len,
ULONG len 
)

Definition at line 1159 of file