From 60bd1dcd283b2d464968092711b658c12a900918 Mon Sep 17 00:00:00 2001
From: Raghavendra Gowdappa <rgowdapp@redhat.com>
Date: Mon, 11 Feb 2019 16:42:48 +0530
Subject: [PATCH 523/529] libglusterfs: rename macros roof and floor to not
conflict with math.h
mainline:
> Change-Id: I666eeb63ebd000711b3f793b948d4e0c04b1a242
> Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
> Updates: bz#1644629
> Reviewed-on: https://review.gluster.org/c/glusterfs/+/21703
Change-Id: I666eeb63ebd000711b3f793b948d4e0c04b1a242
BUG: 1390151
Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/162678
Tested-by: RHGS Build Bot <nigelb@redhat.com>
---
libglusterfs/src/common-utils.h | 4 ++--
rpc/rpc-transport/socket/src/socket.c | 2 +-
xlators/cluster/stripe/src/stripe.c | 18 +++++++++---------
xlators/performance/io-cache/src/io-cache.c | 4 ++--
xlators/performance/io-cache/src/page.c | 4 ++--
xlators/performance/read-ahead/src/page.c | 4 ++--
xlators/performance/read-ahead/src/read-ahead.c | 8 ++++----
xlators/protocol/server/src/server-rpc-fops.c | 2 +-
8 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 15a31a3..af2e0fd 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -53,8 +53,8 @@ void trap (void);
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
-#define roof(a,b) ((((a)+(b)-1)/((b)?(b):1))*(b))
-#define floor(a,b) (((a)/((b)?(b):1))*(b))
+#define gf_roof(a, b) ((((a) + (b) - 1)/((b) ? (b) : 1)) * (b))
+#define gf_floor(a, b) (((a) / ((b) ? (b) : 1)) * (b))
#define IPv4_ADDR_SIZE 32
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 34a937f..e28c5cd 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -1646,7 +1646,7 @@ __socket_read_accepted_successful_reply (rpc_transport_t *this)
/* need to round off to proper roof (%4), as XDR packing pads
the end of opaque object with '0' */
- size = roof (read_rsp.xdata.xdata_len, 4);
+ size = gf_roof (read_rsp.xdata.xdata_len, 4);
if (!size) {
frag->call_body.reply.accepted_success_state
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index 6b32f7f..fc809a0 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -698,10 +698,10 @@ stripe_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
* to the size of the previous stripe.
*/
if (i < eof_idx)
- tmp_offset = roof(offset, fctx->stripe_size *
+ tmp_offset = gf_roof(offset, fctx->stripe_size *
fctx->stripe_count);
else if (i > eof_idx)
- tmp_offset = floor(offset, fctx->stripe_size *
+ tmp_offset = gf_floor(offset, fctx->stripe_size *
fctx->stripe_count);
else
tmp_offset = offset;
@@ -3067,10 +3067,10 @@ stripe_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, d
if (fctx->stripe_coalesce) {
if (i < eof_idx)
- tmp_offset = roof(offset, fctx->stripe_size *
+ tmp_offset = gf_roof(offset, fctx->stripe_size *
fctx->stripe_count);
else if (i > eof_idx)
- tmp_offset = floor(offset, fctx->stripe_size *
+ tmp_offset = gf_floor(offset, fctx->stripe_size *
fctx->stripe_count);
else
tmp_offset = offset;
@@ -3476,8 +3476,8 @@ stripe_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
* the file is in which child node. Always '0-<stripe_size>' part of
* the file resides in the first child.
*/
- rounded_start = floor (offset, stripe_size);
- rounded_end = roof (offset+size, stripe_size);
+ rounded_start = gf_floor (offset, stripe_size);
+ rounded_end = gf_roof (offset+size, stripe_size);
num_stripe = (rounded_end- rounded_start)/stripe_size;
local = mem_get0 (this->local_pool);
@@ -3510,7 +3510,7 @@ stripe_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
goto err;
}
- frame_size = min (roof (frame_offset+1, stripe_size),
+ frame_size = min (gf_roof (frame_offset+1, stripe_size),
(offset + size)) - frame_offset;
rlocal->node_index = index - off_index;
@@ -3693,8 +3693,8 @@ stripe_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
goto err;
}
- rounded_start = floor(offset, stripe_size);
- rounded_end = roof(offset + total_size, stripe_size);
+ rounded_start = gf_floor(offset, stripe_size);
+ rounded_end = gf_roof(offset + total_size, stripe_size);
total_chunks = (rounded_end - rounded_start) / stripe_size;
local->replies = GF_CALLOC(total_chunks, sizeof(struct stripe_replies),
gf_stripe_mt_stripe_replies);
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index d7b3b37..5ef77b0 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -953,8 +953,8 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
local = frame->local;
table = ioc_inode->table;
- rounded_offset = floor (offset, table->page_size);
- rounded_end = roof (offset + size, table->page_size);
+ rounded_offset = gf_floor (offset, table->page_size);
+ rounded_end = gf_roof (offset + size, table->page_size);
trav_offset = rounded_offset;
/* once a frame does read, it should be waiting on something */
diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c
index 50f5e19..832c4ee 100644
--- a/xlators/performance/io-cache/src/page.c
+++ b/xlators/performance/io-cache/src/page.c
@@ -43,7 +43,7 @@ __ioc_page_get (ioc_inode_t *ioc_inode, off_t offset)
table = ioc_inode->table;
GF_VALIDATE_OR_GOTO ("io-cache", ioc_inode, out);
- rounded_offset = floor (offset, table->page_size);
+ rounded_offset = gf_floor (offset, table->page_size);
page = rbthash_get (ioc_inode->cache.page_table, &rounded_offset,
sizeof (rounded_offset));
@@ -256,7 +256,7 @@ __ioc_page_create (ioc_inode_t *ioc_inode, off_t offset)
table = ioc_inode->table;
GF_VALIDATE_OR_GOTO ("io-cache", table, out);
- rounded_offset = floor (offset, table->page_size);
+ rounded_offset = gf_floor (offset, table->page_size);
newpage = GF_CALLOC (1, sizeof (*newpage), gf_ioc_mt_ioc_newpage_t);
if (newpage == NULL) {
diff --git a/xlators/performance/read-ahead/src/page.c b/xlators/performance/read-ahead/src/page.c
index 17e346e..8a5ce58 100644
--- a/xlators/performance/read-ahead/src/page.c
+++ b/xlators/performance/read-ahead/src/page.c
@@ -25,7 +25,7 @@ ra_page_get (ra_file_t *file, off_t offset)
GF_VALIDATE_OR_GOTO ("read-ahead", file, out);
page = file->pages.next;
- rounded_offset = floor (offset, file->page_size);
+ rounded_offset = gf_floor (offset, file->page_size);
while (page != &file->pages && page->offset < rounded_offset)
page = page->next;
@@ -48,7 +48,7 @@ ra_page_create (ra_file_t *file, off_t offset)
GF_VALIDATE_OR_GOTO ("read-ahead", file, out);
page = file->pages.next;
- rounded_offset = floor (offset, file->page_size);
+ rounded_offset = gf_floor (offset, file->page_size);
while (page != &file->pages && page->offset < rounded_offset)
page = page->next;
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c
index e02ca9f..8adbd53 100644
--- a/xlators/performance/read-ahead/src/read-ahead.c
+++ b/xlators/performance/read-ahead/src/read-ahead.c
@@ -283,7 +283,7 @@ read_ahead (call_frame_t *frame, ra_file_t *file)
}
ra_size = file->page_size * file->page_count;
- ra_offset = floor (file->offset, file->page_size);
+ ra_offset = gf_floor (file->offset, file->page_size);
cap = file->size ? file->size : file->offset + ra_size;
while (ra_offset < min (file->offset + ra_size, cap)) {
@@ -372,8 +372,8 @@ dispatch_requests (call_frame_t *frame, ra_file_t *file)
local = frame->local;
conf = file->conf;
- rounded_offset = floor (local->offset, file->page_size);
- rounded_end = roof (local->offset + local->size, file->page_size);
+ rounded_offset = gf_floor (local->offset, file->page_size);
+ rounded_end = gf_roof (local->offset + local->size, file->page_size);
trav_offset = rounded_offset;
@@ -532,7 +532,7 @@ ra_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
dispatch_requests (frame, file);
- flush_region (frame, file, 0, floor (offset, file->page_size), 0);
+ flush_region (frame, file, 0, gf_floor (offset, file->page_size), 0);
read_ahead (frame, file);
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index 35d0887..b7bb26a 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -4123,7 +4123,7 @@ server3_3_writev_vecsizer (int state, ssize_t *readsize, char *base_addr,
/* need to round off to proper roof (%4), as XDR packing pads
the end of opaque object with '0' */
- size = roof (write_req.xdata.xdata_len, 4);
+ size = gf_roof (write_req.xdata.xdata_len, 4);
*readsize = size;
--
1.8.3.1