mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
![Daniel Rosenberg](/assets/img/avatar_default.png)
This adds a case insensitive hash function to allow taking the hash without needing to allocate a casefolded copy of the string. The existing d_hash implementations for casefolding allocate memory within rcu-walk, by avoiding it we can be more efficient and avoid worrying about a failed allocation. Signed-off-by: Daniel Rosenberg <drosen@google.com> Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
36 lines
1 KiB
C
36 lines
1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_UNICODE_H
|
|
#define _LINUX_UNICODE_H
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/dcache.h>
|
|
|
|
struct unicode_map {
|
|
const char *charset;
|
|
int version;
|
|
};
|
|
|
|
int utf8_validate(const struct unicode_map *um, const struct qstr *str);
|
|
|
|
int utf8_strncmp(const struct unicode_map *um,
|
|
const struct qstr *s1, const struct qstr *s2);
|
|
|
|
int utf8_strncasecmp(const struct unicode_map *um,
|
|
const struct qstr *s1, const struct qstr *s2);
|
|
int utf8_strncasecmp_folded(const struct unicode_map *um,
|
|
const struct qstr *cf,
|
|
const struct qstr *s1);
|
|
|
|
int utf8_normalize(const struct unicode_map *um, const struct qstr *str,
|
|
unsigned char *dest, size_t dlen);
|
|
|
|
int utf8_casefold(const struct unicode_map *um, const struct qstr *str,
|
|
unsigned char *dest, size_t dlen);
|
|
|
|
int utf8_casefold_hash(const struct unicode_map *um, const void *salt,
|
|
struct qstr *str);
|
|
|
|
struct unicode_map *utf8_load(const char *version);
|
|
void utf8_unload(struct unicode_map *um);
|
|
|
|
#endif /* _LINUX_UNICODE_H */
|