From 704961a39ffd019487e36ac6dbd425399cb85cf2 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Fri, 4 Oct 2019 11:17:44 +0300 Subject: Multiple files: make root gfid a static variable In many places we use it, compare to it, etc. It could be a static variable, as it really doesn't change. I think it's better than initializing to 0 and then doing gfid[15] = 1 or other tricks. I think there are additional oppportunuties to make more variables static. This is an attempt at an easy one. Change-Id: I7f23a30a94056d8f043645371ab841cbd0f90d19 updates: bz#1193929 Signed-off-by: Yaniv Kaul --- xlators/features/bit-rot/src/stub/bit-rot-stub.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'xlators/features/bit-rot/src/stub') diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c index de2184d6193..d9ac009d316 100644 --- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c +++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c @@ -1817,9 +1817,7 @@ br_stub_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, dict_t *xdata) { void *cookie = NULL; - uuid_t rootgfid = { - 0, - }; + static uuid_t rootgfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; fop_getxattr_cbk_t cbk = br_stub_getxattr_cbk; int32_t op_ret = -1; int32_t op_errno = EINVAL; @@ -1831,8 +1829,6 @@ br_stub_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, GF_VALIDATE_OR_GOTO(this->name, this->private, unwind); GF_VALIDATE_OR_GOTO(this->name, loc->inode, unwind); - rootgfid[15] = 1; - if (!name) { cbk = br_stub_listxattr_cbk; goto wind; @@ -1902,16 +1898,13 @@ br_stub_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name, dict_t *xdata) { void *cookie = NULL; - uuid_t rootgfid = { - 0, - }; + static uuid_t rootgfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; fop_fgetxattr_cbk_t cbk = br_stub_getxattr_cbk; int32_t op_ret = -1; int32_t op_errno = EINVAL; br_stub_local_t *local = NULL; br_stub_private_t *priv = NULL; - rootgfid[15] = 1; priv = this->private; if (!name) { -- cgit