net/sunrpc/auth_gss/gss_mech_switch.c
Source file repositories/reference/linux-study-clean/net/sunrpc/auth_gss/gss_mech_switch.c
File Facts
- System
- Linux kernel
- Corpus path
net/sunrpc/auth_gss/gss_mech_switch.c- Extension
.c- Size
- 10424 bytes
- Lines
- 448
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/slab.hlinux/module.hlinux/oid_registry.hlinux/sunrpc/msg_prot.hlinux/sunrpc/auth_gss.hlinux/sunrpc/svcauth_gss.hlinux/sunrpc/gss_err.hlinux/sunrpc/sched.hlinux/sunrpc/gss_api.hlinux/sunrpc/clnt.htrace/events/rpcgss.h
Detected Declarations
function gss_mech_freefunction make_auth_domain_namefunction gss_mech_svc_setupfunction gss_mech_registerfunction gss_mech_unregisterfunction _gss_mech_get_by_namefunction gss_mech_get_by_namefunction mech_supports_pseudoflavorfunction gss_mech_get_by_pseudoflavorfunction gss_svc_to_pseudoflavorfunction gss_mech_info2flavorfunction gss_mech_flavor2infofunction gss_pseudoflavor_to_servicefunction gss_pseudoflavor_to_datatouchfunction gss_service_to_auth_domain_namefunction gss_mech_putfunction gss_import_sec_contextfunction gss_get_micfunction gss_verify_micfunction gss_wrapfunction gss_unwrapfunction gss_delete_sec_contextexport gss_mech_registerexport gss_mech_unregisterexport gss_mech_getexport gss_pseudoflavor_to_serviceexport gss_mech_put
Annotated Snippet
if (IS_ERR(dom)) {
status = PTR_ERR(dom);
goto out;
}
pf->domain = dom;
}
return 0;
out:
gss_mech_free(gm);
return status;
}
/**
* gss_mech_register - register a GSS mechanism
* @gm: GSS mechanism handle
*
* Returns zero if successful, or a negative errno.
*/
int gss_mech_register(struct gss_api_mech *gm)
{
int status;
status = gss_mech_svc_setup(gm);
if (status)
return status;
spin_lock(®istered_mechs_lock);
list_add_rcu(&gm->gm_list, ®istered_mechs);
spin_unlock(®istered_mechs_lock);
dprintk("RPC: registered gss mechanism %s\n", gm->gm_name);
return 0;
}
EXPORT_SYMBOL_GPL(gss_mech_register);
/**
* gss_mech_unregister - release a GSS mechanism
* @gm: GSS mechanism handle
*
*/
void gss_mech_unregister(struct gss_api_mech *gm)
{
spin_lock(®istered_mechs_lock);
list_del_rcu(&gm->gm_list);
spin_unlock(®istered_mechs_lock);
dprintk("RPC: unregistered gss mechanism %s\n", gm->gm_name);
gss_mech_free(gm);
}
EXPORT_SYMBOL_GPL(gss_mech_unregister);
struct gss_api_mech *gss_mech_get(struct gss_api_mech *gm)
{
__module_get(gm->gm_owner);
return gm;
}
EXPORT_SYMBOL(gss_mech_get);
static struct gss_api_mech *
_gss_mech_get_by_name(const char *name)
{
struct gss_api_mech *pos, *gm = NULL;
rcu_read_lock();
list_for_each_entry_rcu(pos, ®istered_mechs, gm_list) {
if (0 == strcmp(name, pos->gm_name)) {
if (try_module_get(pos->gm_owner))
gm = pos;
break;
}
}
rcu_read_unlock();
return gm;
}
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;
}
struct gss_api_mech *gss_mech_get_by_OID(struct rpcsec_gss_oid *obj)
{
struct gss_api_mech *pos, *gm = NULL;
char buf[32];
Annotation
- Immediate include surface: `linux/types.h`, `linux/slab.h`, `linux/module.h`, `linux/oid_registry.h`, `linux/sunrpc/msg_prot.h`, `linux/sunrpc/auth_gss.h`, `linux/sunrpc/svcauth_gss.h`, `linux/sunrpc/gss_err.h`.
- Detected declarations: `function gss_mech_free`, `function make_auth_domain_name`, `function gss_mech_svc_setup`, `function gss_mech_register`, `function gss_mech_unregister`, `function _gss_mech_get_by_name`, `function gss_mech_get_by_name`, `function mech_supports_pseudoflavor`, `function gss_mech_get_by_pseudoflavor`, `function gss_svc_to_pseudoflavor`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.