depmod: Fix modules.dep truncation
[mit.git] / depmod.h
bloba4f72f6dbd455424e82596735dbd4c90d7d9e95c
1 #ifndef MODINITTOOLS_DEPMOD_H
2 #define MODINITTOOLS_DEPMOD_H
3 #include "list.h"
5 struct module;
7 /* Functions provided by depmod.c */
8 void add_symbol(const char *name, struct module *owner);
9 struct module *find_symbol(const char *name, const char *modname, int weak);
10 void add_dep(struct module *mod, struct module *depends_on);
12 /* I hate strcmp. */
13 #define streq(a,b) (strcmp((a),(b)) == 0)
15 struct module
17 /* Next module in list of all modules */
18 struct module *next;
20 /* 64 or 32 bit? */
21 struct module_ops *ops;
23 /* Convert endian? */
24 int conv;
26 /* Dependencies: filled in by ops->calculate_deps() */
27 unsigned int num_deps;
28 struct module **deps;
30 /* Set while we are traversing dependencies */
31 struct list_head dep_list;
33 /* Tables extracted from module by ops->fetch_tables(). */
34 unsigned int pci_size;
35 void *pci_table;
36 unsigned int usb_size;
37 void *usb_table;
38 unsigned int ieee1394_size;
39 void *ieee1394_table;
40 unsigned int ccw_size;
41 void *ccw_table;
42 unsigned int pnp_size;
43 void *pnp_table;
44 unsigned int pnp_card_size;
45 unsigned int pnp_card_offset;
46 void *pnp_card_table;
47 unsigned int input_size;
48 void *input_table;
49 unsigned int input_table_size;
50 unsigned int serio_size;
51 void *serio_table;
52 unsigned int of_size;
53 void *of_table;
55 /* File contents and length. */
56 void *data;
57 unsigned long len;
59 char *basename; /* points into pathname */
60 char pathname[0];
63 #define END(x, conv) \
64 ({ \
65 typeof(x) __x; \
66 if (conv) __convert_endian(&(x), &(__x), sizeof(__x)); \
67 else __x = (x); \
68 __x; \
71 static inline void __convert_endian(const void *src, void *dest,
72 unsigned int size)
74 unsigned int i;
75 for (i = 0; i < size; i++)
76 ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1];
78 #endif /* MODINITTOOLS_DEPMOD_H */