Blame view

scripts/genksyms/genksyms.h 2.67 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  /* Generate kernel symbol version hashes.
     Copyright 1996, 1997 Linux International.
  
     New implementation contributed by Richard Henderson <rth@tamu.edu>
     Based on original work by Bjorn Ekwall <bj0rn@blox.se>
  
     This file is part of the Linux modutils.
  
     This program is free software; you can redistribute it and/or modify it
     under the terms of the GNU General Public License as published by the
     Free Software Foundation; either version 2 of the License, or (at your
     option) any later version.
  
     This program is distributed in the hope that it will be useful, but
     WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     General Public License for more details.
  
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software Foundation,
     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
23
24
25
  #ifndef MODUTILS_GENKSYMS_H
  #define MODUTILS_GENKSYMS_H 1
  
  #include <stdio.h>
ce5606869   Sam Ravnborg   kbuild: clean-up ...
26
  enum symbol_type {
e37ddb825   Michal Marek   genksyms: Track c...
27
28
  	SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION,
  	SYM_ENUM_CONST
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29
  };
64e6c1e12   Andreas Gruenbacher   genksyms: track s...
30
31
32
  enum symbol_status {
  	STATUS_UNCHANGED, STATUS_DEFINED, STATUS_MODIFIED
  };
ce5606869   Sam Ravnborg   kbuild: clean-up ...
33
34
35
  struct string_list {
  	struct string_list *next;
  	enum symbol_type tag;
2c5925d6b   Michal Marek   genksyms: Do not ...
36
  	int in_source_file;
ce5606869   Sam Ravnborg   kbuild: clean-up ...
37
  	char *string;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
38
  };
ce5606869   Sam Ravnborg   kbuild: clean-up ...
39
40
41
42
43
44
  struct symbol {
  	struct symbol *hash_next;
  	const char *name;
  	enum symbol_type type;
  	struct string_list *defn;
  	struct symbol *expansion_trail;
15fde6751   Andreas Gruenbacher   kbuild: support f...
45
  	struct symbol *visited;
ce5606869   Sam Ravnborg   kbuild: clean-up ...
46
  	int is_extern;
64e6c1e12   Andreas Gruenbacher   genksyms: track s...
47
48
  	int is_declared;
  	enum symbol_status status;
5dae9a550   Andreas Gruenbacher   genksyms: allow t...
49
  	int is_override;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
50
51
52
53
  };
  
  typedef struct string_list **yystype;
  #define YYSTYPE yystype
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
  extern int cur_line;
2c5925d6b   Michal Marek   genksyms: Do not ...
55
56
  extern char *cur_filename, *source_file;
  extern int in_source_file;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
57

01762c4ec   Michal Marek   genksyms: simplif...
58
  struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
59
  struct symbol *add_symbol(const char *name, enum symbol_type type,
ce5606869   Sam Ravnborg   kbuild: clean-up ...
60
  			  struct string_list *defn, int is_extern);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
  void export_symbol(const char *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
62
  void free_node(struct string_list *list);
ce5606869   Sam Ravnborg   kbuild: clean-up ...
63
  void free_list(struct string_list *s, struct string_list *e);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64
  struct string_list *copy_node(struct string_list *);
e37ddb825   Michal Marek   genksyms: Track c...
65
66
  struct string_list *copy_list_range(struct string_list *start,
  				    struct string_list *end);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
67
68
69
70
71
  
  int yylex(void);
  int yyparse(void);
  
  void error_with_pos(const char *, ...);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72
  /*----------------------------------------------------------------------*/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  #define xmalloc(size) ({ void *__ptr = malloc(size);		\
  	if(!__ptr && size != 0) {				\
  		fprintf(stderr, "out of memory
  ");		\
  		exit(1);					\
  	}							\
  	__ptr; })
  #define xstrdup(str)  ({ char *__str = strdup(str);		\
  	if (!__str) {						\
  		fprintf(stderr, "out of memory
  ");		\
  		exit(1);					\
  	}							\
  	__str; })
ce5606869   Sam Ravnborg   kbuild: clean-up ...
87
  #endif				/* genksyms.h */