Merge branch 'for-3.1' of git://linux-nfs.org/~bfields/linux
[pandora-kernel.git] / net / sunrpc / auth_gss / gss_mech_switch.c
index e3c36a2..ca8cad8 100644 (file)
@@ -141,7 +141,7 @@ gss_mech_get(struct gss_api_mech *gm)
 EXPORT_SYMBOL_GPL(gss_mech_get);
 
 struct gss_api_mech *
-gss_mech_get_by_name(const char *name)
+_gss_mech_get_by_name(const char *name)
 {
        struct gss_api_mech     *pos, *gm = NULL;
 
@@ -158,6 +158,17 @@ gss_mech_get_by_name(const char *name)
 
 }
 
+struct gss_api_mech * gss_mech_get_by_name(const char *name)
+{
+       struct gss_api_mech *gm = NULL;
+
+       gm = _gss_mech_get_by_name(name);
+       if (!gm) {
+               request_module("rpc-auth-gss-%s", name);
+               gm = _gss_mech_get_by_name(name);
+       }
+       return gm;
+}
 EXPORT_SYMBOL_GPL(gss_mech_get_by_name);
 
 struct gss_api_mech *
@@ -194,10 +205,9 @@ mech_supports_pseudoflavor(struct gss_api_mech *gm, u32 pseudoflavor)
        return 0;
 }
 
-struct gss_api_mech *
-gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
+struct gss_api_mech *_gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
 {
-       struct gss_api_mech *pos, *gm = NULL;
+       struct gss_api_mech *gm = NULL, *pos;
 
        spin_lock(&registered_mechs_lock);
        list_for_each_entry(pos, &registered_mechs, gm_list) {
@@ -213,6 +223,20 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
        return gm;
 }
 
+struct gss_api_mech *
+gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
+{
+       struct gss_api_mech *gm;
+
+       gm = _gss_mech_get_by_pseudoflavor(pseudoflavor);
+
+       if (!gm) {
+               request_module("rpc-auth-gss-%u", pseudoflavor);
+               gm = _gss_mech_get_by_pseudoflavor(pseudoflavor);
+       }
+       return gm;
+}
+
 EXPORT_SYMBOL_GPL(gss_mech_get_by_pseudoflavor);
 
 int gss_mech_list_pseudoflavors(rpc_authflavor_t *array_ptr)