diff options
Diffstat (limited to 'xlators/storage/posix/src/posix-handle.h')
| -rw-r--r-- | xlators/storage/posix/src/posix-handle.h | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/xlators/storage/posix/src/posix-handle.h b/xlators/storage/posix/src/posix-handle.h index c4d7cb14503..f33ed92620d 100644 --- a/xlators/storage/posix/src/posix-handle.h +++ b/xlators/storage/posix/src/posix-handle.h @@ -18,7 +18,7 @@ #define MAKE_PGFID_XATTR_KEY(var, prefix, pgfid) \ do { \ - var = alloca(strlen(prefix) + UUID_CANONICAL_FORM_LEN + 1); \ + var = alloca(SLEN(prefix) + UUID_CANONICAL_FORM_LEN + 1); \ strcpy(var, prefix); \ strcat(var, uuid_utoa(pgfid)); \ } while (0) @@ -111,22 +111,23 @@ } \ } while (0) -#define MAKE_HANDLE_GFID_PATH(var, this, gfid, base) \ +#define MAKE_HANDLE_GFID_PATH(var, this, gfid) \ do { \ int __len = 0; \ - __len = posix_handle_gfid_path(this, gfid, base, NULL, 0); \ - if (__len <= 0) \ - break; \ + struct posix_private *__priv = this->private; \ + __len = POSIX_GFID_HANDLE_SIZE(__priv->base_path_length); \ + __len += 256; \ var = alloca(__len); \ - __len = posix_handle_gfid_path(this, gfid, base, var, __len); \ + __len = posix_handle_gfid_path(this, gfid, var, __len); \ } while (0) #define MAKE_HANDLE_RELPATH(var, this, gfid, base) \ do { \ int __len; \ - __len = posix_handle_relpath(this, gfid, base, NULL, 0); \ - if (__len <= 0) \ - break; \ + __len = POSIX_GFID_HANDLE_RELSIZE; \ + if (base) { \ + __len += (strlen(base) + 1); \ + } \ var = alloca(__len); \ __len = posix_handle_relpath(this, gfid, base, var, __len); \ } while (0) @@ -140,6 +141,16 @@ __priv->base_path, gfid[0], gfid[1], uuid_utoa(gfid)); \ } while (0) +#define MAKE_HANDLE_ABSPATH_FD(var, this, gfid, dfd) \ + do { \ + struct posix_private *__priv = this->private; \ + int findex = gfid[0]; \ + int __len = POSIX_GFID_HASH2_LEN; \ + var = alloca(__len); \ + snprintf(var, __len, "%02x/%s", gfid[1], uuid_utoa(gfid)); \ + dfd = __priv->arrdfd[findex]; \ + } while (0) + #define MAKE_ENTRY_HANDLE(entp, parp, this, loc, ent_p) \ do { \ char *__parp; \ @@ -183,9 +194,9 @@ /* expand ELOOP */ \ } while (0) +#define POSIX_GFID_HASH2_LEN 45 int -posix_handle_gfid_path(xlator_t *this, uuid_t gfid, const char *basename, - char *buf, size_t len); +posix_handle_gfid_path(xlator_t *this, uuid_t gfid, char *buf, size_t len); int posix_handle_hard(xlator_t *this, const char *path, uuid_t gfid, |
