fs/afs/cmservice.c
Source file repositories/reference/linux-study-clean/fs/afs/cmservice.c
File Facts
- System
- Linux kernel
- Corpus path
fs/afs/cmservice.c- Extension
.c- Size
- 14718 bytes
- Lines
- 618
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- 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/module.hlinux/init.hlinux/slab.hlinux/sched.hlinux/ip.hinternal.hafs_cm.hprotocol_yfs.htrace/events/rxrpc.h
Detected Declarations
function afs_cm_incoming_callfunction afs_cm_destructorfunction afs_abort_service_callfunction SRXAFSCB_CallBackfunction afs_deliver_cb_callbackfunction statefunction afs_deliver_cb_init_call_back_statefunction afs_deliver_cb_init_call_back_state3function SRXAFSCB_Probefunction afs_deliver_cb_probefunction SRXAFSCB_ProbeUuidfunction afs_deliver_cb_probe_uuidfunction SRXAFSCB_TellMeAboutYourselffunction afs_deliver_cb_tell_me_about_yourselffunction afs_deliver_yfs_cb_callback
Annotated Snippet
switch (ret) {
case 0: break;
case -EAGAIN: return 0;
default: return ret;
}
_debug("unmarshall UUID");
call->request = kmalloc_obj(struct afs_uuid);
if (!call->request)
return -ENOMEM;
b = call->buffer;
r = call->request;
r->time_low = b[0];
r->time_mid = htons(ntohl(b[1]));
r->time_hi_and_version = htons(ntohl(b[2]));
r->clock_seq_hi_and_reserved = ntohl(b[3]);
r->clock_seq_low = ntohl(b[4]);
for (loop = 0; loop < 6; loop++)
r->node[loop] = ntohl(b[loop + 5]);
call->unmarshall++;
fallthrough;
case 2:
break;
}
if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING))
return afs_io_error(call, afs_io_error_cm_reply);
if (memcmp(call->request, &call->server->_uuid, sizeof(call->server->_uuid)) != 0) {
pr_notice("Callback UUID does not match fileserver UUID\n");
trace_afs_cm_no_server_u(call, call->request);
return 0;
}
return 0;
}
/*
* allow the fileserver to see if the cache manager is still alive
*/
static void SRXAFSCB_Probe(struct work_struct *work)
{
struct afs_call *call = container_of(work, struct afs_call, work);
_enter("");
afs_send_empty_reply(call);
afs_put_call(call);
_leave("");
}
/*
* deliver request data to a CB.Probe call
*/
static int afs_deliver_cb_probe(struct afs_call *call)
{
int ret;
_enter("");
afs_extract_discard(call, 0);
ret = afs_extract_data(call, false);
if (ret < 0)
return ret;
if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING))
return afs_io_error(call, afs_io_error_cm_reply);
return 0;
}
/*
* Allow the fileserver to quickly find out if the cache manager has been
* rebooted.
*/
static void SRXAFSCB_ProbeUuid(struct work_struct *work)
{
struct afs_call *call = container_of(work, struct afs_call, work);
struct afs_uuid *r = call->request;
_enter("");
if (memcmp(r, &call->net->uuid, sizeof(call->net->uuid)) == 0)
afs_send_empty_reply(call);
else
afs_abort_service_call(call, 1, 1, afs_abort_probeuuid_negative);
afs_put_call(call);
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/slab.h`, `linux/sched.h`, `linux/ip.h`, `internal.h`, `afs_cm.h`, `protocol_yfs.h`.
- Detected declarations: `function afs_cm_incoming_call`, `function afs_cm_destructor`, `function afs_abort_service_call`, `function SRXAFSCB_CallBack`, `function afs_deliver_cb_callback`, `function state`, `function afs_deliver_cb_init_call_back_state`, `function afs_deliver_cb_init_call_back_state3`, `function SRXAFSCB_Probe`, `function afs_deliver_cb_probe`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source 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.