mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
unicode: clean up the Kconfig symbol confusion
Turn the CONFIG_UNICODE symbol into a tristate that generates some always
built in code and remove the confusing CONFIG_UNICODE_UTF8_DATA symbol.
Note that a lot of the IS_ENABLED() checks could be turned from cpp
statements into normal ifs, but this change is intended to be fairly
mechanic, so that should be cleaned up later.
Fixes: 2b3d047870
("unicode: Add utf8-data module")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
This commit is contained in:
parent
6661224e66
commit
5298d4bfe8
@ -94,7 +94,7 @@ obj-$(CONFIG_EXPORTFS) += exportfs/
|
|||||||
obj-$(CONFIG_NFSD) += nfsd/
|
obj-$(CONFIG_NFSD) += nfsd/
|
||||||
obj-$(CONFIG_LOCKD) += lockd/
|
obj-$(CONFIG_LOCKD) += lockd/
|
||||||
obj-$(CONFIG_NLS) += nls/
|
obj-$(CONFIG_NLS) += nls/
|
||||||
obj-$(CONFIG_UNICODE) += unicode/
|
obj-y += unicode/
|
||||||
obj-$(CONFIG_SYSV_FS) += sysv/
|
obj-$(CONFIG_SYSV_FS) += sysv/
|
||||||
obj-$(CONFIG_SMBFS_COMMON) += smbfs_common/
|
obj-$(CONFIG_SMBFS_COMMON) += smbfs_common/
|
||||||
obj-$(CONFIG_CIFS) += cifs/
|
obj-$(CONFIG_CIFS) += cifs/
|
||||||
|
@ -2485,7 +2485,7 @@ struct ext4_filename {
|
|||||||
#ifdef CONFIG_FS_ENCRYPTION
|
#ifdef CONFIG_FS_ENCRYPTION
|
||||||
struct fscrypt_str crypto_buf;
|
struct fscrypt_str crypto_buf;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
struct fscrypt_str cf_name;
|
struct fscrypt_str cf_name;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@ -2721,7 +2721,7 @@ extern unsigned ext4_free_clusters_after_init(struct super_block *sb,
|
|||||||
struct ext4_group_desc *gdp);
|
struct ext4_group_desc *gdp);
|
||||||
ext4_fsblk_t ext4_inode_to_goal_block(struct inode *);
|
ext4_fsblk_t ext4_inode_to_goal_block(struct inode *);
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
extern int ext4_fname_setup_ci_filename(struct inode *dir,
|
extern int ext4_fname_setup_ci_filename(struct inode *dir,
|
||||||
const struct qstr *iname,
|
const struct qstr *iname,
|
||||||
struct ext4_filename *fname);
|
struct ext4_filename *fname);
|
||||||
@ -2754,7 +2754,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir,
|
|||||||
|
|
||||||
ext4_fname_from_fscrypt_name(fname, &name);
|
ext4_fname_from_fscrypt_name(fname, &name);
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
err = ext4_fname_setup_ci_filename(dir, iname, fname);
|
err = ext4_fname_setup_ci_filename(dir, iname, fname);
|
||||||
#endif
|
#endif
|
||||||
return err;
|
return err;
|
||||||
@ -2773,7 +2773,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir,
|
|||||||
|
|
||||||
ext4_fname_from_fscrypt_name(fname, &name);
|
ext4_fname_from_fscrypt_name(fname, &name);
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname);
|
err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname);
|
||||||
#endif
|
#endif
|
||||||
return err;
|
return err;
|
||||||
@ -2790,7 +2790,7 @@ static inline void ext4_fname_free_filename(struct ext4_filename *fname)
|
|||||||
fname->usr_fname = NULL;
|
fname->usr_fname = NULL;
|
||||||
fname->disk_name.name = NULL;
|
fname->disk_name.name = NULL;
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
kfree(fname->cf_name.name);
|
kfree(fname->cf_name.name);
|
||||||
fname->cf_name.name = NULL;
|
fname->cf_name.name = NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -2806,7 +2806,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir,
|
|||||||
fname->disk_name.name = (unsigned char *) iname->name;
|
fname->disk_name.name = (unsigned char *) iname->name;
|
||||||
fname->disk_name.len = iname->len;
|
fname->disk_name.len = iname->len;
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
err = ext4_fname_setup_ci_filename(dir, iname, fname);
|
err = ext4_fname_setup_ci_filename(dir, iname, fname);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2822,7 +2822,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir,
|
|||||||
|
|
||||||
static inline void ext4_fname_free_filename(struct ext4_filename *fname)
|
static inline void ext4_fname_free_filename(struct ext4_filename *fname)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
kfree(fname->cf_name.name);
|
kfree(fname->cf_name.name);
|
||||||
fname->cf_name.name = NULL;
|
fname->cf_name.name = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -290,7 +290,7 @@ static int __ext4fs_dirhash(const struct inode *dir, const char *name, int len,
|
|||||||
int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
|
int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
|
||||||
struct dx_hash_info *hinfo)
|
struct dx_hash_info *hinfo)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
const struct unicode_map *um = dir->i_sb->s_encoding;
|
const struct unicode_map *um = dir->i_sb->s_encoding;
|
||||||
int r, dlen;
|
int r, dlen;
|
||||||
unsigned char *buff;
|
unsigned char *buff;
|
||||||
|
@ -1317,7 +1317,7 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, ext4_lblk_t block)
|
|||||||
dx_set_count(entries, count + 1);
|
dx_set_count(entries, count + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
/*
|
/*
|
||||||
* Test whether a case-insensitive directory entry matches the filename
|
* Test whether a case-insensitive directory entry matches the filename
|
||||||
* being searched for. If quick is set, assume the name being looked up
|
* being searched for. If quick is set, assume the name being looked up
|
||||||
@ -1428,7 +1428,7 @@ static bool ext4_match(struct inode *parent,
|
|||||||
f.crypto_buf = fname->crypto_buf;
|
f.crypto_buf = fname->crypto_buf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) &&
|
if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) &&
|
||||||
(!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) {
|
(!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) {
|
||||||
if (fname->cf_name.name) {
|
if (fname->cf_name.name) {
|
||||||
@ -1800,7 +1800,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (!inode && IS_CASEFOLDED(dir)) {
|
if (!inode && IS_CASEFOLDED(dir)) {
|
||||||
/* Eventually we want to call d_add_ci(dentry, NULL)
|
/* Eventually we want to call d_add_ci(dentry, NULL)
|
||||||
* for negative dentries in the encoding case as
|
* for negative dentries in the encoding case as
|
||||||
@ -2308,7 +2308,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
|
|||||||
if (fscrypt_is_nokey_name(dentry))
|
if (fscrypt_is_nokey_name(dentry))
|
||||||
return -ENOKEY;
|
return -ENOKEY;
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
|
if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
|
||||||
sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
|
sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -3126,7 +3126,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
|
|||||||
ext4_fc_track_unlink(handle, dentry);
|
ext4_fc_track_unlink(handle, dentry);
|
||||||
retval = ext4_mark_inode_dirty(handle, dir);
|
retval = ext4_mark_inode_dirty(handle, dir);
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
/* VFS negative dentries are incompatible with Encoding and
|
/* VFS negative dentries are incompatible with Encoding and
|
||||||
* Case-insensitiveness. Eventually we'll want avoid
|
* Case-insensitiveness. Eventually we'll want avoid
|
||||||
* invalidating the dentries here, alongside with returning the
|
* invalidating the dentries here, alongside with returning the
|
||||||
@ -3231,7 +3231,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
|
|||||||
retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry));
|
retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry));
|
||||||
if (!retval)
|
if (!retval)
|
||||||
ext4_fc_track_unlink(handle, dentry);
|
ext4_fc_track_unlink(handle, dentry);
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
/* VFS negative dentries are incompatible with Encoding and
|
/* VFS negative dentries are incompatible with Encoding and
|
||||||
* Case-insensitiveness. Eventually we'll want avoid
|
* Case-insensitiveness. Eventually we'll want avoid
|
||||||
* invalidating the dentries here, alongside with returning the
|
* invalidating the dentries here, alongside with returning the
|
||||||
|
@ -1302,7 +1302,7 @@ static void ext4_put_super(struct super_block *sb)
|
|||||||
kfree(sbi->s_blockgroup_lock);
|
kfree(sbi->s_blockgroup_lock);
|
||||||
fs_put_dax(sbi->s_daxdev);
|
fs_put_dax(sbi->s_daxdev);
|
||||||
fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
|
fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
utf8_unload(sb->s_encoding);
|
utf8_unload(sb->s_encoding);
|
||||||
#endif
|
#endif
|
||||||
kfree(sbi);
|
kfree(sbi);
|
||||||
@ -1962,7 +1962,7 @@ static const struct mount_opts {
|
|||||||
{Opt_err, 0, 0}
|
{Opt_err, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
static const struct ext4_sb_encodings {
|
static const struct ext4_sb_encodings {
|
||||||
__u16 magic;
|
__u16 magic;
|
||||||
char *name;
|
char *name;
|
||||||
@ -3609,7 +3609,7 @@ int ext4_feature_set_ok(struct super_block *sb, int readonly)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_UNICODE
|
#if !IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (ext4_has_feature_casefold(sb)) {
|
if (ext4_has_feature_casefold(sb)) {
|
||||||
ext4_msg(sb, KERN_ERR,
|
ext4_msg(sb, KERN_ERR,
|
||||||
"Filesystem with casefold feature cannot be "
|
"Filesystem with casefold feature cannot be "
|
||||||
@ -4613,7 +4613,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto failed_mount;
|
goto failed_mount;
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {
|
if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {
|
||||||
const struct ext4_sb_encodings *encoding_info;
|
const struct ext4_sb_encodings *encoding_info;
|
||||||
struct unicode_map *encoding;
|
struct unicode_map *encoding;
|
||||||
@ -5517,7 +5517,7 @@ failed_mount:
|
|||||||
if (sbi->s_chksum_driver)
|
if (sbi->s_chksum_driver)
|
||||||
crypto_free_shash(sbi->s_chksum_driver);
|
crypto_free_shash(sbi->s_chksum_driver);
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
utf8_unload(sb->s_encoding);
|
utf8_unload(sb->s_encoding);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ EXT4_ATTR_FEATURE(meta_bg_resize);
|
|||||||
EXT4_ATTR_FEATURE(encryption);
|
EXT4_ATTR_FEATURE(encryption);
|
||||||
EXT4_ATTR_FEATURE(test_dummy_encryption_v2);
|
EXT4_ATTR_FEATURE(test_dummy_encryption_v2);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
EXT4_ATTR_FEATURE(casefold);
|
EXT4_ATTR_FEATURE(casefold);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FS_VERITY
|
#ifdef CONFIG_FS_VERITY
|
||||||
@ -317,7 +317,7 @@ EXT4_ATTR_FEATURE(verity);
|
|||||||
#endif
|
#endif
|
||||||
EXT4_ATTR_FEATURE(metadata_csum_seed);
|
EXT4_ATTR_FEATURE(metadata_csum_seed);
|
||||||
EXT4_ATTR_FEATURE(fast_commit);
|
EXT4_ATTR_FEATURE(fast_commit);
|
||||||
#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
|
#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
|
||||||
EXT4_ATTR_FEATURE(encrypted_casefold);
|
EXT4_ATTR_FEATURE(encrypted_casefold);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ static struct attribute *ext4_feat_attrs[] = {
|
|||||||
ATTR_LIST(encryption),
|
ATTR_LIST(encryption),
|
||||||
ATTR_LIST(test_dummy_encryption_v2),
|
ATTR_LIST(test_dummy_encryption_v2),
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
ATTR_LIST(casefold),
|
ATTR_LIST(casefold),
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_FS_VERITY
|
#ifdef CONFIG_FS_VERITY
|
||||||
@ -337,7 +337,7 @@ static struct attribute *ext4_feat_attrs[] = {
|
|||||||
#endif
|
#endif
|
||||||
ATTR_LIST(metadata_csum_seed),
|
ATTR_LIST(metadata_csum_seed),
|
||||||
ATTR_LIST(fast_commit),
|
ATTR_LIST(fast_commit),
|
||||||
#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
|
#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
|
||||||
ATTR_LIST(encrypted_casefold),
|
ATTR_LIST(encrypted_casefold),
|
||||||
#endif
|
#endif
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "xattr.h"
|
#include "xattr.h"
|
||||||
#include <trace/events/f2fs.h>
|
#include <trace/events/f2fs.h>
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
extern struct kmem_cache *f2fs_cf_name_slab;
|
extern struct kmem_cache *f2fs_cf_name_slab;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ unsigned char f2fs_get_de_type(struct f2fs_dir_entry *de)
|
|||||||
int f2fs_init_casefolded_name(const struct inode *dir,
|
int f2fs_init_casefolded_name(const struct inode *dir,
|
||||||
struct f2fs_filename *fname)
|
struct f2fs_filename *fname)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
struct super_block *sb = dir->i_sb;
|
struct super_block *sb = dir->i_sb;
|
||||||
|
|
||||||
if (IS_CASEFOLDED(dir)) {
|
if (IS_CASEFOLDED(dir)) {
|
||||||
@ -174,7 +174,7 @@ void f2fs_free_filename(struct f2fs_filename *fname)
|
|||||||
kfree(fname->crypto_buf.name);
|
kfree(fname->crypto_buf.name);
|
||||||
fname->crypto_buf.name = NULL;
|
fname->crypto_buf.name = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (fname->cf_name.name) {
|
if (fname->cf_name.name) {
|
||||||
kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
|
kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
|
||||||
fname->cf_name.name = NULL;
|
fname->cf_name.name = NULL;
|
||||||
@ -208,7 +208,7 @@ static struct f2fs_dir_entry *find_in_block(struct inode *dir,
|
|||||||
return f2fs_find_target_dentry(&d, fname, max_slots);
|
return f2fs_find_target_dentry(&d, fname, max_slots);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
/*
|
/*
|
||||||
* Test whether a case-insensitive directory entry matches the filename
|
* Test whether a case-insensitive directory entry matches the filename
|
||||||
* being searched for.
|
* being searched for.
|
||||||
@ -266,7 +266,7 @@ static inline int f2fs_match_name(const struct inode *dir,
|
|||||||
{
|
{
|
||||||
struct fscrypt_name f;
|
struct fscrypt_name f;
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (fname->cf_name.name) {
|
if (fname->cf_name.name) {
|
||||||
struct qstr cf = FSTR_TO_QSTR(&fname->cf_name);
|
struct qstr cf = FSTR_TO_QSTR(&fname->cf_name);
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ struct f2fs_filename {
|
|||||||
*/
|
*/
|
||||||
struct fscrypt_str crypto_buf;
|
struct fscrypt_str crypto_buf;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
/*
|
/*
|
||||||
* For casefolded directories: the casefolded name, but it's left NULL
|
* For casefolded directories: the casefolded name, but it's left NULL
|
||||||
* if the original name is not valid Unicode, if the directory is both
|
* if the original name is not valid Unicode, if the directory is both
|
||||||
|
@ -105,7 +105,7 @@ void f2fs_hash_filename(const struct inode *dir, struct f2fs_filename *fname)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (IS_CASEFOLDED(dir)) {
|
if (IS_CASEFOLDED(dir)) {
|
||||||
/*
|
/*
|
||||||
* If the casefolded name is provided, hash it instead of the
|
* If the casefolded name is provided, hash it instead of the
|
||||||
|
@ -561,7 +561,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
|
|||||||
goto out_iput;
|
goto out_iput;
|
||||||
}
|
}
|
||||||
out_splice:
|
out_splice:
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (!inode && IS_CASEFOLDED(dir)) {
|
if (!inode && IS_CASEFOLDED(dir)) {
|
||||||
/* Eventually we want to call d_add_ci(dentry, NULL)
|
/* Eventually we want to call d_add_ci(dentry, NULL)
|
||||||
* for negative dentries in the encoding case as
|
* for negative dentries in the encoding case as
|
||||||
@ -622,7 +622,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
f2fs_delete_entry(de, page, dir, inode);
|
f2fs_delete_entry(de, page, dir, inode);
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
/* VFS negative dentries are incompatible with Encoding and
|
/* VFS negative dentries are incompatible with Encoding and
|
||||||
* Case-insensitiveness. Eventually we'll want avoid
|
* Case-insensitiveness. Eventually we'll want avoid
|
||||||
* invalidating the dentries here, alongside with returning the
|
* invalidating the dentries here, alongside with returning the
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
static struct kmem_cache *fsync_entry_slab;
|
static struct kmem_cache *fsync_entry_slab;
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
extern struct kmem_cache *f2fs_cf_name_slab;
|
extern struct kmem_cache *f2fs_cf_name_slab;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ static int init_recovered_filename(const struct inode *dir,
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
f2fs_hash_filename(dir, fname);
|
f2fs_hash_filename(dir, fname);
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
/* Case-sensitive match is fine for recovery */
|
/* Case-sensitive match is fine for recovery */
|
||||||
kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
|
kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
|
||||||
fname->cf_name.name = NULL;
|
fname->cf_name.name = NULL;
|
||||||
|
@ -256,7 +256,7 @@ void f2fs_printk(struct f2fs_sb_info *sbi, const char *fmt, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
static const struct f2fs_sb_encodings {
|
static const struct f2fs_sb_encodings {
|
||||||
__u16 magic;
|
__u16 magic;
|
||||||
char *name;
|
char *name;
|
||||||
@ -1218,7 +1218,7 @@ default_check:
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef CONFIG_UNICODE
|
#if !IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (f2fs_sb_has_casefold(sbi)) {
|
if (f2fs_sb_has_casefold(sbi)) {
|
||||||
f2fs_err(sbi,
|
f2fs_err(sbi,
|
||||||
"Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE");
|
"Filesystem with casefold feature cannot be mounted without CONFIG_UNICODE");
|
||||||
@ -1578,7 +1578,7 @@ static void f2fs_put_super(struct super_block *sb)
|
|||||||
f2fs_destroy_iostat(sbi);
|
f2fs_destroy_iostat(sbi);
|
||||||
for (i = 0; i < NR_PAGE_TYPE; i++)
|
for (i = 0; i < NR_PAGE_TYPE; i++)
|
||||||
kvfree(sbi->write_io[i]);
|
kvfree(sbi->write_io[i]);
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
utf8_unload(sb->s_encoding);
|
utf8_unload(sb->s_encoding);
|
||||||
#endif
|
#endif
|
||||||
kfree(sbi);
|
kfree(sbi);
|
||||||
@ -3861,7 +3861,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
|
|||||||
|
|
||||||
static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)
|
static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (f2fs_sb_has_casefold(sbi) && !sbi->sb->s_encoding) {
|
if (f2fs_sb_has_casefold(sbi) && !sbi->sb->s_encoding) {
|
||||||
const struct f2fs_sb_encodings *encoding_info;
|
const struct f2fs_sb_encodings *encoding_info;
|
||||||
struct unicode_map *encoding;
|
struct unicode_map *encoding;
|
||||||
@ -4412,7 +4412,7 @@ free_bio_info:
|
|||||||
for (i = 0; i < NR_PAGE_TYPE; i++)
|
for (i = 0; i < NR_PAGE_TYPE; i++)
|
||||||
kvfree(sbi->write_io[i]);
|
kvfree(sbi->write_io[i]);
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
utf8_unload(sb->s_encoding);
|
utf8_unload(sb->s_encoding);
|
||||||
sb->s_encoding = NULL;
|
sb->s_encoding = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -192,7 +192,7 @@ static ssize_t unusable_show(struct f2fs_attr *a,
|
|||||||
static ssize_t encoding_show(struct f2fs_attr *a,
|
static ssize_t encoding_show(struct f2fs_attr *a,
|
||||||
struct f2fs_sb_info *sbi, char *buf)
|
struct f2fs_sb_info *sbi, char *buf)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
struct super_block *sb = sbi->sb;
|
struct super_block *sb = sbi->sb;
|
||||||
|
|
||||||
if (f2fs_sb_has_casefold(sbi))
|
if (f2fs_sb_has_casefold(sbi))
|
||||||
@ -756,7 +756,7 @@ F2FS_GENERAL_RO_ATTR(avg_vblocks);
|
|||||||
#ifdef CONFIG_FS_ENCRYPTION
|
#ifdef CONFIG_FS_ENCRYPTION
|
||||||
F2FS_FEATURE_RO_ATTR(encryption);
|
F2FS_FEATURE_RO_ATTR(encryption);
|
||||||
F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2);
|
F2FS_FEATURE_RO_ATTR(test_dummy_encryption_v2);
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
F2FS_FEATURE_RO_ATTR(encrypted_casefold);
|
F2FS_FEATURE_RO_ATTR(encrypted_casefold);
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_FS_ENCRYPTION */
|
#endif /* CONFIG_FS_ENCRYPTION */
|
||||||
@ -775,7 +775,7 @@ F2FS_FEATURE_RO_ATTR(lost_found);
|
|||||||
F2FS_FEATURE_RO_ATTR(verity);
|
F2FS_FEATURE_RO_ATTR(verity);
|
||||||
#endif
|
#endif
|
||||||
F2FS_FEATURE_RO_ATTR(sb_checksum);
|
F2FS_FEATURE_RO_ATTR(sb_checksum);
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
F2FS_FEATURE_RO_ATTR(casefold);
|
F2FS_FEATURE_RO_ATTR(casefold);
|
||||||
#endif
|
#endif
|
||||||
F2FS_FEATURE_RO_ATTR(readonly);
|
F2FS_FEATURE_RO_ATTR(readonly);
|
||||||
@ -886,7 +886,7 @@ static struct attribute *f2fs_feat_attrs[] = {
|
|||||||
#ifdef CONFIG_FS_ENCRYPTION
|
#ifdef CONFIG_FS_ENCRYPTION
|
||||||
ATTR_LIST(encryption),
|
ATTR_LIST(encryption),
|
||||||
ATTR_LIST(test_dummy_encryption_v2),
|
ATTR_LIST(test_dummy_encryption_v2),
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
ATTR_LIST(encrypted_casefold),
|
ATTR_LIST(encrypted_casefold),
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_FS_ENCRYPTION */
|
#endif /* CONFIG_FS_ENCRYPTION */
|
||||||
@ -905,7 +905,7 @@ static struct attribute *f2fs_feat_attrs[] = {
|
|||||||
ATTR_LIST(verity),
|
ATTR_LIST(verity),
|
||||||
#endif
|
#endif
|
||||||
ATTR_LIST(sb_checksum),
|
ATTR_LIST(sb_checksum),
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
ATTR_LIST(casefold),
|
ATTR_LIST(casefold),
|
||||||
#endif
|
#endif
|
||||||
ATTR_LIST(readonly),
|
ATTR_LIST(readonly),
|
||||||
|
10
fs/libfs.c
10
fs/libfs.c
@ -1379,7 +1379,7 @@ bool is_empty_dir_inode(struct inode *inode)
|
|||||||
(inode->i_op == &empty_dir_inode_operations);
|
(inode->i_op == &empty_dir_inode_operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
/*
|
/*
|
||||||
* Determine if the name of a dentry should be casefolded.
|
* Determine if the name of a dentry should be casefolded.
|
||||||
*
|
*
|
||||||
@ -1473,7 +1473,7 @@ static const struct dentry_operations generic_encrypted_dentry_ops = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE)
|
#if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE)
|
||||||
static const struct dentry_operations generic_encrypted_ci_dentry_ops = {
|
static const struct dentry_operations generic_encrypted_ci_dentry_ops = {
|
||||||
.d_hash = generic_ci_d_hash,
|
.d_hash = generic_ci_d_hash,
|
||||||
.d_compare = generic_ci_d_compare,
|
.d_compare = generic_ci_d_compare,
|
||||||
@ -1508,10 +1508,10 @@ void generic_set_encrypted_ci_d_ops(struct dentry *dentry)
|
|||||||
#ifdef CONFIG_FS_ENCRYPTION
|
#ifdef CONFIG_FS_ENCRYPTION
|
||||||
bool needs_encrypt_ops = dentry->d_flags & DCACHE_NOKEY_NAME;
|
bool needs_encrypt_ops = dentry->d_flags & DCACHE_NOKEY_NAME;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
bool needs_ci_ops = dentry->d_sb->s_encoding;
|
bool needs_ci_ops = dentry->d_sb->s_encoding;
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE)
|
#if defined(CONFIG_FS_ENCRYPTION) && IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (needs_encrypt_ops && needs_ci_ops) {
|
if (needs_encrypt_ops && needs_ci_ops) {
|
||||||
d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops);
|
d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops);
|
||||||
return;
|
return;
|
||||||
@ -1523,7 +1523,7 @@ void generic_set_encrypted_ci_d_ops(struct dentry *dentry)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
if (needs_ci_ops) {
|
if (needs_ci_ops) {
|
||||||
d_set_d_op(dentry, &generic_ci_dentry_ops);
|
d_set_d_op(dentry, &generic_ci_dentry_ops);
|
||||||
return;
|
return;
|
||||||
|
@ -3,21 +3,13 @@
|
|||||||
# UTF-8 normalization
|
# UTF-8 normalization
|
||||||
#
|
#
|
||||||
config UNICODE
|
config UNICODE
|
||||||
bool "UTF-8 normalization and casefolding support"
|
tristate "UTF-8 normalization and casefolding support"
|
||||||
help
|
help
|
||||||
Say Y here to enable UTF-8 NFD normalization and NFD+CF casefolding
|
Say Y here to enable UTF-8 NFD normalization and NFD+CF casefolding
|
||||||
support.
|
support. If you say M here the large table of case foldings will
|
||||||
|
be a separate loadable module that gets requested only when a file
|
||||||
config UNICODE_UTF8_DATA
|
system actually use it.
|
||||||
tristate "UTF-8 normalization and casefolding tables"
|
|
||||||
depends on UNICODE
|
|
||||||
default UNICODE
|
|
||||||
help
|
|
||||||
This contains a large table of case foldings, which can be loaded as
|
|
||||||
a separate module if you say M here. To be on the safe side stick
|
|
||||||
to the default of Y. Saying N here makes no sense, if you do not want
|
|
||||||
utf8 casefolding support, disable CONFIG_UNICODE instead.
|
|
||||||
|
|
||||||
config UNICODE_NORMALIZATION_SELFTEST
|
config UNICODE_NORMALIZATION_SELFTEST
|
||||||
tristate "Test UTF-8 normalization support"
|
tristate "Test UTF-8 normalization support"
|
||||||
depends on UNICODE_UTF8_DATA
|
depends on UNICODE
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
obj-$(CONFIG_UNICODE) += unicode.o
|
ifneq ($(CONFIG_UNICODE),)
|
||||||
|
obj-y += unicode.o
|
||||||
|
endif
|
||||||
|
obj-$(CONFIG_UNICODE) += utf8data.o
|
||||||
obj-$(CONFIG_UNICODE_NORMALIZATION_SELFTEST) += utf8-selftest.o
|
obj-$(CONFIG_UNICODE_NORMALIZATION_SELFTEST) += utf8-selftest.o
|
||||||
obj-$(CONFIG_UNICODE_UTF8_DATA) += utf8data.o
|
|
||||||
|
|
||||||
unicode-y := utf8-norm.o utf8-core.o
|
unicode-y := utf8-norm.o utf8-core.o
|
||||||
|
|
||||||
|
@ -1490,7 +1490,7 @@ struct super_block {
|
|||||||
#ifdef CONFIG_FS_VERITY
|
#ifdef CONFIG_FS_VERITY
|
||||||
const struct fsverity_operations *s_vop;
|
const struct fsverity_operations *s_vop;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_UNICODE
|
#if IS_ENABLED(CONFIG_UNICODE)
|
||||||
struct unicode_map *s_encoding;
|
struct unicode_map *s_encoding;
|
||||||
__u16 s_encoding_flags;
|
__u16 s_encoding_flags;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user