Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp885252pxb; Wed, 27 Oct 2021 14:27:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGIxOcAdYQO3ig8te9ymKL0h7zDZwqs0yU2pi1Bw+jbdfP2VxFNDBHnXDxVZrxA0B4cg01 X-Received: by 2002:a05:6402:2550:: with SMTP id l16mr443560edb.229.1635370061280; Wed, 27 Oct 2021 14:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370061; cv=none; d=google.com; s=arc-20160816; b=H1hXA0zsfMeIAFRLO6d9nVXJIRNZQMxsq7yAjUZybS+SdUlCC/KoavkglHJhdz8QPk nqD9B78em9dAMRBJO3L2I6efOtnNKYm/Bs3zvtntZxS32pXd4ClGD5W/9Blbkf3gzkWc iyYtfUAfs/lfQbvrmHNohMwuBi2w5i0oAMP1V8xAcoOTx1ttmJYNWrtX4yn2tFrjkD9c EW8ssAMc6zVQva3d+kpNBsUh+/PwhG+5yhZW/yYYx8QbGzyIemwJzaR3VS4gerMJUPOg nRwSvmn5NCze8xXUvkE6Ne3vyy3MOThvU1DC1dmPyTL7wqmx688qlBkUYGODaaezT7Dx dsFw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zX4H+c6yjsL7nmSydorSU+0CJsORDXgMFr/2jjHZFSA=; b=eF2kZZoXiTz6DLuZb9HQQvG7LHLWPK2j3BapbQMq29e/9XvcL3lWkNiPaM9JNGYwWF MhLkfXVZlsM8vHWZw+oD2GiJCJBdrjvvgt7oO2JfguzBtqyaOM/YPsqv2n66qft1tP4l b1YqQbXfj0LHihOSS8PRko/Nsi2kdr4yvODixLTAo7+tJJyHn2PUnvuv2e2XTRg5K8bH zFHsBC37JrUjDOIP1z1MKq2SI0pIGNtpv0kVQbDPFAdSNNQhD0yn/AcV0xJLzeOg7P3g UEg0/vmKF42ctY2VgBuvhA2nFe/RivK+weF5PKCXNoeyHcGc0Wo/0NJZ5Gc+p3POc03n LRMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PUDOLBic; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s2si1715349ejn.5.2021.10.27.14.27.18; Wed, 27 Oct 2021 14:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PUDOLBic; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236730AbhJ0OXq (ORCPT + 99 others); Wed, 27 Oct 2021 10:23:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:44886 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242523AbhJ0OXT (ORCPT ); Wed, 27 Oct 2021 10:23:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635344454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zX4H+c6yjsL7nmSydorSU+0CJsORDXgMFr/2jjHZFSA=; b=PUDOLBicVIE+pHxpG9YhrG4x0jFZO/RZmYYqxOC6KL9F7hUL7fjZKWwlkWF61EpQZlQBIb t+vtWFqfWaH6lnjZgSqM+eA1GFf0ShhNNwvfTRjuEiY3FLNDDGQpHYw05tblkqb9Ha0Y68 uCUX7FijyWxhRmlyTN0hJ7qXlD1fykY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-212-qPeDJ-szN3GelsfqLB4SXQ-1; Wed, 27 Oct 2021 10:20:50 -0400 X-MC-Unique: qPeDJ-szN3GelsfqLB4SXQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CC047801ADE; Wed, 27 Oct 2021 14:20:49 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7D955DF35; Wed, 27 Oct 2021 14:20:48 +0000 (UTC) From: Lukas Czerner To: linux-ext4@vger.kernel.org, tytso@mit.edu Cc: linux-fsdevel@vger.kernel.org, Carlos Maiolino Subject: [PATCH v4 10/13] ext4: clean up return values in handle_mount_opt() Date: Wed, 27 Oct 2021 16:18:54 +0200 Message-Id: <20211027141857.33657-11-lczerner@redhat.com> In-Reply-To: <20211027141857.33657-1-lczerner@redhat.com> References: <20211027141857.33657-1-lczerner@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Clean up return values in handle_mount_opt() and rename the function to ext4_parse_param() Now we can use it in fs_context_operations as .parse_param. Signed-off-by: Lukas Czerner Reviewed-by: Carlos Maiolino --- fs/ext4/super.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 21845f899c50..b66087f55009 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -91,6 +91,7 @@ static int ext4_validate_options(struct fs_context *fc); static int ext4_check_opt_consistency(struct fs_context *fc, struct super_block *sb); static int ext4_apply_options(struct fs_context *fc, struct super_block *sb); +static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param); /* * Lock ordering @@ -118,6 +119,11 @@ static int ext4_apply_options(struct fs_context *fc, struct super_block *sb); * transaction start -> page lock(s) -> i_data_sem (rw) */ +static const struct fs_context_operations ext4_context_ops = { + .parse_param = ext4_parse_param, +}; + + #if !defined(CONFIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT2) static struct file_system_type ext2_fs_type = { .owner = THIS_MODULE, @@ -2269,7 +2275,7 @@ EXT4_SET_CTX(mount_opt); EXT4_SET_CTX(mount_opt2); EXT4_SET_CTX(mount_flags); -static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param) +static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct ext4_fs_context *ctx = fc->fs_private; struct fs_parse_result result; @@ -2310,30 +2316,30 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param) ctx->s_sb_block = result.uint_32; ctx->spec |= EXT4_SPEC_s_sb_block; } - return 1; + return 0; case Opt_removed: ext4_msg(NULL, KERN_WARNING, "Ignoring removed %s option", param->key); - return 1; + return 0; case Opt_abort: ctx_set_mount_flags(ctx, EXT4_MF_FS_ABORTED); - return 1; + return 0; case Opt_i_version: ctx_set_flags(ctx, SB_I_VERSION); - return 1; + return 0; case Opt_lazytime: ctx_set_flags(ctx, SB_LAZYTIME); - return 1; + return 0; case Opt_nolazytime: ctx_clear_flags(ctx, SB_LAZYTIME); - return 1; + return 0; case Opt_inlinecrypt: #ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT ctx_set_flags(ctx, SB_INLINECRYPT); #else ext4_msg(NULL, KERN_ERR, "inline encryption not supported"); #endif - return 1; + return 0; case Opt_errors: case Opt_data: case Opt_data_err: @@ -2485,7 +2491,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param) if (param->type == fs_value_is_flag) { ctx->spec |= EXT4_SPEC_DUMMY_ENCRYPTION; ctx->test_dummy_enc_arg = NULL; - return 1; + return 0; } if (*param->string && !(!strcmp(param->string, "v1") || @@ -2576,7 +2582,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param) ctx_clear_mount_opt(ctx, m->mount_opt); } } - return 1; + return 0; } static int parse_options(struct fs_context *fc, char *options) @@ -2612,7 +2618,7 @@ static int parse_options(struct fs_context *fc, char *options) param.key = key; param.size = v_len; - ret = handle_mount_opt(fc, ¶m); + ret = ext4_parse_param(fc, ¶m); if (param.string) kfree(param.string); if (ret < 0) -- 2.31.1