build: Build tests in a separate directory
[mit.git] / depmod.h
blobb9cc4b178403a9c2e5a56989048d139cb3d1c974
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 /* Line number in modules.order (or INDEX_PRIORITY_MIN) */
34 unsigned int order;
36 /* Tables extracted from module by ops->fetch_tables(). */
37 unsigned int pci_size;
38 void *pci_table;
39 unsigned int usb_size;
40 void *usb_table;
41 unsigned int ieee1394_size;
42 void *ieee1394_table;
43 unsigned int ccw_size;
44 void *ccw_table;
45 unsigned int pnp_size;
46 void *pnp_table;
47 unsigned int pnp_card_size;
48 unsigned int pnp_card_offset;
49 void *pnp_card_table;
50 unsigned int input_size;
51 void *input_table;
52 unsigned int input_table_size;
53 unsigned int serio_size;
54 void *serio_table;
55 unsigned int of_size;
56 void *of_table;
58 /* File contents and length. */
59 void *data;
60 unsigned long len;
62 char *basename; /* points into pathname */
63 char pathname[0];
66 #define END(x, conv) \
67 ({ \
68 typeof(x) __x; \
69 if (conv) __convert_endian(&(x), &(__x), sizeof(__x)); \
70 else __x = (x); \
71 __x; \
74 static inline void __convert_endian(const void *src, void *dest,
75 unsigned int size)
77 unsigned int i;
78 for (i = 0; i < size; i++)
79 ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1];
81 #endif /* MODINITTOOLS_DEPMOD_H */