Re: [PATCH BUG:361 3/3] OS X: getxattr() takes two additional arguments on Mac OS X

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/9/27 Amar Tumballi <amar@xxxxxxxxxxx>:
> Even here, how about just calling 'sys_getxattr()' instead of getxattr()?
>
> Ref: 'libglusterfs/src/syscall.c'
>
> My apologies, I should have kept in mind about compatibility of posix calls
> while writing these lines..
>

Thanks, I didn't know about libglusterfs/src/syscall.c.

Below is a new patch, compile tested on Linux and verified against man
pages on Mac OS X and FreeBSD.


Signed-off-by: Noah Williamsson <noah.williamsson@xxxxxxxxx>
---
 libglusterfs/src/syscall.c                   |   24 ++++++++++++++++++++++++
 xlators/mgmt/glusterd/src/glusterd-handler.c |    4 ++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index e0d0b13..1e83924 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -307,6 +307,30 @@ sys_llistxattr (const char *path, char *list, size_t size)


 ssize_t
+sys_getxattr (const char *path, const char *name, void *value, size_t size)
+{
+
+#ifdef GF_LINUX_HOST_OS
+        return getxattr (path, name, value, size);
+#endif
+
+#ifdef GF_BSD_HOST_OS
+        return extattr_get_file (path, EXTATTR_NAMESPACE_USER, name, value,
+                                 size);
+#endif
+
+#ifdef GF_SOLARIS_HOST_OS
+        return solaris_getxattr (path, name, value, size);
+#endif
+
+#ifdef GF_DARWIN_HOST_OS
+        return getxattr (path, name, value, size, 0, 0);
+#endif
+
+}
+
+
+ssize_t
 sys_lgetxattr (const char *path, const char *name, void *value, size_t size)
 {

diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c
b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 0da46c5..6fc32b8 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -730,7 +730,7 @@ glusterd_check_and_rebalance (glusterd_volinfo_t
*volinfo, char *dir)

                 if (S_ISDIR (stbuf.st_mode)) {
                         /* Fix the layout of the directory */
-                        getxattr (full_path, "trusted.distribute.fix.layout",
+                        sys_getxattr (full_path,
"trusted.distribute.fix.layout",
                                   &value, 128);
                         continue;
                 }
@@ -859,7 +859,7 @@ glusterd_defrag_start (void *data)
         }

         /* Fix the root ('/') first */
-        getxattr (defrag->mount, "trusted.distribute.fix.layout", &value, 128);
+        sys_getxattr (defrag->mount, "trusted.distribute.fix.layout",
&value, 128);

         ret = glusterd_check_and_rebalance (volinfo, defrag->mount);

-- 
1.7.0.4


-- 
Best regards,
Noah Williamsson



[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux