Skip to contentSkip to conversation

xfsprogs: fix the -V option for various shell scripts

PATCH In review Christoph Hellwig 2 participants 2 messages Sep 2, 2009 – Sep 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsprogs: fix the -V option for various shell scripts

For most of the shellscripts wrapping xfs_db or xfs_growfs the -V option is not implemented correctly. If we just add -V to the options for the underlying binaries we will never actually call it because the mandatory device / mount point argument is missing. Instead just call the underlying command with -V directly and exit early. This is what xfs_bmap.sh, xfs_mkfile and xfs_metadump.sh are already doing.

db/xfs_admin.sh +4 -1
Index: xfsprogs-dev/db/xfs_admin.sh
===================================================================
@@ -19,7 +19,10 @@ do
 	L)	DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";;
 	u)	DB_OPTS=$DB_OPTS" -r -c uuid";;
 	U)	DB_OPTS=$DB_OPTS" -c 'uuid "$OPTARG"'";;
-	V)	DB_OPTS=$DB_OPTS" -V";;
+	V)	xfs_db -p xfs_admin -V
+		status=$?
+		exit $status
+		;;
 	\?)	echo $USAGE 1>&2
 		exit 2
 		;;
db/xfs_check.sh +4 -1
Index: xfsprogs-dev/db/xfs_check.sh
===================================================================
@@ -13,11 +13,14 @@ do
 	s)	OPTS=$OPTS"-s ";;
 	t)	OPTS=$OPTS"-t ";;
 	v)	OPTS=$OPTS"-v ";;
-	V)	OPTS=$OPTS"-V ";;
 	i)	OPTS=$OPTS"-i "$OPTARG" ";;
 	b)	OPTS=$OPTS"-b "$OPTARG" ";;
 	f)	DBOPTS=$DBOPTS" -f";;
 	l)	DBOPTS=$DBOPTS" -l "$OPTARG" ";;
+	V)	xfs_db -p xfs_check -V
+		status=$?
+		exit $status
+		;;
 	\?)	echo $USAGE 1>&2
 		exit 2
 		;;
db/xfs_ncheck.sh +4 -1
Index: xfsprogs-dev/db/xfs_ncheck.sh
===================================================================
@@ -14,9 +14,12 @@ do
 	s)	OPTS=$OPTS"-s ";;
 	i)	OPTS=$OPTS"-i "$OPTARG" ";;
 	v)	OPTS=$OPTS"-v ";;
-	V)	OPTS=$OPTS"-V ";;
 	f)	DBOPTS=$DBOPTS" -f";;
 	l)	DBOPTS=$DBOPTS" -l "$OPTARG" ";;
+	V)	xfs_db -p xfs_ncheck -V
+		status=$?
+		exit $status
+		;;
 	\?)	echo $USAGE 1>&2
 		exit 2
 		;;
growfs/xfs_info.sh +4 -1
Index: xfsprogs-dev/growfs/xfs_info.sh
===================================================================
@@ -10,7 +10,10 @@ while getopts "t:V" c
 do
 	case $c in
 	t)	OPTS="-t $OPTARG" ;;
-	V)	OPTS="-V $OPTARG" ;;
+	V)	xfs_growfs -p xfs_info -V
+		status=$?
+		exit $status
+		;;
 	*)	echo $USAGE 1>&2
 		exit 2
 		;;

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Christoph Hellwig

For most of the shellscripts wrapping xfs_db or xfs_growfs the -V option is not implemented correctly. If we just add -V to the options for the underlying binaries we will never actually call it because the mandatory device / mount point argument is missing. Instead just call the underlying command with -V directly and exit early. This is what xfs_bmap.sh, xfs_mkfile and xfs_metadump.sh are already doing.

Quoted 71 lines

Index: xfsprogs-dev/db/xfs_admin.sh
===================================================================

db/xfs_admin.sh +4 -1
@@ -19,7 +19,10 @@ do
 	L)	DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";;
 	u)	DB_OPTS=$DB_OPTS" -r -c uuid";;
 	U)	DB_OPTS=$DB_OPTS" -c 'uuid "$OPTARG"'";;
-	V)	DB_OPTS=$DB_OPTS" -V";;
+	V)	xfs_db -p xfs_admin -V
+		status=$?
+		exit $status
+		;;
 	\?)	echo $USAGE 1>&2
 		exit 2
 		;;

Index: xfsprogs-dev/db/xfs_check.sh
===================================================================

db/xfs_check.sh +4 -1
@@ -13,11 +13,14 @@ do
 	s)	OPTS=$OPTS"-s ";;
 	t)	OPTS=$OPTS"-t ";;
 	v)	OPTS=$OPTS"-v ";;
-	V)	OPTS=$OPTS"-V ";;
 	i)	OPTS=$OPTS"-i "$OPTARG" ";;
 	b)	OPTS=$OPTS"-b "$OPTARG" ";;
 	f)	DBOPTS=$DBOPTS" -f";;
 	l)	DBOPTS=$DBOPTS" -l "$OPTARG" ";;
+	V)	xfs_db -p xfs_check -V
+		status=$?
+		exit $status
+		;;
 	\?)	echo $USAGE 1>&2
 		exit 2
 		;;

Index: xfsprogs-dev/db/xfs_ncheck.sh
===================================================================

db/xfs_ncheck.sh +4 -1
@@ -14,9 +14,12 @@ do
 	s)	OPTS=$OPTS"-s ";;
 	i)	OPTS=$OPTS"-i "$OPTARG" ";;
 	v)	OPTS=$OPTS"-v ";;
-	V)	OPTS=$OPTS"-V ";;
 	f)	DBOPTS=$DBOPTS" -f";;
 	l)	DBOPTS=$DBOPTS" -l "$OPTARG" ";;
+	V)	xfs_db -p xfs_ncheck -V
+		status=$?
+		exit $status
+		;;
 	\?)	echo $USAGE 1>&2
 		exit 2
 		;;

Index: xfsprogs-dev/growfs/xfs_info.sh
===================================================================

growfs/xfs_info.sh +4 -1
@@ -10,7 +10,10 @@ while getopts "t:V" c
 do
 	case $c in
 	t)	OPTS="-t $OPTARG" ;;
-	V)	OPTS="-V $OPTARG" ;;
+	V)	xfs_growfs -p xfs_info -V
+		status=$?
+		exit $status
+		;;
 	*)	echo $USAGE 1>&2
 		exit 2
 		;;
Quoted 5 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs