Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp537209pxb; Thu, 21 Oct 2021 04:46:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBakKywru23KaCJL0FySZgyAxt+v2KpPLNkitS2wttalOy7isM4rwEew2ps9HVLMLV95aG X-Received: by 2002:a17:907:3f9c:: with SMTP id hr28mr6704408ejc.246.1634816776763; Thu, 21 Oct 2021 04:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634816776; cv=none; d=google.com; s=arc-20160816; b=nIi0WpO7xyE1HDocqz8QKdN2ocOwEw1mr9OKtYIIILVKoCm1YOoz3VsqX7aGhX+1Sd oLlvqhhNzssC8i7KmwPQAi6Vym6pUfS/PL2DVodD6lbO0xlMPCemnecftPso6i+TdLT/ QVtcZsH/pGYYWAIlJFt/PDd4PQFB+gB4BoSZ6GFPYONAT4f/4PRCs5Bho3q4V58QrT1r cjrsUJehAnMKClnOgfQkp2lDdom88DIbfnmbFJ7QskA3d/Z/Bt1mMPP/ugsfbpYsRYOC jWZ9qH9oeNkD9Ar4Mc8A95UaApLuDE6eic5OHeGsqNpkLuyZMDUOZcgkraNeSUA5yGN/ JlYQ== 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=dBomDJo1sD2uF9c5jSKDx6vw9p816vxJCbW/FzejAFk=; b=ShcbAUQ5MWeaALJR6v8UvbnTITRP5UJDPqLNeKS0LkE621CWKP1Q6uYMKz9kJD9b2h MwCU6I7liSJCRkoC5UwpuLA1buPUZyLFXhabqAkvzW6iycfQR5K8fLWc9W5IWaaSLBaM nMA8qM7SikEYgFX+RvhNT57XL4EXUB+SDnBuNVaELDNsLBI9y5uWmm+2mG+X5jYlDg6q VskDrIn/kFZjM1zYi4IfdvVNKy/47GlsBS9J+18GLG7++n1EZQYDNp8ubSn2D1AgiwFd OAAc7fuRXbxVXYDZTP+l88PtODR/+IHLu8Fd4H/meOe78WJPZzUVPv/xN2ezRkW1O6MI hE4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=geMVNW0w; 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 ga40si8990654ejc.152.2021.10.21.04.45.53; Thu, 21 Oct 2021 04:46:16 -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=geMVNW0w; 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 S231271AbhJULrv (ORCPT + 99 others); Thu, 21 Oct 2021 07:47:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49513 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbhJULro (ORCPT ); Thu, 21 Oct 2021 07:47:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634816728; 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=dBomDJo1sD2uF9c5jSKDx6vw9p816vxJCbW/FzejAFk=; b=geMVNW0wSXKn52lfzJ5f1Qp/NrxrpvL9TbFAKFlhUg6u+v2ZR53LQowVFQfgCtJZuUzr0N ZEmIHDOmiN3KBJDiPR92SMSRwXw2YLaJTHKgNNbVr87dphxA/Ieu1mzfreguPfVCnorwvv ExtqgnsUZ8MX7+eKDorxrApS0ouk9Y8= 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-569-dVHkESHeNFqvbUuZHE2pAw-1; Thu, 21 Oct 2021 07:45:26 -0400 X-MC-Unique: dVHkESHeNFqvbUuZHE2pAw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 941401808304; Thu, 21 Oct 2021 11:45:25 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABEAC6911D; Thu, 21 Oct 2021 11:45:24 +0000 (UTC) From: Lukas Czerner To: linux-ext4@vger.kernel.org, tytso@mit.edu Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH v3 10/13] ext4: clean up return values in handle_mount_opt() Date: Thu, 21 Oct 2021 13:45:05 +0200 Message-Id: <20211021114508.21407-11-lczerner@redhat.com> In-Reply-To: <20211021114508.21407-1-lczerner@redhat.com> References: <20211021114508.21407-1-lczerner@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 --- 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 fd48353e8259..bdcaa158eab8 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, @@ -2268,7 +2274,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; @@ -2309,30 +2315,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: @@ -2484,7 +2490,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") || @@ -2575,7 +2581,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) @@ -2611,7 +2617,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