Skip to contentSkip to conversation

dedupe smb unicode files

PATCH Superseded [email protected] 6 participants 21 messages Jun 28, 2023 – Aug 27, 2023

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover dedupe smb unicode files

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting itself.

This dupe was found using PMD:
https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
Share the JFS tables

Dr. David Alan Gilbert (4):
fs/smb: Remove unicode 'lower' tables
fs/smb: Swing unicode common code from smb->NLS
fs/smb/client: Use common code in client
fs/jfs: Use common ucs2 upper case table

 fs/jfs/Kconfig               |   1 +
 fs/jfs/Makefile              |   2 +-
 fs/jfs/jfs_unicode.h         |  17 +-
 fs/jfs/jfs_uniupr.c          | 121 -------------
 fs/nls/Kconfig               |   8 +
 fs/nls/Makefile              |   1 +
 fs/nls/nls_ucs2_data.h       |  15 ++
 fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
 fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
 fs/smb/client/Kconfig        |   1 +
 fs/smb/client/cifs_unicode.c |   1 -
 fs/smb/client/cifs_unicode.h | 330 +----------------------------------
 fs/smb/client/cifs_uniupr.h  | 239 -------------------------
 fs/smb/server/Kconfig        |   1 +
 fs/smb/server/unicode.c      |   1 -
 fs/smb/server/unicode.h      | 325 +---------------------------------
 fs/smb/server/uniupr.h       | 268 ----------------------------
 17 files changed, 467 insertions(+), 1293 deletions(-)
 delete mode 100644 fs/jfs/jfs_uniupr.c
 create mode 100644 fs/nls/nls_ucs2_data.h
 create mode 100644 fs/nls/nls_ucs2_utils.c
 create mode 100644 fs/nls/nls_ucs2_utils.h
 delete mode 100644 fs/smb/client/cifs_uniupr.h
 delete mode 100644 fs/smb/server/uniupr.h
Signature · 1 line
2.41.0
#1 lore raw

PATCH v2 1/4 fs/smb: Remove unicode 'lower' tables

From: "Dr. David Alan Gilbert" <[email protected]>

The unicode glue in smb/*/..uniupr.h has a section guarded by 'ifndef UNIUPR_NOLOWER' - but that's always defined in smb/*/..unicode.h. Nuke those tables.

---
 fs/smb/client/cifs_unicode.h |  50 --------------
 fs/smb/client/cifs_uniupr.h  | 116 -------------------------------
 fs/smb/server/unicode.h      |  48 -------------
 fs/smb/server/uniupr.h       | 129 -----------------------------------
 4 files changed, 343 deletions(-)
fs/smb/client/cifs_unicode.h +0 -50
index 80b3d845419f..33b651def482 100644
@@ -22,8 +22,6 @@
 #include <linux/types.h>
 #include <linux/nls.h>
 
-#define  UNIUPR_NOLOWER		/* Example to not expand lower case tables */
-
 /*
  * Windows maps these to the user defined 16 bit Unicode range since they are
  * reserved symbols (along with \ and /), otherwise illegal to store
@@ -84,11 +82,6 @@ extern signed char CifsUniUpperTable[512];
 extern const struct UniCaseRange CifsUniUpperRange[];
 #endif				/* UNIUPR_NOUPPER */
 
-#ifndef UNIUPR_NOLOWER
-extern signed char CifsUniLowerTable[512];
-extern const struct UniCaseRange CifsUniLowerRange[];
-#endif				/* UNIUPR_NOLOWER */
-
 #ifdef __KERNEL__
 int cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,
 		    const struct nls_table *cp, int map_type);
@@ -358,47 +351,4 @@ UniStrupr(register __le16 *upin)
 }
 #endif				/* UNIUPR_NOUPPER */
 
-#ifndef UNIUPR_NOLOWER
-/*
- * UniTolower:  Convert a unicode character to lower case
- */
-static inline wchar_t
-UniTolower(register wchar_t uc)
-{
-	register const struct UniCaseRange *rp;
-
-	if (uc < sizeof(CifsUniLowerTable)) {
-		/* Latin characters */
-		return uc + CifsUniLowerTable[uc];	/* Use base tables */
-	} else {
-		rp = CifsUniLowerRange;	/* Use range tables */
-		while (rp->start) {
-			if (uc < rp->start)	/* Before start of range */
-				return uc;	/* Uppercase = input */
-			if (uc <= rp->end)	/* In range */
-				return uc + rp->table[uc - rp->start];
-			rp++;	/* Try next range */
-		}
-	}
-	return uc;		/* Past last range */
-}
-
-/*
- * UniStrlwr:  Lower case a unicode string
- */
-static inline wchar_t *
-UniStrlwr(register wchar_t *upin)
-{
-	register wchar_t *up;
-
-	up = upin;
-	while (*up) {		/* For all characters */
-		*up = UniTolower(*up);
-		up++;
-	}
-	return upin;		/* Return input pointer */
-}
-
-#endif
-
 #endif /* _CIFS_UNICODE_H */
fs/smb/client/cifs_uniupr.h +0 -116

119 lines not on this page · raw message

fs/smb/server/unicode.h +0 -48

64 lines not on this page · raw message

fs/smb/server/uniupr.h +0 -129

133 lines not on this page · raw message

Signature · 1 line
2.41.0
#3 lore raw

PATCH v2 3/4 fs/smb/client: Use common code in client

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

Now we've got the common code, use it for the client as well. Note there's a change here where we're using the server version of UniStrcat now which had different types (__le16 vs wchar_t) but it's not interpreting the value other than checking for 0.

---
 fs/smb/client/Kconfig        |   1 +
 fs/smb/client/cifs_unicode.c |   1 -
 fs/smb/client/cifs_unicode.h | 280 +----------------------------------
 fs/smb/client/cifs_uniupr.h  | 123 ---------------
 4 files changed, 2 insertions(+), 403 deletions(-)
 delete mode 100644 fs/smb/client/cifs_uniupr.h
fs/smb/client/Kconfig +1 -0
index 4c0d53bf931a..2927bd174a88 100644
@@ -3,6 +3,7 @@ config CIFS
 	tristate "SMB3 and CIFS support (advanced network filesystem)"
 	depends on INET
 	select NLS
+	select NLS_UCS2_UTILS
 	select CRYPTO
 	select CRYPTO_MD5
 	select CRYPTO_SHA256
fs/smb/client/cifs_unicode.c +0 -1
index e7582dd79179..79d99a913944 100644
@@ -8,7 +8,6 @@
 #include <linux/slab.h>
 #include "cifs_fs_sb.h"
 #include "cifs_unicode.h"
-#include "cifs_uniupr.h"
 #include "cifspdu.h"
 #include "cifsglob.h"
 #include "cifs_debug.h"
fs/smb/client/cifs_unicode.h +1 -279

296 lines not on this page · raw message

fs/smb/client/cifs_uniupr.h deleted +0 -123

123 lines not on this page · raw message

Signature · 1 line
2.41.0
#2 lore raw

PATCH v2 2/4 fs/smb: Swing unicode common code from smb->NLS

In reply to [email protected]

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.

---
 fs/nls/Kconfig                                |   8 +
 fs/nls/Makefile                               |   1 +
 .../server/uniupr.h => nls/nls_ucs2_utils.c}  |  31 +-
 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, 329 insertions(+), 287 deletions(-)
 rename fs/{smb/server/uniupr.h => nls/nls_ucs2_utils.c} (90%)
 create mode 100644 fs/nls/nls_ucs2_utils.h
fs/nls/Kconfig +8 -0
index c7857e36adbb..a0d0e2f7ec83 100644
@@ -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
index ac54db297128..5062c699d041 100644
@@ -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 +18 -13
similarity index 90%
rename from fs/smb/server/uniupr.h
rename to fs/nls/nls_ucs2_utils.c
index d09c585f20c9..ce18c0185898 100644
@@ -1,19 +1,25 @@
-/* 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
+ *   via fs/smb/unicode.c and fs/smb/uniupr.h and fs/cifs/uniupr.h
+ *   Copyright (c) International Business Machines  Corp., 2000,2002,2009
+ *   Modified by Steve French ([email protected])
+ *   Modified by Namjae Jeon ([email protected])
+ *   Modified by Dr. David Alan Gilbert <[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 +57,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 +133,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 +141,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
index 7055cb5d2880..793151ddd60e 100644
@@ -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
index 9ae676906ed3..393dd4a7432b 100644
@@ -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
#4 lore raw

PATCH v2 4/4 fs/jfs: Use common ucs2 upper case table

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

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.

---
 fs/jfs/Kconfig          |   1 +
 fs/jfs/Makefile         |   2 +-
 fs/jfs/jfs_unicode.h    |  17 ++----
 fs/jfs/jfs_uniupr.c     | 121 ----------------------------------------
 fs/nls/nls_ucs2_data.h  |  15 +++++
 fs/nls/nls_ucs2_utils.h |  14 +----
 6 files changed, 23 insertions(+), 147 deletions(-)
 delete mode 100644 fs/jfs/jfs_uniupr.c
 create mode 100644 fs/nls/nls_ucs2_data.h
fs/jfs/Kconfig +1 -0
index 51e856f0e4b8..eab2f2d2291f 100644
@@ -2,6 +2,7 @@
 config JFS_FS
 	tristate "JFS filesystem support"
 	select NLS
+	select NLS_UCS2_UTILS
 	select CRC32
 	select LEGACY_DIRECT_IO
 	help
fs/jfs/Makefile +1 -1
index 7156d2c218c7..b769bbf8bdc2 100644
@@ -9,7 +9,7 @@ jfs-y    := super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
 	    jfs_xtree.o jfs_imap.o jfs_debug.o jfs_dmap.o \
 	    jfs_unicode.o jfs_dtree.o jfs_inode.o jfs_discard.o \
 	    jfs_extent.o symlink.o jfs_metapage.o \
-	    jfs_logmgr.o jfs_txnmgr.o jfs_uniupr.o \
+	    jfs_logmgr.o jfs_txnmgr.o \
 	    resize.o xattr.o ioctl.o
 
 jfs-$(CONFIG_JFS_POSIX_ACL) += acl.o
fs/jfs/jfs_unicode.h +5 -12
index 9db62d047daa..b6a78d4aef1b 100644
@@ -8,16 +8,9 @@
 
 #include <linux/slab.h>
 #include <asm/byteorder.h>
+#include "../nls/nls_ucs2_data.h"
 #include "jfs_types.h"
 
-typedef struct {
-	wchar_t start;
-	wchar_t end;
-	signed char *table;
-} UNICASERANGE;
-
-extern signed char UniUpperTable[512];
-extern UNICASERANGE UniUpperRange[];
 extern int get_UCSname(struct component_name *, struct dentry *);
 extern int jfs_strfromUCS_le(char *, const __le16 *, int, struct nls_table *);
 
@@ -107,12 +100,12 @@ static inline wchar_t *UniStrncpy_from_le(wchar_t * ucs1, const __le16 * ucs2,
  */
 static inline wchar_t UniToupper(wchar_t uc)
 {
-	UNICASERANGE *rp;
+	const struct UniCaseRange *rp;
 
-	if (uc < sizeof(UniUpperTable)) {	/* Latin characters */
-		return uc + UniUpperTable[uc];	/* Use base tables */
+	if (uc < sizeof(NlsUniUpperTable)) {	/* Latin characters */
+		return uc + NlsUniUpperTable[uc];	/* Use base tables */
 	} else {
-		rp = UniUpperRange;	/* Use range tables */
+		rp = NlsUniUpperRange;	/* Use range tables */
 		while (rp->start) {
 			if (uc < rp->start)	/* Before start of range */
 				return uc;	/* Uppercase = input */
fs/jfs/jfs_uniupr.c deleted +0 -121

121 lines not on this page · raw message

fs/nls/nls_ucs2_data.h new file +15 -0
new file mode 100644
index 000000000000..1f454dc0f4e0
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef _NLS_UCS2_DATA_H
+#define _NLS_UCS2_DATA_H
+
+struct UniCaseRange {
+	wchar_t start;
+	wchar_t end;
+	signed char *table;
+};
+
+extern signed char NlsUniUpperTable[512];
+extern const struct UniCaseRange NlsUniUpperRange[];
+
+#endif /* _NLS_UCS2_DATA_H */
fs/nls/nls_ucs2_utils.h +1 -13
index 3500596ea993..ef18d30db1d0 100644
@@ -26,6 +26,7 @@
 #include <linux/types.h>
 #include <linux/nls.h>
 #include <linux/unicode.h>
+#include "nls_ucs2_data.h"
 
 /*
  * Windows maps these to the user defined 16 bit Unicode range since they are
@@ -40,19 +41,6 @@
 #define UNI_PIPE        ((__u16)('|' + 0xF000))
 #define UNI_SLASH       ((__u16)('\\' + 0xF000))
 
-#ifndef	UNICASERANGE_DEFINED
-struct UniCaseRange {
-	wchar_t start;
-	wchar_t end;
-	signed char *table;
-};
-#endif				/* UNICASERANGE_DEFINED */
-
-#ifndef UNIUPR_NOUPPER
-extern signed char NlsUniUpperTable[512];
-extern const struct UniCaseRange NlsUniUpperRange[];
-#endif				/* UNIUPR_NOUPPER */
-
 /*
  * UniStrcat:  Concatenate the second string to the first
  *
Signature · 1 line
2.41.0
#5 lore raw
In reply to [email protected]
Quoted 6 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 59 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting itself.

This dupe was found using PMD:
https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
Share the JFS tables

Dr. David Alan Gilbert (4):
fs/smb: Remove unicode 'lower' tables
fs/smb: Swing unicode common code from smb->NLS
fs/smb/client: Use common code in client
fs/jfs: Use common ucs2 upper case table

 fs/jfs/Kconfig               |   1 +
 fs/jfs/Makefile              |   2 +-
 fs/jfs/jfs_unicode.h         |  17 +-
 fs/jfs/jfs_uniupr.c          | 121 -------------
 fs/nls/Kconfig               |   8 +
 fs/nls/Makefile              |   1 +
 fs/nls/nls_ucs2_data.h       |  15 ++
 fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
 fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
 fs/smb/client/Kconfig        |   1 +
 fs/smb/client/cifs_unicode.c |   1 -
 fs/smb/client/cifs_unicode.h | 330 +----------------------------------
 fs/smb/client/cifs_uniupr.h  | 239 -------------------------
 fs/smb/server/Kconfig        |   1 +
 fs/smb/server/unicode.c      |   1 -
 fs/smb/server/unicode.h      | 325 +---------------------------------
 fs/smb/server/uniupr.h       | 268 ----------------------------
 17 files changed, 467 insertions(+), 1293 deletions(-)
 delete mode 100644 fs/jfs/jfs_uniupr.c
 create mode 100644 fs/nls/nls_ucs2_data.h
 create mode 100644 fs/nls/nls_ucs2_utils.c
 create mode 100644 fs/nls/nls_ucs2_utils.h
 delete mode 100644 fs/smb/client/cifs_uniupr.h
 delete mode 100644 fs/smb/server/uniupr.h
Signature · 1 line
2.41.0
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#6 lore raw

No objections to this on my part. If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

Quoted 80 lines · Dr. David Alan Gilbert
Quoted 6 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 56 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting itself.

This dupe was found using PMD:
https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
Share the JFS tables

Dr. David Alan Gilbert (4):
fs/smb: Remove unicode 'lower' tables
fs/smb: Swing unicode common code from smb->NLS
fs/smb/client: Use common code in client
fs/jfs: Use common ucs2 upper case table

 fs/jfs/Kconfig               |   1 +
 fs/jfs/Makefile              |   2 +-
 fs/jfs/jfs_unicode.h         |  17 +-
 fs/jfs/jfs_uniupr.c          | 121 -------------
 fs/nls/Kconfig               |   8 +
 fs/nls/Makefile              |   1 +
 fs/nls/nls_ucs2_data.h       |  15 ++
 fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
 fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
 fs/smb/client/Kconfig        |   1 +
 fs/smb/client/cifs_unicode.c |   1 -
 fs/smb/client/cifs_unicode.h | 330 +----------------------------------
 fs/smb/client/cifs_uniupr.h  | 239 -------------------------
 fs/smb/server/Kconfig        |   1 +
 fs/smb/server/unicode.c      |   1 -
 fs/smb/server/unicode.h      | 325 +---------------------------------
 fs/smb/server/uniupr.h       | 268 ----------------------------
 17 files changed, 467 insertions(+), 1293 deletions(-)
 delete mode 100644 fs/jfs/jfs_uniupr.c
 create mode 100644 fs/nls/nls_ucs2_data.h
 create mode 100644 fs/nls/nls_ucs2_utils.c
 create mode 100644 fs/nls/nls_ucs2_utils.h
 delete mode 100644 fs/smb/client/cifs_uniupr.h
 delete mode 100644 fs/smb/server/uniupr.h
Quoted 3 lines

--
2.41.0

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 3 lines
Thanks,

Steve
#7 lore raw

The related question is which tree to send it from, if no problems reported (presumably mine since it mostly affect cifs.ko and ksmbd.ko, and because there hasn't been activity in fs/nls for years)

Quoted 88 lines · Steve French

No objections to this on my part. If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

Quoted 72 lines · Dr. David Alan Gilbert
Quoted 6 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 56 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting itself.

This dupe was found using PMD:
https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
Share the JFS tables

Dr. David Alan Gilbert (4):
fs/smb: Remove unicode 'lower' tables
fs/smb: Swing unicode common code from smb->NLS
fs/smb/client: Use common code in client
fs/jfs: Use common ucs2 upper case table

 fs/jfs/Kconfig               |   1 +
 fs/jfs/Makefile              |   2 +-
 fs/jfs/jfs_unicode.h         |  17 +-
 fs/jfs/jfs_uniupr.c          | 121 -------------
 fs/nls/Kconfig               |   8 +
 fs/nls/Makefile              |   1 +
 fs/nls/nls_ucs2_data.h       |  15 ++
 fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
 fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
 fs/smb/client/Kconfig        |   1 +
 fs/smb/client/cifs_unicode.c |   1 -
 fs/smb/client/cifs_unicode.h | 330 +----------------------------------
 fs/smb/client/cifs_uniupr.h  | 239 -------------------------
 fs/smb/server/Kconfig        |   1 +
 fs/smb/server/unicode.c      |   1 -
 fs/smb/server/unicode.h      | 325 +---------------------------------
 fs/smb/server/uniupr.h       | 268 ----------------------------
 17 files changed, 467 insertions(+), 1293 deletions(-)
 delete mode 100644 fs/jfs/jfs_uniupr.c
 create mode 100644 fs/nls/nls_ucs2_data.h
 create mode 100644 fs/nls/nls_ucs2_utils.c
 create mode 100644 fs/nls/nls_ucs2_utils.h
 delete mode 100644 fs/smb/client/cifs_uniupr.h
 delete mode 100644 fs/smb/server/uniupr.h
Quoted 8 lines
Quoted 3 lines

--
2.41.0

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Quoted 4 lines

--
Thanks,

Steve

--
Thanks,

Steve

#8 lore raw
Quoted 3 lines · * Steve French ([email protected]) wrote:

The related question is which tree to send it from, if no problems reported (presumably mine since it mostly affect cifs.ko and ksmbd.ko, and because there hasn't been activity in fs/nls for years)

That was my hope, given that ~half of the patches are directly on that code, and it's the only very active tree this touches as far as I can tell.

Quoted 4 lines · Steve French
Quoted 3 lines

No objections to this on my part. If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

Thanks.

Dave

Quoted 95 lines
Quoted 84 lines · Dr. David Alan Gilbert
Quoted 72 lines · * [email protected] ([email protected]) wrote:
Quoted 6 lines

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 56 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting itself.

This dupe was found using PMD:
https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
Share the JFS tables

Dr. David Alan Gilbert (4):
fs/smb: Remove unicode 'lower' tables
fs/smb: Swing unicode common code from smb->NLS
fs/smb/client: Use common code in client
fs/jfs: Use common ucs2 upper case table

 fs/jfs/Kconfig               |   1 +
 fs/jfs/Makefile              |   2 +-
 fs/jfs/jfs_unicode.h         |  17 +-
 fs/jfs/jfs_uniupr.c          | 121 -------------
 fs/nls/Kconfig               |   8 +
 fs/nls/Makefile              |   1 +
 fs/nls/nls_ucs2_data.h       |  15 ++
 fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
 fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
 fs/smb/client/Kconfig        |   1 +
 fs/smb/client/cifs_unicode.c |   1 -
 fs/smb/client/cifs_unicode.h | 330 +----------------------------------
 fs/smb/client/cifs_uniupr.h  | 239 -------------------------
 fs/smb/server/Kconfig        |   1 +
 fs/smb/server/unicode.c      |   1 -
 fs/smb/server/unicode.h      | 325 +---------------------------------
 fs/smb/server/uniupr.h       | 268 ----------------------------
 17 files changed, 467 insertions(+), 1293 deletions(-)
 delete mode 100644 fs/jfs/jfs_uniupr.c
 create mode 100644 fs/nls/nls_ucs2_data.h
 create mode 100644 fs/nls/nls_ucs2_utils.c
 create mode 100644 fs/nls/nls_ucs2_utils.h
 delete mode 100644 fs/smb/client/cifs_uniupr.h
 delete mode 100644 fs/smb/server/uniupr.h
Quoted 8 lines
Quoted 3 lines

--
2.41.0

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Quoted 4 lines

--
Thanks,

Steve

--
Thanks,

Steve

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Reviewed-by
#9 lore raw
Quoted 13 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Steve French ([email protected]) wrote:

The related question is which tree to send it from, if no problems reported (presumably mine since it mostly affect cifs.ko and ksmbd.ko, and because there hasn't been activity in fs/nls for years)

That was my hope, given that ~half of the patches are directly on that code, and it's the only very active tree this touches as far as I can tell.

Quoted 4 lines · Steve French
Quoted 3 lines

No objections to this on my part. If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

For the series:

Steve,
Feel free to pull in even the 4th patch into your tree with my consent. Or if you're more comfortable, I could submit it after yours hits mainline.

Shaggy

Quoted 100 lines

Thanks.

Dave

Quoted 95 lines
Quoted 84 lines · Dr. David Alan Gilbert
Quoted 72 lines · * [email protected] ([email protected]) wrote:
Quoted 6 lines

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 56 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting itself.

This dupe was found using PMD:
https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
Share the JFS tables

Dr. David Alan Gilbert (4):
fs/smb: Remove unicode 'lower' tables fs/smb: Swing unicode common code from smb->NLS fs/smb/client: Use common code in client fs/jfs: Use common ucs2 upper case table

  fs/jfs/Kconfig               |   1 +
  fs/jfs/Makefile              |   2 +-
  fs/jfs/jfs_unicode.h         |  17 +-
  fs/jfs/jfs_uniupr.c          | 121 -------------
  fs/nls/Kconfig               |   8 +
  fs/nls/Makefile              |   1 +
  fs/nls/nls_ucs2_data.h       |  15 ++
  fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
  fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
  fs/smb/client/Kconfig        |   1 +
  fs/smb/client/cifs_unicode.c |   1 -
  fs/smb/client/cifs_unicode.h | 330 +----------------------------------
  fs/smb/client/cifs_uniupr.h  | 239 -------------------------
  fs/smb/server/Kconfig        |   1 +
  fs/smb/server/unicode.c      |   1 -
  fs/smb/server/unicode.h      | 325 +---------------------------------
  fs/smb/server/uniupr.h       | 268 ----------------------------
  17 files changed, 467 insertions(+), 1293 deletions(-)

delete mode 100644 fs/jfs/jfs_uniupr.c
create mode 100644 fs/nls/nls_ucs2_data.h
create mode 100644 fs/nls/nls_ucs2_utils.c
create mode 100644 fs/nls/nls_ucs2_utils.h
delete mode 100644 fs/smb/client/cifs_uniupr.h
delete mode 100644 fs/smb/server/uniupr.h

Quoted 8 lines
Quoted 3 lines

--
2.41.0

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /

\ _________________________|_____ http://www.treblig.org |_______/

Quoted 4 lines

--
Thanks,

Steve

--
Thanks,

Steve

reviewer Reviewed-by
#10 lore raw
Quoted 15 lines · Dave Kleikamp
Quoted 13 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Steve French ([email protected]) wrote:

The related question is which tree to send it from, if no problems reported (presumably mine since it mostly affect cifs.ko and ksmbd.ko, and because there hasn't been activity in fs/nls for years)

That was my hope, given that ~half of the patches are directly on that code, and it's the only very active tree this touches as far as I can tell.

Quoted 4 lines · Steve French
Quoted 3 lines

No objections to this on my part.  If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

Quoted 7 lines

For the series:

Steve,
Feel free to pull in even the 4th patch into your tree with my consent. Or if you're more comfortable, I could submit it after yours hits mainline.

Shaggy

The changes look good to me but there is one quirk with the copyrights and SPDX in patch 2.

In the new fs/nls/nls_ucs2_utils.c, the SPDX line changes from a "/* ... */" form to "// ...", which may be a proper update, but then partway down, adds the same SPDX in "/* ... */ form. These should at least be consistent.

Review line 1

Quoted 4 lines

+++ b/fs/nls/nls_ucs2_utils.c

(quoted diff) +1 -1
@@ -1,19 +1,25 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-License-Identifier: GPL-2.0-or-later

vs

Review line 1

Quoted 3 lines
(quoted diff) +2 -0
+++ b/fs/nls/nls_ucs2_utils.h
@@ -0,0 +1,297 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */

Second, the copyright in fs/nls/nls_ucs2_utils.c is a bit of a mash-up (adding 2009 especially).

I think it's better to keep the exact text of both copyrights, perhaps with a note as to which files had them previously, and adding some new note/blank line to separate the recent contributions from Namjae and you from the ancient history.

Review

Quoted 12 lines
(quoted diff) +7 -4
+++ b/fs/nls/nls_ucs2_utils.c
...
- *   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
+ *   via fs/smb/unicode.c and fs/smb/uniupr.h and fs/cifs/uniupr.h
+ *   Copyright (c) International Business Machines  Corp., 2000,2002,2009
+ *   Modified by Steve French ([email protected])
+ *   Modified by Namjae Jeon ([email protected])
+ *   Modified by Dr. David Alan Gilbert <[email protected]>

Apart from considering these:

Nice work!

Quoted 103 lines
Quoted 102 lines

Thanks.

Dave

Quoted 97 lines
Quoted 90 lines · Dr. David Alan Gilbert
Quoted 82 lines · * [email protected] ([email protected]) wrote:
Quoted 6 lines

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 61 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting itself.

This dupe was found using PMD:
   https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
   Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
   Share the JFS tables

Dr. David Alan Gilbert (4):
   fs/smb: Remove unicode 'lower' tables fs/smb: Swing unicode common code from smb->NLS fs/smb/client: Use common code in client fs/jfs: Use common ucs2 upper case table

  fs/jfs/Kconfig               |   1 +
  fs/jfs/Makefile              |   2 +- fs/jfs/jfs_unicode.h         |  17 +- fs/jfs/jfs_uniupr.c          | 121 ------------- fs/nls/Kconfig               |   8 +
  fs/nls/Makefile              |   1 + fs/nls/nls_ucs2_data.h       |  15 ++ fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++ fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++ fs/smb/client/Kconfig        |   1 + fs/smb/client/cifs_unicode.c |   1 - fs/smb/client/cifs_unicode.h | 330

+----------------------------------
  fs/smb/client/cifs_uniupr.h  | 239 -------------------------
  fs/smb/server/Kconfig        |   1 +
  fs/smb/server/unicode.c      |   1 -
  fs/smb/server/unicode.h      | 325 
+---------------------------------
  fs/smb/server/uniupr.h       | 268 ----------------------------
  17 files changed, 467 insertions(+), 1293 deletions(-)

  delete mode 100644 fs/jfs/jfs_uniupr.c
  create mode 100644 fs/nls/nls_ucs2_data.h
  create mode 100644 fs/nls/nls_ucs2_utils.c
  create mode 100644 fs/nls/nls_ucs2_utils.h
  delete mode 100644 fs/smb/client/cifs_uniupr.h
  delete mode 100644 fs/smb/server/uniupr.h

Signature · 1 line
2.41.0
Signature · 4 lines
  -----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
  \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 3 lines
Thanks,

Steve
Signature · 3 lines
Thanks,

Steve
#11 lore raw
Quoted 42 lines · * Tom Talpey ([email protected]) wrote:
Quoted 17 lines · Dave Kleikamp
Quoted 14 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Steve French ([email protected]) wrote:

The related question is which tree to send it from, if no problems reported (presumably mine since it mostly affect cifs.ko and ksmbd.ko, and because there hasn't been activity in fs/nls for years)

That was my hope, given that ~half of the patches are directly on that code, and it's the only very active tree this touches as far as I can tell.

Quoted 5 lines
Quoted 3 lines · Steve French

No objections to this on my part.  If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

For the series:

Quoted 8 lines

Steve,
Feel free to pull in even the 4th patch into your tree with my consent. Or if you're more comfortable, I could submit it after yours hits mainline.

Shaggy

The changes look good to me but there is one quirk with the copyrights and SPDX in patch 2.

In the new fs/nls/nls_ucs2_utils.c, the SPDX line changes from a "/* ... */" form to "// ...", which may be a proper update, but then partway down, adds the same SPDX in "/* ... */ form. These should at least be consistent.

Review line 1

Quoted 4 lines

+++ b/fs/nls/nls_ucs2_utils.c

(quoted diff) +1 -1
@@ -1,19 +1,25 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-License-Identifier: GPL-2.0-or-later

vs

Quoted 3 lines

Review line 1

Quoted 3 lines
(quoted diff) +2 -0
+++ b/fs/nls/nls_ucs2_utils.h
@@ -0,0 +1,297 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */

Yeh that's an easy fix - so that's just the fact the .h has the older /* where I'd fixed up the .c ?

Quoted 7 lines

Second, the copyright in fs/nls/nls_ucs2_utils.c is a bit of a mash-up (adding 2009 especially).

I think it's better to keep the exact text of both copyrights, perhaps with a note as to which files had them previously, and adding some new note/blank line to separate the recent contributions from Namjae and you from the ancient history.

How about the following;

* This file has taken chunks from a few other files
* smb/server/uniupr.h had the declaration:
*
* Some of the source code in this file came from fs/cifs/uniupr.h
* Copyright (c) International Business Machines Corp., 2000,2002
*
* fs/smb/server/unicode.c had the declaration:
*
* 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])

*

I haven't added the extra line above Namjae's line, since it's now a straight copy from the unicode.c entry.
I'm not particularly fussed about adding my own line unless you think it's needed; git keeps better history!

Quoted 15 lines

Review

Quoted 12 lines
(quoted diff) +7 -4
+++ b/fs/nls/nls_ucs2_utils.c
...
- *   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
+ *   via fs/smb/unicode.c and fs/smb/uniupr.h and fs/cifs/uniupr.h
+ *   Copyright (c) International Business Machines  Corp., 2000,2002,2009
+ *   Modified by Steve French ([email protected])
+ *   Modified by Namjae Jeon ([email protected])
+ *   Modified by Dr. David Alan Gilbert <[email protected]>

Apart from considering these:

Quoted 1 line

Thanks!

Dave

Quoted 107 lines

Nice work!

Quoted 105 lines
Quoted 104 lines

Thanks.

Dave

Quoted 99 lines
Quoted 92 lines
Quoted 83 lines · Dr. David Alan Gilbert
Quoted 6 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 62 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting
itself.

This dupe was found using PMD:
   https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
   Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
   Share the JFS tables

Dr. David Alan Gilbert (4):
   fs/smb: Remove unicode 'lower' tables fs/smb: Swing unicode common code from smb->NLS fs/smb/client: Use common code in client fs/jfs: Use common ucs2 upper case table

  fs/jfs/Kconfig               |   1 +
  fs/jfs/Makefile              |   2 +- fs/jfs/jfs_unicode.h         |  17 +- fs/jfs/jfs_uniupr.c          | 121 ------------- fs/nls/Kconfig               |   8 +
  fs/nls/Makefile              |   1 + fs/nls/nls_ucs2_data.h       |  15 ++ fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++ fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++ fs/smb/client/Kconfig        |   1 + fs/smb/client/cifs_unicode.c |   1 - fs/smb/client/cifs_unicode.h | 330

+----------------------------------
  fs/smb/client/cifs_uniupr.h  | 239 -------------------------
  fs/smb/server/Kconfig        |   1 +
  fs/smb/server/unicode.c      |   1 -
  fs/smb/server/unicode.h      | 325
+---------------------------------
  fs/smb/server/uniupr.h       | 268 ----------------------------
  17 files changed, 467 insertions(+), 1293 deletions(-)

  delete mode 100644 fs/jfs/jfs_uniupr.c
  create mode 100644 fs/nls/nls_ucs2_data.h
  create mode 100644 fs/nls/nls_ucs2_utils.c
  create mode 100644 fs/nls/nls_ucs2_utils.h
  delete mode 100644 fs/smb/client/cifs_uniupr.h
  delete mode 100644 fs/smb/server/uniupr.h

Signature · 1 line
2.41.0
Signature · 4 lines
  -----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
  \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 3 lines
Thanks,

Steve
Signature · 3 lines
Thanks,

Steve
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
reviewer
#12 lore raw
Quoted 43 lines · Dr. David Alan Gilbert
Quoted 42 lines · * Tom Talpey ([email protected]) wrote:
Quoted 17 lines · Dave Kleikamp
Quoted 14 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Steve French ([email protected]) wrote:

The related question is which tree to send it from, if no problems reported (presumably mine since it mostly affect cifs.ko and ksmbd.ko, and because there hasn't been activity in fs/nls for years)

That was my hope, given that ~half of the patches are directly on that code, and it's the only very active tree this touches as far as I can tell.

Quoted 5 lines
Quoted 3 lines · Steve French

No objections to this on my part.  If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

For the series:

Quoted 8 lines

Steve,
Feel free to pull in even the 4th patch into your tree with my consent. Or if you're more comfortable, I could submit it after yours hits mainline.

Shaggy

The changes look good to me but there is one quirk with the copyrights and SPDX in patch 2.

In the new fs/nls/nls_ucs2_utils.c, the SPDX line changes from a "/* ... */" form to "// ...", which may be a proper update, but then partway down, adds the same SPDX in "/* ... */ form. These should at least be consistent.

Review line 1

Quoted 4 lines

+++ b/fs/nls/nls_ucs2_utils.c

(quoted diff) +1 -1
@@ -1,19 +1,25 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-License-Identifier: GPL-2.0-or-later

vs

Quoted 6 lines
Quoted 3 lines

Review line 1

Quoted 3 lines
(quoted diff) +2 -0
+++ b/fs/nls/nls_ucs2_utils.h
@@ -0,0 +1,297 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */

Yeh that's an easy fix - so that's just the fact the .h has the older /* where I'd fixed up the .c ?

Yep, for consistency that sounds good.

Quoted 8 lines
Quoted 7 lines

Second, the copyright in fs/nls/nls_ucs2_utils.c is a bit of a mash-up (adding 2009 especially).

I think it's better to keep the exact text of both copyrights, perhaps with a note as to which files had them previously, and adding some new note/blank line to separate the recent contributions from Namjae and you from the ancient history.

Quoted 4 lines

How about the following;

* This file has taken chunks from a few other files
* smb/server/uniupr.h had the declaration:

These two lines above aren't needed, because the lines below contain the copyright and where they originated. So just omit the two above.

Quoted 5 lines

*
* Some of the source code in this file came from fs/cifs/uniupr.h
* Copyright (c) International Business Machines Corp., 2000,2002
*
* fs/smb/server/unicode.c had the declaration:

And this one above - not needed.

Quoted 10 lines

*
* 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])

*

I haven't added the extra line above Namjae's line, since it's now a straight copy from the unicode.c entry.

Straight copy is what's important. No deletion, no edit in a copyright. So, ok.

Quoted 2 lines

I'm not particularly fussed about adding my own line unless you think it's needed; git keeps better history!

In fact, since you technically didn't add any code, just deleted, moved or renamed, I think it might be best to leave yourself out. But, totally your choice.

Tom.

Quoted 128 lines
Quoted 15 lines

Review

Quoted 12 lines
(quoted diff) +7 -4
+++ b/fs/nls/nls_ucs2_utils.c
...
- *   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
+ *   via fs/smb/unicode.c and fs/smb/uniupr.h and fs/cifs/uniupr.h
+ *   Copyright (c) International Business Machines  Corp., 2000,2002,2009
+ *   Modified by Steve French ([email protected])
+ *   Modified by Namjae Jeon ([email protected])
+ *   Modified by Dr. David Alan Gilbert <[email protected]>

Apart from considering these:

Quoted 1 line

Thanks!

Dave

Quoted 107 lines

Nice work!

Quoted 105 lines
Quoted 104 lines

Thanks.

Dave

Quoted 99 lines
Quoted 92 lines
Quoted 83 lines · Dr. David Alan Gilbert
Quoted 6 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 62 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting
itself.

This dupe was found using PMD:
   https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
   Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
   Share the JFS tables

Dr. David Alan Gilbert (4):
   fs/smb: Remove unicode 'lower' tables fs/smb: Swing unicode common code from smb->NLS fs/smb/client: Use common code in client fs/jfs: Use common ucs2 upper case table

   fs/jfs/Kconfig               |   1 +
   fs/jfs/Makefile              |   2 +-
   fs/jfs/jfs_unicode.h         |  17 +-
   fs/jfs/jfs_uniupr.c          | 121 -------------
   fs/nls/Kconfig               |   8 +
   fs/nls/Makefile              |   1 +
   fs/nls/nls_ucs2_data.h       |  15 ++
   fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
   fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
   fs/smb/client/Kconfig        |   1 +
   fs/smb/client/cifs_unicode.c |   1 -
   fs/smb/client/cifs_unicode.h | 330
+----------------------------------
   fs/smb/client/cifs_uniupr.h  | 239 -------------------------
   fs/smb/server/Kconfig        |   1 +
   fs/smb/server/unicode.c      |   1 -
   fs/smb/server/unicode.h      | 325
+---------------------------------
   fs/smb/server/uniupr.h       | 268 ----------------------------
   17 files changed, 467 insertions(+), 1293 deletions(-)

  delete mode 100644 fs/jfs/jfs_uniupr.c
  create mode 100644 fs/nls/nls_ucs2_data.h
  create mode 100644 fs/nls/nls_ucs2_utils.c
  create mode 100644 fs/nls/nls_ucs2_utils.h
  delete mode 100644 fs/smb/client/cifs_uniupr.h
  delete mode 100644 fs/smb/server/uniupr.h

Signature · 1 line
2.41.0
Signature · 4 lines
   -----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
   \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 3 lines
Thanks,

Steve
Signature · 3 lines
Thanks,

Steve
#13 lore raw
Quoted 61 lines · * Tom Talpey ([email protected]) wrote:
Quoted 43 lines · Dr. David Alan Gilbert
Quoted 42 lines · * Tom Talpey ([email protected]) wrote:
Quoted 17 lines · Dave Kleikamp
Quoted 14 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Steve French ([email protected]) wrote:

The related question is which tree to send it from, if no problems reported (presumably mine since it mostly affect cifs.ko and ksmbd.ko, and because there hasn't been activity in fs/nls for years)

That was my hope, given that ~half of the patches are directly on that code, and it's the only very active tree this touches as far as I can tell.

Quoted 5 lines
Quoted 3 lines · Steve French

No objections to this on my part.  If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

For the series:

Quoted 8 lines

Steve,
Feel free to pull in even the 4th patch into your tree with my consent. Or if you're more comfortable, I could submit it after yours hits mainline.

Shaggy

The changes look good to me but there is one quirk with the copyrights and SPDX in patch 2.

In the new fs/nls/nls_ucs2_utils.c, the SPDX line changes from a "/* ... */" form to "// ...", which may be a proper update, but then partway down, adds the same SPDX in "/* ... */ form. These should at least be consistent.

Review line 1

Quoted 4 lines

+++ b/fs/nls/nls_ucs2_utils.c

(quoted diff) +1 -1
@@ -1,19 +1,25 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-License-Identifier: GPL-2.0-or-later

vs

Quoted 6 lines
Quoted 3 lines

Review line 1

Quoted 3 lines
(quoted diff) +2 -0
+++ b/fs/nls/nls_ucs2_utils.h
@@ -0,0 +1,297 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */

Yeh that's an easy fix - so that's just the fact the .h has the older /* where I'd fixed up the .c ?

Yep, for consistency that sounds good.

Quoted 8 lines
Quoted 7 lines

Second, the copyright in fs/nls/nls_ucs2_utils.c is a bit of a mash-up (adding 2009 especially).

I think it's better to keep the exact text of both copyrights, perhaps with a note as to which files had them previously, and adding some new note/blank line to separate the recent contributions from Namjae and you from the ancient history.

Quoted 8 lines
Quoted 4 lines

How about the following;

* This file has taken chunks from a few other files
* smb/server/uniupr.h had the declaration:

These two lines above aren't needed, because the lines below contain the copyright and where they originated. So just omit the two above.

OK, will do; although the reason I included them was because the path included in the declaration isn't the file the declaration is currently in.

Quoted 19 lines
Quoted 5 lines

*
* Some of the source code in this file came from fs/cifs/uniupr.h
* Copyright (c) International Business Machines Corp., 2000,2002
*
* fs/smb/server/unicode.c had the declaration:

And this one above - not needed.

Quoted 10 lines

*
* 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])

*

I haven't added the extra line above Namjae's line, since it's now a straight copy from the unicode.c entry.

Quoted 8 lines

Straight copy is what's important. No deletion, no edit in a copyright. So, ok.

Quoted 2 lines

I'm not particularly fussed about adding my own line unless you think it's needed; git keeps better history!

In fact, since you technically didn't add any code, just deleted, moved or renamed, I think it might be best to leave yourself out.

Oh that question could keep copyright lawyers occupied for years :-)

Quoted 1 line

But, totally your choice.

Thanks

I'll post a modified version of this patch in a few hours.

Dave

Quoted 130 lines

Tom.

Quoted 128 lines
Quoted 15 lines

Review

Quoted 12 lines
(quoted diff) +7 -4
+++ b/fs/nls/nls_ucs2_utils.c
...
- *   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
+ *   via fs/smb/unicode.c and fs/smb/uniupr.h and fs/cifs/uniupr.h
+ *   Copyright (c) International Business Machines  Corp., 2000,2002,2009
+ *   Modified by Steve French ([email protected])
+ *   Modified by Namjae Jeon ([email protected])
+ *   Modified by Dr. David Alan Gilbert <[email protected]>

Apart from considering these:

Quoted 1 line

Thanks!

Dave

Quoted 107 lines

Nice work!

Quoted 105 lines
Quoted 104 lines

Thanks.

Dave

Quoted 99 lines
Quoted 92 lines
Quoted 83 lines · Dr. David Alan Gilbert
Quoted 6 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 62 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting
itself.

This dupe was found using PMD:
   https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
   Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
   Share the JFS tables

Dr. David Alan Gilbert (4):
   fs/smb: Remove unicode 'lower' tables fs/smb: Swing unicode common code from smb->NLS fs/smb/client: Use common code in client fs/jfs: Use common ucs2 upper case table

   fs/jfs/Kconfig               |   1 +
   fs/jfs/Makefile              |   2 +-
   fs/jfs/jfs_unicode.h         |  17 +-
   fs/jfs/jfs_uniupr.c          | 121 -------------
   fs/nls/Kconfig               |   8 +
   fs/nls/Makefile              |   1 +
   fs/nls/nls_ucs2_data.h       |  15 ++
   fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
   fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
   fs/smb/client/Kconfig        |   1 +
   fs/smb/client/cifs_unicode.c |   1 -
   fs/smb/client/cifs_unicode.h | 330
+----------------------------------
   fs/smb/client/cifs_uniupr.h  | 239 -------------------------
   fs/smb/server/Kconfig        |   1 +
   fs/smb/server/unicode.c      |   1 -
   fs/smb/server/unicode.h      | 325
+---------------------------------
   fs/smb/server/uniupr.h       | 268 ----------------------------
   17 files changed, 467 insertions(+), 1293 deletions(-)

  delete mode 100644 fs/jfs/jfs_uniupr.c
  create mode 100644 fs/nls/nls_ucs2_data.h
  create mode 100644 fs/nls/nls_ucs2_utils.c
  create mode 100644 fs/nls/nls_ucs2_utils.h
  delete mode 100644 fs/smb/client/cifs_uniupr.h
  delete mode 100644 fs/smb/server/uniupr.h

Signature · 1 line
2.41.0
Signature · 4 lines
   -----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
   \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 3 lines
Thanks,

Steve
Signature · 3 lines
Thanks,

Steve
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#14 lore raw
In reply to Tom Talpey
Quoted 44 lines · * Tom Talpey ([email protected]) wrote:
Quoted 43 lines · Dr. David Alan Gilbert
Quoted 42 lines · * Tom Talpey ([email protected]) wrote:
Quoted 17 lines · Dave Kleikamp
Quoted 14 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Steve French ([email protected]) wrote:

The related question is which tree to send it from, if no problems reported (presumably mine since it mostly affect cifs.ko and ksmbd.ko, and because there hasn't been activity in fs/nls for years)

That was my hope, given that ~half of the patches are directly on that code, and it's the only very active tree this touches as far as I can tell.

Quoted 5 lines
Quoted 3 lines · Steve French

No objections to this on my part.  If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

For the series:

Quoted 8 lines

Steve,
Feel free to pull in even the 4th patch into your tree with my consent. Or if you're more comfortable, I could submit it after yours hits mainline.

Shaggy

The changes look good to me but there is one quirk with the copyrights and SPDX in patch 2.

In the new fs/nls/nls_ucs2_utils.c, the SPDX line changes from a "/* ... */" form to "// ...", which may be a proper update, but then partway down, adds the same SPDX in "/* ... */ form. These should at least be consistent.

Review line 1

Quoted 4 lines

+++ b/fs/nls/nls_ucs2_utils.c

(quoted diff) +1 -1
@@ -1,19 +1,25 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
+// SPDX-License-Identifier: GPL-2.0-or-later

vs

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Review line 1

Quoted 3 lines
(quoted diff) +2 -0
+++ b/fs/nls/nls_ucs2_utils.h
@@ -0,0 +1,297 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */

Yeh that's an easy fix - so that's just the fact the .h has the older /* where I'd fixed up the .c ?

Yep, for consistency that sounds good.

It does.... and I just fixed up my patches for it, and checkpatch moans;

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl#n3737

	if ($realfile =~ /\.(h|s|S)$/) {
		$comment = '/*';
	} elsif ($realfile =~ /\.(c|rs|dts|dtsi)$/) {
		$comment = '//';

I don't get where that idea came from.

Dave

Quoted 176 lines
Quoted 8 lines
Quoted 7 lines

Second, the copyright in fs/nls/nls_ucs2_utils.c is a bit of a mash-up (adding 2009 especially).

I think it's better to keep the exact text of both copyrights, perhaps with a note as to which files had them previously, and adding some new note/blank line to separate the recent contributions from Namjae and you from the ancient history.

Quoted 4 lines

How about the following;

* This file has taken chunks from a few other files
* smb/server/uniupr.h had the declaration:

These two lines above aren't needed, because the lines below contain the copyright and where they originated. So just omit the two above.

Quoted 5 lines

*
* Some of the source code in this file came from fs/cifs/uniupr.h
* Copyright (c) International Business Machines Corp., 2000,2002
*
* fs/smb/server/unicode.c had the declaration:

And this one above - not needed.

Quoted 10 lines

*
* 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])

*

I haven't added the extra line above Namjae's line, since it's now a straight copy from the unicode.c entry.

Straight copy is what's important. No deletion, no edit in a copyright. So, ok.

Quoted 2 lines

I'm not particularly fussed about adding my own line unless you think it's needed; git keeps better history!

In fact, since you technically didn't add any code, just deleted, moved or renamed, I think it might be best to leave yourself out. But, totally your choice.

Tom.

Quoted 128 lines
Quoted 15 lines

Review

Quoted 12 lines
(quoted diff) +7 -4
+++ b/fs/nls/nls_ucs2_utils.c
...
- *   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
+ *   via fs/smb/unicode.c and fs/smb/uniupr.h and fs/cifs/uniupr.h
+ *   Copyright (c) International Business Machines  Corp., 2000,2002,2009
+ *   Modified by Steve French ([email protected])
+ *   Modified by Namjae Jeon ([email protected])
+ *   Modified by Dr. David Alan Gilbert <[email protected]>

Apart from considering these:

Quoted 1 line

Thanks!

Dave

Quoted 107 lines

Nice work!

Quoted 105 lines
Quoted 104 lines

Thanks.

Dave

Quoted 99 lines
Quoted 92 lines
Quoted 83 lines · Dr. David Alan Gilbert
Quoted 6 lines · * [email protected] ([email protected]) wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 62 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting
itself.

This dupe was found using PMD:
   https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
   Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
   Share the JFS tables

Dr. David Alan Gilbert (4):
   fs/smb: Remove unicode 'lower' tables fs/smb: Swing unicode common code from smb->NLS fs/smb/client: Use common code in client fs/jfs: Use common ucs2 upper case table

   fs/jfs/Kconfig               |   1 +
   fs/jfs/Makefile              |   2 +-
   fs/jfs/jfs_unicode.h         |  17 +-
   fs/jfs/jfs_uniupr.c          | 121 -------------
   fs/nls/Kconfig               |   8 +
   fs/nls/Makefile              |   1 +
   fs/nls/nls_ucs2_data.h       |  15 ++
   fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
   fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
   fs/smb/client/Kconfig        |   1 +
   fs/smb/client/cifs_unicode.c |   1 -
   fs/smb/client/cifs_unicode.h | 330
+----------------------------------
   fs/smb/client/cifs_uniupr.h  | 239 -------------------------
   fs/smb/server/Kconfig        |   1 +
   fs/smb/server/unicode.c      |   1 -
   fs/smb/server/unicode.h      | 325
+---------------------------------
   fs/smb/server/uniupr.h       | 268 ----------------------------
   17 files changed, 467 insertions(+), 1293 deletions(-)

  delete mode 100644 fs/jfs/jfs_uniupr.c
  create mode 100644 fs/nls/nls_ucs2_data.h
  create mode 100644 fs/nls/nls_ucs2_utils.c
  create mode 100644 fs/nls/nls_ucs2_utils.h
  delete mode 100644 fs/smb/client/cifs_uniupr.h
  delete mode 100644 fs/smb/server/uniupr.h

Signature · 1 line
2.41.0
Signature · 4 lines
   -----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
   \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 3 lines
Thanks,

Steve
Signature · 3 lines
Thanks,

Steve
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
reviewer Reviewed-by
#16 lore raw
Quoted 11 lines · Paulo Alcantara
Quoted 7 lines · Dr. David Alan Gilbert

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl#n3737

	if ($realfile =~ /\.(h|s|S)$/) {
		$comment = '/*';
	} elsif ($realfile =~ /\.(c|rs|dts|dtsi)$/) {
		$comment = '//';

I don't get where that idea came from.

Check Documentation/process/license-rules.rst.

Ok, header files require a different SPDX comment syntax. I withdraw the consistency comment!

Did I give it my R-B?

#17 lore raw
In reply to Paulo Alcantara
Quoted 11 lines · * Paulo Alcantara ([email protected]) wrote:
Quoted 7 lines · Dr. David Alan Gilbert

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl#n3737

	if ($realfile =~ /\.(h|s|S)$/) {
		$comment = '/*';
	} elsif ($realfile =~ /\.(c|rs|dts|dtsi)$/) {
		$comment = '//';

I don't get where that idea came from.

Check Documentation/process/license-rules.rst.

Oh, that's a painful history!
Hmm that landed just after I posted a v3 (of just this patch)

Steve: Your call, do you want me to post a v4 with that comment back and but with the copyright lineas as in v3?

Dave

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#18 lore raw
Quoted 11 lines · * Dr. David Alan Gilbert ([email protected]) wrote:
Quoted 10 lines · * Paulo Alcantara ([email protected]) wrote:
Quoted 7 lines · Dr. David Alan Gilbert

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl#n3737

	if ($realfile =~ /\.(h|s|S)$/) {
		$comment = '/*';
	} elsif ($realfile =~ /\.(c|rs|dts|dtsi)$/) {
		$comment = '//';

I don't get where that idea came from.

Quoted 7 lines
Quoted 1 line

Check Documentation/process/license-rules.rst.

Oh, that's a painful history!
Hmm that landed just after I posted a v3 (of just this patch)

Steve: Your call, do you want me to post a v4 with that comment back and but with the copyright lineas as in v3?

I've posted the v4.

Dave

Quoted 7 lines

Dave

Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
#19 lore raw

thx - should be doable to put in for-next soon unless we find objections

Quoted 37 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Dr. David Alan Gilbert ([email protected]) wrote:
Quoted 10 lines · * Paulo Alcantara ([email protected]) wrote:
Quoted 7 lines · Dr. David Alan Gilbert

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/checkpatch.pl#n3737

  if ($realfile =~ /\.(h|s|S)$/) {
          $comment = '/*';
  } elsif ($realfile =~ /\.(c|rs|dts|dtsi)$/) {
          $comment = '//';

I don't get where that idea came from.

Quoted 7 lines
Quoted 1 line

Check Documentation/process/license-rules.rst.

Oh, that's a painful history!
Hmm that landed just after I posted a v3 (of just this patch)

Steve: Your call, do you want me to post a v4 with that comment back and but with the copyright lineas as in v3?

I've posted the v4.

Dave

Quoted 7 lines

Dave

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/
Signature · 3 lines
Thanks,

Steve
#20 lore raw
In reply to Dave Kleikamp

Shaggy,
I can add these - am updating the series to include your RB

Quoted 125 lines · Dave Kleikamp
Quoted 13 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Steve French ([email protected]) wrote:

The related question is which tree to send it from, if no problems reported (presumably mine since it mostly affect cifs.ko and ksmbd.ko, and because there hasn't been activity in fs/nls for years)

That was my hope, given that ~half of the patches are directly on that code, and it's the only very active tree this touches as far as I can tell.

Quoted 4 lines · Steve French
Quoted 3 lines

No objections to this on my part. If Shaggy is ok with the JFS change, we could target it for 6.6-rc1 if it tests out ok

For the series:

Steve,
Feel free to pull in even the 4th patch into your tree with my consent. Or if you're more comfortable, I could submit it after yours hits mainline.

Shaggy

Quoted 100 lines

Thanks.

Dave

Quoted 95 lines
Quoted 84 lines · Dr. David Alan Gilbert
Quoted 72 lines · * [email protected] ([email protected]) wrote:
Quoted 6 lines

From: "Dr. David Alan Gilbert" <[email protected]>

The smb client and server code have (mostly) duplicated code for unicode manipulation, in particular upper case handling.

Flatten this lot into shared code.

Gentle two week ping on this please.

Dave

(Apologies to the 3 of you who already got a copy of this ping, recent due to a missing header ',' )

Quoted 56 lines

There's some code that's slightly different between the two, and I've not attempted to share that - this should be strictly a no behaviour change set.

In addition, the same tables and code are shared in jfs, however there's very little testing available for the unicode in there, so just share the raw data tables.

I suspect there's more UCS-2 code that can be shared, in the NLS code and in the UCS-2 code used by the EFI interfaces.

Lightly tested with a module and a monolithic build, and just mounting itself.

This dupe was found using PMD:
https://pmd.github.io/pmd/pmd_userdocs_cpd.html

Dave

Version 2
Moved the shared code to fs/nls after v1 feedback. Renamed shared tables from Smb to Nls prefix Move UniStrcat as well
Share the JFS tables

Dr. David Alan Gilbert (4):
fs/smb: Remove unicode 'lower' tables fs/smb: Swing unicode common code from smb->NLS fs/smb/client: Use common code in client fs/jfs: Use common ucs2 upper case table

  fs/jfs/Kconfig               |   1 +
  fs/jfs/Makefile              |   2 +-
  fs/jfs/jfs_unicode.h         |  17 +-
  fs/jfs/jfs_uniupr.c          | 121 -------------
  fs/nls/Kconfig               |   8 +
  fs/nls/Makefile              |   1 +
  fs/nls/nls_ucs2_data.h       |  15 ++
  fs/nls/nls_ucs2_utils.c      | 144 +++++++++++++++
  fs/nls/nls_ucs2_utils.h      | 285 ++++++++++++++++++++++++++++++
  fs/smb/client/Kconfig        |   1 +
  fs/smb/client/cifs_unicode.c |   1 -
  fs/smb/client/cifs_unicode.h | 330 +----------------------------------
  fs/smb/client/cifs_uniupr.h  | 239 -------------------------
  fs/smb/server/Kconfig        |   1 +
  fs/smb/server/unicode.c      |   1 -
  fs/smb/server/unicode.h      | 325 +---------------------------------
  fs/smb/server/uniupr.h       | 268 ----------------------------
  17 files changed, 467 insertions(+), 1293 deletions(-)

delete mode 100644 fs/jfs/jfs_uniupr.c
create mode 100644 fs/nls/nls_ucs2_data.h
create mode 100644 fs/nls/nls_ucs2_utils.c
create mode 100644 fs/nls/nls_ucs2_utils.h
delete mode 100644 fs/smb/client/cifs_uniupr.h
delete mode 100644 fs/smb/server/uniupr.h

Quoted 8 lines
Quoted 3 lines

--
2.41.0

--
-----Open up your eyes, open up your mind, open up your code -------

/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \
\        dave @ treblig.org |                               | In Hex /

\ _________________________|_____ http://www.treblig.org |_______/

Quoted 4 lines

--
Thanks,

Steve

--
Thanks,

Steve

Signature · 3 lines
Thanks,

Steve