From a3cb38e3edf005bef73da4c9cfd958474a14d50f Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 17 Apr 2014 15:54:34 -0700 Subject: build: MacOSX Porting fixes git@forge.gluster.org:~schafdog/glusterfs-core/osx-glusterfs Working functionality on MacOSX - GlusterD (management daemon) - GlusterCLI (management cli) - GlusterFS FUSE (using OSXFUSE) - GlusterNFS (without NLM - issues with rpc.statd) Change-Id: I20193d3f8904388e47344e523b3787dbeab044ac BUG: 1089172 Signed-off-by: Harshavardhana Signed-off-by: Dennis Schafroth Tested-by: Harshavardhana Tested-by: Dennis Schafroth Reviewed-on: http://review.gluster.org/7503 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/syscall.h | 53 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) (limited to 'libglusterfs/src/syscall.h') diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h index f1c9f58c3..bbf23bef0 100644 --- a/libglusterfs/src/syscall.h +++ b/libglusterfs/src/syscall.h @@ -11,6 +11,41 @@ #ifndef __SYSCALL_H__ #define __SYSCALL_H__ +/* GF follows the Linux XATTR definition, which differs in Darwin. */ +#define GF_XATTR_CREATE 0x1 /* set value, fail if attr already exists */ +#define GF_XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ + +/* Linux kernel version 2.6.x don't have these defined + define if not defined */ + +#ifndef XATTR_SECURITY_PREFIX +#define XATTR_SECURITY_PREFIX "security." +#define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1) +#endif + +#ifndef XATTR_SYSTEM_PREFIX +#define XATTR_SYSTEM_PREFIX "system." +#define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1) +#endif + +#ifndef XATTR_TRUSTED_PREFIX +#define XATTR_TRUSTED_PREFIX "trusted." +#define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1) +#endif + +#ifndef XATTR_USER_PREFIX +#define XATTR_USER_PREFIX "user." +#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1) +#endif + +#if defined(GF_DARWIN_HOST_OS) +#include +#define XATTR_DARWIN_NOSECURITY XATTR_NOSECURITY +#define XATTR_DARWIN_NODEFAULT XATTR_NODEFAULT +#define XATTR_DARWIN_SHOWCOMPRESSION XATTR_SHOWCOMPRESSION +#endif + + int sys_lstat (const char *path, struct stat *buf); @@ -20,8 +55,13 @@ sys_stat (const char *path, struct stat *buf); int sys_fstat (int fd, struct stat *buf); -DIR * -sys_opendir (const char *name); +int +sys_fstatat (int dirfd, const char *pathname, struct stat *buf, + int flags); +int +sys_openat (int dirfd, const char *pathname, int flags, ...); + +DIR *sys_opendir (const char *name); struct dirent * sys_readdir (DIR *dir); @@ -38,6 +78,9 @@ sys_mknod (const char *pathname, mode_t mode, dev_t dev); int sys_mkdir (const char *pathname, mode_t mode); +int +sys_mkdirat (int dirfd, const char *pathname, mode_t mode); + int sys_unlink (const char *pathname); @@ -107,6 +150,12 @@ sys_fsync (int fd); int sys_fdatasync (int fd); +void +gf_add_prefix(const char *ns, const char *key, char **newkey); + +void +gf_remove_prefix(const char *ns, const char *key, char **newkey); + int sys_lsetxattr (const char *path, const char *name, const void *value, size_t size, int flags); -- cgit