All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] dedupe smb unicode files
@ 2023-06-28 23:24 linux
  2023-06-28 23:24 ` [PATCH v2 1/4] fs/smb: Remove unicode 'lower' tables linux
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: linux @ 2023-06-28 23:24 UTC (permalink / raw)
  To: sfrench, linkinjeon, tom, linux-cifs
  Cc: krisman, jfs-discussion, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

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

-- 
2.41.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/4] fs/smb: Remove unicode 'lower' tables
  2023-06-28 23:24 [PATCH v2 0/4] dedupe smb unicode files linux
@ 2023-06-28 23:24 ` linux
  2023-06-28 23:24 ` [PATCH v2 2/4] fs/smb: Swing unicode common code from smb->NLS linux
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: linux @ 2023-06-28 23:24 UTC (permalink / raw)
  To: sfrench, linkinjeon, tom, linux-cifs
  Cc: krisman, jfs-discussion, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

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.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 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(-)

diff --git a/fs/smb/client/cifs_unicode.h b/fs/smb/client/cifs_unicode.h
index 80b3d845419f..33b651def482 100644
--- a/fs/smb/client/cifs_unicode.h
+++ b/fs/smb/client/cifs_unicode.h
@@ -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 */
diff --git a/fs/smb/client/cifs_uniupr.h b/fs/smb/client/cifs_uniupr.h
index 7b272fcdf0d3..b1d51d0da4fe 100644
--- a/fs/smb/client/cifs_uniupr.h
+++ b/fs/smb/client/cifs_uniupr.h
@@ -121,119 +121,3 @@ const struct UniCaseRange CifsUniUpperRange[] = {
 	{0}
 };
 #endif
-
-#ifndef UNIUPR_NOLOWER
-/*
- * Latin lower case
- */
-signed char CifsUniLowerTable[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 */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 030-03f */
-	0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,	/* 040-04f */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 0, 0, 0, 0, 0,	/* 050-05f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 060-06f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 070-07f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 080-08f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 090-09f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0a0-0af */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0b0-0bf */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,	/* 0c0-0cf */
-	32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, 0,	/* 0d0-0df */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0e0-0ef */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0f0-0ff */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 100-10f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 110-11f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 120-12f */
-	0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1,	/* 130-13f */
-	0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0,	/* 140-14f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 150-15f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 160-16f */
-	1, 0, 1, 0, 1, 0, 1, 0, -121, 1, 0, 1, 0, 1, 0, 0,	/* 170-17f */
-	0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 79, 0,	/* 180-18f */
-	0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,	/* 190-19f */
-	1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1,	/* 1a0-1af */
-	0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,	/* 1b0-1bf */
-	0, 0, 0, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 0, 1,	/* 1c0-1cf */
-	0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0,	/* 1d0-1df */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e0-1ef */
-	0, 2, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1f0-1ff */
-};
-
-/* Lower case range - Greek */
-static signed char UniCaseRangeL0380[44] = {
-	0, 0, 0, 0, 0, 0, 38, 0, 37, 37, 37, 0, 64, 0, 63, 63,	/* 380-38f */
-	0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,	/* 390-39f */
-	32, 32, 0, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-};
-
-/* Lower case range - Cyrillic */
-static signed char UniCaseRangeL0400[48] = {
-	0, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 0, 80, 80,	/* 400-40f */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,	/* 410-41f */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,	/* 420-42f */
-};
-
-/* Lower case range - Extended cyrillic */
-static signed char UniCaseRangeL0490[60] = {
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 490-49f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 4a0-4af */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 4b0-4bf */
-	0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
-};
-
-/* Lower case range - Extended latin and greek */
-static signed char UniCaseRangeL1e00[504] = {
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e00-1e0f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e10-1e1f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e20-1e2f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e30-1e3f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e40-1e4f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e50-1e5f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e60-1e6f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e70-1e7f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e80-1e8f */
-	1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0,	/* 1e90-1e9f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1ea0-1eaf */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1eb0-1ebf */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1ec0-1ecf */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1ed0-1edf */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1ee0-1eef */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,	/* 1ef0-1eff */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f00-1f0f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, 0, 0,	/* 1f10-1f1f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f20-1f2f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f30-1f3f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, 0, 0,	/* 1f40-1f4f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, -8, 0, -8, 0, -8, 0, -8,	/* 1f50-1f5f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f60-1f6f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f70-1f7f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f80-1f8f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f90-1f9f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1fa0-1faf */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -74, -74, -9, 0, 0, 0,	/* 1fb0-1fbf */
-	0, 0, 0, 0, 0, 0, 0, 0, -86, -86, -86, -86, -9, 0, 0, 0,	/* 1fc0-1fcf */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -100, -100, 0, 0, 0, 0,	/* 1fd0-1fdf */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -112, -112, -7, 0, 0, 0,	/* 1fe0-1fef */
-	0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-/* Lower case range - Wide latin */
-static signed char UniCaseRangeLff20[27] = {
-	0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,	/* ff20-ff2f */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-};
-
-/*
- * Lower Case Range
- */
-const struct UniCaseRange CifsUniLowerRange[] = {
-	{0x0380, 0x03ab, UniCaseRangeL0380},
-	{0x0400, 0x042f, UniCaseRangeL0400},
-	{0x0490, 0x04cb, UniCaseRangeL0490},
-	{0x1e00, 0x1ff7, UniCaseRangeL1e00},
-	{0xff20, 0xff3a, UniCaseRangeLff20},
-	{0}
-};
-#endif
diff --git a/fs/smb/server/unicode.h b/fs/smb/server/unicode.h
index 076f6034a789..b48c7b11b9c7 100644
--- a/fs/smb/server/unicode.h
+++ b/fs/smb/server/unicode.h
@@ -26,8 +26,6 @@
 #include <linux/nls.h>
 #include <linux/unicode.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
@@ -57,11 +55,6 @@ extern signed char SmbUniUpperTable[512];
 extern const struct UniCaseRange SmbUniUpperRange[];
 #endif				/* UNIUPR_NOUPPER */
 
-#ifndef UNIUPR_NOLOWER
-extern signed char CifsUniLowerTable[512];
-extern const struct UniCaseRange CifsUniLowerRange[];
-#endif				/* UNIUPR_NOLOWER */
-
 #ifdef __KERNEL__
 int smb_strtoUTF16(__le16 *to, const char *from, int len,
 		   const struct nls_table *codepage);
@@ -314,45 +307,4 @@ static inline __le16 *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 */
-	}
-
-	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 */
diff --git a/fs/smb/server/uniupr.h b/fs/smb/server/uniupr.h
index 26583b776897..d09c585f20c9 100644
--- a/fs/smb/server/uniupr.h
+++ b/fs/smb/server/uniupr.h
@@ -136,133 +136,4 @@ const struct UniCaseRange SmbUniUpperRange[] = {
 };
 #endif
 
-#ifndef UNIUPR_NOLOWER
-/*
- * Latin lower case
- */
-signed char CifsUniLowerTable[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 */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 030-03f */
-	0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-					 32, 32, 32,	/* 040-04f */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 0, 0,
-					 0, 0, 0,	/* 050-05f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 060-06f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 070-07f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 080-08f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 090-09f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0a0-0af */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0b0-0bf */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-				 32, 32, 32, 32,	/* 0c0-0cf */
-	32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32,
-					 32, 32, 32, 0,	/* 0d0-0df */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0e0-0ef */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0f0-0ff */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 100-10f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 110-11f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 120-12f */
-	0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1,	/* 130-13f */
-	0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0,	/* 140-14f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 150-15f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 160-16f */
-	1, 0, 1, 0, 1, 0, 1, 0, -121, 1, 0, 1, 0, 1, 0,
-						 0,	/* 170-17f */
-	0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 79,
-						 0,	/* 180-18f */
-	0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,	/* 190-19f */
-	1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1,	/* 1a0-1af */
-	0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,	/* 1b0-1bf */
-	0, 0, 0, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 0, 1,	/* 1c0-1cf */
-	0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0,	/* 1d0-1df */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e0-1ef */
-	0, 2, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1f0-1ff */
-};
-
-/* Lower case range - Greek */
-static signed char UniCaseRangeL0380[44] = {
-	0, 0, 0, 0, 0, 0, 38, 0, 37, 37, 37, 0, 64, 0, 63, 63,	/* 380-38f */
-	0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-						 32, 32, 32,	/* 390-39f */
-	32, 32, 0, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-};
-
-/* Lower case range - Cyrillic */
-static signed char UniCaseRangeL0400[48] = {
-	0, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
-					 0, 80, 80,	/* 400-40f */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-					 32, 32, 32,	/* 410-41f */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-					 32, 32, 32,	/* 420-42f */
-};
-
-/* Lower case range - Extended cyrillic */
-static signed char UniCaseRangeL0490[60] = {
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 490-49f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 4a0-4af */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 4b0-4bf */
-	0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
-};
-
-/* Lower case range - Extended latin and greek */
-static signed char UniCaseRangeL1e00[504] = {
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e00-1e0f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e10-1e1f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e20-1e2f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e30-1e3f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e40-1e4f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e50-1e5f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e60-1e6f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e70-1e7f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1e80-1e8f */
-	1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0,	/* 1e90-1e9f */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1ea0-1eaf */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1eb0-1ebf */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1ec0-1ecf */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1ed0-1edf */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,	/* 1ee0-1eef */
-	1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,	/* 1ef0-1eff */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f00-1f0f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, 0, 0,	/* 1f10-1f1f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f20-1f2f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f30-1f3f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, 0, 0,	/* 1f40-1f4f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, -8, 0, -8, 0, -8, 0, -8,	/* 1f50-1f5f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f60-1f6f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f70-1f7f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f80-1f8f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1f90-1f9f */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -8, -8, -8, -8, -8, -8,	/* 1fa0-1faf */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -74, -74, -9, 0, 0, 0,	/* 1fb0-1fbf */
-	0, 0, 0, 0, 0, 0, 0, 0, -86, -86, -86, -86, -9, 0,
-							 0, 0,	/* 1fc0-1fcf */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -100, -100, 0, 0, 0, 0,	/* 1fd0-1fdf */
-	0, 0, 0, 0, 0, 0, 0, 0, -8, -8, -112, -112, -7, 0,
-							 0, 0,	/* 1fe0-1fef */
-	0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-/* Lower case range - Wide latin */
-static signed char UniCaseRangeLff20[27] = {
-	0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-							 32,	/* ff20-ff2f */
-	32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-};
-
-/*
- * Lower Case Range
- */
-const struct UniCaseRange CifsUniLowerRange[] = {
-	{0x0380, 0x03ab, UniCaseRangeL0380},
-	{0x0400, 0x042f, UniCaseRangeL0400},
-	{0x0490, 0x04cb, UniCaseRangeL0490},
-	{0x1e00, 0x1ff7, UniCaseRangeL1e00},
-	{0xff20, 0xff3a, UniCaseRangeLff20},
-	{0}
-};
-#endif
-
 #endif /* __KSMBD_UNIUPR_H */
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/4] fs/smb: Swing unicode common code from smb->NLS
  2023-06-28 23:24 [PATCH v2 0/4] dedupe smb unicode files linux
  2023-06-28 23:24 ` [PATCH v2 1/4] fs/smb: Remove unicode 'lower' tables linux
@ 2023-06-28 23:24 ` linux
  2023-06-28 23:24 ` [PATCH v2 3/4] fs/smb/client: Use common code in client linux
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: linux @ 2023-06-28 23:24 UTC (permalink / raw)
  To: sfrench, linkinjeon, tom, linux-cifs
  Cc: krisman, jfs-discussion, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

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 <linux@treblig.org>
---
 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

diff --git a/fs/nls/Kconfig b/fs/nls/Kconfig
index c7857e36adbb..a0d0e2f7ec83 100644
--- a/fs/nls/Kconfig
+++ b/fs/nls/Kconfig
@@ -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
diff --git a/fs/nls/Makefile b/fs/nls/Makefile
index ac54db297128..5062c699d041 100644
--- a/fs/nls/Makefile
+++ b/fs/nls/Makefile
@@ -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
diff --git a/fs/smb/server/uniupr.h b/fs/nls/nls_ucs2_utils.c
similarity index 90%
rename from fs/smb/server/uniupr.h
rename to fs/nls/nls_ucs2_utils.c
index d09c585f20c9..ce18c0185898 100644
--- a/fs/smb/server/uniupr.h
+++ b/fs/nls/nls_ucs2_utils.c
@@ -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 (sfrench@us.ibm.com)
+ *   Modified by Namjae Jeon (linkinjeon@kernel.org)
+ *   Modified by Dr. David Alan Gilbert <linux@treblig.org>
  *
  */
-#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);
diff --git a/fs/nls/nls_ucs2_utils.h b/fs/nls/nls_ucs2_utils.h
new file mode 100644
index 000000000000..3500596ea993
--- /dev/null
+++ b/fs/nls/nls_ucs2_utils.h
@@ -0,0 +1,297 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Some of the source code in this file came from fs/cifs/cifs_unicode.c
+ * and then via server/unicode.c
+ * cifs_unicode:  Unicode kernel case support
+ *
+ * Function:
+ *     Convert a unicode character to upper or lower case using
+ *     compressed tables.
+ *
+ *   Copyright (c) International Business Machines  Corp., 2000,2009
+ *
+ *
+ * Notes:
+ *     These APIs are based on the C library functions.  The semantics
+ *     should match the C functions but with expanded size operands.
+ *
+ *     The upper/lower functions are based on a table created by mkupr.
+ *     This is a compressed table of upper and lower case conversion.
+ *
+ */
+#ifndef _NLS_UCS2_UTILS_H
+#define _NLS_UCS2_UTILS_H
+
+#include <asm/byteorder.h>
+#include <linux/types.h>
+#include <linux/nls.h>
+#include <linux/unicode.h>
+
+/*
+ * Windows maps these to the user defined 16 bit Unicode range since they are
+ * reserved symbols (along with \ and /), otherwise illegal to store
+ * in filenames in NTFS
+ */
+#define UNI_ASTERISK    ((__u16)('*' + 0xF000))
+#define UNI_QUESTION    ((__u16)('?' + 0xF000))
+#define UNI_COLON       ((__u16)(':' + 0xF000))
+#define UNI_GRTRTHAN    ((__u16)('>' + 0xF000))
+#define UNI_LESSTHAN    ((__u16)('<' + 0xF000))
+#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
+ *
+ * Returns:
+ *     Address of the first string
+ */
+static inline wchar_t *UniStrcat(wchar_t *ucs1, const wchar_t *ucs2)
+{
+	wchar_t *anchor = ucs1;	/* save a pointer to start of ucs1 */
+
+	while (*ucs1++)
+	/*NULL*/;	/* To end of first string */
+	ucs1--;			/* Return to the null */
+	while ((*ucs1++ = *ucs2++))
+	/*NULL*/;	/* copy string 2 over */
+	return anchor;
+}
+
+/*
+ * UniStrchr:  Find a character in a string
+ *
+ * Returns:
+ *     Address of first occurrence of character in string
+ *     or NULL if the character is not in the string
+ */
+static inline wchar_t *UniStrchr(const wchar_t *ucs, wchar_t uc)
+{
+	while ((*ucs != uc) && *ucs)
+		ucs++;
+
+	if (*ucs == uc)
+		return (wchar_t *)ucs;
+	return NULL;
+}
+
+/*
+ * UniStrcmp:  Compare two strings
+ *
+ * Returns:
+ *     < 0:  First string is less than second
+ *     = 0:  Strings are equal
+ *     > 0:  First string is greater than second
+ */
+static inline int UniStrcmp(const wchar_t *ucs1, const wchar_t *ucs2)
+{
+	while ((*ucs1 == *ucs2) && *ucs1) {
+		ucs1++;
+		ucs2++;
+	}
+	return (int)*ucs1 - (int)*ucs2;
+}
+
+/*
+ * UniStrcpy:  Copy a string
+ */
+static inline wchar_t *UniStrcpy(wchar_t *ucs1, const wchar_t *ucs2)
+{
+	wchar_t *anchor = ucs1;	/* save the start of result string */
+
+	while ((*ucs1++ = *ucs2++))
+	/*NULL*/;
+	return anchor;
+}
+
+/*
+ * UniStrlen:  Return the length of a string (in 16 bit Unicode chars not bytes)
+ */
+static inline size_t UniStrlen(const wchar_t *ucs1)
+{
+	int i = 0;
+
+	while (*ucs1++)
+		i++;
+	return i;
+}
+
+/*
+ * UniStrnlen:  Return the length (in 16 bit Unicode chars not bytes) of a
+ *		string (length limited)
+ */
+static inline size_t UniStrnlen(const wchar_t *ucs1, int maxlen)
+{
+	int i = 0;
+
+	while (*ucs1++) {
+		i++;
+		if (i >= maxlen)
+			break;
+	}
+	return i;
+}
+
+/*
+ * UniStrncat:  Concatenate length limited string
+ */
+static inline wchar_t *UniStrncat(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
+{
+	wchar_t *anchor = ucs1;	/* save pointer to string 1 */
+
+	while (*ucs1++)
+	/*NULL*/;
+	ucs1--;			/* point to null terminator of s1 */
+	while (n-- && (*ucs1 = *ucs2)) {	/* copy s2 after s1 */
+		ucs1++;
+		ucs2++;
+	}
+	*ucs1 = 0;		/* Null terminate the result */
+	return anchor;
+}
+
+/*
+ * UniStrncmp:  Compare length limited string
+ */
+static inline int UniStrncmp(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
+{
+	if (!n)
+		return 0;	/* Null strings are equal */
+	while ((*ucs1 == *ucs2) && *ucs1 && --n) {
+		ucs1++;
+		ucs2++;
+	}
+	return (int)*ucs1 - (int)*ucs2;
+}
+
+/*
+ * UniStrncmp_le:  Compare length limited string - native to little-endian
+ */
+static inline int
+UniStrncmp_le(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
+{
+	if (!n)
+		return 0;	/* Null strings are equal */
+	while ((*ucs1 == __le16_to_cpu(*ucs2)) && *ucs1 && --n) {
+		ucs1++;
+		ucs2++;
+	}
+	return (int)*ucs1 - (int)__le16_to_cpu(*ucs2);
+}
+
+/*
+ * UniStrncpy:  Copy length limited string with pad
+ */
+static inline wchar_t *UniStrncpy(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
+{
+	wchar_t *anchor = ucs1;
+
+	while (n-- && *ucs2)	/* Copy the strings */
+		*ucs1++ = *ucs2++;
+
+	n++;
+	while (n--)		/* Pad with nulls */
+		*ucs1++ = 0;
+	return anchor;
+}
+
+/*
+ * UniStrncpy_le:  Copy length limited string with pad to little-endian
+ */
+static inline wchar_t *UniStrncpy_le(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
+{
+	wchar_t *anchor = ucs1;
+
+	while (n-- && *ucs2)	/* Copy the strings */
+		*ucs1++ = __le16_to_cpu(*ucs2++);
+
+	n++;
+	while (n--)		/* Pad with nulls */
+		*ucs1++ = 0;
+	return anchor;
+}
+
+/*
+ * UniStrstr:  Find a string in a string
+ *
+ * Returns:
+ *     Address of first match found
+ *     NULL if no matching string is found
+ */
+static inline wchar_t *UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2)
+{
+	const wchar_t *anchor1 = ucs1;
+	const wchar_t *anchor2 = ucs2;
+
+	while (*ucs1) {
+		if (*ucs1 == *ucs2) {
+			/* Partial match found */
+			ucs1++;
+			ucs2++;
+		} else {
+			if (!*ucs2)	/* Match found */
+				return (wchar_t *)anchor1;
+			ucs1 = ++anchor1;	/* No match */
+			ucs2 = anchor2;
+		}
+	}
+
+	if (!*ucs2)		/* Both end together */
+		return (wchar_t *)anchor1;	/* Match found */
+	return NULL;		/* No match */
+}
+
+#ifndef UNIUPR_NOUPPER
+/*
+ * UniToupper:  Convert a unicode character to upper case
+ */
+static inline wchar_t UniToupper(register wchar_t uc)
+{
+	register const struct UniCaseRange *rp;
+
+	if (uc < sizeof(NlsUniUpperTable)) {
+		/* Latin characters */
+		return uc + NlsUniUpperTable[uc];	/* Use base tables */
+	}
+
+	rp = NlsUniUpperRange;	/* 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 */
+}
+
+/*
+ * UniStrupr:  Upper case a unicode string
+ */
+static inline __le16 *UniStrupr(register __le16 *upin)
+{
+	register __le16 *up;
+
+	up = upin;
+	while (*up) {		/* For all characters */
+		*up = cpu_to_le16(UniToupper(le16_to_cpu(*up)));
+		up++;
+	}
+	return upin;		/* Return input pointer */
+}
+#endif				/* UNIUPR_NOUPPER */
+
+#endif /* _NLS_UCS2_UTILS_H */
diff --git a/fs/smb/server/Kconfig b/fs/smb/server/Kconfig
index 7055cb5d2880..793151ddd60e 100644
--- a/fs/smb/server/Kconfig
+++ b/fs/smb/server/Kconfig
@@ -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
diff --git a/fs/smb/server/unicode.c b/fs/smb/server/unicode.c
index 9ae676906ed3..393dd4a7432b 100644
--- a/fs/smb/server/unicode.c
+++ b/fs/smb/server/unicode.c
@@ -11,7 +11,6 @@
 #include <asm/unaligned.h>
 #include "glob.h"
 #include "unicode.h"
-#include "uniupr.h"
 #include "smb_common.h"
 
 /*
diff --git a/fs/smb/server/unicode.h b/fs/smb/server/unicode.h
index b48c7b11b9c7..28c7c736f7bb 100644
--- a/fs/smb/server/unicode.h
+++ b/fs/smb/server/unicode.h
@@ -18,42 +18,14 @@
  *     This is a compressed table of upper and lower case conversion.
  *
  */
-#ifndef _CIFS_UNICODE_H
-#define _CIFS_UNICODE_H
+#ifndef _SMB_UNICODE_H
+#define _SMB_UNICODE_H
 
 #include <asm/byteorder.h>
 #include <linux/types.h>
 #include <linux/nls.h>
 #include <linux/unicode.h>
-
-/*
- * Windows maps these to the user defined 16 bit Unicode range since they are
- * reserved symbols (along with \ and /), otherwise illegal to store
- * in filenames in NTFS
- */
-#define UNI_ASTERISK    ((__u16)('*' + 0xF000))
-#define UNI_QUESTION    ((__u16)('?' + 0xF000))
-#define UNI_COLON       ((__u16)(':' + 0xF000))
-#define UNI_GRTRTHAN    ((__u16)('>' + 0xF000))
-#define UNI_LESSTHAN    ((__u16)('<' + 0xF000))
-#define UNI_PIPE        ((__u16)('|' + 0xF000))
-#define UNI_SLASH       ((__u16)('\\' + 0xF000))
-
-/* Just define what we want from uniupr.h.  We don't want to define the tables
- * in each source file.
- */
-#ifndef	UNICASERANGE_DEFINED
-struct UniCaseRange {
-	wchar_t start;
-	wchar_t end;
-	signed char *table;
-};
-#endif				/* UNICASERANGE_DEFINED */
-
-#ifndef UNIUPR_NOUPPER
-extern signed char SmbUniUpperTable[512];
-extern const struct UniCaseRange SmbUniUpperRange[];
-#endif				/* UNIUPR_NOUPPER */
+#include "../../nls/nls_ucs2_utils.h"
 
 #ifdef __KERNEL__
 int smb_strtoUTF16(__le16 *to, const char *from, int len,
@@ -66,245 +38,4 @@ int smbConvertToUTF16(__le16 *target, const char *source, int srclen,
 char *ksmbd_extract_sharename(struct unicode_map *um, const char *treename);
 #endif
 
-/*
- * UniStrcat:  Concatenate the second string to the first
- *
- * Returns:
- *     Address of the first string
- */
-static inline wchar_t *UniStrcat(wchar_t *ucs1, const wchar_t *ucs2)
-{
-	wchar_t *anchor = ucs1;	/* save a pointer to start of ucs1 */
-
-	while (*ucs1++)
-	/*NULL*/;	/* To end of first string */
-	ucs1--;			/* Return to the null */
-	while ((*ucs1++ = *ucs2++))
-	/*NULL*/;	/* copy string 2 over */
-	return anchor;
-}
-
-/*
- * UniStrchr:  Find a character in a string
- *
- * Returns:
- *     Address of first occurrence of character in string
- *     or NULL if the character is not in the string
- */
-static inline wchar_t *UniStrchr(const wchar_t *ucs, wchar_t uc)
-{
-	while ((*ucs != uc) && *ucs)
-		ucs++;
-
-	if (*ucs == uc)
-		return (wchar_t *)ucs;
-	return NULL;
-}
-
-/*
- * UniStrcmp:  Compare two strings
- *
- * Returns:
- *     < 0:  First string is less than second
- *     = 0:  Strings are equal
- *     > 0:  First string is greater than second
- */
-static inline int UniStrcmp(const wchar_t *ucs1, const wchar_t *ucs2)
-{
-	while ((*ucs1 == *ucs2) && *ucs1) {
-		ucs1++;
-		ucs2++;
-	}
-	return (int)*ucs1 - (int)*ucs2;
-}
-
-/*
- * UniStrcpy:  Copy a string
- */
-static inline wchar_t *UniStrcpy(wchar_t *ucs1, const wchar_t *ucs2)
-{
-	wchar_t *anchor = ucs1;	/* save the start of result string */
-
-	while ((*ucs1++ = *ucs2++))
-	/*NULL*/;
-	return anchor;
-}
-
-/*
- * UniStrlen:  Return the length of a string (in 16 bit Unicode chars not bytes)
- */
-static inline size_t UniStrlen(const wchar_t *ucs1)
-{
-	int i = 0;
-
-	while (*ucs1++)
-		i++;
-	return i;
-}
-
-/*
- * UniStrnlen:  Return the length (in 16 bit Unicode chars not bytes) of a
- *		string (length limited)
- */
-static inline size_t UniStrnlen(const wchar_t *ucs1, int maxlen)
-{
-	int i = 0;
-
-	while (*ucs1++) {
-		i++;
-		if (i >= maxlen)
-			break;
-	}
-	return i;
-}
-
-/*
- * UniStrncat:  Concatenate length limited string
- */
-static inline wchar_t *UniStrncat(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	wchar_t *anchor = ucs1;	/* save pointer to string 1 */
-
-	while (*ucs1++)
-	/*NULL*/;
-	ucs1--;			/* point to null terminator of s1 */
-	while (n-- && (*ucs1 = *ucs2)) {	/* copy s2 after s1 */
-		ucs1++;
-		ucs2++;
-	}
-	*ucs1 = 0;		/* Null terminate the result */
-	return anchor;
-}
-
-/*
- * UniStrncmp:  Compare length limited string
- */
-static inline int UniStrncmp(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	if (!n)
-		return 0;	/* Null strings are equal */
-	while ((*ucs1 == *ucs2) && *ucs1 && --n) {
-		ucs1++;
-		ucs2++;
-	}
-	return (int)*ucs1 - (int)*ucs2;
-}
-
-/*
- * UniStrncmp_le:  Compare length limited string - native to little-endian
- */
-static inline int
-UniStrncmp_le(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	if (!n)
-		return 0;	/* Null strings are equal */
-	while ((*ucs1 == __le16_to_cpu(*ucs2)) && *ucs1 && --n) {
-		ucs1++;
-		ucs2++;
-	}
-	return (int)*ucs1 - (int)__le16_to_cpu(*ucs2);
-}
-
-/*
- * UniStrncpy:  Copy length limited string with pad
- */
-static inline wchar_t *UniStrncpy(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	wchar_t *anchor = ucs1;
-
-	while (n-- && *ucs2)	/* Copy the strings */
-		*ucs1++ = *ucs2++;
-
-	n++;
-	while (n--)		/* Pad with nulls */
-		*ucs1++ = 0;
-	return anchor;
-}
-
-/*
- * UniStrncpy_le:  Copy length limited string with pad to little-endian
- */
-static inline wchar_t *UniStrncpy_le(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	wchar_t *anchor = ucs1;
-
-	while (n-- && *ucs2)	/* Copy the strings */
-		*ucs1++ = __le16_to_cpu(*ucs2++);
-
-	n++;
-	while (n--)		/* Pad with nulls */
-		*ucs1++ = 0;
-	return anchor;
-}
-
-/*
- * UniStrstr:  Find a string in a string
- *
- * Returns:
- *     Address of first match found
- *     NULL if no matching string is found
- */
-static inline wchar_t *UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2)
-{
-	const wchar_t *anchor1 = ucs1;
-	const wchar_t *anchor2 = ucs2;
-
-	while (*ucs1) {
-		if (*ucs1 == *ucs2) {
-			/* Partial match found */
-			ucs1++;
-			ucs2++;
-		} else {
-			if (!*ucs2)	/* Match found */
-				return (wchar_t *)anchor1;
-			ucs1 = ++anchor1;	/* No match */
-			ucs2 = anchor2;
-		}
-	}
-
-	if (!*ucs2)		/* Both end together */
-		return (wchar_t *)anchor1;	/* Match found */
-	return NULL;		/* No match */
-}
-
-#ifndef UNIUPR_NOUPPER
-/*
- * UniToupper:  Convert a unicode character to upper case
- */
-static inline wchar_t UniToupper(register wchar_t uc)
-{
-	register const struct UniCaseRange *rp;
-
-	if (uc < sizeof(SmbUniUpperTable)) {
-		/* Latin characters */
-		return uc + SmbUniUpperTable[uc];	/* Use base tables */
-	}
-
-	rp = SmbUniUpperRange;	/* 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 */
-}
-
-/*
- * UniStrupr:  Upper case a unicode string
- */
-static inline __le16 *UniStrupr(register __le16 *upin)
-{
-	register __le16 *up;
-
-	up = upin;
-	while (*up) {		/* For all characters */
-		*up = cpu_to_le16(UniToupper(le16_to_cpu(*up)));
-		up++;
-	}
-	return upin;		/* Return input pointer */
-}
-#endif				/* UNIUPR_NOUPPER */
-
-#endif /* _CIFS_UNICODE_H */
+#endif /* _SMB_UNICODE_H */
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/4] fs/smb/client: Use common code in client
  2023-06-28 23:24 [PATCH v2 0/4] dedupe smb unicode files linux
  2023-06-28 23:24 ` [PATCH v2 1/4] fs/smb: Remove unicode 'lower' tables linux
  2023-06-28 23:24 ` [PATCH v2 2/4] fs/smb: Swing unicode common code from smb->NLS linux
@ 2023-06-28 23:24 ` linux
  2023-06-28 23:24 ` [PATCH v2 4/4] fs/jfs: Use common ucs2 upper case table linux
  2023-07-12 23:17 ` [PATCH v2 0/4] dedupe smb unicode files Dr. David Alan Gilbert
  4 siblings, 0 replies; 21+ messages in thread
From: linux @ 2023-06-28 23:24 UTC (permalink / raw)
  To: sfrench, linkinjeon, tom, linux-cifs
  Cc: krisman, jfs-discussion, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

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.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 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

diff --git a/fs/smb/client/Kconfig b/fs/smb/client/Kconfig
index 4c0d53bf931a..2927bd174a88 100644
--- a/fs/smb/client/Kconfig
+++ b/fs/smb/client/Kconfig
@@ -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
diff --git a/fs/smb/client/cifs_unicode.c b/fs/smb/client/cifs_unicode.c
index e7582dd79179..79d99a913944 100644
--- a/fs/smb/client/cifs_unicode.c
+++ b/fs/smb/client/cifs_unicode.c
@@ -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"
diff --git a/fs/smb/client/cifs_unicode.h b/fs/smb/client/cifs_unicode.h
index 33b651def482..e137a0dfbbe9 100644
--- a/fs/smb/client/cifs_unicode.h
+++ b/fs/smb/client/cifs_unicode.h
@@ -21,19 +21,7 @@
 #include <asm/byteorder.h>
 #include <linux/types.h>
 #include <linux/nls.h>
-
-/*
- * Windows maps these to the user defined 16 bit Unicode range since they are
- * reserved symbols (along with \ and /), otherwise illegal to store
- * in filenames in NTFS
- */
-#define UNI_ASTERISK    (__u16) ('*' + 0xF000)
-#define UNI_QUESTION    (__u16) ('?' + 0xF000)
-#define UNI_COLON       (__u16) (':' + 0xF000)
-#define UNI_GRTRTHAN    (__u16) ('>' + 0xF000)
-#define UNI_LESSTHAN    (__u16) ('<' + 0xF000)
-#define UNI_PIPE        (__u16) ('|' + 0xF000)
-#define UNI_SLASH       (__u16) ('\\' + 0xF000)
+#include "../../nls/nls_ucs2_utils.h"
 
 /*
  * Macs use an older "SFM" mapping of the symbols above. Fortunately it does
@@ -66,22 +54,6 @@
 #define SFM_MAP_UNI_RSVD	1
 #define SFU_MAP_UNI_RSVD	2
 
-/* Just define what we want from uniupr.h.  We don't want to define the tables
- * in each source file.
- */
-#ifndef	UNICASERANGE_DEFINED
-struct UniCaseRange {
-	wchar_t start;
-	wchar_t end;
-	signed char *table;
-};
-#endif				/* UNICASERANGE_DEFINED */
-
-#ifndef UNIUPR_NOUPPER
-extern signed char CifsUniUpperTable[512];
-extern const struct UniCaseRange CifsUniUpperRange[];
-#endif				/* UNIUPR_NOUPPER */
-
 #ifdef __KERNEL__
 int cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,
 		    const struct nls_table *cp, int map_type);
@@ -101,254 +73,4 @@ extern __le16 *cifs_strndup_to_utf16(const char *src, const int maxlen,
 
 wchar_t cifs_toupper(wchar_t in);
 
-/*
- * UniStrcat:  Concatenate the second string to the first
- *
- * Returns:
- *     Address of the first string
- */
-static inline __le16 *
-UniStrcat(__le16 *ucs1, const __le16 *ucs2)
-{
-	__le16 *anchor = ucs1;	/* save a pointer to start of ucs1 */
-
-	while (*ucs1++) ;	/* To end of first string */
-	ucs1--;			/* Return to the null */
-	while ((*ucs1++ = *ucs2++)) ;	/* copy string 2 over */
-	return anchor;
-}
-
-/*
- * UniStrchr:  Find a character in a string
- *
- * Returns:
- *     Address of first occurrence of character in string
- *     or NULL if the character is not in the string
- */
-static inline wchar_t *
-UniStrchr(const wchar_t *ucs, wchar_t uc)
-{
-	while ((*ucs != uc) && *ucs)
-		ucs++;
-
-	if (*ucs == uc)
-		return (wchar_t *) ucs;
-	return NULL;
-}
-
-/*
- * UniStrcmp:  Compare two strings
- *
- * Returns:
- *     < 0:  First string is less than second
- *     = 0:  Strings are equal
- *     > 0:  First string is greater than second
- */
-static inline int
-UniStrcmp(const wchar_t *ucs1, const wchar_t *ucs2)
-{
-	while ((*ucs1 == *ucs2) && *ucs1) {
-		ucs1++;
-		ucs2++;
-	}
-	return (int) *ucs1 - (int) *ucs2;
-}
-
-/*
- * UniStrcpy:  Copy a string
- */
-static inline wchar_t *
-UniStrcpy(wchar_t *ucs1, const wchar_t *ucs2)
-{
-	wchar_t *anchor = ucs1;	/* save the start of result string */
-
-	while ((*ucs1++ = *ucs2++)) ;
-	return anchor;
-}
-
-/*
- * UniStrlen:  Return the length of a string (in 16 bit Unicode chars not bytes)
- */
-static inline size_t
-UniStrlen(const wchar_t *ucs1)
-{
-	int i = 0;
-
-	while (*ucs1++)
-		i++;
-	return i;
-}
-
-/*
- * UniStrnlen:  Return the length (in 16 bit Unicode chars not bytes) of a
- *		string (length limited)
- */
-static inline size_t
-UniStrnlen(const wchar_t *ucs1, int maxlen)
-{
-	int i = 0;
-
-	while (*ucs1++) {
-		i++;
-		if (i >= maxlen)
-			break;
-	}
-	return i;
-}
-
-/*
- * UniStrncat:  Concatenate length limited string
- */
-static inline wchar_t *
-UniStrncat(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	wchar_t *anchor = ucs1;	/* save pointer to string 1 */
-
-	while (*ucs1++) ;
-	ucs1--;			/* point to null terminator of s1 */
-	while (n-- && (*ucs1 = *ucs2)) {	/* copy s2 after s1 */
-		ucs1++;
-		ucs2++;
-	}
-	*ucs1 = 0;		/* Null terminate the result */
-	return (anchor);
-}
-
-/*
- * UniStrncmp:  Compare length limited string
- */
-static inline int
-UniStrncmp(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	if (!n)
-		return 0;	/* Null strings are equal */
-	while ((*ucs1 == *ucs2) && *ucs1 && --n) {
-		ucs1++;
-		ucs2++;
-	}
-	return (int) *ucs1 - (int) *ucs2;
-}
-
-/*
- * UniStrncmp_le:  Compare length limited string - native to little-endian
- */
-static inline int
-UniStrncmp_le(const wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	if (!n)
-		return 0;	/* Null strings are equal */
-	while ((*ucs1 == __le16_to_cpu(*ucs2)) && *ucs1 && --n) {
-		ucs1++;
-		ucs2++;
-	}
-	return (int) *ucs1 - (int) __le16_to_cpu(*ucs2);
-}
-
-/*
- * UniStrncpy:  Copy length limited string with pad
- */
-static inline wchar_t *
-UniStrncpy(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	wchar_t *anchor = ucs1;
-
-	while (n-- && *ucs2)	/* Copy the strings */
-		*ucs1++ = *ucs2++;
-
-	n++;
-	while (n--)		/* Pad with nulls */
-		*ucs1++ = 0;
-	return anchor;
-}
-
-/*
- * UniStrncpy_le:  Copy length limited string with pad to little-endian
- */
-static inline wchar_t *
-UniStrncpy_le(wchar_t *ucs1, const wchar_t *ucs2, size_t n)
-{
-	wchar_t *anchor = ucs1;
-
-	while (n-- && *ucs2)	/* Copy the strings */
-		*ucs1++ = __le16_to_cpu(*ucs2++);
-
-	n++;
-	while (n--)		/* Pad with nulls */
-		*ucs1++ = 0;
-	return anchor;
-}
-
-/*
- * UniStrstr:  Find a string in a string
- *
- * Returns:
- *     Address of first match found
- *     NULL if no matching string is found
- */
-static inline wchar_t *
-UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2)
-{
-	const wchar_t *anchor1 = ucs1;
-	const wchar_t *anchor2 = ucs2;
-
-	while (*ucs1) {
-		if (*ucs1 == *ucs2) {
-			/* Partial match found */
-			ucs1++;
-			ucs2++;
-		} else {
-			if (!*ucs2)	/* Match found */
-				return (wchar_t *) anchor1;
-			ucs1 = ++anchor1;	/* No match */
-			ucs2 = anchor2;
-		}
-	}
-
-	if (!*ucs2)		/* Both end together */
-		return (wchar_t *) anchor1;	/* Match found */
-	return NULL;		/* No match */
-}
-
-#ifndef UNIUPR_NOUPPER
-/*
- * UniToupper:  Convert a unicode character to upper case
- */
-static inline wchar_t
-UniToupper(register wchar_t uc)
-{
-	register const struct UniCaseRange *rp;
-
-	if (uc < sizeof(CifsUniUpperTable)) {
-		/* Latin characters */
-		return uc + CifsUniUpperTable[uc];	/* Use base tables */
-	} else {
-		rp = CifsUniUpperRange;	/* 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 */
-}
-
-/*
- * UniStrupr:  Upper case a unicode string
- */
-static inline __le16 *
-UniStrupr(register __le16 *upin)
-{
-	register __le16 *up;
-
-	up = upin;
-	while (*up) {		/* For all characters */
-		*up = cpu_to_le16(UniToupper(le16_to_cpu(*up)));
-		up++;
-	}
-	return upin;		/* Return input pointer */
-}
-#endif				/* UNIUPR_NOUPPER */
-
 #endif /* _CIFS_UNICODE_H */
diff --git a/fs/smb/client/cifs_uniupr.h b/fs/smb/client/cifs_uniupr.h
deleted file mode 100644
index b1d51d0da4fe..000000000000
--- a/fs/smb/client/cifs_uniupr.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- *   Copyright (c) International Business Machines  Corp., 2000,2002
- *
- * uniupr.h - Unicode compressed case ranges
-*/
-
-#ifndef UNIUPR_NOUPPER
-/*
- * Latin upper case
- */
-signed char CifsUniUpperTable[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 */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 030-03f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 040-04f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 050-05f */
-	0, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,	/* 060-06f */
-	-32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, 0, 0, 0, 0, 0,	/* 070-07f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 080-08f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 090-09f */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0a0-0af */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0b0-0bf */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0c0-0cf */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 0d0-0df */
-	-32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,	/* 0e0-0ef */
-	-32, -32, -32, -32, -32, -32, -32, 0, -32, -32, -32, -32, -32, -32, -32, 121,	/* 0f0-0ff */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 100-10f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 110-11f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 120-12f */
-	0, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0,	/* 130-13f */
-	-1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1,	/* 140-14f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 150-15f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 160-16f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0,	/* 170-17f */
-	0, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0,	/* 180-18f */
-	0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0,	/* 190-19f */
-	0, -1, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0,	/* 1a0-1af */
-	-1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0,	/* 1b0-1bf */
-	0, 0, 0, 0, 0, -1, -2, 0, -1, -2, 0, -1, -2, 0, -1, 0,	/* 1c0-1cf */
-	-1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -79, 0, -1, /* 1d0-1df */
-	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 */
-};
-
-/* Upper case range - Greek */
-static signed char UniCaseRangeU03a0[47] = {
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -38, -37, -37, -37,	/* 3a0-3af */
-	0, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,	/* 3b0-3bf */
-	-32, -32, -31, -32, -32, -32, -32, -32, -32, -32, -32, -32, -64,
-	-63, -63,
-};
-
-/* Upper case range - Cyrillic */
-static signed char UniCaseRangeU0430[48] = {
-	-32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,	/* 430-43f */
-	-32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,	/* 440-44f */
-	0, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, 0, -80, -80,	/* 450-45f */
-};
-
-/* Upper case range - Extended cyrillic */
-static signed char UniCaseRangeU0490[61] = {
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 490-49f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 4a0-4af */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 4b0-4bf */
-	0, 0, -1, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1,
-};
-
-/* Upper case range - Extended latin and greek */
-static signed char UniCaseRangeU1e00[509] = {
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1e00-1e0f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1e10-1e1f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1e20-1e2f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1e30-1e3f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1e40-1e4f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1e50-1e5f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1e60-1e6f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1e70-1e7f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1e80-1e8f */
-	0, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, -59, 0, -1, 0, -1,	/* 1e90-1e9f */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1ea0-1eaf */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1eb0-1ebf */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1ec0-1ecf */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1ed0-1edf */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1,	/* 1ee0-1eef */
-	0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0,	/* 1ef0-1eff */
-	8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f00-1f0f */
-	8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f10-1f1f */
-	8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f20-1f2f */
-	8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f30-1f3f */
-	8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f40-1f4f */
-	0, 8, 0, 8, 0, 8, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f50-1f5f */
-	8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f60-1f6f */
-	74, 74, 86, 86, 86, 86, 100, 100, 0, 0, 112, 112, 126, 126, 0, 0,	/* 1f70-1f7f */
-	8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f80-1f8f */
-	8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1f90-1f9f */
-	8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1fa0-1faf */
-	8, 8, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1fb0-1fbf */
-	0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1fc0-1fcf */
-	8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1fd0-1fdf */
-	8, 8, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,	/* 1fe0-1fef */
-	0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-/* Upper case range - Wide latin */
-static signed char UniCaseRangeUff40[27] = {
-	0, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,	/* ff40-ff4f */
-	-32, -32, -32, -32, -32, -32, -32, -32, -32, -32, -32,
-};
-
-/*
- * Upper Case Range
- */
-const struct UniCaseRange CifsUniUpperRange[] = {
-	{0x03a0, 0x03ce, UniCaseRangeU03a0},
-	{0x0430, 0x045f, UniCaseRangeU0430},
-	{0x0490, 0x04cc, UniCaseRangeU0490},
-	{0x1e00, 0x1ffc, UniCaseRangeU1e00},
-	{0xff40, 0xff5a, UniCaseRangeUff40},
-	{0}
-};
-#endif
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 4/4] fs/jfs: Use common ucs2 upper case table
  2023-06-28 23:24 [PATCH v2 0/4] dedupe smb unicode files linux
                   ` (2 preceding siblings ...)
  2023-06-28 23:24 ` [PATCH v2 3/4] fs/smb/client: Use common code in client linux
@ 2023-06-28 23:24 ` linux
  2023-07-12 23:17 ` [PATCH v2 0/4] dedupe smb unicode files Dr. David Alan Gilbert
  4 siblings, 0 replies; 21+ messages in thread
From: linux @ 2023-06-28 23:24 UTC (permalink / raw)
  To: sfrench, linkinjeon, tom, linux-cifs
  Cc: krisman, jfs-discussion, linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

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 <linux@treblig.org>
---
 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

diff --git a/fs/jfs/Kconfig b/fs/jfs/Kconfig
index 51e856f0e4b8..eab2f2d2291f 100644
--- a/fs/jfs/Kconfig
+++ b/fs/jfs/Kconfig
@@ -2,6 +2,7 @@
 config JFS_FS
 	tristate "JFS filesystem support"
 	select NLS
+	select NLS_UCS2_UTILS
 	select CRC32
 	select LEGACY_DIRECT_IO
 	help
diff --git a/fs/jfs/Makefile b/fs/jfs/Makefile
index 7156d2c218c7..b769bbf8bdc2 100644
--- a/fs/jfs/Makefile
+++ b/fs/jfs/Makefile
@@ -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
diff --git a/fs/jfs/jfs_unicode.h b/fs/jfs/jfs_unicode.h
index 9db62d047daa..b6a78d4aef1b 100644
--- a/fs/jfs/jfs_unicode.h
+++ b/fs/jfs/jfs_unicode.h
@@ -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 */
diff --git a/fs/jfs/jfs_uniupr.c b/fs/jfs/jfs_uniupr.c
deleted file mode 100644
index d0b18c7befb8..000000000000
--- a/fs/jfs/jfs_uniupr.c
+++ /dev/null
@@ -1,121 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- *   Copyright (C) International Business Machines Corp., 2000-2002
- */
-
-#include <linux/fs.h>
-#include "jfs_unicode.h"
-
-/*
- * Latin upper case
- */
-signed char UniUpperTable[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 */
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 030-03f */
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 040-04f */
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 050-05f */
-   0,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32, /* 060-06f */
- -32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,  0,  0,  0,  0,  0, /* 070-07f */
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 080-08f */
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 090-09f */
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 0a0-0af */
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 0b0-0bf */
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 0c0-0cf */
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 0d0-0df */
- -32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32, /* 0e0-0ef */
- -32,-32,-32,-32,-32,-32,-32,  0,-32,-32,-32,-32,-32,-32,-32,121, /* 0f0-0ff */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 100-10f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 110-11f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 120-12f */
-   0,  0,  0, -1,  0, -1,  0, -1,  0,  0, -1,  0, -1,  0, -1,  0, /* 130-13f */
-  -1,  0, -1,  0, -1,  0, -1,  0, -1,  0,  0, -1,  0, -1,  0, -1, /* 140-14f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 150-15f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 160-16f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0,  0, -1,  0, -1,  0, -1,  0, /* 170-17f */
-   0,  0,  0, -1,  0, -1,  0,  0, -1,  0,  0,  0, -1,  0,  0,  0, /* 180-18f */
-   0,  0, -1,  0,  0,  0,  0,  0,  0, -1,  0,  0,  0,  0,  0,  0, /* 190-19f */
-   0, -1,  0, -1,  0, -1,  0,  0, -1,  0,  0,  0,  0, -1,  0,  0, /* 1a0-1af */
-  -1,  0,  0,  0, -1,  0, -1,  0,  0, -1,  0,  0,  0, -1,  0,  0, /* 1b0-1bf */
-   0,  0,  0,  0,  0, -1, -2,  0, -1, -2,  0, -1, -2,  0, -1,  0, /* 1c0-1cf */
-  -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,-79,  0, -1, /* 1d0-1df */
-   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 */
-};
-
-/* Upper case range - Greek */
-static signed char UniCaseRangeU03a0[47] = {
-   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,-38,-37,-37,-37, /* 3a0-3af */
-   0,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32, /* 3b0-3bf */
- -32,-32,-31,-32,-32,-32,-32,-32,-32,-32,-32,-32,-64,-63,-63,
-};
-
-/* Upper case range - Cyrillic */
-static signed char UniCaseRangeU0430[48] = {
- -32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32, /* 430-43f */
- -32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32, /* 440-44f */
-   0,-80,-80,-80,-80,-80,-80,-80,-80,-80,-80,-80,-80,  0,-80,-80, /* 450-45f */
-};
-
-/* Upper case range - Extended cyrillic */
-static signed char UniCaseRangeU0490[61] = {
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 490-49f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 4a0-4af */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 4b0-4bf */
-   0,  0, -1,  0, -1,  0,  0,  0, -1,  0,  0,  0, -1,
-};
-
-/* Upper case range - Extended latin and greek */
-static signed char UniCaseRangeU1e00[509] = {
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1e00-1e0f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1e10-1e1f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1e20-1e2f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1e30-1e3f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1e40-1e4f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1e50-1e5f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1e60-1e6f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1e70-1e7f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1e80-1e8f */
-   0, -1,  0, -1,  0, -1,  0,  0,  0,  0,  0,-59,  0, -1,  0, -1, /* 1e90-1e9f */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1ea0-1eaf */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1eb0-1ebf */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1ec0-1ecf */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1ed0-1edf */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0, -1, /* 1ee0-1eef */
-   0, -1,  0, -1,  0, -1,  0, -1,  0, -1,  0,  0,  0,  0,  0,  0, /* 1ef0-1eff */
-   8,  8,  8,  8,  8,  8,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0, /* 1f00-1f0f */
-   8,  8,  8,  8,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 1f10-1f1f */
-   8,  8,  8,  8,  8,  8,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0, /* 1f20-1f2f */
-   8,  8,  8,  8,  8,  8,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0, /* 1f30-1f3f */
-   8,  8,  8,  8,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 1f40-1f4f */
-   0,  8,  0,  8,  0,  8,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0, /* 1f50-1f5f */
-   8,  8,  8,  8,  8,  8,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0, /* 1f60-1f6f */
-  74, 74, 86, 86, 86, 86,100,100,  0,  0,112,112,126,126,  0,  0, /* 1f70-1f7f */
-   8,  8,  8,  8,  8,  8,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0, /* 1f80-1f8f */
-   8,  8,  8,  8,  8,  8,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0, /* 1f90-1f9f */
-   8,  8,  8,  8,  8,  8,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0, /* 1fa0-1faf */
-   8,  8,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 1fb0-1fbf */
-   0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 1fc0-1fcf */
-   8,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 1fd0-1fdf */
-   8,  8,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, /* 1fe0-1fef */
-   0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-};
-
-/* Upper case range - Wide latin */
-static signed char UniCaseRangeUff40[27] = {
-   0,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32, /* ff40-ff4f */
- -32,-32,-32,-32,-32,-32,-32,-32,-32,-32,-32,
-};
-
-/*
- * Upper Case Range
- */
-UNICASERANGE UniUpperRange[] = {
-    { 0x03a0,  0x03ce,  UniCaseRangeU03a0 },
-    { 0x0430,  0x045f,  UniCaseRangeU0430 },
-    { 0x0490,  0x04cc,  UniCaseRangeU0490 },
-    { 0x1e00,  0x1ffc,  UniCaseRangeU1e00 },
-    { 0xff40,  0xff5a,  UniCaseRangeUff40 },
-    { 0 }
-};
diff --git a/fs/nls/nls_ucs2_data.h b/fs/nls/nls_ucs2_data.h
new file mode 100644
index 000000000000..1f454dc0f4e0
--- /dev/null
+++ b/fs/nls/nls_ucs2_data.h
@@ -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 */
diff --git a/fs/nls/nls_ucs2_utils.h b/fs/nls/nls_ucs2_utils.h
index 3500596ea993..ef18d30db1d0 100644
--- a/fs/nls/nls_ucs2_utils.h
+++ b/fs/nls/nls_ucs2_utils.h
@@ -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
  *
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-06-28 23:24 [PATCH v2 0/4] dedupe smb unicode files linux
                   ` (3 preceding siblings ...)
  2023-06-28 23:24 ` [PATCH v2 4/4] fs/jfs: Use common ucs2 upper case table linux
@ 2023-07-12 23:17 ` Dr. David Alan Gilbert
  2023-07-19 17:56   ` Steve French
  4 siblings, 1 reply; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-07-12 23:17 UTC (permalink / raw)
  To: sfrench, linkinjeon, tom, dave.kleikamp, shaggy, linux-cifs
  Cc: krisman, jfs-discussion, linux-kernel

* linux@treblig.org (linux@treblig.org) wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> 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 ',' )

> 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
> 
> -- 
> 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   |_______/

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-12 23:17 ` [PATCH v2 0/4] dedupe smb unicode files Dr. David Alan Gilbert
@ 2023-07-19 17:56   ` Steve French
  2023-07-19 18:02     ` Steve French
  0 siblings, 1 reply; 21+ messages in thread
From: Steve French @ 2023-07-19 17:56 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: linkinjeon, tom, dave.kleikamp, shaggy, linux-cifs, krisman,
	jfs-discussion, linux-kernel

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

On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert <dave@treblig.org> wrote:
>
> * linux@treblig.org (linux@treblig.org) wrote:
> > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> >
> > 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 ',' )
>
> > 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
> >
> > --
> > 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   |_______/



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-19 17:56   ` Steve French
@ 2023-07-19 18:02     ` Steve French
  2023-07-19 21:58       ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 21+ messages in thread
From: Steve French @ 2023-07-19 18:02 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: linkinjeon, tom, dave.kleikamp, shaggy, linux-cifs, krisman,
	jfs-discussion, linux-kernel

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)

On Wed, Jul 19, 2023 at 12:56 PM Steve French <smfrench@gmail.com> wrote:
>
> 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
>
> On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert <dave@treblig.org> wrote:
> >
> > * linux@treblig.org (linux@treblig.org) wrote:
> > > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> > >
> > > 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 ',' )
> >
> > > 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
> > >
> > > --
> > > 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   |_______/
>
>
>
> --
> Thanks,
>
> Steve



--
Thanks,

Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-19 18:02     ` Steve French
@ 2023-07-19 21:58       ` Dr. David Alan Gilbert
  2023-07-19 22:06         ` Dave Kleikamp
  0 siblings, 1 reply; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-07-19 21:58 UTC (permalink / raw)
  To: Steve French
  Cc: linkinjeon, tom, dave.kleikamp, shaggy, linux-cifs, krisman,
	jfs-discussion, linux-kernel

* Steve French (smfrench@gmail.com) 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.

> On Wed, Jul 19, 2023 at 12:56 PM Steve French <smfrench@gmail.com> wrote:
> >
> > 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

> > On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert <dave@treblig.org> wrote:
> > >
> > > * linux@treblig.org (linux@treblig.org) wrote:
> > > > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> > > >
> > > > 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 ',' )
> > >
> > > > 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
> > > >
> > > > --
> > > > 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   |_______/
> >
> >
> >
> > --
> > Thanks,
> >
> > Steve
> 
> 
> 
> --
> Thanks,
> 
> Steve
-- 
 -----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   |_______/

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-19 21:58       ` Dr. David Alan Gilbert
@ 2023-07-19 22:06         ` Dave Kleikamp
  2023-07-20 14:25           ` Tom Talpey
  2023-08-27 23:14           ` Steve French
  0 siblings, 2 replies; 21+ messages in thread
From: Dave Kleikamp @ 2023-07-19 22:06 UTC (permalink / raw)
  To: Dr. David Alan Gilbert, Steve French
  Cc: linkinjeon, tom, shaggy, linux-cifs, krisman, jfs-discussion,
	linux-kernel

On 7/19/23 4:58PM, Dr. David Alan Gilbert wrote:
> * Steve French (smfrench@gmail.com) 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.
> 
>> On Wed, Jul 19, 2023 at 12:56 PM Steve French <smfrench@gmail.com> wrote:
>>>
>>> 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:
Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>

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

> 
> Thanks.
> 
> Dave
> 
>>> On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert <dave@treblig.org> wrote:
>>>>
>>>> * linux@treblig.org (linux@treblig.org) wrote:
>>>>> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>>>>>
>>>>> 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 ',' )
>>>>
>>>>> 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
>>>>>
>>>>> --
>>>>> 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   |_______/
>>>
>>>
>>>
>>> --
>>> Thanks,
>>>
>>> Steve
>>
>>
>>
>> --
>> Thanks,
>>
>> Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-19 22:06         ` Dave Kleikamp
@ 2023-07-20 14:25           ` Tom Talpey
  2023-07-20 23:57             ` Dr. David Alan Gilbert
  2023-08-27 23:14           ` Steve French
  1 sibling, 1 reply; 21+ messages in thread
From: Tom Talpey @ 2023-07-20 14:25 UTC (permalink / raw)
  To: Dave Kleikamp, Dr. David Alan Gilbert, Steve French
  Cc: linkinjeon, shaggy, linux-cifs, krisman, jfs-discussion, linux-kernel

On 7/19/2023 6:06 PM, Dave Kleikamp wrote:
> On 7/19/23 4:58PM, Dr. David Alan Gilbert wrote:
>> * Steve French (smfrench@gmail.com) 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.
>>
>>> On Wed, Jul 19, 2023 at 12:56 PM Steve French <smfrench@gmail.com> 
>>> wrote:
>>>>
>>>> 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:
> Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>
> 
> 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.

> +++ b/fs/nls/nls_ucs2_utils.c
> @@ -1,19 +1,25 @@
> -/* SPDX-License-Identifier: GPL-2.0-or-later */
> +// SPDX-License-Identifier: GPL-2.0-or-later

vs

> +++ 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.

> +++ 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 (sfrench@us.ibm.com)
> + *   Modified by Namjae Jeon (linkinjeon@kernel.org)
> + *   Modified by Dr. David Alan Gilbert <linux@treblig.org>

Apart from considering these:

Reviewed-by: Tom Talpey <tom@talpey.com>

Nice work!

>>
>> Thanks.
>>
>> Dave
>>
>>>> On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert 
>>>> <dave@treblig.org> wrote:
>>>>>
>>>>> * linux@treblig.org (linux@treblig.org) wrote:
>>>>>> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>>>>>>
>>>>>> 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 ',' )
>>>>>
>>>>>> 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
>>>>>>
>>>>>> -- 
>>>>>> 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   |_______/
>>>>
>>>>
>>>>
>>>> -- 
>>>> Thanks,
>>>>
>>>> Steve
>>>
>>>
>>>
>>> -- 
>>> Thanks,
>>>
>>> Steve
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-20 14:25           ` Tom Talpey
@ 2023-07-20 23:57             ` Dr. David Alan Gilbert
  2023-07-21 13:19               ` Tom Talpey
  0 siblings, 1 reply; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-07-20 23:57 UTC (permalink / raw)
  To: Tom Talpey
  Cc: Dave Kleikamp, Steve French, linkinjeon, shaggy, linux-cifs,
	krisman, jfs-discussion, linux-kernel

* Tom Talpey (tom@talpey.com) wrote:
> On 7/19/2023 6:06 PM, Dave Kleikamp wrote:
> > On 7/19/23 4:58PM, Dr. David Alan Gilbert wrote:
> > > * Steve French (smfrench@gmail.com) 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.
> > > 
> > > > On Wed, Jul 19, 2023 at 12:56 PM Steve French
> > > > <smfrench@gmail.com> wrote:
> > > > > 
> > > > > 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:
> > Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>
> > 
> > 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.
> 
> > +++ b/fs/nls/nls_ucs2_utils.c
> > @@ -1,19 +1,25 @@
> > -/* SPDX-License-Identifier: GPL-2.0-or-later */
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> 
> vs
> 
> > +++ 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 ?

> 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 (sfrench@us.ibm.com)
 *   Modified by Namjae Jeon (linkinjeon@kernel.org)
 *

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!

> > +++ 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 (sfrench@us.ibm.com)
> > + *   Modified by Namjae Jeon (linkinjeon@kernel.org)
> > + *   Modified by Dr. David Alan Gilbert <linux@treblig.org>
> 
> Apart from considering these:
> 
> Reviewed-by: Tom Talpey <tom@talpey.com>

Thanks!

Dave

> Nice work!
> 
> > > 
> > > Thanks.
> > > 
> > > Dave
> > > 
> > > > > On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert
> > > > > <dave@treblig.org> wrote:
> > > > > > 
> > > > > > * linux@treblig.org (linux@treblig.org) wrote:
> > > > > > > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> > > > > > > 
> > > > > > > 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 ',' )
> > > > > > 
> > > > > > > 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
> > > > > > > 
> > > > > > > -- 
> > > > > > > 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   |_______/
> > > > > 
> > > > > 
> > > > > 
> > > > > -- 
> > > > > Thanks,
> > > > > 
> > > > > Steve
> > > > 
> > > > 
> > > > 
> > > > -- 
> > > > Thanks,
> > > > 
> > > > Steve
> > 
-- 
 -----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   |_______/

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-20 23:57             ` Dr. David Alan Gilbert
@ 2023-07-21 13:19               ` Tom Talpey
  2023-07-21 13:25                 ` Dr. David Alan Gilbert
  2023-07-21 20:58                 ` Dr. David Alan Gilbert
  0 siblings, 2 replies; 21+ messages in thread
From: Tom Talpey @ 2023-07-21 13:19 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: Dave Kleikamp, Steve French, linkinjeon, shaggy, linux-cifs,
	krisman, jfs-discussion, linux-kernel

On 7/20/2023 7:57 PM, Dr. David Alan Gilbert wrote:
> * Tom Talpey (tom@talpey.com) wrote:
>> On 7/19/2023 6:06 PM, Dave Kleikamp wrote:
>>> On 7/19/23 4:58PM, Dr. David Alan Gilbert wrote:
>>>> * Steve French (smfrench@gmail.com) 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.
>>>>
>>>>> On Wed, Jul 19, 2023 at 12:56 PM Steve French
>>>>> <smfrench@gmail.com> wrote:
>>>>>>
>>>>>> 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:
>>> Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>
>>>
>>> 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.
>>
>>> +++ b/fs/nls/nls_ucs2_utils.c
>>> @@ -1,19 +1,25 @@
>>> -/* SPDX-License-Identifier: GPL-2.0-or-later */
>>> +// SPDX-License-Identifier: GPL-2.0-or-later
>>
>> vs
>>
>>> +++ 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.

>> 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:

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

>   *
>   *   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.

>   *
>   *   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 (sfrench@us.ibm.com)
>   *   Modified by Namjae Jeon (linkinjeon@kernel.org)
>   *
> 
> 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.

> 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.

>>> +++ 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 (sfrench@us.ibm.com)
>>> + *   Modified by Namjae Jeon (linkinjeon@kernel.org)
>>> + *   Modified by Dr. David Alan Gilbert <linux@treblig.org>
>>
>> Apart from considering these:
>>
>> Reviewed-by: Tom Talpey <tom@talpey.com>
> 
> Thanks!
> 
> Dave
> 
>> Nice work!
>>
>>>>
>>>> Thanks.
>>>>
>>>> Dave
>>>>
>>>>>> On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert
>>>>>> <dave@treblig.org> wrote:
>>>>>>>
>>>>>>> * linux@treblig.org (linux@treblig.org) wrote:
>>>>>>>> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>>>>>>>>
>>>>>>>> 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 ',' )
>>>>>>>
>>>>>>>> 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
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> 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   |_______/
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> Thanks,
>>>>>>
>>>>>> Steve
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Thanks,
>>>>>
>>>>> Steve
>>>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-21 13:19               ` Tom Talpey
@ 2023-07-21 13:25                 ` Dr. David Alan Gilbert
  2023-07-21 20:58                 ` Dr. David Alan Gilbert
  1 sibling, 0 replies; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-07-21 13:25 UTC (permalink / raw)
  To: Tom Talpey
  Cc: Dave Kleikamp, Steve French, linkinjeon, shaggy, linux-cifs,
	krisman, jfs-discussion, linux-kernel

* Tom Talpey (tom@talpey.com) wrote:
> On 7/20/2023 7:57 PM, Dr. David Alan Gilbert wrote:
> > * Tom Talpey (tom@talpey.com) wrote:
> > > On 7/19/2023 6:06 PM, Dave Kleikamp wrote:
> > > > On 7/19/23 4:58PM, Dr. David Alan Gilbert wrote:
> > > > > * Steve French (smfrench@gmail.com) 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.
> > > > > 
> > > > > > On Wed, Jul 19, 2023 at 12:56 PM Steve French
> > > > > > <smfrench@gmail.com> wrote:
> > > > > > > 
> > > > > > > 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:
> > > > Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>
> > > > 
> > > > 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.
> > > 
> > > > +++ b/fs/nls/nls_ucs2_utils.c
> > > > @@ -1,19 +1,25 @@
> > > > -/* SPDX-License-Identifier: GPL-2.0-or-later */
> > > > +// SPDX-License-Identifier: GPL-2.0-or-later
> > > 
> > > vs
> > > 
> > > > +++ 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.
> 
> > > 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:
> 
> 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.

> >   *
> >   *   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.
> 
> >   *
> >   *   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 (sfrench@us.ibm.com)
> >   *   Modified by Namjae Jeon (linkinjeon@kernel.org)
> >   *
> > 
> > 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.
> 
> > 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 :-)

> But, totally your choice.

Thanks

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

Dave

> Tom.
> 
> > > > +++ 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 (sfrench@us.ibm.com)
> > > > + *   Modified by Namjae Jeon (linkinjeon@kernel.org)
> > > > + *   Modified by Dr. David Alan Gilbert <linux@treblig.org>
> > > 
> > > Apart from considering these:
> > > 
> > > Reviewed-by: Tom Talpey <tom@talpey.com>
> > 
> > Thanks!
> > 
> > Dave
> > 
> > > Nice work!
> > > 
> > > > > 
> > > > > Thanks.
> > > > > 
> > > > > Dave
> > > > > 
> > > > > > > On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert
> > > > > > > <dave@treblig.org> wrote:
> > > > > > > > 
> > > > > > > > * linux@treblig.org (linux@treblig.org) wrote:
> > > > > > > > > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> > > > > > > > > 
> > > > > > > > > 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 ',' )
> > > > > > > > 
> > > > > > > > > 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
> > > > > > > > > 
> > > > > > > > > -- 
> > > > > > > > > 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   |_______/
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > -- 
> > > > > > > Thanks,
> > > > > > > 
> > > > > > > Steve
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > -- 
> > > > > > Thanks,
> > > > > > 
> > > > > > Steve
> > > > 
-- 
 -----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   |_______/

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-21 13:19               ` Tom Talpey
  2023-07-21 13:25                 ` Dr. David Alan Gilbert
@ 2023-07-21 20:58                 ` Dr. David Alan Gilbert
  2023-07-21 21:06                   ` Paulo Alcantara
  1 sibling, 1 reply; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-07-21 20:58 UTC (permalink / raw)
  To: Tom Talpey
  Cc: Dave Kleikamp, Steve French, linkinjeon, shaggy, linux-cifs,
	krisman, jfs-discussion, linux-kernel

* Tom Talpey (tom@talpey.com) wrote:
> On 7/20/2023 7:57 PM, Dr. David Alan Gilbert wrote:
> > * Tom Talpey (tom@talpey.com) wrote:
> > > On 7/19/2023 6:06 PM, Dave Kleikamp wrote:
> > > > On 7/19/23 4:58PM, Dr. David Alan Gilbert wrote:
> > > > > * Steve French (smfrench@gmail.com) 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.
> > > > > 
> > > > > > On Wed, Jul 19, 2023 at 12:56 PM Steve French
> > > > > > <smfrench@gmail.com> wrote:
> > > > > > > 
> > > > > > > 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:
> > > > Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>
> > > > 
> > > > 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.
> > > 
> > > > +++ b/fs/nls/nls_ucs2_utils.c
> > > > @@ -1,19 +1,25 @@
> > > > -/* SPDX-License-Identifier: GPL-2.0-or-later */
> > > > +// SPDX-License-Identifier: GPL-2.0-or-later
> > > 
> > > vs
> > > 
> > > > +++ 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

> > > 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:
> 
> These two lines above aren't needed, because the lines below
> contain the copyright and where they originated. So just omit
> the two above.
> 
> >   *
> >   *   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.
> 
> >   *
> >   *   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 (sfrench@us.ibm.com)
> >   *   Modified by Namjae Jeon (linkinjeon@kernel.org)
> >   *
> > 
> > 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.
> 
> > 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.
> 
> > > > +++ 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 (sfrench@us.ibm.com)
> > > > + *   Modified by Namjae Jeon (linkinjeon@kernel.org)
> > > > + *   Modified by Dr. David Alan Gilbert <linux@treblig.org>
> > > 
> > > Apart from considering these:
> > > 
> > > Reviewed-by: Tom Talpey <tom@talpey.com>
> > 
> > Thanks!
> > 
> > Dave
> > 
> > > Nice work!
> > > 
> > > > > 
> > > > > Thanks.
> > > > > 
> > > > > Dave
> > > > > 
> > > > > > > On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert
> > > > > > > <dave@treblig.org> wrote:
> > > > > > > > 
> > > > > > > > * linux@treblig.org (linux@treblig.org) wrote:
> > > > > > > > > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> > > > > > > > > 
> > > > > > > > > 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 ',' )
> > > > > > > > 
> > > > > > > > > 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
> > > > > > > > > 
> > > > > > > > > -- 
> > > > > > > > > 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   |_______/
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > -- 
> > > > > > > Thanks,
> > > > > > > 
> > > > > > > Steve
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > -- 
> > > > > > Thanks,
> > > > > > 
> > > > > > Steve
> > > > 
-- 
 -----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   |_______/

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-21 20:58                 ` Dr. David Alan Gilbert
@ 2023-07-21 21:06                   ` Paulo Alcantara
  2023-07-21 21:12                     ` Tom Talpey
  2023-07-21 21:12                     ` Dr. David Alan Gilbert
  0 siblings, 2 replies; 21+ messages in thread
From: Paulo Alcantara @ 2023-07-21 21:06 UTC (permalink / raw)
  To: Dr. David Alan Gilbert, Tom Talpey
  Cc: Dave Kleikamp, Steve French, linkinjeon, shaggy, linux-cifs,
	krisman, jfs-discussion, linux-kernel

"Dr. David Alan Gilbert" <linux@treblig.org> writes:

> 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.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-21 21:06                   ` Paulo Alcantara
@ 2023-07-21 21:12                     ` Tom Talpey
  2023-07-21 21:12                     ` Dr. David Alan Gilbert
  1 sibling, 0 replies; 21+ messages in thread
From: Tom Talpey @ 2023-07-21 21:12 UTC (permalink / raw)
  To: Paulo Alcantara, Dr. David Alan Gilbert
  Cc: Dave Kleikamp, Steve French, linkinjeon, shaggy, linux-cifs,
	krisman, jfs-discussion, linux-kernel

On 7/21/2023 5:06 PM, Paulo Alcantara wrote:
> "Dr. David Alan Gilbert" <linux@treblig.org> writes:
> 
>> 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?

Reviewed-by: Tom Talpey <tom@talpey.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-21 21:06                   ` Paulo Alcantara
  2023-07-21 21:12                     ` Tom Talpey
@ 2023-07-21 21:12                     ` Dr. David Alan Gilbert
  2023-08-13  0:57                       ` Dr. David Alan Gilbert
  1 sibling, 1 reply; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-07-21 21:12 UTC (permalink / raw)
  To: Paulo Alcantara, smfrench
  Cc: Tom Talpey, Dave Kleikamp, linkinjeon, shaggy, linux-cifs,
	krisman, jfs-discussion, linux-kernel

* Paulo Alcantara (pc@manguebit.com) wrote:
> "Dr. David Alan Gilbert" <linux@treblig.org> writes:
> 
> > 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

-- 
 -----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   |_______/

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-21 21:12                     ` Dr. David Alan Gilbert
@ 2023-08-13  0:57                       ` Dr. David Alan Gilbert
  2023-08-13  3:11                         ` Steve French
  0 siblings, 1 reply; 21+ messages in thread
From: Dr. David Alan Gilbert @ 2023-08-13  0:57 UTC (permalink / raw)
  To: Paulo Alcantara, smfrench
  Cc: Tom Talpey, Dave Kleikamp, linkinjeon, shaggy, linux-cifs,
	krisman, jfs-discussion, linux-kernel

* Dr. David Alan Gilbert (dave@treblig.org) wrote:
> * Paulo Alcantara (pc@manguebit.com) wrote:
> > "Dr. David Alan Gilbert" <linux@treblig.org> writes:
> > 
> > > 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?

I've posted the v4.

Dave

> 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   |_______/

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-08-13  0:57                       ` Dr. David Alan Gilbert
@ 2023-08-13  3:11                         ` Steve French
  0 siblings, 0 replies; 21+ messages in thread
From: Steve French @ 2023-08-13  3:11 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: Paulo Alcantara, Tom Talpey, Dave Kleikamp, linkinjeon, shaggy,
	linux-cifs, krisman, jfs-discussion, linux-kernel

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

On Sat, Aug 12, 2023 at 7:57 PM Dr. David Alan Gilbert <dave@treblig.org> wrote:
>
> * Dr. David Alan Gilbert (dave@treblig.org) wrote:
> > * Paulo Alcantara (pc@manguebit.com) wrote:
> > > "Dr. David Alan Gilbert" <linux@treblig.org> writes:
> > >
> > > > 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?
>
> I've posted the v4.
>
> Dave
>
> > 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   |_______/



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/4] dedupe smb unicode files
  2023-07-19 22:06         ` Dave Kleikamp
  2023-07-20 14:25           ` Tom Talpey
@ 2023-08-27 23:14           ` Steve French
  1 sibling, 0 replies; 21+ messages in thread
From: Steve French @ 2023-08-27 23:14 UTC (permalink / raw)
  To: Dave Kleikamp
  Cc: Dr. David Alan Gilbert, linkinjeon, tom, shaggy, linux-cifs,
	krisman, jfs-discussion, linux-kernel

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

On Wed, Jul 19, 2023 at 5:06 PM Dave Kleikamp <dave.kleikamp@oracle.com> wrote:
>
> On 7/19/23 4:58PM, Dr. David Alan Gilbert wrote:
> > * Steve French (smfrench@gmail.com) 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.
> >
> >> On Wed, Jul 19, 2023 at 12:56 PM Steve French <smfrench@gmail.com> wrote:
> >>>
> >>> 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:
> Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>
>
> 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
>
> >
> > Thanks.
> >
> > Dave
> >
> >>> On Wed, Jul 12, 2023 at 6:28 PM Dr. David Alan Gilbert <dave@treblig.org> wrote:
> >>>>
> >>>> * linux@treblig.org (linux@treblig.org) wrote:
> >>>>> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> >>>>>
> >>>>> 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 ',' )
> >>>>
> >>>>> 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
> >>>>>
> >>>>> --
> >>>>> 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   |_______/
> >>>
> >>>
> >>>
> >>> --
> >>> Thanks,
> >>>
> >>> Steve
> >>
> >>
> >>
> >> --
> >> Thanks,
> >>
> >> Steve



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-08-27 23:16 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 23:24 [PATCH v2 0/4] dedupe smb unicode files linux
2023-06-28 23:24 ` [PATCH v2 1/4] fs/smb: Remove unicode 'lower' tables linux
2023-06-28 23:24 ` [PATCH v2 2/4] fs/smb: Swing unicode common code from smb->NLS linux
2023-06-28 23:24 ` [PATCH v2 3/4] fs/smb/client: Use common code in client linux
2023-06-28 23:24 ` [PATCH v2 4/4] fs/jfs: Use common ucs2 upper case table linux
2023-07-12 23:17 ` [PATCH v2 0/4] dedupe smb unicode files Dr. David Alan Gilbert
2023-07-19 17:56   ` Steve French
2023-07-19 18:02     ` Steve French
2023-07-19 21:58       ` Dr. David Alan Gilbert
2023-07-19 22:06         ` Dave Kleikamp
2023-07-20 14:25           ` Tom Talpey
2023-07-20 23:57             ` Dr. David Alan Gilbert
2023-07-21 13:19               ` Tom Talpey
2023-07-21 13:25                 ` Dr. David Alan Gilbert
2023-07-21 20:58                 ` Dr. David Alan Gilbert
2023-07-21 21:06                   ` Paulo Alcantara
2023-07-21 21:12                     ` Tom Talpey
2023-07-21 21:12                     ` Dr. David Alan Gilbert
2023-08-13  0:57                       ` Dr. David Alan Gilbert
2023-08-13  3:11                         ` Steve French
2023-08-27 23:14           ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.