1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIST_H
#define _LIST_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Constants
*/
#define MAXNAME 256
#define TYPESIZE 32
/*
* find_elem flags
*/
#define FOLLOW_LINK 1
#define NO_FOLLOW_LINK 0
/*
* elem_list types
*/
#define PROTOLIST_LIST 1
#define PROTODIR_LIST 2
#define EXCEPTION_LIST 3
/*
* file types
*/
#define CHAR_DEV_T 'c'
#define BLOCK_DEV_T 'b'
#define DIR_T 'd'
#define FILE_T 'f'
#define EDIT_T 'e'
#define VOLATILE_T 'v'
#define SYM_LINK_T 's'
#define LINK_T 'l'
/*
* Arch Values
*/
/* sparc */
#define P_SPARC 1
#define P_SUN4 2
#define P_SUN4c 3
#define P_SUN4d 4
#define P_SUN4e 5
#define P_SUN4m 6
#define P_SUN4u 7
#define P_SUN4v 8
/* x86 values */
#define P_I386 101
#define P_I86PC 102
/* ppc values */
#define P_PPC 201
#define P_PREP 202
#if defined(sparc)
#define P_ISA P_SPARC
#elif defined(i386)
#define P_ISA P_I386
#elif defined(__ppc)
#define P_ISA P_PPC
#else
#error "Unknown instruction set"
#endif
#define P_ALL P_ISA
/*
* typedefs
*/
typedef struct pkg_list {
char pkg_name[MAXNAME];
struct pkg_list *next;
} pkg_list;
typedef struct elem {
int inode;
short perm;
int ref_cnt;
short flag;
short major;
short minor;
short arch;
struct elem *next;
struct elem *link_parent;
struct elem *link_sib;
pkg_list *pkgs;
char *symsrc;
char name[MAXNAME];
char owner[TYPESIZE];
char group[TYPESIZE];
char file_type;
} elem;
typedef struct {
int num_of_buckets;
elem **list;
short type;
} elem_list;
#define HASH_SIZE 4093
/*
* Funcs
*/
extern void add_elem(elem_list*, elem *);
extern pkg_list *add_pkg(pkg_list *, const char *);
extern elem *find_elem(elem_list *, elem *, int);
extern elem *find_elem_mach(elem_list *, elem *, int);
extern elem *find_elem_isa(elem_list *, elem *, int);
extern void init_list(elem_list *, int);
extern unsigned int hash(const char *str);
extern int processed_package(const char *pkgname);
extern void mark_processed(const char *pkgname);
#ifdef DEBUG
extern void examine_list(elem_list *list);
extern void print_list(elem_list *);
extern void print_type_list(elem_list *list, char file_type);
#endif
/* Global statistics */
extern int max_list_depth;
#ifdef __cplusplus
}
#endif
#endif /* _LIST_H */
|