1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Generate kernel symbol version hashes.
3 Copyright 1996, 1997 Linux International.
8 This file is part of the Linux modutils.
12 #ifndef MODUTILS_GENKSYMS_H
13 #define MODUTILS_GENKSYMS_H 1
18 SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION,
23 STATUS_UNCHANGED, STATUS_DEFINED, STATUS_MODIFIED
27 struct string_list *next;
34 struct symbol *hash_next;
36 enum symbol_type type;
37 struct string_list *defn;
38 struct symbol *expansion_trail;
39 struct symbol *visited;
42 enum symbol_status status;
46 typedef struct string_list **yystype;
47 #define YYSTYPE yystype
50 extern char *cur_filename, *source_file;
51 extern int in_source_file;
53 struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact);
54 struct symbol *add_symbol(const char *name, enum symbol_type type,
55 struct string_list *defn, int is_extern);
56 void export_symbol(const char *);
58 void free_node(struct string_list *list);
59 void free_list(struct string_list *s, struct string_list *e);
60 struct string_list *copy_node(struct string_list *);
61 struct string_list *copy_list_range(struct string_list *start,
62 struct string_list *end);
67 void error_with_pos(const char *, ...) __attribute__ ((format(printf, 1, 2)));
69 /*----------------------------------------------------------------------*/
70 #define xmalloc(size) ({ void *__ptr = malloc(size); \
71 if(!__ptr && size != 0) { \
72 fprintf(stderr, "out of memory\n"); \
76 #define xstrdup(str) ({ char *__str = strdup(str); \
78 fprintf(stderr, "out of memory\n"); \
83 #endif /* genksyms.h */