fs/smb: Swing unicode common code from smb->NLS
Subsystems (2)
PATCH v3 2/4 fs/smb: Swing unicode common code from smb->NLS
From: "Dr. David Alan Gilbert" <[email protected]>
Swing most of the inline functions and unicode tables into nls from the copy in smb/server. This is UCS-2 rather than most of the rest of the code in NLS, but it currently seems like the best place for it.
The actual unicode.c implementations vary much more between server and client so they're unmoved.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
---
fs/nls/Kconfig | 8 +
fs/nls/Makefile | 1 +
.../server/uniupr.h => nls/nls_ucs2_utils.c} | 27 +-
fs/nls/nls_ucs2_utils.h | 297 ++++++++++++++++++
fs/smb/server/Kconfig | 1 +
fs/smb/server/unicode.c | 1 -
fs/smb/server/unicode.h | 277 +---------------
7 files changed, 328 insertions(+), 284 deletions(-)
rename fs/{smb/server/uniupr.h => nls/nls_ucs2_utils.c} (91%)
create mode 100644 fs/nls/nls_ucs2_utils.hfs/nls/Kconfig +8 -0
@@ -617,4 +617,12 @@ config NLS_UTF8 input/output character sets. Say Y here for the UTF-8 encoding of the Unicode/ISO9646 universal character set. +config NLS_UCS2_UTILS + tristate "NLS UCS-2 UTILS" + help + Set of older UCS-2 conversion utilities and tables used by some + filesystems including SMB/CIFS. This includes upper case conversion + tables. This will automatically be selected when the filesystem + that uses it is selected. + endif # NLS
fs/nls/Makefile +1 -0
@@ -54,3 +54,4 @@ obj-$(CONFIG_NLS_MAC_INUIT) += mac-inuit.o obj-$(CONFIG_NLS_MAC_ROMANIAN) += mac-romanian.o obj-$(CONFIG_NLS_MAC_ROMAN) += mac-roman.o obj-$(CONFIG_NLS_MAC_TURKISH) += mac-turkish.o +obj-$(CONFIG_NLS_UCS2_UTILS) += nls_ucs2_utils.o
fs/nls/nls_ucs2_utils.c renamed from fs/smb/server/uniupr.h +17 -10
@@ -1,19 +1,27 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Some of the source code in this file came from fs/cifs/uniupr.h * Copyright (c) International Business Machines Corp., 2000,2002 * -* uniupr.h - Unicode compressed case ranges +* Some of the source code in this file came from fs/cifs/cifs_unicode.c +* +* Copyright (c) International Business Machines Corp., 2000,2009 +* Modified by Steve French ([email protected]) +* Modified by Namjae Jeon ([email protected]) * */ -#ifndef __KSMBD_UNIUPR_H -#define __KSMBD_UNIUPR_H +#include <linux/fs.h> +#include <linux/module.h> +#include <linux/slab.h> +#include <asm/unaligned.h> +#include "nls_ucs2_utils.h" + +MODULE_LICENSE ("GPL" ); -#ifndef UNIUPR_NOUPPER /* * Latin upper case */ -signed char SmbUniUpperTable[512 ] = { +signed char NlsUniUpperTable[512 ] = {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* 000-00f */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* 010-01f */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* 020-02f */
@@ -51,6 +59,7 @@ signed char SmbUniUpperTable[512] = {0 ,-1 ,0 ,-1 ,0 ,-1 ,0 ,-1 ,0 ,-1 ,0 ,-1 ,0 ,-1 ,0 ,-1 ,/* 1e0-1ef */ 0, 0, -1, -2, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, 0, -1, /* 1f0-1ff */ }; +EXPORT_SYMBOL_GPL (NlsUniUpperTable);/* Upper case range - Greek */ static signed char UniCaseRangeU03a0[47] = {
@@ -126,7 +135,7 @@ static signed char UniCaseRangeUff40[27] = {/* * Upper Case Range */ -const struct UniCaseRange SmbUniUpperRange[] = { +const struct UniCaseRange NlsUniUpperRange[] = { {0x03a0 ,0x03ce , UniCaseRangeU03a0}, {0x0430 ,0x045f , UniCaseRangeU0430}, {0x0490 ,0x04cc , UniCaseRangeU0490},
@@ -134,6 +143,4 @@ const struct UniCaseRange SmbUniUpperRange[] = { {0xff40, 0xff5a, UniCaseRangeUff40}, {0} }; -#endif - -#endif /* __KSMBD_UNIUPR_H */ +EXPORT_SYMBOL_GPL (NlsUniUpperRange);
fs/nls/nls_ucs2_utils.h new file +297 -0
297 lines not on this page · raw message
fs/smb/server/Kconfig +1 -0
@@ -5,6 +5,7 @@ config SMB_SERVER depends on FILE_LOCKING select NLS select NLS_UTF8 + select NLS_UCS2_UTILS select CRYPTO select CRYPTO_MD5 select CRYPTO_HMAC
fs/smb/server/unicode.c +0 -1
@@ -11,7 +11,6 @@#include <asm/unaligned.h> #include "glob.h" #include "unicode.h" -#include "uniupr.h" #include "smb_common.h" /*
fs/smb/server/unicode.h +4 -273
291 lines not on this page · raw message
Signature · 1 line
2.41.0