]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests: fix internal _xfs_check to handle logdev etc
authorEric Sandeen <sandeen@redhat.com>
Thu, 2 May 2013 14:53:19 +0000 (14:53 +0000)
committerRich Johnston <rjohnston@sgi.com>
Fri, 3 May 2013 16:06:57 +0000 (11:06 -0500)
Pull all of the old xfs_check script into common/rc:_xfs_check()
so that it properly handles all options, including external log
devices.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
common/rc

index 846d47daf3dd211fb510b56334f55e0e85c34248..bf1c8b7111ad773a3001bfd99c0cdfc71ab941e8 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -393,8 +393,8 @@ _xfs_check()
 {
     OPTS=" "
     DBOPTS=" "
+    USAGE="Usage: xfs_check [-fsvV] [-l logdev] [-i ino]... [-b bno]... special"
 
-    OPTIND=1
     while getopts "b:fi:l:stvV" c
     do
         case $c in
@@ -410,8 +410,17 @@ _xfs_check()
                 ;;
         esac
     done
-    ${XFS_DB_PROG}${DBOPTS} -F -i -p xfs_check -c "check$OPTS" $1
-    return $?
+    set -- extra $@
+    shift $OPTIND
+    case $# in
+        1)    ${XFS_DB_PROG}${DBOPTS} -F -i -p xfs_check -c "check$OPTS" $1
+               status=$?
+               ;;
+        2)    echo $USAGE 1>&1
+              status=2
+              ;;
+    esac
+    return $status
 }
 
 _setup_large_ext4_fs()