From: James Simmons Date: Tue, 16 Nov 2021 16:07:13 +0000 (-0500) Subject: LU-9859 gss: replace cfs_size_roundXX macros. X-Git-Tag: 2.14.56~27 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F84%2F45584%2F3;p=fs%2Flustre-release.git LU-9859 gss: replace cfs_size_roundXX macros. Many of the cfs_size_roundX() macros are not even used so delete them. Replace cfs_size_round4() uses in the GSS layer with round_up(var, 4); Change-Id: Id35f0f7b60f8d00f425d9b15d2a76aa4d0fa5f2f Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/45584 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger Reviewed-by: Arshad Hussain --- diff --git a/libcfs/include/libcfs/libcfs_private.h b/libcfs/include/libcfs/libcfs_private.h index 6994b40..a60f142 100644 --- a/libcfs/include/libcfs/libcfs_private.h +++ b/libcfs/include/libcfs/libcfs_private.h @@ -330,11 +330,6 @@ do { \ #define MKSTR(ptr) ((ptr))? (ptr) : "" -static inline size_t cfs_size_round4(size_t val) -{ - return (val + 3) & (~0x3); -} - #ifndef HAVE_CFS_SIZE_ROUND static inline size_t cfs_size_round(size_t val) { @@ -343,26 +338,4 @@ static inline size_t cfs_size_round(size_t val) #define HAVE_CFS_SIZE_ROUND #endif -static inline size_t cfs_size_round16(size_t val) -{ - return (val + 0xf) & (~0xf); -} - -static inline size_t cfs_size_round32(size_t val) -{ - return (val + 0x1f) & (~0x1f); -} - -static inline size_t cfs_size_round0(size_t val) -{ - if (!val) - return 0; - return (val + 1 + 7) & (~0x7); -} - -static inline size_t cfs_round_strlen(char *fset) -{ - return cfs_size_round(strlen(fset) + 1); -} - #endif diff --git a/lustre/ptlrpc/gss/gss_cli_upcall.c b/lustre/ptlrpc/gss/gss_cli_upcall.c index 04eab5a..4a42f65 100644 --- a/lustre/ptlrpc/gss/gss_cli_upcall.c +++ b/lustre/ptlrpc/gss/gss_cli_upcall.c @@ -132,7 +132,7 @@ int ctx_init_pack_request(struct obd_import *imp, CERROR("can't copy token\n"); return -EFAULT; } - size -= sizeof(__u32) + cfs_size_round4(token_size); + size -= sizeof(__u32) + round_up(token_size, 4); req->rq_reqdata_len = lustre_shrink_msg(req->rq_reqbuf, offset, msg->lm_buflens[offset] - size, 0); @@ -163,8 +163,8 @@ int ctx_init_parse_reply(struct lustre_msg *msg, int swabbed, return -EPROTO; } - if (outlen < (4 + 2) * 4 + cfs_size_round4(ghdr->gh_handle.len) + - cfs_size_round4(msg->lm_buflens[2])) { + if (outlen < (4 + 2) * 4 + round_up(ghdr->gh_handle.len, 4) + + round_up(msg->lm_buflens[2], 4)) { CERROR("output buffer size %ld too small\n", outlen); return -EFAULT; } diff --git a/lustre/ptlrpc/gss/gss_rawobj.c b/lustre/ptlrpc/gss/gss_rawobj.c index 1400414..a623790 100644 --- a/lustre/ptlrpc/gss/gss_rawobj.c +++ b/lustre/ptlrpc/gss/gss_rawobj.c @@ -114,7 +114,7 @@ int rawobj_serialize(rawobj_t *obj, __u32 **buf, __u32 *buflen) LASSERT(buf); LASSERT(buflen); - len = cfs_size_round4(obj->len); + len = round_up(obj->len, 4); if (*buflen < 4 + len) { CERROR("shorter buflen than needed: %u < %u\n", @@ -150,7 +150,7 @@ static int __rawobj_extract(rawobj_t *obj, __u32 **buf, __u32 *buflen, return 0; } - len = local ? obj->len : cfs_size_round4(obj->len); + len = local ? obj->len : round_up(obj->len, 4); if (*buflen < len) { CERROR("shorter buflen than object size: %u < %u\n", *buflen, len); diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index 99b3e00..8e729eb 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -1038,7 +1038,7 @@ cache_check: } grctx->src_init = 1; - grctx->src_reserve_len = cfs_size_round4(rsip->out_token.len); + grctx->src_reserve_len = round_up(rsip->out_token.len, 4); rc = lustre_pack_reply_v2(req, 1, &replen, NULL, 0); if (rc) {