Module lifecycle
The linux kernel module implements all backend services for executing and yielding UMS worker threads.
Once loaded, the kernel module initializes its caches, it registers the UMS
device and it initializes the UMS procfs
directories:
11static int __init ums_init(void)
12{
13 int retval;
14
15 retval = ums_caches_init();
16 if (retval)
17 goto cache_init;
18
19 retval = register_ums_device();
20 if (retval)
21 goto register_dev;
22
23 retval = ums_proc_init();
24 if (retval)
25 goto proc_init;
26
27 return 0;
28
29proc_init:
30 unregister_ums_device();
31register_dev:
32 ums_caches_destroy();
33cache_init:
34 return retval;
35}
When the module is unloaded it destroies every resources associated with it:
37static void __exit ums_exit(void)
38{
39 /* wait for all RCU callbacks to fire. */
40 rcu_barrier();
41
42 unregister_ums_device();
43 ums_caches_destroy();
44 ums_proc_destroy();
45}