Don't build the ksplice core twice.
[ksplice.git] / kmodsrc / helper.c
blob356baae478b41735552c44e292a89adc5e82b191
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
15 * 02110-1301, USA.
18 #ifdef KSPLICE_STANDALONE
19 #include "ksplice.h"
20 #else
21 #include <linux/ksplice.h>
22 #endif
24 extern struct ksplice_reloc ksplice_relocs[], ksplice_relocs_end[];
25 extern struct ksplice_section ksplice_sections[], ksplice_sections_end[];
26 extern struct ksplice_symbol ksplice_symbols[], ksplice_symbols_end[];
27 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
28 extern struct paravirt_patch_site parainstructions[], parainstructions_end[];
29 #endif
30 #ifdef KSPLICE_STANDALONE
31 extern struct ksplice_system_map ksplice_system_map[],
32 ksplice_system_map_end[];
33 #endif /* KSPLICE_STANDALONE */
35 /* Defined in primary.c */
36 #define pack KSPLICE_UNIQ(pack)
37 extern struct ksplice_pack pack;
39 #define PTR(p) ({ static const volatile typeof(&*p) p##_ptr = p; p##_ptr; })
41 static int init_helper(void)
43 pack.helper_relocs = PTR(ksplice_relocs);
44 pack.helper_relocs_end = PTR(ksplice_relocs_end);
45 pack.helper_sections = PTR(ksplice_sections);
46 pack.helper_sections_end = PTR(ksplice_sections_end);
47 pack.helper_symbols = PTR(ksplice_symbols);
48 pack.helper_symbols_end = PTR(ksplice_symbols_end);
49 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
50 pack.helper_parainstructions = PTR(parainstructions);
51 pack.helper_parainstructions_end = PTR(parainstructions_end);
52 #endif
53 #ifdef KSPLICE_STANDALONE
54 pack.helper_system_map = PTR(ksplice_system_map);
55 pack.helper_system_map_end = PTR(ksplice_system_map_end);
56 #endif /* KSPLICE_STANDALONE */
57 return init_ksplice_pack(&pack);
60 static void cleanup_helper(void)
62 cleanup_ksplice_pack(&pack);
65 module_init(init_helper);
66 module_exit(cleanup_helper);
68 MODULE_AUTHOR("Ksplice, Inc.");
69 MODULE_DESCRIPTION("Ksplice rebootless update helper module");
70 #ifdef KSPLICE_VERSION
71 MODULE_VERSION(KSPLICE_VERSION);
72 #endif
73 MODULE_LICENSE("GPL v2");