diff options
author | Raghavendra Gowdappa <rgowdapp@redhat.com> | 2018-11-16 16:27:17 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2018-11-28 15:11:59 +0000 |
commit | 18b6d7ce7d490e807815270918a17a4b392a829d (patch) | |
tree | 7ca2d0da54400db14fefc36663f360a06c4c2fc8 | |
parent | 9f9f46ff2d30ff87a6a4f8c2af491ea1aa92fbb2 (diff) |
libglusterfs: rename macros roof and floor to not conflict with math.h
Change-Id: I666eeb63ebd000711b3f793b948d4e0c04b1a242
Signed-off-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
Updates: bz#1644629
-rw-r--r-- | libglusterfs/src/common-utils.h | 4 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 8 | ||||
-rw-r--r-- | xlators/cluster/stripe/src/stripe.c | 27 | ||||
-rw-r--r-- | xlators/performance/io-cache/src/io-cache.c | 4 | ||||
-rw-r--r-- | xlators/performance/io-cache/src/page.c | 4 | ||||
-rw-r--r-- | xlators/performance/read-ahead/src/page.c | 4 | ||||
-rw-r--r-- | xlators/performance/read-ahead/src/read-ahead.c | 8 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-rpc-fops.c | 2 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-rpc-fops_v2.c | 2 |
9 files changed, 32 insertions, 31 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index c08c16ccedb..f0762566313 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -61,8 +61,8 @@ 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 != 0) ? (b) : 1)) * (b)) -#define floor(a, b) (((a) / ((b != 0) ? (b) : 1)) * (b)) +#define gf_roof(a, b) ((((a) + (b)-1) / ((b != 0) ? (b) : 1)) * (b)) +#define gf_floor(a, b) (((a) / ((b != 0) ? (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 a770e6954be..dc227137d57 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -1744,9 +1744,9 @@ __socket_read_accepted_successful_reply(rpc_transport_t *this) free(read_rsp.xdata.xdata_val); - /* need to round off to proper roof (%4), as XDR packing pads + /* need to round off to proper gf_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 @@ -1874,9 +1874,9 @@ __socket_read_accepted_successful_reply_v2(rpc_transport_t *this) free(read_rsp.xdata.pairs.pairs_val); - /* need to round off to proper roof (%4), as XDR packing pads + /* need to round off to proper gf_roof (%4), as XDR packing pads the end of opaque object with '0' */ - size = roof(read_rsp.xdata.xdr_size, 4); + size = gf_roof(read_rsp.xdata.xdr_size, 4); if (!size) { frag->call_body.reply diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 836bc680897..6010c1ed6c3 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -678,11 +678,11 @@ 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 * fctx->stripe_count); + tmp_offset = gf_roof(offset, + fctx->stripe_size * fctx->stripe_count); else if (i > eof_idx) - tmp_offset = floor(offset, - fctx->stripe_size * fctx->stripe_count); + tmp_offset = gf_floor(offset, + fctx->stripe_size * fctx->stripe_count); else tmp_offset = offset; @@ -2966,11 +2966,11 @@ stripe_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, if (fctx->stripe_coalesce) { if (i < eof_idx) - tmp_offset = roof(offset, - fctx->stripe_size * fctx->stripe_count); + tmp_offset = gf_roof(offset, + fctx->stripe_size * fctx->stripe_count); else if (i > eof_idx) - tmp_offset = floor(offset, - fctx->stripe_size * fctx->stripe_count); + tmp_offset = gf_floor(offset, + fctx->stripe_size * fctx->stripe_count); else tmp_offset = offset; @@ -3365,8 +3365,8 @@ stripe_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, * 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); @@ -3399,7 +3399,8 @@ stripe_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, goto err; } - frame_size = min(roof(frame_offset + 1, stripe_size), (offset + size)) - + frame_size = min(gf_roof(frame_offset + 1, stripe_size), + (offset + size)) - frame_offset; rlocal->node_index = index - off_index; @@ -3581,8 +3582,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 380ba876cba..6705128087e 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -926,8 +926,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 c376ade0fba..d2cbe2499a4 100644 --- a/xlators/performance/io-cache/src/page.c +++ b/xlators/performance/io-cache/src/page.c @@ -42,7 +42,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)); @@ -253,7 +253,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 c4071393c95..87c9c2347f4 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; @@ -47,7 +47,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 c62bd1bb172..1822cdc0925 100644 --- a/xlators/performance/read-ahead/src/read-ahead.c +++ b/xlators/performance/read-ahead/src/read-ahead.c @@ -268,7 +268,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)) { @@ -354,8 +354,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; @@ -509,7 +509,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 9631c353f69..33a1437e4ef 100644 --- a/xlators/protocol/server/src/server-rpc-fops.c +++ b/xlators/protocol/server/src/server-rpc-fops.c @@ -4185,7 +4185,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; diff --git a/xlators/protocol/server/src/server-rpc-fops_v2.c b/xlators/protocol/server/src/server-rpc-fops_v2.c index f921a22df86..d945f47fc8c 100644 --- a/xlators/protocol/server/src/server-rpc-fops_v2.c +++ b/xlators/protocol/server/src/server-rpc-fops_v2.c @@ -3988,7 +3988,7 @@ server4_0_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.xdr_size, 4); + size = gf_roof(write_req.xdata.xdr_size, 4); *readsize = size; |