diff options
| author | Emmanuel Dreyfus <manu@netbsd.org> | 2015-04-02 15:51:30 +0200 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-04 10:48:35 -0700 | 
| commit | 28397cae4102ac3f08576ebaf071ad92683097e8 (patch) | |
| tree | 4c8be92299a951c8a28e1dc85bf2671f60da6e08 /xlators/cluster/dht/src | |
| parent | 0aebfaa349c7c68c2d59531eabae5a03a748e16a (diff) | |
Avoid conflict between contrib/uuid and system uuid
glusterfs relies on Linux uuid implementation, which
API is incompatible with most other systems's uuid. As
a result, libglusterfs has to embed contrib/uuid,
which is the Linux implementation, on non Linux systems.
This implementation is incompatible with systtem's
built in, but the symbols have the same names.
Usually this is not a problem because when we link
with -lglusterfs, libc's symbols are trumped. However
there is a problem when a program not linked with
-lglusterfs will dlopen() glusterfs component. In
such a case, libc's uuid implementation is already
loaded in the calling program, and it will be used
instead of libglusterfs's implementation, causing
crashes.
A possible workaround is to use pre-load libglusterfs
in the calling program (using LD_PRELOAD on NetBSD for
instance), but such a mechanism is not portable, nor
is it flexible. A much better approach is to rename
libglusterfs's uuid_* functions to gf_uuid_* to avoid
any possible conflict. This is what this change attempts.
BUG: 1206587
Change-Id: I9ccd3e13afed1c7fc18508e92c7beb0f5d49f31a
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.org/10017
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src')
| -rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 90 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-helper.c | 8 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-layout.c | 4 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-linkfile.c | 12 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 34 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-rename.c | 20 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-selfheal.c | 18 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-shared.c | 2 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/tier.c | 12 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/unittest/dht_layout_mock.c | 2 | 
10 files changed, 101 insertions, 101 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 9a98ebfab30..6d36fdbe284 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -294,7 +294,7 @@ selfheal:          main_frame->local = local;          discover_frame->local =  NULL;          FRAME_SU_DO (main_frame, dht_local_t); -        uuid_copy (local->loc.gfid, local->gfid); +        gf_uuid_copy (local->loc.gfid, local->gfid);          ret = dht_selfheal_directory_for_nameless_lookup (main_frame,                                                          dht_lookup_selfheal_cbk,                                                            &local->loc, layout); @@ -334,10 +334,10 @@ dht_discover_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          /* Check if the gfid is different for file from other node */ -        if (!op_ret && uuid_compare (local->gfid, stbuf->ia_gfid)) { +        if (!op_ret && gf_uuid_compare (local->gfid, stbuf->ia_gfid)) { -                uuid_unparse(stbuf->ia_gfid, gfid_node); -                uuid_unparse(local->gfid, gfid_local); +                gf_uuid_unparse(stbuf->ia_gfid, gfid_node); +                gf_uuid_unparse(local->gfid, gfid_local);                  gf_msg (this->name, GF_LOG_WARNING, 0,                          DHT_MSG_GFID_MISMATCH, @@ -469,7 +469,7 @@ dht_discover (call_frame_t *frame, xlator_t *this, loc_t *loc)                  goto err;          } -        uuid_copy (local->gfid, loc->gfid); +        gf_uuid_copy (local->gfid, loc->gfid);          discover_frame = copy_frame (frame);          if (!discover_frame) { @@ -524,15 +524,15 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          layout = local->layout; -        if (!op_ret && uuid_is_null (local->gfid)) +        if (!op_ret && gf_uuid_is_null (local->gfid))                  memcpy (local->gfid, stbuf->ia_gfid, 16);          /* Check if the gfid is different for file from other node */ -        if (!op_ret && uuid_compare (local->gfid, stbuf->ia_gfid)) { +        if (!op_ret && gf_uuid_compare (local->gfid, stbuf->ia_gfid)) { -                uuid_unparse(stbuf->ia_gfid, gfid_node); -                uuid_unparse(local->gfid, gfid_local); +                gf_uuid_unparse(stbuf->ia_gfid, gfid_node); +                gf_uuid_unparse(local->gfid, gfid_local);                  gf_msg (this->name, GF_LOG_WARNING, 0,                          DHT_MSG_GFID_MISMATCH, @@ -631,7 +631,7 @@ unlock:  selfheal:          FRAME_SU_DO (frame, dht_local_t); -        uuid_copy (local->loc.gfid, local->gfid); +        gf_uuid_copy (local->loc.gfid, local->gfid);          ret = dht_selfheal_directory (frame, dht_lookup_selfheal_cbk,                                        &local->loc, layout);  out: @@ -667,7 +667,7 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          if (!conf)                  goto out; -        uuid_unparse (local->loc.gfid, gfid); +        gf_uuid_unparse (local->loc.gfid, gfid);          LOCK (&frame->lock);          { @@ -803,7 +803,7 @@ out:                  }                  if (local->need_selfheal) {                          local->need_selfheal = 0; -                        uuid_copy (local->gfid, local->stbuf.ia_gfid); +                        gf_uuid_copy (local->gfid, local->stbuf.ia_gfid);                          local->stbuf.ia_gid = local->prebuf.ia_gid;                          local->stbuf.ia_uid = local->prebuf.ia_uid;                          copy = create_frame (this, this->ctx->pool); @@ -888,7 +888,7 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,          cached_subvol = local->cached_subvol;          conf = this->private; -        uuid_unparse(local->loc.gfid, gfid); +        gf_uuid_unparse(local->loc.gfid, gfid);          ret = dht_layout_preset (this, local->cached_subvol, local->loc.inode);          if (ret < 0) { @@ -1118,7 +1118,7 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)          hashed_subvol = local->hashed_subvol;          cached_subvol = local->cached_subvol; -        uuid_unparse (local->loc.gfid, gfid); +        gf_uuid_unparse (local->loc.gfid, gfid);          if (local->file_count && local->dir_count) {                  gf_msg (this->name, GF_LOG_ERROR, 0, @@ -1244,7 +1244,7 @@ dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this)                  if (local->skip_unlink.handle_valid_link == _gf_true) {                          if (cached_subvol == local->skip_unlink.hash_links_to) { -                             if (uuid_compare (local->skip_unlink.cached_gfid, +                             if (gf_uuid_compare (local->skip_unlink.cached_gfid,                                                 local->skip_unlink.hashed_gfid)){                                          /*GFID different, return error*/ @@ -1335,7 +1335,7 @@ preset_layout:          if (found_non_linkto_on_hashed) {                  if (local->need_lookup_everywhere) { -                        if (uuid_compare (local->gfid, local->inode->gfid)) { +                        if (gf_uuid_compare (local->gfid, local->inode->gfid)) {                                  /* GFID different, return error */                                  DHT_STACK_UNWIND (lookup, frame, -1, ENOENT,                                                    NULL, NULL, NULL, NULL); @@ -1478,12 +1478,12 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                          goto unlock;                  } -                if (uuid_is_null (local->gfid)) -                        uuid_copy (local->gfid, buf->ia_gfid); +                if (gf_uuid_is_null (local->gfid)) +                        gf_uuid_copy (local->gfid, buf->ia_gfid); -                uuid_unparse(local->gfid, gfid); +                gf_uuid_unparse(local->gfid, gfid); -                if (uuid_compare (local->gfid, buf->ia_gfid)) { +                if (gf_uuid_compare (local->gfid, buf->ia_gfid)) {                          gf_msg (this->name, GF_LOG_WARNING, 0,                                  DHT_MSG_GFID_MISMATCH,                                  "%s: gfid differs on subvolume %s," @@ -1515,7 +1515,7 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  }                  /* non linkfile GFID takes precedence */ -                uuid_copy (local->gfid, buf->ia_gfid); +                gf_uuid_copy (local->gfid, buf->ia_gfid);                  if (is_dir) {                          local->dir_count++; @@ -1544,7 +1544,7 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                                  dht_iatt_merge (this, &local->postparent,                                                  postparent, subvol); -                                uuid_copy (local->skip_unlink.cached_gfid, +                                gf_uuid_copy (local->skip_unlink.cached_gfid,                                             buf->ia_gfid);                          } else {                                  /* This is where we need 'rename' both entries logic */ @@ -1580,7 +1580,7 @@ unlock:                          local->skip_unlink.handle_valid_link = _gf_true;                          local->skip_unlink.opend_fd_count = fd_count;                          local->skip_unlink.hash_links_to = link_subvol; -                        uuid_copy (local->skip_unlink.hashed_gfid, +                        gf_uuid_copy (local->skip_unlink.hashed_gfid,                                     buf->ia_gfid);                          gf_msg_debug (this->name, 0, "Found" @@ -1708,7 +1708,7 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,          local  = frame->local;          loc    = &local->loc; -        uuid_unparse(loc->gfid, gfid); +        gf_uuid_unparse(loc->gfid, gfid);          if (op_ret == -1) {                  gf_log (this->name, GF_LOG_INFO, @@ -1741,7 +1741,7 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,                  goto err;          } -        if (uuid_compare (local->gfid, stbuf->ia_gfid)) { +        if (gf_uuid_compare (local->gfid, stbuf->ia_gfid)) {                  gf_msg (this->name, GF_LOG_WARNING, 0,                          DHT_MSG_GFID_MISMATCH,                          "%s: gfid different on data file on %s," @@ -1815,7 +1815,7 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc)                  local->xattr = NULL;          } -        if (!uuid_is_null (local->gfid)) { +        if (!gf_uuid_is_null (local->gfid)) {                  ret = dict_set_static_bin (local->xattr_req, "gfid-req",                                             local->gfid, 16);                  if (ret) @@ -1871,7 +1871,7 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          /* This is required for handling stale linkfile deletion,           * or any more call which happens from this 'loc'.           */ -        if (!op_ret && uuid_is_null (local->gfid)) +        if (!op_ret && gf_uuid_is_null (local->gfid))                  memcpy (local->gfid, stbuf->ia_gfid, 16);          gf_msg_debug (this->name, 0, @@ -2074,7 +2074,7 @@ dht_lookup (call_frame_t *frame, xlator_t *this,                  local->xattr_req = dict_new ();          } -        if (uuid_is_null (loc->pargfid) && !uuid_is_null (loc->gfid) && +        if (gf_uuid_is_null (loc->pargfid) && !gf_uuid_is_null (loc->gfid) &&              !__is_root_gfid (loc->inode->gfid)) {                  local->cached_subvol = NULL;                  dht_discover (frame, this, loc); @@ -4762,7 +4762,7 @@ dht_link (call_frame_t *frame, xlator_t *this,          }          if (hashed_subvol != cached_subvol) { -                uuid_copy (local->gfid, oldloc->inode->gfid); +                gf_uuid_copy (local->gfid, oldloc->inode->gfid);                  dht_linkfile_create (frame, dht_link_linkfile_cbk, this,                                       cached_subvol, hashed_subvol, newloc);          } else { @@ -5068,8 +5068,8 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie,          conf = this->private;          hashed_subvol = local->hashed_subvol; -        if (uuid_is_null (local->loc.gfid) && !op_ret) -                uuid_copy (local->loc.gfid, stbuf->ia_gfid); +        if (gf_uuid_is_null (local->loc.gfid) && !op_ret) +                gf_uuid_copy (local->loc.gfid, stbuf->ia_gfid);          if (dht_is_subvol_filled (this, hashed_subvol))                  ret = dht_layout_merge (this, layout, prev->this, @@ -5098,8 +5098,8 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie,          local->call_cnt = conf->subvolume_cnt - 1; -        if (uuid_is_null (local->loc.gfid)) -                uuid_copy (local->loc.gfid, stbuf->ia_gfid); +        if (gf_uuid_is_null (local->loc.gfid)) +                gf_uuid_copy (local->loc.gfid, stbuf->ia_gfid);          if (local->call_cnt == 0) {                  dht_selfheal_directory (frame, dht_mkdir_selfheal_cbk,                                          &local->loc, layout); @@ -5214,7 +5214,7 @@ dht_rmdir_hashed_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          prev  = cookie;          conf = this->private; -        uuid_unparse(local->loc.gfid, gfid); +        gf_uuid_unparse(local->loc.gfid, gfid);          LOCK (&frame->lock);          { @@ -5252,7 +5252,7 @@ unlock:                          /* TODO: neater interface needed below */                          local->stbuf.ia_type = local->loc.inode->ia_type; -                        uuid_copy (local->gfid, local->loc.inode->gfid); +                        gf_uuid_copy (local->gfid, local->loc.inode->gfid);                          dht_selfheal_restore (frame, dht_rmdir_selfheal_cbk,                                                &local->loc, local->layout);                 } else { @@ -5305,7 +5305,7 @@ dht_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                                          local->need_selfheal = 1;                          } -                        uuid_unparse(local->loc.gfid, gfid); +                        gf_uuid_unparse(local->loc.gfid, gfid);                          gf_msg_debug (this->name, 0,                                        "rmdir on %s for %s failed." @@ -5343,7 +5343,7 @@ unlock:                          /* TODO: neater interface needed below */                          local->stbuf.ia_type = local->loc.inode->ia_type; -                        uuid_copy (local->gfid, local->loc.inode->gfid); +                        gf_uuid_copy (local->gfid, local->loc.inode->gfid);                          dht_selfheal_restore (frame, dht_rmdir_selfheal_cbk,                                                &local->loc, local->layout);                  } else if (this_call_cnt) { @@ -5405,7 +5405,7 @@ dht_rmdir_do (call_frame_t *frame, xlator_t *this)          hashed_subvol = dht_subvol_get_hashed (this, &local->loc);          if (!hashed_subvol) { -                uuid_unparse(local->loc.gfid, gfid); +                gf_uuid_unparse(local->loc.gfid, gfid);                  gf_msg (this->name, GF_LOG_WARNING, 0,                          DHT_MSG_HASHED_SUBVOL_GET_FAILED, @@ -5465,7 +5465,7 @@ dht_rmdir_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this          main_frame = local->main_frame;          main_local = main_frame->local; -        uuid_unparse(local->loc.gfid, gfid); +        gf_uuid_unparse(local->loc.gfid, gfid);          if (op_ret == 0) {                  gf_msg_trace (this->name, 0, @@ -5517,7 +5517,7 @@ dht_rmdir_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  main_local->op_ret  = -1;                  main_local->op_errno = ENOTEMPTY; -                 uuid_unparse(local->loc.gfid, gfid); +                 gf_uuid_unparse(local->loc.gfid, gfid);                  gf_log (this->name, GF_LOG_WARNING,                          "%s on %s is not a linkfile (type=0%o, gfid = %s)", @@ -5691,9 +5691,9 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,                  if (build_ret != 0)                          goto err; -                uuid_copy (lookup_local->loc.gfid, trav->d_stat.ia_gfid); +                gf_uuid_copy (lookup_local->loc.gfid, trav->d_stat.ia_gfid); -                uuid_unparse(lookup_local->loc.gfid, gfid); +                gf_uuid_unparse(lookup_local->loc.gfid, gfid);                  gf_msg_trace (this->name, 0,                                "looking up %s on subvolume %s, gfid = %s", @@ -5802,7 +5802,7 @@ dht_rmdir_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          this_call_cnt = dht_frame_return (frame);          if (op_ret == -1) { -                uuid_unparse(local->loc.gfid, gfid); +                gf_uuid_unparse(local->loc.gfid, gfid);                  gf_msg_debug (this->name, 0,                                "opendir on %s for %s failed, " @@ -5946,7 +5946,7 @@ dht_entrylk (call_frame_t *frame, xlator_t *this,          subvol = local->cached_subvol;          if (!subvol) { -                uuid_unparse(loc->gfid, gfid); +                gf_uuid_unparse(loc->gfid, gfid);                  gf_msg_debug (this->name, 0,                                "no cached subvolume for path=%s, " @@ -5996,7 +5996,7 @@ dht_fentrylk (call_frame_t *frame, xlator_t *this,          VALIDATE_OR_GOTO (fd, err);          VALIDATE_OR_GOTO(fd->inode, err); -        uuid_unparse(fd->inode->gfid, gfid); +        gf_uuid_unparse(fd->inode->gfid, gfid);          subvol = dht_subvol_get_cached (this, fd->inode);          if (!subvol) { diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 346d19bec88..35d3d0f9dba 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -674,7 +674,7 @@ dht_iatt_merge (xlator_t *this, struct iatt *to,          to->ia_dev      = from->ia_dev; -        uuid_copy (to->ia_gfid, from->ia_gfid); +        gf_uuid_copy (to->ia_gfid, from->ia_gfid);          to->ia_ino      = from->ia_ino;          to->ia_prot     = from->ia_prot; @@ -914,7 +914,7 @@ dht_migration_complete_check_task (void *data)                          goto out;                  } -                if (uuid_compare (stbuf.ia_gfid, local->loc.inode->gfid)) { +                if (gf_uuid_compare (stbuf.ia_gfid, local->loc.inode->gfid)) {                          gf_msg (this->name, GF_LOG_ERROR, 0,                                  DHT_MSG_GFID_MISMATCH,                                  "%s: gfid different on the target file on %s", @@ -1111,7 +1111,7 @@ dht_rebalance_inprogress_task (void *data)                          goto out;                  } -                if (uuid_compare (stbuf.ia_gfid, local->loc.inode->gfid)) { +                if (gf_uuid_compare (stbuf.ia_gfid, local->loc.inode->gfid)) {                          gf_msg (this->name, GF_LOG_ERROR, 0,                                  DHT_MSG_GFID_MISMATCH,                                  "%s: gfid different on the target file on %s", @@ -1693,7 +1693,7 @@ dht_lock_request_cmp (const void *val1, const void *val2)          ret = strcmp (lock1->xl->name, lock2->xl->name);          if (ret == 0) { -                ret = uuid_compare (lock1->loc.gfid, lock2->loc.gfid); +                ret = gf_uuid_compare (lock1->loc.gfid, lock2->loc.gfid);          }  out: diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c index 15b183861a7..bbac904743e 100644 --- a/xlators/cluster/dht/src/dht-layout.c +++ b/xlators/cluster/dht/src/dht-layout.c @@ -667,7 +667,7 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout)                  goto out;          } -        uuid_unparse(loc->gfid, gfid); +        gf_uuid_unparse(loc->gfid, gfid);          ret = dht_layout_anomalies (this, loc, layout,                                      &holes, &overlaps, @@ -733,7 +733,7 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,          char        gfid[GF_UUID_BUF_SIZE] = {0};          if(loc && loc->inode) -                uuid_unparse(loc->inode->gfid, gfid); +                gf_uuid_unparse(loc->inode->gfid, gfid);          for (idx = 0; idx < layout->cnt; idx++) {                  if (layout->list[idx].xlator == subvol) { diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c index 90892a8a9bd..14df3187097 100644 --- a/xlators/cluster/dht/src/dht-linkfile.c +++ b/xlators/cluster/dht/src/dht-linkfile.c @@ -39,7 +39,7 @@ dht_linkfile_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          if (op_ret)                  goto out; -        uuid_unparse(local->loc.gfid, gfid); +        gf_uuid_unparse(local->loc.gfid, gfid);          is_linkfile = check_is_linkfile (inode, stbuf, xattr,                                           conf->link_xattr_name); @@ -136,8 +136,8 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,          } -        if (!uuid_is_null (local->gfid)) { -                uuid_unparse(local->gfid, gfid); +        if (!gf_uuid_is_null (local->gfid)) { +                gf_uuid_unparse(local->gfid, gfid);                  ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16);                  if (ret) @@ -146,7 +146,7 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,                                  "%s: Failed to set dictionary value: "                                  "key = gfid-req, gfid = %s ", loc->path, gfid);          } else { -                uuid_unparse(loc->gfid, gfid); +                gf_uuid_unparse(loc->gfid, gfid);          }          ret = dict_set_str (dict, GLUSTERFS_INTERNAL_FOP_KEY, "yes"); @@ -208,7 +208,7 @@ dht_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          if (op_ret == -1) { -                uuid_unparse(local->loc.gfid, gfid); +                gf_uuid_unparse(local->loc.gfid, gfid);                  gf_msg (this->name, GF_LOG_INFO, op_errno,                          DHT_MSG_UNLINK_FAILED,                          "Unlinking linkfile %s (gfid = %s)on " @@ -327,7 +327,7 @@ dht_linkfile_attr_heal (call_frame_t *frame, xlator_t *this)          if (local->stbuf.ia_type == IA_INVAL)                  return 0; -        uuid_copy (local->loc.gfid, local->stbuf.ia_gfid); +        gf_uuid_copy (local->loc.gfid, local->stbuf.ia_gfid);          copy = copy_frame (frame); diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index fc3b6124dd5..a0837e38528 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -154,7 +154,7 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t  *xattrs,          conf = this->private; -        if (uuid_is_null (loc->pargfid)) { +        if (gf_uuid_is_null (loc->pargfid)) {                  gf_msg ("", GF_LOG_ERROR, 0,                          DHT_MSG_MIGRATE_FILE_FAILED,                          "Migrate file failed :" @@ -162,7 +162,7 @@ gf_defrag_handle_hardlink (xlator_t *this, loc_t *loc, dict_t  *xattrs,                  goto out;          } -        if (uuid_is_null (loc->gfid)) { +        if (gf_uuid_is_null (loc->gfid)) {                  gf_msg ("", GF_LOG_ERROR, 0,                          DHT_MSG_MIGRATE_FILE_FAILED,                          "Migrate file failed :" @@ -381,7 +381,7 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc          ret = syncop_lookup (to, loc, NULL, &new_stbuf, NULL, NULL);          if (!ret) {                  /* File exits in the destination, check if gfid matches */ -                if (uuid_compare (stbuf->ia_gfid, new_stbuf.ia_gfid) != 0) { +                if (gf_uuid_compare (stbuf->ia_gfid, new_stbuf.ia_gfid) != 0) {                          gf_msg (this->name, GF_LOG_ERROR, 0,                                  DHT_MSG_GFID_MISMATCH,                                  "file %s exists in %s with different gfid", @@ -428,7 +428,7 @@ __dht_rebalance_create_dst_file (xlator_t *to, xlator_t *from, loc_t *loc, struc          ret = syncop_lookup (to, loc, NULL, &check_stbuf, NULL, NULL);          if (!ret) { -                if (uuid_compare (stbuf->ia_gfid, check_stbuf.ia_gfid) != 0) { +                if (gf_uuid_compare (stbuf->ia_gfid, check_stbuf.ia_gfid) != 0) {                          gf_msg (this->name, GF_LOG_ERROR, 0,                                  DHT_MSG_GFID_MISMATCH,                                  "file %s exists in %s with different gfid," @@ -918,7 +918,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,          flock.l_type = F_WRLCK;          tmp_loc.inode = inode_ref (loc->inode); -        uuid_copy (tmp_loc.gfid, loc->gfid); +        gf_uuid_copy (tmp_loc.gfid, loc->gfid);          tmp_loc.path = gf_strdup(loc->path);          ret = syncop_inodelk (from, DHT_FILE_MIGRATE_DOMAIN, &tmp_loc, F_SETLKW, @@ -1155,7 +1155,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,                  rcvd_enoent_from_src = 1;          } -        if ((uuid_compare (empty_iatt.ia_gfid, loc->gfid) == 0 ) && +        if ((gf_uuid_compare (empty_iatt.ia_gfid, loc->gfid) == 0 ) &&              (!rcvd_enoent_from_src)) {                  /* take out the source from namespace */                  ret = syncop_unlink (from, loc); @@ -1511,7 +1511,7 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                                  goto out;                          } -                        if (uuid_is_null (entry->d_stat.ia_gfid)) { +                        if (gf_uuid_is_null (entry->d_stat.ia_gfid)) {                                  gf_msg (this->name, GF_LOG_ERROR, 0,                                          DHT_MSG_GFID_NULL,                                          "%s/%s gfid not present", loc->path, @@ -1519,9 +1519,9 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                                  continue;                          } -                        uuid_copy (entry_loc.gfid, entry->d_stat.ia_gfid); +                        gf_uuid_copy (entry_loc.gfid, entry->d_stat.ia_gfid); -                        if (uuid_is_null (loc->gfid)) { +                        if (gf_uuid_is_null (loc->gfid)) {                                  gf_msg (this->name, GF_LOG_ERROR, 0,                                          DHT_MSG_GFID_NULL,                                          "%s/%s gfid not present", loc->path, @@ -1529,7 +1529,7 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                                  continue;                          } -                        uuid_copy (entry_loc.pargfid, loc->gfid); +                        gf_uuid_copy (entry_loc.pargfid, loc->gfid);                          entry_loc.inode->ia_type = entry->d_stat.ia_type; @@ -1566,8 +1566,8 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                                  continue;                          } -                        if (uuid_parse (uuid_str, node_uuid)) { -                                gf_log (this->name, GF_LOG_ERROR, "uuid_parse " +                        if (gf_uuid_parse (uuid_str, node_uuid)) { +                                gf_log (this->name, GF_LOG_ERROR, "gf_uuid_parse "                                          "failed for %s", entry_loc.path);                                  continue;                          } @@ -1575,7 +1575,7 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                          /* if file belongs to different node, skip migration                           * the other node will take responsibility of migration                           */ -                        if (uuid_compare (node_uuid, defrag->node_uuid)) { +                        if (gf_uuid_compare (node_uuid, defrag->node_uuid)) {                                  gf_msg_trace (this->name, 0, "%s does not"                                                "belong to this node",                                                entry_loc.path); @@ -1781,7 +1781,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                                  goto out;                          } -                        if (uuid_is_null (entry->d_stat.ia_gfid)) { +                        if (gf_uuid_is_null (entry->d_stat.ia_gfid)) {                                  gf_log (this->name, GF_LOG_ERROR, "%s/%s"                                          " gfid not present", loc->path,                                           entry->d_name); @@ -1789,7 +1789,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                          } -                        uuid_copy (entry_loc.gfid, entry->d_stat.ia_gfid); +                        gf_uuid_copy (entry_loc.gfid, entry->d_stat.ia_gfid);                          /*In case the gfid stored in the inode by inode_link                           * and the gfid obtained in the lookup differs, then @@ -1805,14 +1805,14 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,                          entry_loc.inode = linked_inode;                          inode_unref (inode); -                        if (uuid_is_null (loc->gfid)) { +                        if (gf_uuid_is_null (loc->gfid)) {                                  gf_log (this->name, GF_LOG_ERROR, "%s/%s"                                          " gfid not present", loc->path,                                           entry->d_name);                                  continue;                          } -                        uuid_copy (entry_loc.pargfid, loc->gfid); +                        gf_uuid_copy (entry_loc.pargfid, loc->gfid);                          ret = syncop_lookup (this, &entry_loc, NULL, &iatt,                                               NULL, NULL); diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index c8a05a3939d..7d73eb9f272 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -40,7 +40,7 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          if (op_ret == -1) {                  /* TODO: undo the damage */ -                uuid_unparse(local->loc.inode->gfid, gfid); +                gf_uuid_unparse(local->loc.inode->gfid, gfid);                  gf_msg (this->name, GF_LOG_INFO, op_errno,                          DHT_MSG_RENAME_FAILED, @@ -110,7 +110,7 @@ dht_rename_hashed_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          if (op_ret == -1) {                  /* TODO: undo the damage */ -                uuid_unparse(local->loc.inode->gfid, gfid); +                gf_uuid_unparse(local->loc.inode->gfid, gfid);                  gf_msg (this->name, GF_LOG_INFO, op_errno,                          DHT_MSG_RENAME_FAILED, @@ -241,7 +241,7 @@ dht_rename_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          if (op_ret == -1) { -                uuid_unparse(local->loc.inode->gfid, gfid); +                gf_uuid_unparse(local->loc.inode->gfid, gfid);                  gf_msg (this->name, GF_LOG_INFO, op_errno,                          DHT_MSG_OPENDIR_FAILED,                          "opendir on %s for %s failed,(gfid = %s) ", @@ -501,7 +501,7 @@ dht_rename_cleanup (call_frame_t *frame)          DHT_MARK_FOP_INTERNAL (xattr); -        uuid_unparse(local->loc.inode->gfid, gfid); +        gf_uuid_unparse(local->loc.inode->gfid, gfid);          if (local->linked && (dst_hashed != src_hashed) &&                          (dst_hashed != src_cached)) { @@ -535,7 +535,7 @@ dht_rename_cleanup (call_frame_t *frame)                  xattr_new = dict_copy_with_ref (xattr, NULL); -                if (uuid_compare (local->loc.pargfid, +                if (gf_uuid_compare (local->loc.pargfid,                                    local->loc2.pargfid) == 0) {                          DHT_MARKER_DONT_ACCOUNT(xattr_new);                  } @@ -683,7 +683,7 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  if (link_local->loc.inode)                          inode_unref (link_local->loc.inode);                  link_local->loc.inode = inode_ref (local->loc.inode); -                uuid_copy (link_local->gfid, local->loc.inode->gfid); +                gf_uuid_copy (link_local->gfid, local->loc.inode->gfid);                  dht_linkfile_create (link_frame, dht_rename_links_create_cbk,                                       this, src_cached, dst_hashed, @@ -740,7 +740,7 @@ err:                                "deleting old src datafile %s @ %s",                                local->loc.path, src_cached->name); -                if (uuid_compare (local->loc.pargfid, +                if (gf_uuid_compare (local->loc.pargfid,                                    local->loc2.pargfid) == 0) {                          DHT_MARKER_DONT_ACCOUNT(xattr_new);                  } @@ -920,7 +920,7 @@ dht_rename_linkto_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          gf_msg_trace (this->name, 0,                        "link %s => %s (%s)", local->loc.path,                        local->loc2.path, src_cached->name); -        if (uuid_compare (local->loc.pargfid, +        if (gf_uuid_compare (local->loc.pargfid,                                  local->loc2.pargfid) == 0) {                  DHT_MARKER_DONT_ACCOUNT(xattr);          } @@ -1062,7 +1062,7 @@ dht_rename_create_links (call_frame_t *frame)                  gf_msg_trace (this->name, 0,                                "link %s => %s (%s)", local->loc.path,                                local->loc2.path, src_cached->name); -                if (uuid_compare (local->loc.pargfid, +                if (gf_uuid_compare (local->loc.pargfid,                                    local->loc2.pargfid) == 0) {                          DHT_MARKER_DONT_ACCOUNT(xattr_new);                  } @@ -1281,7 +1281,7 @@ dht_rename (call_frame_t *frame, xlator_t *this,          VALIDATE_OR_GOTO (oldloc, err);          VALIDATE_OR_GOTO (newloc, err); -        uuid_unparse(oldloc->inode->gfid, gfid); +        gf_uuid_unparse(oldloc->inode->gfid, gfid);          src_hashed = dht_subvol_get_hashed (this, oldloc);          if (!src_hashed) { diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 727b2d6027d..f0f44ebf77a 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -657,7 +657,7 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,                  goto err;          } -        uuid_unparse(loc->inode->gfid, gfid); +        gf_uuid_unparse(loc->inode->gfid, gfid);          ret = dht_disk_layout_extract (this, layout, i, &disk_layout);          if (ret == -1) { @@ -700,8 +700,8 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,                  }          } -        if (!uuid_is_null (local->gfid)) -                uuid_copy (loc->gfid, local->gfid); +        if (!gf_uuid_is_null (local->gfid)) +                gf_uuid_copy (loc->gfid, local->gfid);          STACK_WIND (frame, dht_selfheal_dir_xattr_cbk,                      subvol, subvol->fops->setxattr, @@ -1041,8 +1041,8 @@ dht_selfheal_dir_setattr (call_frame_t *frame, loc_t *loc, struct iatt *stbuf,                  return 0;          } -        if (!uuid_is_null (local->gfid)) -                uuid_copy (loc->gfid, local->gfid); +        if (!gf_uuid_is_null (local->gfid)) +                gf_uuid_copy (loc->gfid, local->gfid);          local->call_cnt = missing_attr;          for (i = 0; i < layout->cnt; i++) { @@ -1093,7 +1093,7 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          if (op_ret) { -                uuid_unparse(local->loc.gfid, gfid); +                gf_uuid_unparse(local->loc.gfid, gfid);                  gf_msg (this->name, ((op_errno == EEXIST) ? GF_LOG_DEBUG :                                       GF_LOG_WARNING),                          op_errno, DHT_MSG_DIR_SELFHEAL_FAILED, @@ -1188,7 +1188,7 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc,          }          local->call_cnt = missing_dirs; -        if (!uuid_is_null (local->gfid)) { +        if (!gf_uuid_is_null (local->gfid)) {                  dict = dict_new ();                  if (!dict)                          return -1; @@ -1739,7 +1739,7 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,          local = frame->local;          this = frame->this; -        uuid_unparse(loc->gfid, gfid); +        gf_uuid_unparse(loc->gfid, gfid);          dht_layout_anomalies (this, loc, layout,                                &local->selfheal.hole_cnt, @@ -1915,7 +1915,7 @@ dht_dir_attr_heal (void *data)                                        (GF_SET_ATTR_UID | GF_SET_ATTR_GID),                                        NULL, NULL);                  if (ret) { -                        uuid_unparse(local->loc.gfid, gfid); +                        gf_uuid_unparse(local->loc.gfid, gfid);                          gf_msg ("dht", GF_LOG_ERROR, -ret,                                  DHT_MSG_DIR_ATTR_HEAL_FAILED, diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c index 3987510441f..0c008d83653 100644 --- a/xlators/cluster/dht/src/dht-shared.c +++ b/xlators/cluster/dht/src/dht-shared.c @@ -579,7 +579,7 @@ dht_init (xlator_t *this)                          goto err;                  } -                if (uuid_parse (node_uuid, defrag->node_uuid)) { +                if (gf_uuid_parse (node_uuid, defrag->node_uuid)) {                          gf_msg (this->name, GF_LOG_ERROR, 0,                                  DHT_MSG_INVALID_OPTION, "Invalid option:"                                  " Cannot parse glusterd node uuid"); diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index 7e3eaa02c02..51a6a8340e9 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -134,7 +134,7 @@ tier_migrate_using_query_file (void *_args)                          continue;                  } -                uuid_parse (gfid_str, query_record->gfid); +                gf_uuid_parse (gfid_str, query_record->gfid);                  if (dict_get(migrate_data, GF_XATTR_FILE_MIGRATE_KEY))                          dict_del(migrate_data, GF_XATTR_FILE_MIGRATE_KEY); @@ -181,7 +181,7 @@ tier_migrate_using_query_file (void *_args)                                  goto error;                          } -                        uuid_copy (p_loc.gfid, link_info->pargfid); +                        gf_uuid_copy (p_loc.gfid, link_info->pargfid);                          p_loc.inode = inode_new (defrag->root_inode->table);                          if (!p_loc.inode) { @@ -206,9 +206,9 @@ tier_migrate_using_query_file (void *_args)                          inode_unref (p_loc.inode);                          p_loc.inode = linked_inode; -                        uuid_copy (loc.gfid, query_record->gfid); +                        gf_uuid_copy (loc.gfid, query_record->gfid);                          loc.inode = inode_new (defrag->root_inode->table); -                        uuid_copy (loc.pargfid, link_info->pargfid); +                        gf_uuid_copy (loc.pargfid, link_info->pargfid);                          loc.parent = inode_ref(p_loc.inode);                          loc.name = gf_strdup (link_info->file_name); @@ -229,7 +229,7 @@ tier_migrate_using_query_file (void *_args)                                  goto error;                          } -                        uuid_copy (loc.parent->gfid, link_info->pargfid); +                        gf_uuid_copy (loc.parent->gfid, link_info->pargfid);                          ret = syncop_lookup (this, &loc, NULL, ¤t,                                               NULL, NULL); @@ -313,7 +313,7 @@ tier_gf_query_callback (gfdb_query_record_t *gfdb_query_record,          GF_VALIDATE_OR_GOTO ("tier", query_cbk_args->defrag, out);          GF_VALIDATE_OR_GOTO ("tier", query_cbk_args->queryFILE, out); -        uuid_unparse (gfdb_query_record->gfid, gfid_str); +        gf_uuid_unparse (gfdb_query_record->gfid, gfid_str);          fprintf (query_cbk_args->queryFILE, "%s|%s|%ld\n", gfid_str,                   gfdb_query_record->_link_info_str,                   gfdb_query_record->link_info_size); diff --git a/xlators/cluster/dht/src/unittest/dht_layout_mock.c b/xlators/cluster/dht/src/unittest/dht_layout_mock.c index a5c6357a3da..faf871d49be 100644 --- a/xlators/cluster/dht/src/unittest/dht_layout_mock.c +++ b/xlators/cluster/dht/src/unittest/dht_layout_mock.c @@ -62,7 +62,7 @@ int _gf_log_callingfn (const char *domain, const char *file,      return 0;  } -void uuid_unparse(const uuid_t uu, char *out) +void gf_uuid_unparse(const uuid_t uu, char *out)  {      // could call a will-return function here      // to place the correct data in *out  | 
