0001
0002 #ifndef _LINUX_UNICODE_H
0003 #define _LINUX_UNICODE_H
0004
0005 #include <linux/init.h>
0006 #include <linux/dcache.h>
0007
0008 struct utf8data;
0009 struct utf8data_table;
0010
0011 #define UNICODE_MAJ_SHIFT 16
0012 #define UNICODE_MIN_SHIFT 8
0013
0014 #define UNICODE_AGE(MAJ, MIN, REV) \
0015 (((unsigned int)(MAJ) << UNICODE_MAJ_SHIFT) | \
0016 ((unsigned int)(MIN) << UNICODE_MIN_SHIFT) | \
0017 ((unsigned int)(REV)))
0018
0019 static inline u8 unicode_major(unsigned int age)
0020 {
0021 return (age >> UNICODE_MAJ_SHIFT) & 0xff;
0022 }
0023
0024 static inline u8 unicode_minor(unsigned int age)
0025 {
0026 return (age >> UNICODE_MIN_SHIFT) & 0xff;
0027 }
0028
0029 static inline u8 unicode_rev(unsigned int age)
0030 {
0031 return age & 0xff;
0032 }
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 enum utf8_normalization {
0045 UTF8_NFDI = 0,
0046 UTF8_NFDICF,
0047 UTF8_NMAX,
0048 };
0049
0050 struct unicode_map {
0051 unsigned int version;
0052 const struct utf8data *ntab[UTF8_NMAX];
0053 const struct utf8data_table *tables;
0054 };
0055
0056 int utf8_validate(const struct unicode_map *um, const struct qstr *str);
0057
0058 int utf8_strncmp(const struct unicode_map *um,
0059 const struct qstr *s1, const struct qstr *s2);
0060
0061 int utf8_strncasecmp(const struct unicode_map *um,
0062 const struct qstr *s1, const struct qstr *s2);
0063 int utf8_strncasecmp_folded(const struct unicode_map *um,
0064 const struct qstr *cf,
0065 const struct qstr *s1);
0066
0067 int utf8_normalize(const struct unicode_map *um, const struct qstr *str,
0068 unsigned char *dest, size_t dlen);
0069
0070 int utf8_casefold(const struct unicode_map *um, const struct qstr *str,
0071 unsigned char *dest, size_t dlen);
0072
0073 int utf8_casefold_hash(const struct unicode_map *um, const void *salt,
0074 struct qstr *str);
0075
0076 struct unicode_map *utf8_load(unsigned int version);
0077 void utf8_unload(struct unicode_map *um);
0078
0079 #endif