Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19922029rwd; Wed, 28 Jun 2023 16:51:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KQAxT3vYiFgyzOWXiqvfczJj0k7EvlaycNV+6Kqitp17YafQA2gjoJiQ5bcNAs5y50vSy X-Received: by 2002:ac8:5a83:0:b0:401:e1e7:a291 with SMTP id c3-20020ac85a83000000b00401e1e7a291mr9278613qtc.22.1687996288220; Wed, 28 Jun 2023 16:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687996288; cv=none; d=google.com; s=arc-20160816; b=sodLx0xPOA0vYCeY9URHTeyl7B7D9aN4FzT81BdrmkeWpYCQphnVmPt+9ZwlfmnQia oBMMoW7c/s5777/RXImR7tuG2ITPvvBVFAbIM3jgbGl80mY+3Gcz7NavW+9VKdBpsXiw 4jnbteaXNGmbu0tgNSMQ3Py3eRhg4UxHu2er9Ua4jKEP4c0BSK6ssFCu/R5KGP22kKfO m3Ymf1xbucTmgYkXwKEMg/kWAOjSsE3VmbHXXZXUDeX0TZyr8HZInKKtjN+9JfSCKmVp iWij7a9P34UPFNP7dcgWEe0lc2SApcjjU6/nxQchARdyZQ/ME+jz/9yqM3ieg35f1KQz i1Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=I6mOd3aGt7IBhtkudJQZT6k5aBQc6MxUgBycQg/Cs5I=; fh=/6LtkWO7QdvYpQr0mj44Mir3vijK5yuNSLGAk5S+viw=; b=TKoQN7q7OJBr49bCqyHN+w6XoJ55ixDoflS9v7pe7TvvoYLJ0ikymgaU8/h7IOYu68 xwZ+IWpoHX1D8M9XKNMEOOUkLap1EsSy8e3ViYVr/Rf4+WX2QPHaUE+GP2GDiaLZlRsf NEcm5agr/OwONNLL8sy5FvtXPGlncxp9FvWYX+UAqq/0C5N7xm762S5gyEly5zIQyA+J zdzaq88MLft+aC6m7Dnn5DwXhotEUdFpQOylIRZDjKvbRWZ6IpCdFGRFRFumLi+hp0kb ch8Nww17iBofBsj8b5cSSZvA4/eETRo97IPtHFhrfquuN0jbC3XN6AwkeewlImhh+BkZ QwvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@treblig.org header.s=bytemarkmx header.b=a83Tv9TI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r191-20020a632bc8000000b005577ad28a97si9668309pgr.633.2023.06.28.16.51.14; Wed, 28 Jun 2023 16:51:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@treblig.org header.s=bytemarkmx header.b=a83Tv9TI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229755AbjF1XY7 (ORCPT + 99 others); Wed, 28 Jun 2023 19:24:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231496AbjF1XYt (ORCPT ); Wed, 28 Jun 2023 19:24:49 -0400 Received: from mx.treblig.org (unknown [IPv6:2a00:1098:5b::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD6F8131; Wed, 28 Jun 2023 16:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=I6mOd3aGt7IBhtkudJQZT6k5aBQc6MxUgBycQg/Cs5I=; b=a83Tv9TIpQJv5ZtnBTsDgxFVPh SIOggketT4m8GX08VNFiU5uY72vY2beAMlj5didxij6rtPETdocvzkrM9Ej4js60yXaXEYvIU8mDG KrM11X+GcFvzEPukt0S6GjDBshMkvQEgYAn87Ym1c3X2ignspImXGGZPZaoT4kUCRo0pZMbvTNkdh zOkKefnmjW5a0QEF2+XPsMWSB2hXS3Ia59OWBvidcCHgHr05Nl4HXQgBgxdKF0qONGoddUX7r4IF3 m91xFQt8+Lh/fLBOf6sh9VhW4tcqnmfuIJhH3zewcibbNMItzzfIHVBB//ltK1pEd+iBY7bjqTngy 7GJIKYXw==; Received: from localhost ([127.0.0.1] helo=dalek.home.treblig.org) by mx.treblig.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qEeWU-00GXy3-Pt; Wed, 28 Jun 2023 23:24:29 +0000 From: linux@treblig.org To: sfrench@samba.org, linkinjeon@kernel.org, tom@talpey.com, linux-cifs@vger.kernel.org Cc: krisman@collabora.com, jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org, "Dr. David Alan Gilbert" Subject: [PATCH v2 0/4] dedupe smb unicode files Date: Thu, 29 Jun 2023 00:24:13 +0100 Message-ID: <20230628232417.120844-1-linux@treblig.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Dr. David Alan Gilbert" 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