diff options
| author | Harshavardhana <harsha@harshavardhana.net> | 2014-04-17 15:54:34 -0700 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2014-04-24 14:41:48 -0700 | 
| commit | a3cb38e3edf005bef73da4c9cfd958474a14d50f (patch) | |
| tree | a406029332a9eb096c14d441160bb670a42df8cb /xlators/storage/posix/src/posix-helpers.c | |
| parent | 9c13471b109587a639662fc690384285bee02bc6 (diff) | |
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 <harsha@harshavardhana.net>
Signed-off-by: Dennis Schafroth <dennis@schafroth.com>
Tested-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Dennis Schafroth <dennis@schafroth.com>
Reviewed-on: http://review.gluster.org/7503
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-helpers.c')
| -rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 39 | 
1 files changed, 30 insertions, 9 deletions
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 5725cad7d92..ab46f7f7e95 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -784,6 +784,27 @@ out:          return op_ret;  } +#ifdef GF_DARWIN_HOST_OS +static +void posix_dump_buffer (xlator_t *this, const char *real_path, const char *key, +                        data_t *value, int flags) +{ +        char buffer[3*value->len+1]; +        int index = 0; +        buffer[0] = 0; +        gf_loglevel_t log_level = gf_log_get_loglevel (); +        if (log_level == GF_LOG_TRACE) { +                char *data = (char *) value->data; +                for (index = 0; index < value->len; index++) +                        sprintf(buffer+3*index, " %02x", data[index]); +        } +        gf_log (this->name, GF_LOG_DEBUG, +                "Dump %s: key:%s flags: %u length:%u data:%s ", +                real_path, key, flags, value->len, +                (log_level == GF_LOG_TRACE ? buffer : "<skipped in DEBUG>")); +} +#endif +  static int gf_xattr_enotsup_log;  int @@ -802,7 +823,9 @@ posix_handle_pair (xlator_t *this, const char *real_path,          } else {                  sys_ret = sys_lsetxattr (real_path, key, value->data,                                           value->len, flags); - +#ifdef GF_DARWIN_HOST_OS +                posix_dump_buffer(this, real_path, key, value, flags); +#endif                  if (sys_ret < 0) {                          ret = -errno;                          if (errno == ENOTSUP) { @@ -825,13 +848,13 @@ posix_handle_pair (xlator_t *this, const char *real_path,                                  gf_log (this->name,                                          ((errno == EINVAL) ?                                           GF_LOG_DEBUG : GF_LOG_ERROR), -                                        "%s: key:%s error:%s", -                                        real_path, key, +                                        "%s: key:%s flags: %u length:%d error:%s", +                                        real_path, key, flags, value->len,                                          strerror (errno));  #else /* ! DARWIN */                                  gf_log (this->name, GF_LOG_ERROR, -                                        "%s: key:%s error:%s", -                                        real_path, key, +                                        "%s: key:%s flags: %u length:%d error:%s", +                                        real_path, key, flags, value->len,                                          strerror (errno));  #endif /* DARWIN */                          } @@ -1430,12 +1453,10 @@ posix_fsyncer_process (xlator_t *this, call_stub_t *stub, gf_boolean_t do_fsync)          }          if (do_fsync) { -#ifdef HAVE_FDATASYNC                  if (stub->args.datasync) -                        ret = fdatasync (pfd->fd); +                        ret = sys_fdatasync (pfd->fd);                  else -#endif -                        ret = fsync (pfd->fd); +                        ret = sys_fsync (pfd->fd);          } else {                  ret = 0;          }  | 
