summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2019-10-04 11:17:44 +0300
committerXavi Hernandez <xhernandez@redhat.com>2019-10-14 08:21:52 +0000
commit704961a39ffd019487e36ac6dbd425399cb85cf2 (patch)
treebbdff1293d5cd5602a04d42822f2024d481a3754 /xlators/protocol/server/src
parent240eec91c6ab5818c3fa4a9087ba46bbed0e8d2b (diff)
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 <ykaul@redhat.com>
Diffstat (limited to 'xlators/protocol/server/src')
-rw-r--r--xlators/protocol/server/src/server-common.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/xlators/protocol/server/src/server-common.c b/xlators/protocol/server/src/server-common.c
index ce7f264dd80..4bb84042a9e 100644
--- a/xlators/protocol/server/src/server-common.c
+++ b/xlators/protocol/server/src/server-common.c
@@ -21,11 +21,8 @@ server_post_stat(server_state_t *state, gfs3_stat_rsp *rsp, struct iatt *stbuf)
we use inode table which is shared by everyone, but
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
- uuid_t gfid = {
- 0,
- };
+ static uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- gfid[15] = 1;
stbuf->ia_ino = 1;
gf_uuid_copy(stbuf->ia_gfid, gfid);
}
@@ -182,11 +179,8 @@ server_post_fstat(server_state_t *state, gfs3_fstat_rsp *rsp,
we use inode table which is shared by everyone, but
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
- uuid_t gfid = {
- 0,
- };
+ static uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- gfid[15] = 1;
stbuf->ia_ino = 1;
gf_uuid_copy(stbuf->ia_gfid, gfid);
}
@@ -454,9 +448,7 @@ server_post_lookup(gfs3_lookup_rsp *rsp, call_frame_t *frame,
{
inode_t *root_inode = NULL;
inode_t *link_inode = 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};
root_inode = frame->root->client->bound_xl->itable->root;
@@ -480,7 +472,6 @@ server_post_lookup(gfs3_lookup_rsp *rsp, call_frame_t *frame,
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
stbuf->ia_ino = 1;
- rootgfid[15] = 1;
gf_uuid_copy(stbuf->ia_gfid, rootgfid);
if (inode->ia_type == 0)
inode->ia_type = stbuf->ia_type;
@@ -521,11 +512,8 @@ server4_post_common_3iatt(server_state_t *state, gfx_common_3iatt_rsp *rsp,
we use inode table which is shared by everyone, but
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
- uuid_t gfid = {
- 0,
- };
+ static uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- gfid[15] = 1;
preparent->ia_ino = 1;
postparent->ia_ino = 1;
gf_uuid_copy(preparent->ia_gfid, gfid);
@@ -591,11 +579,8 @@ server4_post_common_iatt(server_state_t *state, gfx_common_iatt_rsp *rsp,
we use inode table which is shared by everyone, but
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
- uuid_t gfid = {
- 0,
- };
+ static uuid_t gfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
- gfid[15] = 1;
stbuf->ia_ino = 1;
gf_uuid_copy(stbuf->ia_gfid, gfid);
}
@@ -802,9 +787,7 @@ server4_post_lookup(gfx_common_2iatt_rsp *rsp, call_frame_t *frame,
{
inode_t *root_inode = NULL;
inode_t *link_inode = 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};
root_inode = frame->root->client->bound_xl->itable->root;
@@ -828,7 +811,6 @@ server4_post_lookup(gfx_common_2iatt_rsp *rsp, call_frame_t *frame,
make sure we send fops only from subdir and below,
we have to alter inode gfid and send it to client */
stbuf->ia_ino = 1;
- rootgfid[15] = 1;
gf_uuid_copy(stbuf->ia_gfid, rootgfid);
if (inode->ia_type == 0)
inode->ia_type = stbuf->ia_type;