lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <165950051183.198922.10544333892197894472.stgit@magnolia>
Date:   Tue, 02 Aug 2022 21:21:51 -0700
From:   "Darrick J. Wong" <djwong@...nel.org>
To:     djwong@...nel.org, guaneryu@...il.com, zlang@...hat.com
Cc:     linux-xfs@...r.kernel.org, fstests@...r.kernel.org, guan@...u.me,
        tytso@....edu, linux-ext4@...r.kernel.org
Subject: [PATCH 2/3] common/rc: move XFS-specific parts of _scratch_options
 into common/xfs

From: Darrick J. Wong <djwong@...nel.org>

Move all the non-XFS code in _scratch_options into a
_scratch_xfs_options helper in common/xfs, in preparation to add ext4
bits.

Signed-off-by: Darrick J. Wong <djwong@...nel.org>
---
 common/rc  |   23 +++--------------------
 common/xfs |   23 +++++++++++++++++++++++
 2 files changed, 26 insertions(+), 20 deletions(-)


diff --git a/common/rc b/common/rc
index 52dd3b41..dc1d65c3 100644
--- a/common/rc
+++ b/common/rc
@@ -172,30 +172,13 @@ _clear_mount_stack()
 
 _scratch_options()
 {
-    local type=$1
-    local rt_opt=""
-    local log_opt=""
     SCRATCH_OPTIONS=""
 
-    if [ "$FSTYP" != "xfs" ]; then
-        return
-    fi
-
-    case $type in
-    mkfs)
-	SCRATCH_OPTIONS="$SCRATCH_OPTIONS -f"
-	rt_opt="-r"
-        log_opt="-l"
-	;;
-    mount)
-	rt_opt="-o"
-        log_opt="-o"
+    case "$FSTYP" in
+    "xfs")
+	_scratch_xfs_options "$@"
 	;;
     esac
-    [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
-	SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${rt_opt}rtdev=$SCRATCH_RTDEV"
-    [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
-	SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}logdev=$SCRATCH_LOGDEV"
 }
 
 _test_options()
diff --git a/common/xfs b/common/xfs
index 9f84dffb..f6f4cdd2 100644
--- a/common/xfs
+++ b/common/xfs
@@ -265,6 +265,29 @@ _xfs_check()
 	return $status
 }
 
+_scratch_xfs_options()
+{
+    local type=$1
+    local rt_opt=""
+    local log_opt=""
+
+    case $type in
+    mkfs)
+	SCRATCH_OPTIONS="$SCRATCH_OPTIONS -f"
+	rt_opt="-r"
+        log_opt="-l"
+	;;
+    mount)
+	rt_opt="-o"
+        log_opt="-o"
+	;;
+    esac
+    [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+	SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${rt_opt}rtdev=$SCRATCH_RTDEV"
+    [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	SCRATCH_OPTIONS="$SCRATCH_OPTIONS ${log_opt}logdev=$SCRATCH_LOGDEV"
+}
+
 _scratch_xfs_db_options()
 {
 	SCRATCH_OPTIONS=""

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ