87 if (
state->delegation.state)
134 if (
state->delegation.state) {
146 dprintf(2,
"delegation recalled, waiting for open stateid..\n");
149 while (!
state->do_close)
151 INFINITE, CONDITION_VARIABLE_LOCKMODE_SHARED);
154 if (
state->locks.stateid.seqid) {
157 }
else if (
state->do_close) {
208 create, createhow, createattrs,
TRUE, &open_stateid,
215 &
state->file, &delegation,
TRUE, &deleg_state);
218 dprintf(1,
"do_open: received delegation: saving srv_open = %x\n",
224 memcpy(&
state->stateid, &open_stateid,
sizeof(open_stateid));
226 state->delegation.state = deleg_state;
248 createattrs, try_recovery,
info);
305 dprintf(1,
"parsing NFS41_OPEN: filename='%s' access mask=%d "
306 "access mode=%d\n\tfile attrs=0x%x create attrs=0x%x "
307 "(kernel) disposition=%d\n\topen_owner_id=%d mode=%o "
308 "srv_open=%p symlink=%s ea=%p\n",
args->path,
args->access_mask,
328 dprintf(1,
"Opening a directory\n");
331 dprintf(1,
"Creating a directory\n");
347 dprintf(1,
"Open call that wants to manage attributes\n");
362 if (persistent) *createhowmode =
GUARDED4;
370 if (persistent) *createhowmode =
GUARDED4;
380 dprintf(1,
"creating new file\n");
384 dprintf(1,
"opening existing file\n");
410 else if (access_mask &
424#define FIX_ALLOW_DENY_WIN2NFS_CONVERSION
425#ifdef FIX_ALLOW_DENY_WIN2NFS_CONVERSION
450 eprintf(
"nfs41_access() failed with %s for %s\n",
457 eprintf(
"server can't verify execute access, and user does "
458 "not have read access to file %s\n",
state->path.path);
462 dprintf(1,
"user does not have execute access to file %s\n",
466 dprintf(2,
"user has execute access to file\n");
489 eprintf(
"create_open_state(%d) failed with %d\n",
540 dprintf(2,
"handle_nfs41_open: DIRECTORY\n");
542 eprintf(
"trying to open directory %s as a file\n",
548 dprintf(2,
"handle nfs41_open: FILE\n");
550 eprintf(
"trying to open file %s as a directory\n",
556 dprintf(2,
"handle nfs41_open: SYMLINK\n");
570 eprintf(
"nfs41_symlink_target() for %s failed with %d\n",
580 dprintf(2,
"handle_open(): unsupported type=%d\n",
info.type);
597 args->access_mode == 0 &&
606 dprintf(1,
"trying to create a symlink, deferring create\n");
610 state->file.fh.superblock =
state->parent.fh.superblock;
613 }
else if (
args->symlink.len) {
619 createattrs.
mode = 0777;
621 dprintf(1,
"creating cygwin symlink %s -> %s\n",
622 state->file.name.name,
args->symlink.path);
627 eprintf(
"nfs41_create() for symlink=%s failed with %s\n",
705 createattrs.
size = 0;
710 args->deleg_type =
state->delegation.state->state.type;
717 goto supersede_retry;
761 unsigned short len = (
args->symlink.len + 1) *
sizeof(
WCHAR);
768 args->symlink.path,
args->symlink.len,
774 dprintf(2,
"NFS41_OPEN: downcall open_state=0x%p mode %o changeattr 0x%llu\n",
792 if (
state->do_close) {
801 dprintf(1,
"cancel_open: nfs41_close() failed with %s\n",
804 }
else if (
args->created) {
812 dprintf(1,
"cancel_open: nfs41_remove() failed with %s\n",
842 dprintf(1,
"parsing NFS41_CLOSE: remove=%d srv_open=%x renamed=%d "
843 "filename='%s'\n",
args->remove,
args->srv_open,
args->renamed,
860 dprintf(1,
"nfs41_close() failed with error %s.\n",
910 dprintf(1,
"nfs41_remove() failed with error %s.\n",
916 if (
state->do_close) {
ACPI_SIZE strlen(const char *String)
#define InterlockedIncrement
#define InterlockedDecrement
#define FILE_DIRECTORY_FILE
#define FILE_NON_DIRECTORY_FILE
int nfs41_ea_set(IN nfs41_open_state *state, IN PFILE_FULL_EA_INFORMATION ea)
static void list_remove(struct list_entry *entry)
#define list_container(entry, type, field)
#define list_for_each_tmp(entry, tmp, head)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
int nfs41_lookup(IN nfs41_root *root, IN nfs41_session *session, IN OUT nfs41_abs_path *path_inout, OUT OPTIONAL nfs41_path_fh *parent_out, OUT OPTIONAL nfs41_path_fh *target_out, OUT OPTIONAL nfs41_file_info *info_out, OUT nfs41_session **session_out)
const nfs41_upcall_op nfs41_op_close
static int map_disposition_2_nfsopen(ULONG disposition, int in_status, bool_t persistent, uint32_t *create, uint32_t *createhowmode, uint32_t *last_error)
static int do_nfs41_close(nfs41_open_state *state)
static int handle_open(nfs41_upcall *upcall)
static int parse_open(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
void nfs41_open_state_deref(IN nfs41_open_state *state)
const nfs41_upcall_op nfs41_op_open
static void client_state_add(IN nfs41_open_state *state)
void nfs41_open_state_ref(IN nfs41_open_state *state)
static int create_open_state(IN const char *path, IN uint32_t open_owner_id, OUT nfs41_open_state **state_out)
static void cancel_open(IN nfs41_upcall *upcall)
static BOOLEAN open_for_attributes(uint32_t type, ULONG access_mask, ULONG disposition, int status)
static int handle_close(nfs41_upcall *upcall)
static void open_state_free(IN nfs41_open_state *state)
static void cleanup_close(nfs41_upcall *upcall)
static int create_with_ea(IN uint32_t disposition, IN uint32_t lookup_status)
static int check_execute_access(nfs41_open_state *state)
static int open_or_delegate(IN OUT nfs41_open_state *state, IN uint32_t create, IN uint32_t createhow, IN nfs41_file_info *createattrs, IN bool_t try_recovery, OUT nfs41_file_info *info)
void nfs41_open_stateid_arg(IN nfs41_open_state *state, OUT stateid_arg *arg)
static int parse_abs_path(unsigned char **buffer, uint32_t *length, nfs41_abs_path *path)
static void map_access_2_allowdeny(ULONG access_mask, ULONG access_mode, ULONG disposition, uint32_t *allow, uint32_t *deny)
static void client_state_remove(IN nfs41_open_state *state)
static int parse_close(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
static int do_open(IN OUT nfs41_open_state *state, IN uint32_t create, IN uint32_t createhow, IN nfs41_file_info *createattrs, IN bool_t try_recovery, OUT nfs41_file_info *info)
static int marshall_open(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
void path_fh_init(OUT nfs41_path_fh *file, IN nfs41_abs_path *path)
void nfs_to_standard_info(IN const nfs41_file_info *info, OUT PFILE_STANDARD_INFO std_out)
bool_t last_component(IN const char *path, IN const char *path_end, OUT nfs41_component *component)
void nfs_to_basic_info(IN const nfs41_file_info *info, OUT PFILE_BASIC_INFO basic_out)
int safe_write(unsigned char **pos, uint32_t *remaining, void *src, uint32_t src_len)
int map_symlink_errors(int status)
void abs_path_copy(OUT nfs41_abs_path *dst, IN const nfs41_abs_path *src)
int safe_read(unsigned char **pos, uint32_t *remaining, void *dest, uint32_t dest_len)
int nfs_to_windows_error(int status, int default_error)
int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
int create_silly_rename(IN nfs41_abs_path *path, IN const nfs41_fh *fh, OUT nfs41_component *silly)
void eprintf(LPCSTR format,...)
void print_disposition(int level, DWORD disposition)
const char * nfs_error_string(int status)
void print_share_mode(int level, DWORD mode)
void print_create_attributes(int level, DWORD create_opts)
void print_access_mask(int level, DWORD access_mask)
void nfs41_delegation_deref(IN nfs41_delegation_state *state)
int nfs41_delegate_open(IN nfs41_open_state *state, IN uint32_t create, IN OPTIONAL nfs41_file_info *createattrs, OUT nfs41_file_info *info)
int nfs41_delegation_return(IN nfs41_session *session, IN nfs41_path_fh *file, IN enum open_delegation_type4 access, IN bool_t truncate)
int nfs41_delegation_granted(IN nfs41_session *session, IN nfs41_path_fh *parent, IN nfs41_path_fh *file, IN open_delegation4 *delegation, IN bool_t try_recovery, OUT nfs41_delegation_state **deleg_out)
void nfs41_delegation_remove_srvopen(IN nfs41_session *session, IN nfs41_path_fh *file)
#define INVALID_HANDLE_VALUE
#define MultiByteToWideChar
#define ERROR_ACCESS_DENIED
VOID WINAPI ReleaseSRWLockShared(PSRWLOCK Lock)
VOID WINAPI AcquireSRWLockExclusive(PSRWLOCK Lock)
VOID WINAPI AcquireSRWLockShared(PSRWLOCK Lock)
VOID WINAPI ReleaseSRWLockExclusive(PSRWLOCK Lock)
VOID WINAPI InitializeSRWLock(PSRWLOCK Lock)
BOOL WINAPI SleepConditionVariableSRW(PCONDITION_VARIABLE ConditionVariable, PSRWLOCK Lock, DWORD Timeout, ULONG Flags)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
#define FILE_OVERWRITE_IF
#define FILE_OPEN_REPARSE_POINT
GLint GLint GLsizei GLsizei GLsizei depth
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLuint GLsizei GLsizei * length
GLuint GLint GLboolean GLint GLenum access
#define memcpy(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
static const struct access_res create[16]
static __inline nfs41_session * nfs41_root_session(IN nfs41_root *root)
#define NFS41_MAX_PATH_LEN
#define NFS41_MAX_SYMLINK_DEPTH
#define CREATE_SESSION4_FLAG_PERSIST
#define NFS4_OPAQUE_LIMIT
nfs41_updowncall_list upcall
int nfs41_open(IN nfs41_session *session, IN nfs41_path_fh *parent, IN nfs41_path_fh *file, IN state_owner4 *owner, IN open_claim4 *claim, IN uint32_t allow, IN uint32_t deny, IN uint32_t create, IN uint32_t how_mode, IN OPTIONAL nfs41_file_info *createattrs, IN bool_t try_recovery, OUT stateid4 *stateid, OUT open_delegation4 *delegation, OUT OPTIONAL nfs41_file_info *info)
int nfs41_access(IN nfs41_session *session, IN nfs41_path_fh *file, IN uint32_t requested, OUT uint32_t *supported OPTIONAL, OUT uint32_t *access OPTIONAL)
int nfs41_create(IN nfs41_session *session, IN uint32_t type, IN nfs41_file_info *createattrs, IN OPTIONAL const char *symlink, IN nfs41_path_fh *parent, OUT nfs41_path_fh *file, OUT nfs41_file_info *info)
int nfs41_remove(IN nfs41_session *session, IN nfs41_path_fh *parent, IN const nfs41_component *target, IN uint64_t fileid)
int nfs41_close(IN nfs41_session *session, IN nfs41_path_fh *file, IN stateid_arg *stateid)
int nfs41_symlink_follow(IN nfs41_root *root, IN nfs41_session *session, IN nfs41_path_fh *symlink, OUT nfs41_file_info *info)
@ OPEN4_SHARE_ACCESS_WRITE
@ OPEN4_SHARE_ACCESS_WANT_NO_DELEG
@ OPEN4_SHARE_ACCESS_BOTH
@ OPEN4_SHARE_ACCESS_READ
int nfs41_symlink_target(IN nfs41_session *session, IN nfs41_path_fh *file, OUT nfs41_abs_path *target)
#define FILE_ATTRIBUTE_HIDDEN
#define FILE_ATTRIBUTE_SYSTEM
#define FILE_WRITE_ATTRIBUTES
#define FILE_ATTRIBUTE_ARCHIVE
void pnfs_layout_state_close(IN struct __nfs41_session *session, IN struct __nfs41_open_state *state, IN bool_t remove)
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
STRSAFEAPI StringCchPrintfA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszFormat,...)
enum delegation_status status
struct __open_claim4::@44::__open_claim_null null
union __open_claim4::@44 u
nfs41_delegation_state * delegation
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
DWORD WINAPI GetLastError(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define ERROR_BUFFER_OVERFLOW
#define ERROR_TOO_MANY_LINKS
#define ERROR_FILE_EXISTS
#define ERROR_BAD_FILE_TYPE
#define ERROR_FILENAME_EXCED_RANGE
#define ERROR_INTERNAL_ERROR