Print this page
8115 parallel zfs mount
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/kiconv.h
+++ new/usr/src/uts/common/sys/kiconv.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 + *
25 + * Copyright 2017 RackTop Systems.
24 26 */
25 27
26 28 #ifndef _SYS_KICONV_H
27 29 #define _SYS_KICONV_H
28 30
29 31 #ifdef __cplusplus
30 32 extern "C" {
31 33 #endif
32 34
33 35 #include <sys/types.h>
34 36
35 -#ifdef _KERNEL
37 +#if defined(_KERNEL) || defined(_FAKE_KERNEL)
36 38
37 39 /*
38 40 * Supported fromcode/tocode values are saved in the following component type
39 41 * of (name, id) pair. The id values of fromcode and tocode are used to
40 42 * find out the corresponding code conversions.
41 43 */
42 44 typedef struct {
43 45 char *name;
44 46 size_t id;
45 47 } kiconv_code_list_t;
46 48
47 49 /*
48 50 * Each unique kiconv code conversion identified by tocode and fromcode ids
49 51 * have corresponding module id and internal function pointers to open(),
50 52 * kiconv(), close(), and kiconvstr().
51 53 */
52 54 typedef struct {
53 55 uint16_t tid; /* tocode id. */
54 56 uint16_t fid; /* fromcode id. */
55 57 uint16_t mid; /* module id. */
56 58 void *(*open)(void);
57 59 size_t (*kiconv)(void *, char **, size_t *, char **, size_t *,
58 60 int *);
59 61 int (*close)(void *);
60 62 size_t (*kiconvstr)(char *, size_t *, char *, size_t *, int,
61 63 int *);
62 64 } kiconv_conv_list_t;
63 65
64 66 /*
65 67 * Each module id has a corresponding module name that is used to load
66 68 * the module as needed and a reference counter.
67 69 */
68 70 typedef struct {
69 71 char *name;
70 72 uint_t refcount;
71 73 } kiconv_mod_list_t;
72 74
73 75 /*
74 76 * The following two data structures are being used to transfer information
75 77 * on the supported kiconv code conversions from a module to the framework.
76 78 *
77 79 * Details can be found from kiconv_ops(9S) and kiconv_module_info(9S)
78 80 * man pages at PSARC/2007/173.
79 81 */
80 82 typedef struct {
81 83 char *tocode;
82 84 char *fromcode;
83 85 void *(*kiconv_open)(void);
84 86 size_t (*kiconv)(void *, char **, size_t *, char **, size_t *,
85 87 int *);
86 88 int (*kiconv_close)(void *);
87 89 size_t (*kiconvstr)(char *, size_t *, char *, size_t *, int,
88 90 int *);
89 91 } kiconv_ops_t;
90 92
91 93 typedef struct kiconv_mod_info {
92 94 char *module_name;
93 95 size_t kiconv_num_convs;
94 96 kiconv_ops_t *kiconv_ops_tbl;
95 97 size_t kiconv_num_aliases;
96 98 char **aliases;
97 99 char **canonicals;
98 100 int nowait;
99 101 } kiconv_module_info_t;
100 102
101 103 /* The kiconv code conversion descriptor data structure. */
102 104 typedef struct {
103 105 void *handle; /* Handle from the actual open(). */
104 106 size_t id; /* Index to the conv_list[]. */
105 107 } kiconv_data_t, *kiconv_t;
106 108
107 109 /* Common conversion state data structure. */
108 110 typedef struct {
109 111 uint8_t id;
110 112 uint8_t bom_processed;
111 113 } kiconv_state_data_t, *kiconv_state_t;
112 114
113 115 /* Common component types for possible code conversion mapping tables. */
114 116 typedef struct {
115 117 uchar_t u8[3];
116 118 } kiconv_to_utf8_tbl_comp_t;
117 119
118 120 typedef struct {
119 121 uint32_t u8:24;
120 122 uint32_t sb:8;
121 123 } kiconv_to_sb_tbl_comp_t;
122 124
123 125 /*
124 126 * The maximum name length for any given codeset or alias names; the following
125 127 * should be plenty big enough.
126 128 */
127 129 #define KICONV_MAX_CODENAME_LEN 63
128 130
129 131 /* The following characters do not exist in the normalized code names. */
130 132 #define KICONV_SKIPPABLE_CHAR(c) \
131 133 ((c) == '-' || (c) == '_' || (c) == '.' || (c) == '@')
132 134
133 135 /*
134 136 * When we encounter non-identical characters, as like iconv(3C) we have,
135 137 * map them into either one of the replacement characters based on what is
136 138 * the current target tocde.
137 139 *
138 140 * The 0xefbfdb in UTF-8 is U+FFFD in Unicode scalar value.
139 141 */
140 142 #define KICONV_ASCII_REPLACEMENT_CHAR ('?')
141 143 #define KICONV_UTF8_REPLACEMENT_CHAR (0xefbfbd)
142 144
143 145 /* Numeric ids for kiconv modules. */
144 146 #define KICONV_EMBEDDED (0)
145 147 #define KICONV_MODULE_ID_JA (1)
146 148 #define KICONV_MODULE_ID_SC (2)
147 149 #define KICONV_MODULE_ID_KO (3)
148 150 #define KICONV_MODULE_ID_TC (4)
149 151 #define KICONV_MODULE_ID_EMEA (5)
150 152
151 153 #define KICONV_MAX_MODULE_ID KICONV_MODULE_ID_EMEA
152 154
153 155 /* Functions used in kiconv conversion and module management. */
154 156 extern void kiconv_init();
155 157 extern int kiconv_register_module(kiconv_module_info_t *);
156 158 extern int kiconv_unregister_module(kiconv_module_info_t *);
157 159 extern size_t kiconv_module_ref_count(size_t);
158 160
159 161 #endif /* _KERNEL */
160 162
161 163 #ifdef __cplusplus
162 164 }
163 165 #endif
164 166
165 167 #endif /* _SYS_KICONV_H */
↓ open down ↓ |
120 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX