Skip to contentSkip to conversation

common: cleanups after common/rc split

PATCH New Eryu Guan 1 participant 1 message Dec 2, 2016

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH v2 1/1 common: cleanups after common/rc split

Fix code style issues after the common/rc split, e.g. use tab indention, fix if-then-else format, fix while-do and for-do format and various whitespace issues. No functional changes.

---

This is a v2 follow-up patch to Dave's "make common/rc easier to manage" patchset.

v2: Address Dave's comments
- update indention of switch-case-esac code block
- convert some multi-line "[ ... ] && ..." to "if-then-fi"
- group multi-line file dump code together and do stdout redirection on the whole code block once

 common/btrfs |  91 ++++++------
 common/xfs   | 450 ++++++++++++++++++++++++++++++-----------------------------
 2 files changed, 272 insertions(+), 269 deletions(-)
common/btrfs +45 -46
index 7cc4f5d..b022b79 100644
@@ -68,53 +68,53 @@ _require_btrfs_fs_feature()
 
 _check_btrfs_filesystem()
 {
-    device=$1
-
-    # If type is set, we're mounted
-    type=`_fs_type $device`
-    ok=1
-
-    if [ "$type" = "$FSTYP" ]
-    then
-        # mounted ...
-        mountpoint=`_umount_or_remount_ro $device`
-    fi
-
-    btrfsck $device >$tmp.fsck 2>&1
-    if [ $? -ne 0 ]
-    then
-        echo "_check_btrfs_filesystem: filesystem on $device is inconsistent (see $seqres.full)"
-
-        echo "_check_btrfs_filesystem: filesystem on $device is inconsistent" >>$seqres.full
-        echo "*** fsck.$FSTYP output ***"	>>$seqres.full
-        cat $tmp.fsck				>>$seqres.full
-        echo "*** end fsck.$FSTYP output"	>>$seqres.full
-
-        ok=0
-    fi
-    rm -f $tmp.fsck
-
-    if [ $ok -eq 0 ]
-    then
-        echo "*** mount output ***"		>>$seqres.full
-        _mount					>>$seqres.full
-        echo "*** end mount output"		>>$seqres.full
-    elif [ "$type" = "$FSTYP" ]
-    then
-	# was mounted ...
-	_mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint
-	ok=$?
-    fi
-
-    if [ $ok -eq 0 ]; then
-	status=1
-	if [ "$iam" != "check" ]; then
-		exit 1
+	device=$1
+
+	# If type is set, we're mounted
+	type=`_fs_type $device`
+	ok=1
+
+	if [ "$type" = "$FSTYP" ]; then
+		# mounted ...
+		mountpoint=`_umount_or_remount_ro $device`
 	fi
-	return 1
-    fi
 
-    return 0
+	btrfsck $device >$tmp.fsck 2>&1
+	if [ $? -ne 0 ]; then
+		(
+		echo "_check_btrfs_filesystem: filesystem on $device is inconsistent (see $seqres.full)"
+
+		echo "_check_btrfs_filesystem: filesystem on $device is inconsistent"
+		echo "*** fsck.$FSTYP output ***"
+		cat $tmp.fsck
+		echo "*** end fsck.$FSTYP output"
+		) >>$seqres.full
+
+		ok=0
+	fi
+	rm -f $tmp.fsck
+
+	if [ $ok -eq 0 ]; then
+		(
+		echo "*** mount output ***"
+		_mount
+		echo "*** end mount output"
+		) >>$seqres.full
+	elif [ "$type" = "$FSTYP" ]; then
+		# was mounted ...
+		_mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint
+		ok=$?
+	fi
+
+	if [ $ok -eq 0 ]; then
+		status=1
+		if [ "$iam" != "check" ]; then
+			exit 1
+		fi
+		return 1
+	fi
+
+	return 0
 }
 
 _require_btrfs_dev_del_by_devid()
@@ -332,4 +332,3 @@ _reload_btrfs_ko()
 	modprobe -r btrfs || _fail "btrfs unload failed"
 	modprobe btrfs || _fail "btrfs load failed"
 }
-
common/xfs +227 -223

567 lines not on this page · raw message

Signature · 1 line
2.9.3