Skip to content

Commit f3a9b37

Browse files
Dr. David Alan GilbertSteve French
authored andcommitted
fs/jfs: Use common ucs2 upper case table
Use the UCS-2 upper case tables from nls, that are shared with smb. This code in JFS is hard to test, so we're only reusing the same tables (which are identical), not trying to reuse the rest of the helper functions. Signed-off-by: Dr. David Alan Gilbert <[email protected]> Reviewed-by: Dave Kleikamp <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent de54845 commit f3a9b37

File tree

6 files changed

+23
-147
lines changed

6 files changed

+23
-147
lines changed

fs/jfs/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
config JFS_FS
33
tristate "JFS filesystem support"
44
select NLS
5+
select NLS_UCS2_UTILS
56
select CRC32
67
select LEGACY_DIRECT_IO
78
help

fs/jfs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jfs-y := super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
99
jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
1010
jfs_unicode.o jfs_dtree.o jfs_inode.o jfs_discard.o \
1111
jfs_extent.o symlink.o jfs_metapage.o \
12-
jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
12+
jfs_logmgr.o jfs_txnmgr.o \
1313
resize.o xattr.o ioctl.o
1414

1515
jfs-$(CONFIG_JFS_POSIX_ACL) += acl.o

fs/jfs/jfs_unicode.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,9 @@
88

99
#include <linux/slab.h>
1010
#include <asm/byteorder.h>
11+
#include "../nls/nls_ucs2_data.h"
1112
#include "jfs_types.h"
1213

13-
typedef struct {
14-
wchar_t start;
15-
wchar_t end;
16-
signed char *table;
17-
} UNICASERANGE;
18-
19-
extern signed char UniUpperTable[512];
20-
extern UNICASERANGE UniUpperRange[];
2114
extern int get_UCSname(struct component_name *, struct dentry *);
2215
extern int jfs_strfromUCS_le(char *, const __le16 *, int, struct nls_table *);
2316

@@ -107,12 +100,12 @@ static inline wchar_t *UniStrncpy_from_le(wchar_t * ucs1, const __le16 * ucs2,
107100
*/
108101
static inline wchar_t UniToupper(wchar_t uc)
109102
{
110-
UNICASERANGE *rp;
103+
const struct UniCaseRange *rp;
111104

112-
if (uc < sizeof(UniUpperTable)) { /* Latin characters */
113-
return uc + UniUpperTable[uc]; /* Use base tables */
105+
if (uc < sizeof(NlsUniUpperTable)) { /* Latin characters */
106+
return uc + NlsUniUpperTable[uc]; /* Use base tables */
114107
} else {
115-
rp = UniUpperRange; /* Use range tables */
108+
rp = NlsUniUpperRange; /* Use range tables */
116109
while (rp->start) {
117110
if (uc < rp->start) /* Before start of range */
118111
return uc; /* Uppercase = input */

fs/jfs/jfs_uniupr.c

Lines changed: 0 additions & 121 deletions
This file was deleted.

fs/nls/nls_ucs2_data.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later */
2+
3+
#ifndef _NLS_UCS2_DATA_H
4+
#define _NLS_UCS2_DATA_H
5+
6+
struct UniCaseRange {
7+
wchar_t start;
8+
wchar_t end;
9+
signed char *table;
10+
};
11+
12+
extern signed char NlsUniUpperTable[512];
13+
extern const struct UniCaseRange NlsUniUpperRange[];
14+
15+
#endif /* _NLS_UCS2_DATA_H */

fs/nls/nls_ucs2_utils.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/types.h>
2727
#include <linux/nls.h>
2828
#include <linux/unicode.h>
29+
#include "nls_ucs2_data.h"
2930

3031
/*
3132
* Windows maps these to the user defined 16 bit Unicode range since they are
@@ -40,19 +41,6 @@
4041
#define UNI_PIPE ((__u16)('|' + 0xF000))
4142
#define UNI_SLASH ((__u16)('\\' + 0xF000))
4243

43-
#ifndef UNICASERANGE_DEFINED
44-
struct UniCaseRange {
45-
wchar_t start;
46-
wchar_t end;
47-
signed char *table;
48-
};
49-
#endif /* UNICASERANGE_DEFINED */
50-
51-
#ifndef UNIUPR_NOUPPER
52-
extern signed char NlsUniUpperTable[512];
53-
extern const struct UniCaseRange NlsUniUpperRange[];
54-
#endif /* UNIUPR_NOUPPER */
55-
5644
/*
5745
* UniStrcat: Concatenate the second string to the first
5846
*

0 commit comments

Comments
 (0)