Properly protect kernel structures in varsym.h
[dragonfly.git] / sys / sys / varsym.h
CommitLineData
98a7f915
MD
1/*
2 * SYS/VARSYM.H
3 *
4 * Implements structures used for variant symlink support.
5 *
3df22e80 6 * $DragonFly: src/sys/sys/varsym.h,v 1.7 2008/02/23 00:59:23 swildner Exp $
98a7f915
MD
7 */
8
9#ifndef _SYS_VARSYM_H_
10#define _SYS_VARSYM_H_
11
e3dd2e77 12#if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
98a7f915
MD
13
14#ifndef _SYS_QUEUE_H_
15#include <sys/queue.h> /* TAILQ_* macros */
16#endif
17
9d7a637e
AE
18#include <sys/lock.h>
19
98a7f915
MD
20struct varsym {
21 int vs_refs; /* a lot of sharing occurs */
22 int vs_namelen;
23 char *vs_name; /* variable name */
24 char *vs_data; /* variable contents */
25};
26
27typedef struct varsym *varsym_t;
28
29struct varsyment {
30 TAILQ_ENTRY(varsyment) ve_entry;
31 varsym_t ve_sym;
32};
33
34struct varsymset {
35 TAILQ_HEAD(, varsyment) vx_queue;
36 int vx_setsize;
9d7a637e 37 struct lock vx_lock;
98a7f915
MD
38};
39
40#endif /* _KERNEL || _KERNEL_STRUCTURES */
41
42#define VARSYM_PROC 1
43#define VARSYM_USER 2
44#define VARSYM_SYS 3
dbc282df 45#define VARSYM_PRISON 4 /* used internally */
98a7f915
MD
46
47#define VARSYM_PROC_MASK (1 << VARSYM_PROC)
48#define VARSYM_USER_MASK (1 << VARSYM_USER)
49#define VARSYM_SYS_MASK (1 << VARSYM_SYS)
50#define VARSYM_ALL_MASK (VARSYM_PROC_MASK|VARSYM_USER_MASK|VARSYM_SYS_MASK)
51
52#define MAXVARSYM_NAME 64
53#define MAXVARSYM_DATA 256
92673705 54#define MAXVARSYM_SET 16384
98a7f915
MD
55
56#ifdef _KERNEL
57
58varsym_t varsymfind(int mask, const char *name, int namelen);
59int varsymmake(int level, const char *name, const char *data);
60void varsymdrop(varsym_t var);
61void varsymset_init(struct varsymset *varsymset, struct varsymset *copy);
62void varsymset_clean(struct varsymset *varsymset);
063147e5 63int varsymreplace(char *cp, int linklen, int maxlen);
98a7f915 64
3df22e80
SW
65#endif /* _KERNEL */
66
98a7f915 67#endif