This source file includes following definitions.
- ACPI_MODULE_NAME
- acpi_ut_repair_name
- ut_convert_backslashes
1
2
3
4
5
6
7
8 #include <acpi/acpi.h>
9 #include "accommon.h"
10 #include "acnamesp.h"
11
12 #define _COMPONENT ACPI_UTILITIES
13 ACPI_MODULE_NAME("utstring")
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 void acpi_ut_print_string(char *string, u16 max_length)
30 {
31 u32 i;
32
33 if (!string) {
34 acpi_os_printf("<\"NULL STRING PTR\">");
35 return;
36 }
37
38 acpi_os_printf("\"");
39 for (i = 0; (i < max_length) && string[i]; i++) {
40
41
42
43 switch (string[i]) {
44 case 0x07:
45
46 acpi_os_printf("\\a");
47 break;
48
49 case 0x08:
50
51 acpi_os_printf("\\b");
52 break;
53
54 case 0x0C:
55
56 acpi_os_printf("\\f");
57 break;
58
59 case 0x0A:
60
61 acpi_os_printf("\\n");
62 break;
63
64 case 0x0D:
65
66 acpi_os_printf("\\r");
67 break;
68
69 case 0x09:
70
71 acpi_os_printf("\\t");
72 break;
73
74 case 0x0B:
75
76 acpi_os_printf("\\v");
77 break;
78
79 case '\'':
80 case '\"':
81 case '\\':
82
83 acpi_os_printf("\\%c", (int)string[i]);
84 break;
85
86 default:
87
88
89
90 if (isprint((int)string[i])) {
91
92
93 acpi_os_printf("%c", (int)string[i]);
94 } else {
95
96
97 acpi_os_printf("\\x%2.2X", (s32)string[i]);
98 }
99 break;
100 }
101 }
102
103 acpi_os_printf("\"");
104
105 if (i == max_length && string[i]) {
106 acpi_os_printf("...");
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 void acpi_ut_repair_name(char *name)
133 {
134 u32 i;
135 u8 found_bad_char = FALSE;
136 u32 original_name;
137
138 ACPI_FUNCTION_NAME(ut_repair_name);
139
140
141
142
143
144 if (ACPI_COMPARE_NAMESEG(name, ACPI_ROOT_PATHNAME)) {
145 return;
146 }
147
148 ACPI_COPY_NAMESEG(&original_name, name);
149
150
151
152 for (i = 0; i < ACPI_NAMESEG_SIZE; i++) {
153 if (acpi_ut_valid_name_char(name[i], i)) {
154 continue;
155 }
156
157
158
159
160
161
162 name[i] = '*';
163 found_bad_char = TRUE;
164 }
165
166 if (found_bad_char) {
167
168
169
170 if (!acpi_gbl_enable_interpreter_slack) {
171 ACPI_WARNING((AE_INFO,
172 "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
173 original_name, name));
174 } else {
175 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
176 "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]",
177 original_name, name));
178 }
179 }
180 }
181
182 #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
183
184
185
186
187
188
189
190
191
192
193
194
195
196 void ut_convert_backslashes(char *pathname)
197 {
198
199 if (!pathname) {
200 return;
201 }
202
203 while (*pathname) {
204 if (*pathname == '\\') {
205 *pathname = '/';
206 }
207
208 pathname++;
209 }
210 }
211 #endif