8702 PCI addresses with physaddr > 0xffffffff can't be mapped in
[unleashed.git] / usr / src / uts / common / sys / kobj_lex.h
blobca6ef40f6ac4757ed0f136ce96509811f3192c91
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright 2015 PALO, Richard. All rights reserved.
29 #ifndef _SYS_KOBJ_LEX_H
30 #define _SYS_KOBJ_LEX_H
32 #include <sys/ctype.h>
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
39 * This file contains declarations for lex and its associated functions that
40 * are used by the kernel to parse the contents of system files.
42 * These lex functions are for a few selected kernel modules that are required
43 * to parse contents of file(s) on disk. This file is not for general kernel
44 * usage.
47 #define isunary(ch) ((ch) == '~' || (ch) == '-')
49 #define iswhite(ch) ((ch) == ' ' || (ch) == '\t')
51 #define isnewline(ch) ((ch) == '\n' || (ch) == '\r' || (ch) == '\f')
53 #define isalphanum(ch) (isalpha(ch) || isdigit(ch))
55 #define isnamechar(ch) (isalphanum(ch) || (ch) == '_' || (ch) == '-')
57 typedef enum {
58 UNEXPECTED = -1,
59 EQUALS,
60 AMPERSAND,
61 BIT_OR,
62 STAR,
63 POUND,
64 COLON,
65 SEMICOLON,
66 COMMA,
67 SLASH,
68 WHITE_SPACE,
69 NEWLINE,
70 EOF,
71 STRING,
72 HEXVAL,
73 DECVAL,
74 NAME
75 } token_t;
77 #ifdef DEBUG
78 /* string values for token_t */
79 extern char *tokennames[];
80 #endif /* DEBUG */
83 * return 1 with sptr pointing to the string represented by token
84 * On error returns NULL. The memory pointed to by sptr should be
85 * freed using free_string function.
87 int kobj_get_string(u_longlong_t *sptr, char *token);
88 void kobj_free_string(void *ptr, int len);
91 * returns decimal/octal/hex number in valuep
92 * return 0 on success, -1 on failure
94 int kobj_getvalue(const char *token, u_longlong_t *valuep);
96 /* prints a formated message via cmn_err */
97 /*PRINTFLIKE3*/
98 extern void kobj_file_err(int type, struct _buf *file, char *fmt, ...)
99 __KPRINTFLIKE(3);
102 * returns the next token in the file on success,
103 * return -1 on failure
105 token_t kobj_lex(struct _buf *file, char *val, size_t size);
107 void kobj_find_eol(struct _buf *file);
109 #ifdef __cplusplus
111 #endif
113 #endif /* !_SYS_KOBJ_LEX_H */