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