diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2019-06-13 16:22:44 +0300 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-06-25 06:44:12 +0000 |
commit | fa804f13f3c1a2e8701327a3746b979f04ce09dd (patch) | |
tree | 6a9b130b0c8eb064cfc1fa37acb1f909e2047a48 /xlators/mgmt/glusterd/src/glusterd-store.c | |
parent | 283b77805cca3027e333a11c9b00ac611662c9ee (diff) |
glusterd.h: remove unneeded macros or move them to their users.
Some macros were not used, so removed.
Some macros were quite local, so moved to the respective users.
Some macros simplified (removed an allocation here and there)
Change-Id: Ifaf1aff15a78f105b1549ab8053378933b35df43
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 708b0977900..fc0df1155a9 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -48,6 +48,33 @@ #include "mntent_compat.h" #endif +#define GLUSTERD_GET_SNAP_DIR(path, snap, priv) \ + do { \ + int32_t _snap_dir_len; \ + _snap_dir_len = snprintf(path, PATH_MAX, "%s/snaps/%s", priv->workdir, \ + snap->snapname); \ + if ((_snap_dir_len < 0) || (_snap_dir_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + +#define GLUSTERD_GET_BRICK_DIR(path, volinfo, priv) \ + do { \ + int32_t _brick_len; \ + if (volinfo->is_snap_volume) { \ + _brick_len = snprintf(path, PATH_MAX, "%s/snaps/%s/%s/%s", \ + priv->workdir, volinfo->snapshot->snapname, \ + volinfo->volname, GLUSTERD_BRICK_INFO_DIR); \ + } else { \ + _brick_len = snprintf(path, PATH_MAX, "%s/%s/%s/%s", \ + priv->workdir, GLUSTERD_VOLUME_DIR_PREFIX, \ + volinfo->volname, GLUSTERD_BRICK_INFO_DIR); \ + } \ + if ((_brick_len < 0) || (_brick_len >= PATH_MAX)) { \ + path[0] = 0; \ + } \ + } while (0) + void glusterd_replace_slash_with_hyphen(char *str) { |