fs/nls: make load_nls() take a const parameter
Subsystems (3)
PATCH 1/1 fs/nls: make load_nls() take a const parameter
load_nls() take a char * parameter, use it to find nls module in list or construct the module name to load it.
This change make load_nls() take a const parameter, so we don't need do some cast like this:
ses->local_nls = load_nls((char *)ctx->local_nls->charset);
Also remove the cast in cifs code.
--- fs/nls/nls_base.c | 4 ++-- fs/smb/client/connect.c | 2 +- include/linux/nls.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/nls/nls_base.c +2 -2
@@ -272,7 +272,7 @@ int unregister_nls(struct nls_table * nls)return -EINVAL ; } -static struct nls_table *find_nls (char *charset) +static struct nls_table *find_nls (const char *charset) {struct nls_table *nls;spin_lock (&nls_lock);
@@ -288,7 +288,7 @@ static struct nls_table *find_nls(char *charset)return nls; } -struct nls_table *load_nls (char *charset) +struct nls_table *load_nls (const char *charset) {return try_then_request_module (find_nls (charset),"nls_%s" , charset); }
fs/smb/client/connect.c +1 -1
@@ -2290,7 +2290,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb3_fs_context *ctx) ses->sectype = ctx->sectype; ses->sign = ctx->sign; - ses->local_nls =load_nls ((char *)ctx->local_nls->charset); + ses->local_nls =load_nls (ctx->local_nls->charset);/* add server as first channel */ spin_lock (&ses->chan_lock);
include/linux/nls.h +1 -1
@@ -47,7 +47,7 @@ enum utf16_endian {/* nls_base.c */ extern int __register_nls (struct nls_table *,struct module *);extern int unregister_nls (struct nls_table *); -extern struct nls_table *load_nls (char *); +extern struct nls_table *load_nls (const char *charset);extern void unload_nls (struct nls_table *);extern struct nls_table *load_nls_default (void );#define register_nls (nls) __register_nls((nls), THIS_MODULE)
Signature · 1 line
2.40.1
Quoted 10 lines · Winston Wen
load_nls()take a char * parameter, use it to find nls module in list or construct the module name to load it.This change make
load_nls()take a const parameter, so we don't need do some cast like this:ses->local_nls = load_nls((char *)ctx->local_nls->charset);Also remove the cast in cifs code.
Quoted 7 lines
Suggested-by Stephen Rothwell <[email protected]>Signed-off-by Winston Wen <[email protected]>--- fs/nls/nls_base.c | 4 ++-- fs/smb/client/connect.c | 2 +- include/linux/nls.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
Changes look good, however you should probably get rid of the cifs.ko changes in this patch and for the cifs.ko one, you could resend without the casts.
Quoted 20 lines · On Fri, 21 Jul 2023 14:36:54 -0300 Paulo Alcantara <[email protected]> wrote:
Quoted 10 lines · Winston Wen
load_nls()take a char * parameter, use it to find nls module in list or construct the module name to load it.This change make
load_nls()take a const parameter, so we don't need do some cast like this:ses->local_nls = load_nls((char *)ctx->local_nls->charset);Also remove the cast in cifs code.
Quoted 7 lines
Suggested-by Stephen Rothwell <[email protected]>Signed-off-by Winston Wen <[email protected]>--- fs/nls/nls_base.c | 4 ++-- fs/smb/client/connect.c | 2 +- include/linux/nls.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
Quoted 4 lines
Changes look good, however you should probably get rid of the cifs.ko changes in this patch and for the cifs.ko one, you could resend without the casts.
Make sense. I've resent the patch, thanks!
Signature · 2 lines
Thanks, Winston