11 #include <linux/types.h>
18 static inline u16 case_fold(
u16 c)
34 u16 len1, len2, c1, c2;
57 return (c1 < c2) ? -1 : 1;
67 u16 len1, len2, c1, c2;
76 for (len =
min(len1, len2); len > 0; len--) {
80 return c1 < c2 ? -1 : 1;
85 return len1 < len2 ? -1 :
90 #define Hangul_SBase 0xac00
91 #define Hangul_LBase 0x1100
92 #define Hangul_VBase 0x1161
93 #define Hangul_TBase 0x11a7
94 #define Hangul_SCount 11172
95 #define Hangul_LCount 19
96 #define Hangul_VCount 21
97 #define Hangul_TCount 28
98 #define Hangul_NCount (Hangul_VCount * Hangul_TCount)
107 if (!e || cc < p[s * 2] || cc > p[e * 2])
113 else if (cc < p[i * 2])
123 char *astr,
int *len_p)
126 struct nls_table *nls = HFSPLUS_SB(sb)->nls;
130 int i,
len, ustrlen,
res, compose;
139 while (ustrlen > 0) {
180 ce1 = hfsplus_compose_lookup(
205 ce2 = hfsplus_compose_lookup(ce1, c0);
208 while (i < ustrlen) {
209 ce1 = hfsplus_compose_lookup(ce2,
247 *len_p = (
char *)op - astr;
255 static inline int asc2unichar(
struct super_block *
sb,
const char *astr,
int len,
258 int size = HFSPLUS_SB(sb)->nls->char2uni(astr, len, uc);
275 static inline u16 *decompose_unichar(
wchar_t uc,
int *size)
280 if (off == 0 || off == 0xffff)
299 const char *astr,
int len)
301 int size, dsize, decompose;
306 while (outlen < HFSPLUS_MAX_STRLEN && len > 0) {
307 size = asc2unichar(sb, astr, len, &c);
310 dstr = decompose_unichar(c, &dsize);
318 }
while (--dsize > 0);
342 int casefold, decompose,
size, len;
354 size = asc2unichar(sb, astr, len, &c);
359 dstr = decompose_unichar(c, &dsize);
368 hash = partial_name_hash(c2, hash);
369 }
while (--dsize > 0);
375 hash = partial_name_hash(c2, hash);
378 str->hash = end_name_hash(hash);
389 const struct inode *pinode,
391 unsigned int len,
const char *
str,
const struct qstr *
name)
394 int casefold, decompose,
size;
395 int dsize1, dsize2, len1, len2;
396 const u16 *dstr1, *dstr2;
397 const char *astr1, *astr2;
408 dstr1 = dstr2 =
NULL;
410 while (len1 > 0 && len2 > 0) {
412 size = asc2unichar(sb, astr1, len1, &c);
417 dstr1 = decompose_unichar(c, &dsize1);
418 if (!decompose || !dstr1) {
426 size = asc2unichar(sb, astr2, len2, &c);
431 dstr2 = decompose_unichar(c, &dsize2);
432 if (!decompose || !dstr2) {