Whamcloud - gitweb
LU-9859 gss: replace cfs_size_roundXX macros. 84/45584/3
authorJames Simmons <jsimmons@infradead.org>
Tue, 16 Nov 2021 16:07:13 +0000 (11:07 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Nov 2021 03:52:51 +0000 (03:52 +0000)
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 <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/45584
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
libcfs/include/libcfs/libcfs_private.h
lustre/ptlrpc/gss/gss_cli_upcall.c
lustre/ptlrpc/gss/gss_rawobj.c
lustre/ptlrpc/gss/gss_svc_upcall.c

index 6994b40..a60f142 100644 (file)
@@ -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
index 04eab5a..4a42f65 100644 (file)
@@ -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;
         }
index 1400414..a623790 100644 (file)
@@ -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);
index 99b3e00..8e729eb 100644 (file)
@@ -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) {