depmod: simplify option error handling
[mit.git] / elfops.h
blobc3d2e33d1dfea0d319ea3dbec184c34215f1b543
1 #ifndef MODINITTOOLS_MODULEOPS_H
2 #define MODINITTOOLS_MODULEOPS_H
3 #include <stdio.h>
4 #include <stdint.h>
5 #include "logging.h"
7 /* All the icky stuff to do with manipulating 64 and 32-bit modules
8 belongs here. */
9 struct kernel_symbol32 {
10 char value[4];
11 char name[64 - 4];
14 struct kernel_symbol64 {
15 char value[8];
16 char name[64 - 8];
19 struct modver_info32
21 uint32_t crc;
22 char name[64 - sizeof(uint32_t)];
25 struct modver_info64
27 uint64_t crc;
28 char name[64 - sizeof(uint64_t)];
31 struct elf_file
33 char *pathname;
35 /* File operations */
36 struct module_ops *ops;
38 /* Convert endian? */
39 int conv;
41 /* File contents and length. */
42 void *data;
43 unsigned long len;
46 /* Tables extracted from module by ops->fetch_tables(). */
47 struct module_tables
49 unsigned int pci_size;
50 void *pci_table;
51 unsigned int usb_size;
52 void *usb_table;
53 unsigned int ieee1394_size;
54 void *ieee1394_table;
55 unsigned int ccw_size;
56 void *ccw_table;
57 unsigned int pnp_size;
58 void *pnp_table;
59 unsigned int pnp_card_size;
60 unsigned int pnp_card_offset;
61 void *pnp_card_table;
62 unsigned int input_size;
63 void *input_table;
64 unsigned int input_table_size;
65 unsigned int serio_size;
66 void *serio_table;
67 unsigned int of_size;
68 void *of_table;
71 struct module_ops
73 void *(*load_section)(struct elf_file *module,
74 const char *secname, unsigned long *secsize);
75 struct string_table *(*load_strings)(struct elf_file *module,
76 const char *secname, struct string_table *tbl, errfn_t error);
77 struct string_table *(*load_symbols)(struct elf_file *module);
78 struct string_table *(*load_dep_syms)(const char *pathname,
79 struct elf_file *module, struct string_table **types);
80 void (*fetch_tables)(struct elf_file *module,
81 struct module_tables *tables);
82 char *(*get_aliases)(struct elf_file *module, unsigned long *size);
83 char *(*get_modinfo)(struct elf_file *module, unsigned long *size);
84 void (*strip_section)(struct elf_file *module, const char *secname);
85 int (*dump_modvers)(struct elf_file *module);
88 extern struct module_ops mod_ops32, mod_ops64;
90 struct elf_file *grab_elf_file(const char *pathname);
91 struct elf_file *grab_elf_file_fd(const char *pathname, int fd);
92 void release_elf_file(struct elf_file *file);
94 #endif /* MODINITTOOLS_MODULEOPS_H */