1 /* Copyright (C) 2007-2009 Ksplice, Inc.
2 * Authors: Jeff Arnold, Anders Kaseorg, Tim Abbott
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
18 #ifdef KSPLICE_STANDALONE
21 #include <linux/ksplice.h>
24 extern struct ksplice_reloc ksplice_relocs
[], ksplice_relocs_end
[];
25 extern const struct ksplice_section ksplice_sections
[], ksplice_sections_end
[];
26 extern struct ksplice_symbol ksplice_symbols
[], ksplice_symbols_end
[];
27 extern struct ksplice_patch ksplice_patches
[], ksplice_patches_end
[];
28 extern const typeof(int (*)(void)) ksplice_call_pre_apply
[],
29 ksplice_call_pre_apply_end
[], ksplice_call_check_apply
[],
30 ksplice_call_check_apply_end
[];
31 extern const typeof(void (*)(void)) ksplice_call_apply
[],
32 ksplice_call_apply_end
[], ksplice_call_post_apply
[],
33 ksplice_call_post_apply_end
[], ksplice_call_fail_apply
[],
34 ksplice_call_fail_apply_end
[];
35 extern const typeof(int (*)(void)) ksplice_call_pre_reverse
[],
36 ksplice_call_pre_reverse_end
[], ksplice_call_check_reverse
[],
37 ksplice_call_check_reverse_end
[];
38 extern const typeof(void (*)(void)) ksplice_call_reverse
[],
39 ksplice_call_reverse_end
[], ksplice_call_post_reverse
[],
40 ksplice_call_post_reverse_end
[], ksplice_call_fail_reverse
[],
41 ksplice_call_fail_reverse_end
[];
43 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
44 extern struct paravirt_patch_site parainstructions
[], parainstructions_end
[];
46 #ifdef KSPLICE_STANDALONE
47 extern struct ksplice_system_map ksplice_system_map
[],
48 ksplice_system_map_end
[];
49 #endif /* KSPLICE_STANDALONE */
51 #define pack KSPLICE_UNIQ(pack)
52 struct ksplice_pack pack
= {
53 .name
= "ksplice_" __stringify(KSPLICE_MID
),
54 .kid
= __stringify(KSPLICE_KID
),
55 .target_name
= __stringify(KSPLICE_TARGET
),
56 #ifdef KSPLICE_STANDALONE
57 .map_printk
= MAP_PRINTK
,
58 #endif /* KSPLICE_STANDALONE */
59 .primary
= THIS_MODULE
,
60 .primary_relocs
= ksplice_relocs
,
61 .primary_relocs_end
= ksplice_relocs_end
,
62 .primary_sections
= ksplice_sections
,
63 .primary_sections_end
= ksplice_sections_end
,
64 .primary_symbols
= ksplice_symbols
,
65 .primary_symbols_end
= ksplice_symbols_end
,
66 .patches
= ksplice_patches
,
67 .patches_end
= ksplice_patches_end
,
68 .pre_apply
= ksplice_call_pre_apply
,
69 .pre_apply_end
= ksplice_call_pre_apply_end
,
70 .check_apply
= ksplice_call_check_apply
,
71 .check_apply_end
= ksplice_call_check_apply_end
,
72 .apply
= ksplice_call_apply
,
73 .apply_end
= ksplice_call_apply_end
,
74 .post_apply
= ksplice_call_post_apply
,
75 .post_apply_end
= ksplice_call_post_apply_end
,
76 .fail_apply
= ksplice_call_fail_apply
,
77 .fail_apply_end
= ksplice_call_fail_apply_end
,
78 .pre_reverse
= ksplice_call_pre_reverse
,
79 .pre_reverse_end
= ksplice_call_pre_reverse_end
,
80 .check_reverse
= ksplice_call_check_reverse
,
81 .check_reverse_end
= ksplice_call_check_reverse_end
,
82 .reverse
= ksplice_call_reverse
,
83 .reverse_end
= ksplice_call_reverse_end
,
84 .post_reverse
= ksplice_call_post_reverse
,
85 .post_reverse_end
= ksplice_call_post_reverse_end
,
86 .fail_reverse
= ksplice_call_fail_reverse
,
87 .fail_reverse_end
= ksplice_call_fail_reverse_end
,
88 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
89 .primary_parainstructions
= parainstructions
,
90 .primary_parainstructions_end
= parainstructions_end
,
92 #ifdef KSPLICE_STANDALONE
93 .primary_system_map
= ksplice_system_map
,
94 .primary_system_map_end
= ksplice_system_map_end
,
95 #endif /* KSPLICE_STANDALONE */
97 EXPORT_SYMBOL_GPL(pack
);
99 static int init_primary(void)
104 static void cleanup_primary(void)
106 cleanup_ksplice_pack(&pack
);
109 module_init(init_primary
);
110 module_exit(cleanup_primary
);
112 MODULE_AUTHOR("Ksplice, Inc.");
113 MODULE_DESCRIPTION("Ksplice rebootless update primary module");
114 #ifdef KSPLICE_VERSION
115 MODULE_VERSION(KSPLICE_VERSION
);
117 MODULE_LICENSE("GPL v2");