53 eprintf(
"trying to write extended attribute value of size %d, "
54 "max allowed %d\n", ea->EaValueLength,
NFS4_EASIZE);
59 if (ea->EaValueLength == 0) {
62 name.len = ea->EaNameLength;
77 createattrs.
mode = 0664;
89 (
unsigned char*)ea->EaName + ea->EaNameLength + 1,
90 ea->EaValueLength, 0,
FILE_SYNC4, &bytes_written,
111 &&
sizeof(
"NfsSymlinkTargetName")-1 == ea->
EaNameLength);
114#define NEXT_ENTRY(ea) ((PBYTE)(ea) + (ea)->NextEntryOffset)
125 eprintf(
"nfs41_rpc_openattr() failed with error %s\n",
134 if (ea->NextEntryOffset == 0)
157 dprintf(1,
"parsing NFS41_EA_SET: mode=%o\n",
args->mode);
182 info.attrmask.arr[0] = 0;
188 dprintf(1,
"nfs41_setattr() failed with error %s.\n",
229 dprintf(1,
"parsing NFS41_EA_GET: buf_len=%d Index %d Restart %d "
235#define READDIR_LEN_INITIAL 8192
236#define READDIR_LEN_MIN 2048
242 OUT unsigned char **buffer_out,
253 attr_request.
count = 0;
268 len = buffer_len - total_len;
282 len = buffer_len - total_len;
291 if (last_entry ==
NULL) {
311 *length_out = total_len;
320#define ALIGNED_EASIZE(len) (align4(sizeof(FILE_GET_EA_INFORMATION) + len))
323 IN const unsigned char *position,
333 if (!
entry->next_entry_offset)
336 position +=
entry->next_entry_offset;
337 remaining -=
entry->next_entry_offset;
343 IN const unsigned char *position,
354 if (!
entry->next_entry_offset) {
362 position +=
entry->next_entry_offset;
372 unsigned char *entry_list;
381 *ealist_out =
state->ea.list;
382 *eaindex_out =
state->ea.index;
396 ea_list =
calloc(1, ea_size);
397 if (ea_list ==
NULL) {
404 *ealist_out =
state->ea.list = ea_list;
405 *eaindex_out =
state->ea.index;
452 eprintf(
"EA value for '%s' longer than maximum %u "
453 "(%llu bytes), returning %s\n", ea->EaName,
NFS4_EASIZE,
458 buffer = (
unsigned char*)ea->EaName + ea->EaNameLength + 1;
464 ea->EaNameLength +
info.size);
483 ea->EaValueLength = (
USHORT)bytes_read;
491 ea->EaValueLength = 0;
517 prev->NextEntryOffset = 0;
521 args->buf_len = needed;
548 eprintf(
"nfs41_rpc_openattr() failed with %s\n",
562 dprintf(
EALVL,
"empty named attribute directory for '%s'\n",
570 else if (
args->restart)
575 if (
query->NextEntryOffset == 0) {
597 remaining =
args->buf_len;
602 if (needed > remaining) {
607 ea->EaNameLength =
query->EaNameLength;
613 &
state->owner, ea, remaining, &needed);
624 ea->EaNameLength + 1 + ea->EaValueLength);
626 if (remaining < needed) {
635 if (
query->NextEntryOffset == 0 ||
args->single)
639 ea->NextEntryOffset = needed;
644 ea->NextEntryOffset = 0;
645 args->buf_len -= remaining;
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
void restart(int argc, const char *argv[])
static int handle_getexattr(nfs41_upcall *upcall)
static int parse_setexattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
static int get_ea_list(IN OUT nfs41_open_state *state, IN nfs41_path_fh *eadir, OUT PFILE_GET_EA_INFORMATION *ealist_out, OUT uint32_t *eaindex_out)
static int empty_ea_error(IN uint32_t index, IN BOOLEAN restart)
static int is_cygwin_ea(PFILE_FULL_EA_INFORMATION ea)
static int read_entire_dir(IN nfs41_session *session, IN nfs41_path_fh *eadir, OUT unsigned char **buffer_out, OUT uint32_t *length_out)
static int marshall_setexattr(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
static int marshall_getexattr(unsigned char *buffer, uint32_t *length, nfs41_upcall *upcall)
const nfs41_upcall_op nfs41_op_getexattr
static int parse_getexattr(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall)
const nfs41_upcall_op nfs41_op_setexattr
#define ALIGNED_EASIZE(len)
static int get_ea_value(IN nfs41_session *session, IN nfs41_path_fh *parent, IN state_owner4 *owner, OUT PFILE_FULL_EA_INFORMATION ea, IN uint32_t length, OUT uint32_t *needed)
#define READDIR_LEN_INITIAL
static void populate_ea_list(IN const unsigned char *position, OUT PFILE_GET_EA_INFORMATION ea_list)
static int handle_setexattr(nfs41_upcall *upcall)
static uint32_t calculate_ea_list_length(IN const unsigned char *position, IN uint32_t remaining)
static int set_ea_value(IN nfs41_session *session, IN nfs41_path_fh *parent, IN state_owner4 *owner, IN PFILE_FULL_EA_INFORMATION ea)
int nfs41_ea_set(IN nfs41_open_state *state, IN PFILE_FULL_EA_INFORMATION ea)
int safe_write(unsigned char **pos, uint32_t *remaining, void *src, uint32_t src_len)
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)
__inline uint32_t align4(uint32_t offset)
void eprintf(LPCSTR format,...)
const char * nfs_error_string(int status)
#define ERROR_INSUFFICIENT_BUFFER
int nfs41_delegation_return(IN nfs41_session *session, IN nfs41_path_fh *file, IN enum open_delegation_type4 access, IN bool_t truncate)
#define INVALID_HANDLE_VALUE
#define ERROR_NOT_SUPPORTED
__kernel_ptrdiff_t ptrdiff_t
struct _FILE_FULL_EA_INFORMATION * PFILE_FULL_EA_INFORMATION
struct _FILE_GET_EA_INFORMATION * PFILE_GET_EA_INFORMATION
struct _FILE_FULL_EA_INFORMATION FILE_FULL_EA_INFORMATION
GLuint GLsizei GLsizei * length
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
#define ERROR_FILE_NOT_FOUND
void nfs41_open_stateid_arg(IN nfs41_open_state *state, OUT struct __stateid_arg *arg)
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_read(IN nfs41_session *session, IN nfs41_path_fh *file, IN stateid_arg *stateid, IN uint64_t offset, IN uint32_t count, OUT unsigned char *data_out, OUT uint32_t *data_len_out, OUT bool_t *eof_out)
enum nfsstat4 nfs41_rpc_openattr(IN nfs41_session *session, IN nfs41_path_fh *file, IN bool_t createdir, OUT nfs41_fh *fh_out)
int nfs41_readdir(IN nfs41_session *session, IN nfs41_path_fh *file, IN bitmap4 *attr_request, IN nfs41_readdir_cookie *cookie, OUT unsigned char *entries, IN OUT uint32_t *entries_len, OUT bool_t *eof_out)
int nfs41_remove(IN nfs41_session *session, IN nfs41_path_fh *parent, IN const nfs41_component *target, IN uint64_t fileid)
int nfs41_setattr(IN nfs41_session *session, IN nfs41_path_fh *file, IN stateid_arg *stateid, IN nfs41_file_info *info)
int nfs41_write(IN nfs41_session *session, IN nfs41_path_fh *file, IN stateid_arg *stateid, IN unsigned char *data, IN uint32_t data_len, IN uint64_t offset, IN enum stable_how4 stable, OUT uint32_t *bytes_written, OUT nfs41_write_verf *verf, OUT nfs41_file_info *cinfo)
int nfs41_close(IN nfs41_session *session, IN nfs41_path_fh *file, IN stateid_arg *stateid)
@ OPEN4_SHARE_ACCESS_WRITE
@ OPEN4_SHARE_ACCESS_WANT_NO_DELEG
@ OPEN4_SHARE_ACCESS_READ
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
STRSAFEAPI StringCchCopyA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
uint32_t next_entry_offset
struct __open_claim4::@44::__open_claim_null null
union __open_claim4::@44 u
#define FIELD_OFFSET(t, f)
DWORD WINAPI GetLastError(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define ERROR_BUFFER_OVERFLOW
#define ERROR_INVALID_EA_HANDLE
#define ERROR_EA_FILE_CORRUPT
#define ERROR_NO_MORE_FILES
#define ERROR_EAS_NOT_SUPPORTED