From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, Christian Brauner <brauner@kernel.org>
Subject: Re: [PATCH 2/2 V2] fat: Convert to new mount api
Date: Mon, 01 Jul 2024 23:15:08 +0900 [thread overview]
Message-ID: <87v81p8ahf.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <72d3f126-ac1c-46d3-b346-6e941f377e1e@redhat.com> (Eric Sandeen's message of "Sat, 29 Jun 2024 13:02:48 -0500")
Eric Sandeen <sandeen@redhat.com> writes:
[...]
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> V2: Ignore all options during remount via
>
> if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE)
> return 0;
Thanks, basically looks good. However I tested a bit and found a bug,
and small comments.
> +extern const struct fs_parameter_spec fat_param_spec[];
> +extern int fat_init_fs_context(struct fs_context *fc, bool is_vfat);
> +extern void fat_free_fc(struct fs_context *fc);
> +
> +int fat_parse_param(struct fs_context *fc, struct fs_parameter *param,
> + int is_vfat);
> +extern int fat_reconfigure(struct fs_context *fc);
Let's remove extern from new one.
> +int fat_parse_param(struct fs_context *fc, struct fs_parameter *param,
> + int is_vfat)
Maybe better to use bool (and true/false) instead of int for is_vfat?
> +{
> + struct fat_mount_options *opts = fc->fs_private;
> + struct fs_parse_result result;
> + int opt;
> + char buf[50];
[...]
> + case Opt_codepage:
> + sprintf(buf, "cp%d", result.uint_32);
"buf" is unused.
> + /* obsolete mount options */
> + case Opt_obsolete:
> + infof(fc, "\"%s\" option is obsolete, not supported now",
> + param->key);
> + break;
I'm not sure though, "Opt_obsolete" should use fs_param_deprecated?
> + default:
> + return -EINVAL;
I'm not sure though, "default:" should not happen anymore?
> }
>
> return 0;
> }
> +EXPORT_SYMBOL_GPL(fat_parse_param);
[...]
> + /* If user doesn't specify allow_utime, it's initialized from dmask. */
> + if (opts->allow_utime == (unsigned short)-1)
> + opts->allow_utime = ~opts->fs_dmask & (S_IWGRP | S_IWOTH);
> + if (opts->unicode_xlate)
> + opts->utf8 = 0;
Probably, this should move to fat_parse_param()?
> + /* Apply pparsed options to sbi */
> + sbi->options = *opts;
/* Transfer ownership of iocharset to sbi->options */
opts->iocharset = NULL;
opts = &sbi->options;
opts->iocharset is freed by both of opts and sbi->options, we should fix
it like above or such.
> - sprintf(buf, "cp%d", sbi->options.codepage);
> + sprintf(buf, "cp%d", opts->codepage);
[...]
> /* FIXME: utf8 is using iocharset for upper/lower conversion */
> if (sbi->options.isvfat) {
> - sbi->nls_io = load_nls(sbi->options.iocharset);
> + sbi->nls_io = load_nls(opts->iocharset);
> if (!sbi->nls_io) {
> fat_msg(sb, KERN_ERR, "IO charset %s not found",
> - sbi->options.iocharset);
> + opts->iocharset);
> goto out_fail;
Revert above to remove opts usage to not touch after ownership transfer
if we fix the bug like that way.
> +static int msdos_parse_param(struct fs_context *fc, struct fs_parameter *param)
> +{
> + return fat_parse_param(fc, param, 0);
If we changed int to bool, 0 to false.
> +static int msdos_init_fs_context(struct fs_context *fc)
> +{
> + int err;
> +
> + /* Initialize with isvfat == 0 */
> + err = fat_init_fs_context(fc, 0);
If we changed int to bool, 0 to false.
> +static int vfat_parse_param(struct fs_context *fc, struct fs_parameter *param)
> +{
> + return fat_parse_param(fc, param, 1);
If we changed int to bool, 0 to true.
> +static int vfat_init_fs_context(struct fs_context *fc)
> +{
> + int err;
> +
> + /* Initialize with isvfat == 1 */
> + err = fat_init_fs_context(fc, 1);
If we changed int to bool, 0 to true.
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
next prev parent reply other threads:[~2024-07-01 14:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-29 17:30 [PATCH 0/2] fat: convert to the new mount API Eric Sandeen
2024-06-29 17:31 ` [PATCH 1/2] fat: move debug into fat_mount_options Eric Sandeen
2024-06-29 17:32 ` [PATCH 2/2] fat: Convert to new mount api Eric Sandeen
2024-06-29 18:02 ` [PATCH 2/2 V2] " Eric Sandeen
2024-07-01 14:15 ` OGAWA Hirofumi [this message]
2024-07-01 17:35 ` Eric Sandeen
2024-07-01 20:20 ` Eric Sandeen
2024-07-02 5:04 ` OGAWA Hirofumi
2024-06-29 18:00 ` [PATCH 0/2] fat: convert to the new mount API Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v81p8ahf.fsf@mail.parknet.co.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox