Whamcloud - gitweb
LU-6496 ptlrpc: Fix wrong code indentation in plain_authorize
[fs/lustre-release.git] / lustre / ptlrpc / sec_plain.c
index b57f28a..9eaa852 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -40,9 +40,6 @@
 
 #define DEBUG_SUBSYSTEM S_SEC
 
-#ifndef __KERNEL__
-#include <liblustre.h>
-#endif
 
 #include <obd_support.h>
 #include <obd_cksum.h>
@@ -50,6 +47,8 @@
 #include <lustre_net.h>
 #include <lustre_sec.h>
 
+#include "ptlrpc_internal.h"
+
 struct plain_sec {
         struct ptlrpc_sec       pls_base;
        rwlock_t            pls_lock;
@@ -155,7 +154,6 @@ static int plain_verify_bulk_csum(struct ptlrpc_bulk_desc *desc,
         return 0;
 }
 
-#ifdef __KERNEL__
 static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc)
 {
        char           *ptr;
@@ -166,26 +164,12 @@ static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc)
                        continue;
 
                ptr = kmap(desc->bd_iov[i].kiov_page);
-               off = desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK;
+               off = desc->bd_iov[i].kiov_offset & ~PAGE_MASK;
                ptr[off] ^= 0x1;
                kunmap(desc->bd_iov[i].kiov_page);
                return;
        }
 }
-#else
-static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc)
-{
-        unsigned int    i;
-
-        for (i = 0; i < desc->bd_iov_count; i++) {
-                if (desc->bd_iov[i].iov_len == 0)
-                        continue;
-
-                ((char *)desc->bd_iov[i].iov_base)[i] ^= 0x1;
-                return;
-        }
-}
-#endif /* __KERNEL__ */
 
 /****************************************
  * cli_ctx apis                         *
@@ -355,9 +339,7 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
         struct ptlrpc_bulk_sec_desc *bsdv;
         struct plain_bulk_token     *tokenv;
         int                          rc;
-#ifdef __KERNEL__
         int                          i, nob;
-#endif
 
         LASSERT(req->rq_pack_bulk);
         LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS);
@@ -372,7 +354,6 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
                 return 0;
         }
 
-#ifdef __KERNEL__
         /* fix the actual data size */
         for (i = 0, nob = 0; i < desc->bd_iov_count; i++) {
                 if (desc->bd_iov[i].kiov_len + nob > desc->bd_nob_transferred) {
@@ -381,7 +362,6 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
                 }
                 nob += desc->bd_iov[i].kiov_len;
         }
-#endif
 
         rc = plain_verify_bulk_csum(desc, req->rq_flvr.u_bulk.hash.hash_alg,
                                     tokenv);
@@ -913,7 +893,7 @@ int plain_authorize(struct ptlrpc_request *req)
                        lustre_msg_buf(msg, PLAIN_PACK_MSG_OFF, 0),
                        lustre_msg_buflen(msg, PLAIN_PACK_MSG_OFF),
                        NULL, 0, (unsigned char *)&msg->lm_cksum, &hsize);
-                       req->rq_reply_off = 0;
+               req->rq_reply_off = 0;
         }
 
         RETURN(0);