Skip to content

Commit 5298d4b

Browse files
Christoph Hellwigkrisman-at-collabora
authored andcommitted
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: 2b3d047 ("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>
1 parent 6661224 commit 5298d4b

File tree

17 files changed

+60
-66
lines changed

17 files changed

+60
-66
lines changed

fs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ obj-$(CONFIG_EXPORTFS) += exportfs/
9494
obj-$(CONFIG_NFSD) += nfsd/
9595
obj-$(CONFIG_LOCKD) += lockd/
9696
obj-$(CONFIG_NLS) += nls/
97-
obj-$(CONFIG_UNICODE) += unicode/
97+
obj-y += unicode/
9898
obj-$(CONFIG_SYSV_FS) += sysv/
9999
obj-$(CONFIG_SMBFS_COMMON) += smbfs_common/
100100
obj-$(CONFIG_CIFS) += cifs/

fs/ext4/ext4.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,7 +2485,7 @@ struct ext4_filename {
24852485
#ifdef CONFIG_FS_ENCRYPTION
24862486
struct fscrypt_str crypto_buf;
24872487
#endif
2488-
#ifdef CONFIG_UNICODE
2488+
#if IS_ENABLED(CONFIG_UNICODE)
24892489
struct fscrypt_str cf_name;
24902490
#endif
24912491
};
@@ -2721,7 +2721,7 @@ extern unsigned ext4_free_clusters_after_init(struct super_block *sb,
27212721
struct ext4_group_desc *gdp);
27222722
ext4_fsblk_t ext4_inode_to_goal_block(struct inode *);
27232723

2724-
#ifdef CONFIG_UNICODE
2724+
#if IS_ENABLED(CONFIG_UNICODE)
27252725
extern int ext4_fname_setup_ci_filename(struct inode *dir,
27262726
const struct qstr *iname,
27272727
struct ext4_filename *fname);
@@ -2754,7 +2754,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir,
27542754

27552755
ext4_fname_from_fscrypt_name(fname, &name);
27562756

2757-
#ifdef CONFIG_UNICODE
2757+
#if IS_ENABLED(CONFIG_UNICODE)
27582758
err = ext4_fname_setup_ci_filename(dir, iname, fname);
27592759
#endif
27602760
return err;
@@ -2773,7 +2773,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir,
27732773

27742774
ext4_fname_from_fscrypt_name(fname, &name);
27752775

2776-
#ifdef CONFIG_UNICODE
2776+
#if IS_ENABLED(CONFIG_UNICODE)
27772777
err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname);
27782778
#endif
27792779
return err;
@@ -2790,7 +2790,7 @@ static inline void ext4_fname_free_filename(struct ext4_filename *fname)
27902790
fname->usr_fname = NULL;
27912791
fname->disk_name.name = NULL;
27922792

2793-
#ifdef CONFIG_UNICODE
2793+
#if IS_ENABLED(CONFIG_UNICODE)
27942794
kfree(fname->cf_name.name);
27952795
fname->cf_name.name = NULL;
27962796
#endif
@@ -2806,7 +2806,7 @@ static inline int ext4_fname_setup_filename(struct inode *dir,
28062806
fname->disk_name.name = (unsigned char *) iname->name;
28072807
fname->disk_name.len = iname->len;
28082808

2809-
#ifdef CONFIG_UNICODE
2809+
#if IS_ENABLED(CONFIG_UNICODE)
28102810
err = ext4_fname_setup_ci_filename(dir, iname, fname);
28112811
#endif
28122812

@@ -2822,7 +2822,7 @@ static inline int ext4_fname_prepare_lookup(struct inode *dir,
28222822

28232823
static inline void ext4_fname_free_filename(struct ext4_filename *fname)
28242824
{
2825-
#ifdef CONFIG_UNICODE
2825+
#if IS_ENABLED(CONFIG_UNICODE)
28262826
kfree(fname->cf_name.name);
28272827
fname->cf_name.name = NULL;
28282828
#endif

fs/ext4/hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static int __ext4fs_dirhash(const struct inode *dir, const char *name, int len,
290290
int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
291291
struct dx_hash_info *hinfo)
292292
{
293-
#ifdef CONFIG_UNICODE
293+
#if IS_ENABLED(CONFIG_UNICODE)
294294
const struct unicode_map *um = dir->i_sb->s_encoding;
295295
int r, dlen;
296296
unsigned char *buff;

fs/ext4/namei.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, ext4_lblk_t block)
13171317
dx_set_count(entries, count + 1);
13181318
}
13191319

1320-
#ifdef CONFIG_UNICODE
1320+
#if IS_ENABLED(CONFIG_UNICODE)
13211321
/*
13221322
* Test whether a case-insensitive directory entry matches the filename
13231323
* being searched for. If quick is set, assume the name being looked up
@@ -1428,7 +1428,7 @@ static bool ext4_match(struct inode *parent,
14281428
f.crypto_buf = fname->crypto_buf;
14291429
#endif
14301430

1431-
#ifdef CONFIG_UNICODE
1431+
#if IS_ENABLED(CONFIG_UNICODE)
14321432
if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) &&
14331433
(!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) {
14341434
if (fname->cf_name.name) {
@@ -1800,7 +1800,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
18001800
}
18011801
}
18021802

1803-
#ifdef CONFIG_UNICODE
1803+
#if IS_ENABLED(CONFIG_UNICODE)
18041804
if (!inode && IS_CASEFOLDED(dir)) {
18051805
/* Eventually we want to call d_add_ci(dentry, NULL)
18061806
* for negative dentries in the encoding case as
@@ -2308,7 +2308,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
23082308
if (fscrypt_is_nokey_name(dentry))
23092309
return -ENOKEY;
23102310

2311-
#ifdef CONFIG_UNICODE
2311+
#if IS_ENABLED(CONFIG_UNICODE)
23122312
if (sb_has_strict_encoding(sb) && IS_CASEFOLDED(dir) &&
23132313
sb->s_encoding && utf8_validate(sb->s_encoding, &dentry->d_name))
23142314
return -EINVAL;
@@ -3126,7 +3126,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
31263126
ext4_fc_track_unlink(handle, dentry);
31273127
retval = ext4_mark_inode_dirty(handle, dir);
31283128

3129-
#ifdef CONFIG_UNICODE
3129+
#if IS_ENABLED(CONFIG_UNICODE)
31303130
/* VFS negative dentries are incompatible with Encoding and
31313131
* Case-insensitiveness. Eventually we'll want avoid
31323132
* invalidating the dentries here, alongside with returning the
@@ -3231,7 +3231,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
32313231
retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry));
32323232
if (!retval)
32333233
ext4_fc_track_unlink(handle, dentry);
3234-
#ifdef CONFIG_UNICODE
3234+
#if IS_ENABLED(CONFIG_UNICODE)
32353235
/* VFS negative dentries are incompatible with Encoding and
32363236
* Case-insensitiveness. Eventually we'll want avoid
32373237
* invalidating the dentries here, alongside with returning the

fs/ext4/super.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ static void ext4_put_super(struct super_block *sb)
13021302
kfree(sbi->s_blockgroup_lock);
13031303
fs_put_dax(sbi->s_daxdev);
13041304
fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
1305-
#ifdef CONFIG_UNICODE
1305+
#if IS_ENABLED(CONFIG_UNICODE)
13061306
utf8_unload(sb->s_encoding);
13071307
#endif
13081308
kfree(sbi);
@@ -1962,7 +1962,7 @@ static const struct mount_opts {
19621962
{Opt_err, 0, 0}
19631963
};
19641964

1965-
#ifdef CONFIG_UNICODE
1965+
#if IS_ENABLED(CONFIG_UNICODE)
19661966
static const struct ext4_sb_encodings {
19671967
__u16 magic;
19681968
char *name;
@@ -3609,7 +3609,7 @@ int ext4_feature_set_ok(struct super_block *sb, int readonly)
36093609
return 0;
36103610
}
36113611

3612-
#ifndef CONFIG_UNICODE
3612+
#if !IS_ENABLED(CONFIG_UNICODE)
36133613
if (ext4_has_feature_casefold(sb)) {
36143614
ext4_msg(sb, KERN_ERR,
36153615
"Filesystem with casefold feature cannot be "
@@ -4613,7 +4613,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
46134613
if (err < 0)
46144614
goto failed_mount;
46154615

4616-
#ifdef CONFIG_UNICODE
4616+
#if IS_ENABLED(CONFIG_UNICODE)
46174617
if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {
46184618
const struct ext4_sb_encodings *encoding_info;
46194619
struct unicode_map *encoding;
@@ -5517,7 +5517,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
55175517
if (sbi->s_chksum_driver)
55185518
crypto_free_shash(sbi->s_chksum_driver);
55195519

5520-
#ifdef CONFIG_UNICODE
5520+
#if IS_ENABLED(CONFIG_UNICODE)
55215521
utf8_unload(sb->s_encoding);
55225522
#endif
55235523

fs/ext4/sysfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,15 @@ EXT4_ATTR_FEATURE(meta_bg_resize);
309309
EXT4_ATTR_FEATURE(encryption);
310310
EXT4_ATTR_FEATURE(test_dummy_encryption_v2);
311311
#endif
312-
#ifdef CONFIG_UNICODE
312+
#if IS_ENABLED(CONFIG_UNICODE)
313313
EXT4_ATTR_FEATURE(casefold);
314314
#endif
315315
#ifdef CONFIG_FS_VERITY
316316
EXT4_ATTR_FEATURE(verity);
317317
#endif
318318
EXT4_ATTR_FEATURE(metadata_csum_seed);
319319
EXT4_ATTR_FEATURE(fast_commit);
320-
#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
320+
#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
321321
EXT4_ATTR_FEATURE(encrypted_casefold);
322322
#endif
323323

@@ -329,15 +329,15 @@ static struct attribute *ext4_feat_attrs[] = {
329329
ATTR_LIST(encryption),
330330
ATTR_LIST(test_dummy_encryption_v2),
331331
#endif
332-
#ifdef CONFIG_UNICODE
332+
#if IS_ENABLED(CONFIG_UNICODE)
333333
ATTR_LIST(casefold),
334334
#endif
335335
#ifdef CONFIG_FS_VERITY
336336
ATTR_LIST(verity),
337337
#endif
338338
ATTR_LIST(metadata_csum_seed),
339339
ATTR_LIST(fast_commit),
340-
#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
340+
#if IS_ENABLED(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
341341
ATTR_LIST(encrypted_casefold),
342342
#endif
343343
NULL,

fs/f2fs/dir.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "xattr.h"
1717
#include <trace/events/f2fs.h>
1818

19-
#ifdef CONFIG_UNICODE
19+
#if IS_ENABLED(CONFIG_UNICODE)
2020
extern struct kmem_cache *f2fs_cf_name_slab;
2121
#endif
2222

@@ -79,7 +79,7 @@ unsigned char f2fs_get_de_type(struct f2fs_dir_entry *de)
7979
int f2fs_init_casefolded_name(const struct inode *dir,
8080
struct f2fs_filename *fname)
8181
{
82-
#ifdef CONFIG_UNICODE
82+
#if IS_ENABLED(CONFIG_UNICODE)
8383
struct super_block *sb = dir->i_sb;
8484

8585
if (IS_CASEFOLDED(dir)) {
@@ -174,7 +174,7 @@ void f2fs_free_filename(struct f2fs_filename *fname)
174174
kfree(fname->crypto_buf.name);
175175
fname->crypto_buf.name = NULL;
176176
#endif
177-
#ifdef CONFIG_UNICODE
177+
#if IS_ENABLED(CONFIG_UNICODE)
178178
if (fname->cf_name.name) {
179179
kmem_cache_free(f2fs_cf_name_slab, fname->cf_name.name);
180180
fname->cf_name.name = NULL;
@@ -208,7 +208,7 @@ static struct f2fs_dir_entry *find_in_block(struct inode *dir,
208208
return f2fs_find_target_dentry(&d, fname, max_slots);
209209
}
210210

211-
#ifdef CONFIG_UNICODE
211+
#if IS_ENABLED(CONFIG_UNICODE)
212212
/*
213213
* Test whether a case-insensitive directory entry matches the filename
214214
* being searched for.
@@ -266,7 +266,7 @@ static inline int f2fs_match_name(const struct inode *dir,
266266
{
267267
struct fscrypt_name f;
268268

269-
#ifdef CONFIG_UNICODE
269+
#if IS_ENABLED(CONFIG_UNICODE)
270270
if (fname->cf_name.name) {
271271
struct qstr cf = FSTR_TO_QSTR(&fname->cf_name);
272272

fs/f2fs/f2fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ struct f2fs_filename {
487487
*/
488488
struct fscrypt_str crypto_buf;
489489
#endif
490-
#ifdef CONFIG_UNICODE
490+
#if IS_ENABLED(CONFIG_UNICODE)
491491
/*
492492
* For casefolded directories: the casefolded name, but it's left NULL
493493
* if the original name is not valid Unicode, if the directory is both

fs/f2fs/hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void f2fs_hash_filename(const struct inode *dir, struct f2fs_filename *fname)
105105
return;
106106
}
107107

108-
#ifdef CONFIG_UNICODE
108+
#if IS_ENABLED(CONFIG_UNICODE)
109109
if (IS_CASEFOLDED(dir)) {
110110
/*
111111
* If the casefolded name is provided, hash it instead of the

fs/f2fs/namei.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry,
561561
goto out_iput;
562562
}
563563
out_splice:
564-
#ifdef CONFIG_UNICODE
564+
#if IS_ENABLED(CONFIG_UNICODE)
565565
if (!inode && IS_CASEFOLDED(dir)) {
566566
/* Eventually we want to call d_add_ci(dentry, NULL)
567567
* for negative dentries in the encoding case as
@@ -622,7 +622,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
622622
goto fail;
623623
}
624624
f2fs_delete_entry(de, page, dir, inode);
625-
#ifdef CONFIG_UNICODE
625+
#if IS_ENABLED(CONFIG_UNICODE)
626626
/* VFS negative dentries are incompatible with Encoding and
627627
* Case-insensitiveness. Eventually we'll want avoid
628628
* invalidating the dentries here, alongside with returning the

0 commit comments

Comments
 (0)