Whamcloud - gitweb
LU-3963 libcfs: convert ptlrpc,quota plus others to linux atomics
[fs/lustre-release.git] / lustre / ptlrpc / gss / gss_internal.h
index 66afd61..d42b9a1 100644 (file)
@@ -1,9 +1,9 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * Modified from NFSv4 project for Lustre
  *
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  *
  * Author: Eric Mei <ericm@clusterfs.com>
  */
@@ -207,7 +207,7 @@ static inline __u64 gss_handle_to_u64(rawobj_t *handle)
                                          GSS_SEQ_WIN_MAIN / 4)
 
 struct gss_svc_seq_data {
-        spinlock_t              ssd_lock;
+       spinlock_t              ssd_lock;
         /*
          * highest sequence number seen so far, for main and back window
          */
@@ -232,6 +232,7 @@ struct gss_svc_ctx {
         uid_t                   gsc_mapped_uid;
         unsigned int            gsc_usr_root:1,
                                 gsc_usr_mds:1,
+                                gsc_usr_oss:1,
                                 gsc_remote:1,
                                 gsc_reverse:1;
 };
@@ -260,15 +261,15 @@ struct gss_svc_reqctx {
 };
 
 struct gss_cli_ctx {
-        struct ptlrpc_cli_ctx   gc_base;
-        __u32                   gc_flavor;
-        __u32                   gc_proc;
-        __u32                   gc_win;
-        atomic_t                gc_seq;
-        rawobj_t                gc_handle;
-        struct gss_ctx         *gc_mechctx;
-        /* handle for the buddy svc ctx */
-        rawobj_t                gc_svc_handle;
+       struct ptlrpc_cli_ctx   gc_base;
+       __u32                   gc_flavor;
+       __u32                   gc_proc;
+       __u32                   gc_win;
+       atomic_t                gc_seq;
+       rawobj_t                gc_handle;
+       struct gss_ctx          *gc_mechctx;
+       /* handle for the buddy svc ctx */
+       rawobj_t                gc_svc_handle;
 };
 
 struct gss_cli_ctx_keyring {
@@ -278,16 +279,16 @@ struct gss_cli_ctx_keyring {
 };
 
 struct gss_sec {
-        struct ptlrpc_sec       gs_base;
-        struct gss_api_mech    *gs_mech;
-        spinlock_t              gs_lock;
-        __u64                   gs_rvs_hdl;
+       struct ptlrpc_sec       gs_base;
+       struct gss_api_mech     *gs_mech;
+       spinlock_t              gs_lock;
+       __u64                   gs_rvs_hdl;
 };
 
 struct gss_sec_pipefs {
         struct gss_sec          gsp_base;
         int                     gsp_chash_size;  /* must be 2^n */
-        struct hlist_head       gsp_chash[0];
+        cfs_hlist_head_t        gsp_chash[0];
 };
 
 /*
@@ -300,7 +301,7 @@ struct gss_sec_keyring {
         /*
          * all contexts listed here. access is protected by sec spinlock.
          */
-        struct hlist_head       gsk_clist;
+        cfs_hlist_head_t        gsk_clist;
         /*
          * specially point to root ctx (only one at a time). access is
          * protected by sec spinlock.
@@ -309,10 +310,10 @@ struct gss_sec_keyring {
         /*
          * specially serialize upcalls for root context.
          */
-        struct mutex            gsk_root_uc_lock;
+       struct mutex                    gsk_root_uc_lock;
 
 #ifdef HAVE_KEYRING_UPCALL_SERIALIZED
-        struct mutex            gsk_uc_lock;        /* serialize upcalls */
+       struct mutex            gsk_uc_lock;    /* serialize upcalls */
 #endif
 };
 
@@ -400,7 +401,8 @@ int cli_ctx_check_death(struct ptlrpc_cli_ctx *ctx);
 int gss_copy_rvc_cli_ctx(struct ptlrpc_cli_ctx *cli_ctx,
                          struct ptlrpc_svc_ctx *svc_ctx);
 
-struct gss_header *gss_swab_header(struct lustre_msg *msg, int segment);
+struct gss_header *gss_swab_header(struct lustre_msg *msg, int segment,
+                                   int swabbed);
 netobj_t *gss_swab_netobj(struct lustre_msg *msg, int segment);
 
 void gss_cli_ctx_uptodate(struct gss_cli_ctx *gctx);
@@ -425,12 +427,22 @@ int gss_cli_ctx_fini_common(struct ptlrpc_sec *sec,
 void gss_cli_ctx_flags2str(unsigned long flags, char *buf, int bufsize);
 
 /* gss_keyring.c */
+#ifndef HAVE_GSS_KEYRING
+static inline int  __init gss_init_keyring(void) { return 0; }
+static inline void __exit gss_exit_keyring(void) { return; }
+#else
 int  __init gss_init_keyring(void);
 void __exit gss_exit_keyring(void);
+#endif
 
 /* gss_pipefs.c */
+#ifndef HAVE_GSS_PIPEFS
+static inline int  __init gss_init_pipefs(void) { return 0; }
+static inline void __exit gss_exit_pipefs(void) { return; }
+#else
 int  __init gss_init_pipefs(void);
 void __exit gss_exit_pipefs(void);
+#endif
 
 /* gss_bulk.c */
 int gss_cli_prep_bulk(struct ptlrpc_request *req,
@@ -448,10 +460,6 @@ int gss_svc_unwrap_bulk(struct ptlrpc_request *req,
 int gss_svc_wrap_bulk(struct ptlrpc_request *req,
                       struct ptlrpc_bulk_desc *desc);
 
-/* gss_mech_switch.c */
-int init_kerberos_module(void);
-void cleanup_kerberos_module(void);
-
 /* gss_generic_token.c */
 int g_token_size(rawobj_t *mech, unsigned int body_size);
 void g_make_token_header(rawobj_t *mech, int body_size, unsigned char **buf);
@@ -464,7 +472,7 @@ int gss_do_ctx_init_rpc(char *buffer, unsigned long count);
 int gss_do_ctx_fini_rpc(struct gss_cli_ctx *gctx);
 
 int  __init gss_init_cli_upcall(void);
-void __exit gss_exit_cli_upcall(void);
+void gss_exit_cli_upcall(void);
 
 /* gss_svc_upcall.c */
 __u64 gss_get_next_ctx_index(void);
@@ -487,19 +495,26 @@ void gss_svc_upcall_put_ctx(struct gss_svc_ctx *ctx);
 void gss_svc_upcall_destroy_ctx(struct gss_svc_ctx *ctx);
 
 int  __init gss_init_svc_upcall(void);
-void __exit gss_exit_svc_upcall(void);
+void gss_exit_svc_upcall(void);
 
 /* lproc_gss.c */
 void gss_stat_oos_record_cli(int behind);
 void gss_stat_oos_record_svc(int phase, int replay);
 
 int  __init gss_init_lproc(void);
-void __exit gss_exit_lproc(void);
+void gss_exit_lproc(void);
+
+/* gss_null_mech.c */
+int __init init_null_module(void);
+void cleanup_null_module(void);
 
 /* gss_krb5_mech.c */
 int __init init_kerberos_module(void);
-void __exit cleanup_kerberos_module(void);
+void cleanup_kerberos_module(void);
 
+/* gss_sk_mech.c */
+int __init init_sk_module(void);
+void cleanup_sk_module(void);
 
 /* debug */
 static inline