Whamcloud - gitweb
LU-6496 ptlrpc: Fix wrong code indentation in plain_authorize
[fs/lustre-release.git] / lustre / ptlrpc / sec_config.c
index b18b1f6..6812d82 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2008, 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/
 #define DEBUG_SUBSYSTEM S_SEC
 
 #include <libcfs/libcfs.h>
-#ifndef __KERNEL__
-#include <liblustre.h>
-#include <libcfs/list.h>
-#else
 #include <linux/crypto.h>
 #include <linux/key.h>
-#endif
 
 #include <obd.h>
 #include <obd_class.h>
@@ -93,7 +88,6 @@ enum lustre_sec_part sptlrpc_target_sec_part(struct obd_device *obd)
         CERROR("unknown target %p(%s)\n", obd, type);
         return LUSTRE_SP_ANY;
 }
-EXPORT_SYMBOL(sptlrpc_target_sec_part);
 
 /****************************************
  * user supplied flavor string parsing  *
@@ -291,7 +285,6 @@ int sptlrpc_rule_set_expand(struct sptlrpc_rule_set *rset)
         rset->srs_nslot = nslot;
         return 0;
 }
-EXPORT_SYMBOL(sptlrpc_rule_set_expand);
 
 static inline int rule_spec_dir(struct sptlrpc_rule *rule)
 {
@@ -439,7 +432,6 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
 
         return 0;
 }
-EXPORT_SYMBOL(sptlrpc_rule_set_choose);
 
 void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset)
 {
@@ -452,7 +444,6 @@ void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *rset)
                        r->sr_from, r->sr_to, r->sr_netid, r->sr_flvr.sf_rpc);
         }
 }
-EXPORT_SYMBOL(sptlrpc_rule_set_dump);
 
 static int sptlrpc_rule_set_extract(struct sptlrpc_rule_set *gen,
                                     struct sptlrpc_rule_set *tgt,
@@ -904,7 +895,6 @@ void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
         if (sptlrpc_rule_set_choose(rset, from, LUSTRE_SP_ANY, nid, sf) == 0)
                 get_default_flavor(sf);
 }
-EXPORT_SYMBOL(sptlrpc_target_choose_flavor);
 
 #define SEC_ADAPT_DELAY         (10)
 
@@ -938,18 +928,15 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd)
 }
 EXPORT_SYMBOL(sptlrpc_conf_client_adapt);
 
-#ifdef __KERNEL__
 
 static void rule2string(struct sptlrpc_rule *r, char *buf, int buflen)
 {
-        char    dirbuf[8];
-        char   *net;
-        char   *ptr = buf;
+       char     dirbuf[8];
+       char     net[LNET_NIDSTR_SIZE] = "default";
+       char    *ptr = buf;
 
-        if (r->sr_netid == LNET_NIDNET(LNET_NID_ANY))
-                net = "default";
-        else
-                net = libcfs_net2str(r->sr_netid);
+       if (r->sr_netid != LNET_NIDNET(LNET_NID_ANY))
+               libcfs_net2str_r(r->sr_netid, net, sizeof(net));
 
         if (r->sr_from == LUSTRE_SP_ANY && r->sr_to == LUSTRE_SP_ANY)
                 dirbuf[0] = '\0';
@@ -1151,7 +1138,6 @@ out_pop:
        RETURN(rc);
 }
 
-#endif /* __KRENEL__ */
 
 /**
  * called by target devices, extract sptlrpc rules which applies to
@@ -1188,7 +1174,6 @@ int sptlrpc_conf_target_get_rules(struct obd_device *obd,
                 GOTO(out, rc);
         }
 
-#ifdef __KERNEL__
         if (conf->sc_updated  == 0) {
                 /*
                  * always read from local copy. here another option is
@@ -1208,7 +1193,6 @@ int sptlrpc_conf_target_get_rules(struct obd_device *obd,
                 else
                         CDEBUG(D_SEC, "unchanged, skip updating local copy\n");
         }
-#endif
 
         /* extract rule set for this target */
         conf_tgt = sptlrpc_conf_get_tgt(conf, obd->obd_name, 0);
@@ -1220,7 +1204,6 @@ out:
        mutex_unlock(&sptlrpc_conf_lock);
         RETURN(rc);
 }
-EXPORT_SYMBOL(sptlrpc_conf_target_get_rules);
 
 int  sptlrpc_conf_init(void)
 {