~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/unicode.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_UNICODE_H
  3 #define _LINUX_UNICODE_H
  4 
  5 #include <linux/init.h>
  6 #include <linux/dcache.h>
  7 
  8 struct utf8data;
  9 struct utf8data_table;
 10 
 11 #define UNICODE_MAJ_SHIFT               16
 12 #define UNICODE_MIN_SHIFT               8
 13 
 14 #define UNICODE_AGE(MAJ, MIN, REV)                      \
 15         (((unsigned int)(MAJ) << UNICODE_MAJ_SHIFT) |   \
 16          ((unsigned int)(MIN) << UNICODE_MIN_SHIFT) |   \
 17          ((unsigned int)(REV)))
 18 
 19 static inline u8 unicode_major(unsigned int age)
 20 {
 21         return (age >> UNICODE_MAJ_SHIFT) & 0xff;
 22 }
 23 
 24 static inline u8 unicode_minor(unsigned int age)
 25 {
 26         return (age >> UNICODE_MIN_SHIFT) & 0xff;
 27 }
 28 
 29 static inline u8 unicode_rev(unsigned int age)
 30 {
 31         return age & 0xff;
 32 }
 33 
 34 /*
 35  * Two normalization forms are supported:
 36  * 1) NFDI
 37  *   - Apply unicode normalization form NFD.
 38  *   - Remove any Default_Ignorable_Code_Point.
 39  * 2) NFDICF
 40  *   - Apply unicode normalization form NFD.
 41  *   - Remove any Default_Ignorable_Code_Point.
 42  *   - Apply a full casefold (C + F).
 43  */
 44 enum utf8_normalization {
 45         UTF8_NFDI = 0,
 46         UTF8_NFDICF,
 47         UTF8_NMAX,
 48 };
 49 
 50 struct unicode_map {
 51         unsigned int version;
 52         const struct utf8data *ntab[UTF8_NMAX];
 53         const struct utf8data_table *tables;
 54 };
 55 
 56 int utf8_validate(const struct unicode_map *um, const struct qstr *str);
 57 
 58 int utf8_strncmp(const struct unicode_map *um,
 59                  const struct qstr *s1, const struct qstr *s2);
 60 
 61 int utf8_strncasecmp(const struct unicode_map *um,
 62                  const struct qstr *s1, const struct qstr *s2);
 63 int utf8_strncasecmp_folded(const struct unicode_map *um,
 64                             const struct qstr *cf,
 65                             const struct qstr *s1);
 66 
 67 int utf8_normalize(const struct unicode_map *um, const struct qstr *str,
 68                    unsigned char *dest, size_t dlen);
 69 
 70 int utf8_casefold(const struct unicode_map *um, const struct qstr *str,
 71                   unsigned char *dest, size_t dlen);
 72 
 73 int utf8_casefold_hash(const struct unicode_map *um, const void *salt,
 74                        struct qstr *str);
 75 
 76 struct unicode_map *utf8_load(unsigned int version);
 77 void utf8_unload(struct unicode_map *um);
 78 
 79 #endif /* _LINUX_UNICODE_H */
 80 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php