Merge pull request #202 from flandr/osx-xattr

Specialize {set,get}xattr for OS X
This commit is contained in:
Takeshi Nakatani 2015-06-29 00:29:57 +09:00
commit 4190130194

View File

@ -201,8 +201,13 @@ static int s3fs_readdir(const char* path, void* buf, fuse_fill_dir_t filler, off
static int s3fs_access(const char* path, int mask); static int s3fs_access(const char* path, int mask);
static void* s3fs_init(struct fuse_conn_info* conn); static void* s3fs_init(struct fuse_conn_info* conn);
static void s3fs_destroy(void*); static void s3fs_destroy(void*);
#if defined(__APPLE__)
static int s3fs_setxattr(const char* path, const char* name, const char* value, size_t size, int flags, uint32_t position);
static int s3fs_getxattr(const char* path, const char* name, char* value, size_t size, uint32_t position);
#else
static int s3fs_setxattr(const char* path, const char* name, const char* value, size_t size, int flags); static int s3fs_setxattr(const char* path, const char* name, const char* value, size_t size, int flags);
static int s3fs_getxattr(const char* path, const char* name, char* value, size_t size); static int s3fs_getxattr(const char* path, const char* name, char* value, size_t size);
#endif
static int s3fs_listxattr(const char* path, char* list, size_t size); static int s3fs_listxattr(const char* path, char* list, size_t size);
static int s3fs_removexattr(const char* path, const char* name); static int s3fs_removexattr(const char* path, const char* name);
@ -2884,7 +2889,11 @@ static int set_xattrs_to_header(headers_t& meta, const char* name, const char* v
return 0; return 0;
} }
#if defined(__APPLE__)
static int s3fs_setxattr(const char* path, const char* name, const char* value, size_t size, int flags, uint32_t position)
#else
static int s3fs_setxattr(const char* path, const char* name, const char* value, size_t size, int flags) static int s3fs_setxattr(const char* path, const char* name, const char* value, size_t size, int flags)
#endif
{ {
FPRN("[path=%s][name=%s][value=%p][size=%zu][flags=%d]", path, name, value, size, flags); FPRN("[path=%s][name=%s][value=%p][size=%zu][flags=%d]", path, name, value, size, flags);
@ -2893,6 +2902,13 @@ static int s3fs_setxattr(const char* path, const char* name, const char* value,
return 0; return 0;
} }
#if defined(__APPLE__)
if (position != 0) {
// No resource fork support
return -EINVAL;
}
#endif
int result; int result;
string strpath; string strpath;
string newpath; string newpath;
@ -2963,7 +2979,11 @@ static int s3fs_setxattr(const char* path, const char* name, const char* value,
return 0; return 0;
} }
#if defined(__APPLE__)
static int s3fs_getxattr(const char* path, const char* name, char* value, size_t size, uint32_t position)
#else
static int s3fs_getxattr(const char* path, const char* name, char* value, size_t size) static int s3fs_getxattr(const char* path, const char* name, char* value, size_t size)
#endif
{ {
FPRN("[path=%s][name=%s][value=%p][size=%zu]", path, name, value, size); FPRN("[path=%s][name=%s][value=%p][size=%zu]", path, name, value, size);
@ -2971,6 +2991,13 @@ static int s3fs_getxattr(const char* path, const char* name, char* value, size_t
return -EIO; return -EIO;
} }
#if (__APPLE__)
if (position != 0) {
// No resource fork support
return -EINVAL;
}
#endif
int result; int result;
headers_t meta; headers_t meta;
xattrs_t xattrs; xattrs_t xattrs;