diff options
Diffstat (limited to 'libglusterfs/src/syscall.h')
| -rw-r--r-- | libglusterfs/src/syscall.h | 77 |
1 files changed, 61 insertions, 16 deletions
diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h index de1044cdb..bbf23bef0 100644 --- a/libglusterfs/src/syscall.h +++ b/libglusterfs/src/syscall.h @@ -1,25 +1,51 @@ /* - Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com> + Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com> This file is part of GlusterFS. - GlusterFS is free software; you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - GlusterFS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see - <http://www.gnu.org/licenses/>. + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. */ #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 <sys/xattr.h> +#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); @@ -29,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); @@ -48,6 +79,9 @@ 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); int @@ -116,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); @@ -140,9 +180,14 @@ int sys_lremovexattr (const char *path, const char *name); int +sys_fremovexattr (int filedes, const char *name); + +int sys_access (const char *pathname, int mode); int sys_ftruncate (int fd, off_t length); +int sys_fallocate(int fd, int mode, off_t offset, off_t len); + #endif /* __SYSCALL_H__ */ |
