diff options
author | Christoph Hellwig <hch@lst.de> | 2021-09-15 09:00:04 +0200 |
---|---|---|
committer | Gabriel Krisman Bertazi <krisman@collabora.com> | 2021-10-11 17:02:02 -0300 |
commit | 6ca99ce756c27852d1ea1e555045de1c920f30ed (patch) | |
tree | 3cedb519da25bfe7e8c3cce48f03c47599ce953e /include/linux/unicode.h | |
parent | fbc59d65059ecfea8b746715e920c325cc16cede (diff) |
unicode: cache the normalization tables in struct unicode_map
Instead of repeatedly looking up the version add pointers to the
NFD and NFD+CF tables to struct unicode_map, and pass a
unicode_map plus index to the functions using the normalization
tables.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Diffstat (limited to 'include/linux/unicode.h')
-rw-r--r-- | include/linux/unicode.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/unicode.h b/include/linux/unicode.h index 77bb915fd1f0..526ca8b8391a 100644 --- a/include/linux/unicode.h +++ b/include/linux/unicode.h @@ -5,6 +5,8 @@ #include <linux/init.h> #include <linux/dcache.h> +struct utf8data; + #define UNICODE_MAJ_SHIFT 16 #define UNICODE_MIN_SHIFT 8 @@ -28,8 +30,25 @@ static inline u8 unicode_rev(unsigned int age) return age & 0xff; } +/* + * Two normalization forms are supported: + * 1) NFDI + * - Apply unicode normalization form NFD. + * - Remove any Default_Ignorable_Code_Point. + * 2) NFDICF + * - Apply unicode normalization form NFD. + * - Remove any Default_Ignorable_Code_Point. + * - Apply a full casefold (C + F). + */ +enum utf8_normalization { + UTF8_NFDI = 0, + UTF8_NFDICF, + UTF8_NMAX, +}; + struct unicode_map { unsigned int version; + const struct utf8data *ntab[UTF8_NMAX]; }; int utf8_validate(const struct unicode_map *um, const struct qstr *str); |