From: Dave Chinner <david@fromorbit.com>
To: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>
Cc: fstests@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-xfs@vger.kernel.org, ritesh.list@gmail.com,
ojaswin@linux.ibm.com, djwong@kernel.org, zlang@kernel.org
Subject: Re: [PATCH v2 1/2] common: Move exit related functions to a common/exit
Date: Wed, 30 Apr 2025 09:51:21 +1000 [thread overview]
Message-ID: <aBFl-eKBBwG-QxCm@dread.disaster.area> (raw)
In-Reply-To: <a2e20e1d74360a76fd2a1ef553cac6094897bff2.1745908976.git.nirjhar.roy.lists@gmail.com>
On Tue, Apr 29, 2025 at 06:52:53AM +0000, Nirjhar Roy (IBM) wrote:
> Introduce a new file common/exit that will contain all the exit
> related functions. This will remove the dependencies these functions
> have on other non-related helper files and they can be indepedently
> sourced. This was suggested by Dave Chinner[1].
>
> [1] https://lore.kernel.org/linux-xfs/Z_UJ7XcpmtkPRhTr@dread.disaster.area/
> Suggested-by: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
> ---
> common/config | 17 +----------------
> common/exit | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
> common/preamble | 1 +
> common/punch | 5 -----
> common/rc | 28 ---------------------------
> 5 files changed, 52 insertions(+), 49 deletions(-)
> create mode 100644 common/exit
Neither of my replys to v1 made it to the list [1], so I'll have to
repeat what I said here.
I did point out that I had already sent this out here:
https://lore.kernel.org/fstests/20250417031208.1852171-4-david@fromorbit.com/
but now this version is mostly the same (except for things noted
below) so I'm good with this.
>
> diff --git a/common/config b/common/config
> index eada3971..6a60d144 100644
> --- a/common/config
> +++ b/common/config
> @@ -38,7 +38,7 @@
> # - this script shouldn't make any assertions about filesystem
> # validity or mountedness.
> #
> -
> +. common/exit
> . common/test_names
This isn't needed. Include it in check and other high level scripts
(which need to include this, anyway) before including common/config.
> diff --git a/common/exit b/common/exit
> new file mode 100644
> index 00000000..ad7e7498
> --- /dev/null
> +++ b/common/exit
> @@ -0,0 +1,50 @@
> +##/bin/bash
> +
> +# This functions sets the exit code to status and then exits. Don't use
> +# exit directly, as it might not set the value of "$status" correctly, which is
> +# used as an exit code in the trap handler routine set up by the check script.
> +_exit()
> +{
> + test -n "$1" && status="$1"
> + exit "$status"
> +}
> +
> +_fatal()
> +{
> + echo "$*"
> + _exit 1
> +}
> +
> +_die()
> +{
> + echo $@
> + _exit 1
> +}
This should be removed and replaced with _fatal
> +die_now()
> +{
> + _exit 1
> +}
And this should be removed as well.
i.e. These two functions are only used by common/punch, so change
them to use _fatal and _exit rather than duplicating the wrappers.
> diff --git a/common/preamble b/common/preamble
> index ba029a34..9b6b4b26 100644
> --- a/common/preamble
> +++ b/common/preamble
> @@ -33,6 +33,7 @@ _register_cleanup()
> # explicitly as a member of the 'all' group.
> _begin_fstest()
> {
> + . common/exit
> if [ -n "$seq" ]; then
> echo "_begin_fstest can only be called once!"
> _exit 1
Please leave a blank line between includes and unrelated code.
-Dave.
[1] Thanks Google, for removing mail auth methods without any
warning and not reporting permanent delivery failure on attempts
to send mail an unsupported auth method.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2025-04-29 23:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 6:52 [PATCH v2 0/2] common: Move exit related functions to common/exit Nirjhar Roy (IBM)
2025-04-29 6:52 ` [PATCH v2 1/2] common: Move exit related functions to a common/exit Nirjhar Roy (IBM)
2025-04-29 14:07 ` Nirjhar Roy (IBM)
2025-04-29 23:51 ` Dave Chinner [this message]
2025-04-30 6:13 ` Nirjhar Roy (IBM)
2025-04-29 6:52 ` [PATCH v2 2/2] check: Replace exit with _exit in check Nirjhar Roy (IBM)
2025-04-29 23:59 ` Dave Chinner
2025-04-30 12:13 ` Nirjhar Roy (IBM)
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=aBFl-eKBBwG-QxCm@dread.disaster.area \
--to=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=nirjhar.roy.lists@gmail.com \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=zlang@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.