Makefile.ksplice: Rewrite ksplice-cow-check as a wrapper function.
[ksplice.git] / kmodsrc / old_code_loader.c
blobb5cfc3839f873ab1e5a5f44b975d71fbb64827aa
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[], ksplice_system_map_end[];
32 #endif /* KSPLICE_STANDALONE */
34 /* Defined in new_code_loader.c */
35 #define change KSPLICE_UNIQ(change)
36 extern struct ksplice_mod_change change;
38 static struct ksplice_code old_code = {
39 .relocs = ksplice_relocs,
40 .relocs_end = ksplice_relocs_end,
41 .sections = ksplice_sections,
42 .sections_end = ksplice_sections_end,
43 .symbols = ksplice_symbols,
44 .symbols_end = ksplice_symbols_end,
45 #ifdef KSPLICE_NEED_PARAINSTRUCTIONS
46 .parainstructions = parainstructions,
47 .parainstructions_end = parainstructions_end,
48 #endif
49 #ifdef KSPLICE_STANDALONE
50 .system_map = ksplice_system_map,
51 .system_map_end = ksplice_system_map_end,
52 #endif /* KSPLICE_STANDALONE */
55 static int init_old_code(void)
57 change.old_code = old_code;
58 return init_ksplice_mod_change(&change);
61 static void cleanup_old_code(void)
63 cleanup_ksplice_mod_change(&change);
66 module_init(init_old_code);
67 module_exit(cleanup_old_code);
69 MODULE_AUTHOR("Ksplice, Inc.");
70 MODULE_DESCRIPTION("Ksplice rebootless update old code module");
71 #ifdef KSPLICE_VERSION
72 MODULE_VERSION(KSPLICE_VERSION);
73 #endif
74 MODULE_LICENSE("GPL v2");