update the check method for debugfs

On some platforms old methods can't find debugfs correctly,
so a new way via /proc/mounts is used to find debugfs path.

Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
diff --git a/cases/function/apei-inj/apei-inject.sh b/cases/function/apei-inj/apei-inject.sh
index ffa5cf0..5385937 100755
--- a/cases/function/apei-inj/apei-inject.sh
+++ b/cases/function/apei-inj/apei-inject.sh
@@ -49,7 +49,7 @@
 
 	check_debugfs
 	#APEI_IF should be defined after debugfs is mounted
-	APEI_IF=`mount | grep debugfs | cut -d ' ' -f3 | head -1`/apei/einj
+	APEI_IF=`cat /proc/mounts | grep debugfs | cut -d ' ' -f2 | head -1`/apei/einj
 
 	#if einj is a module, it is ensured to have been loaded
 	modinfo einj > /dev/null 2>&1
diff --git a/cases/function/hwpoison/random_offline b/cases/function/hwpoison/random_offline
index ecd0b3e..5528dfe 100755
--- a/cases/function/hwpoison/random_offline
+++ b/cases/function/hwpoison/random_offline
@@ -46,7 +46,7 @@
 
 [ "$(whoami)" != root ] && fail "Not root"
 check_debugfs
-DEBUG=`mount | grep debugfs | cut -d ' ' -f3 | head -1`
+DEBUG=`cat /proc/mounts | grep debugfs | cut -d ' ' -f2 | head -1`
 #if hwpoison_inject is a module, it is ensured to have been loaded
 modinfo hwpoison_inject > /dev/null 2>&1
 if [ $? -eq 0 ]; then
diff --git a/cases/function/pfa/run_pfa.sh b/cases/function/pfa/run_pfa.sh
index 116931e..0366dee 100755
--- a/cases/function/pfa/run_pfa.sh
+++ b/cases/function/pfa/run_pfa.sh
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+. ../../../lib/mce.sh
+
 INJ_TYPE=0x00000008
 APEI_IF=""
 PFA_BIN=""
@@ -10,15 +12,6 @@
 	exit 1
 }
 
-check_debugfs()
-{
-	mount|grep -q debugfs
-	[ $? -eq 0 ] && return
-	mount -t debugfs none /sys/kernel/debug
-	mount|grep -q /sys/kernel/debug
-	[ $? -ne 0 ] && invalid "Kernel without debugfs support ?"
-}
-
 apei_inj()
 {
 	echo $INJ_TYPE > $APEI_IF/error_type
@@ -47,7 +40,7 @@
 	PFA_BIN=$1
 	check_debugfs
 
-	APEI_IF=`mount | grep debugfs | cut -d ' ' -f3 | head -1`/apei/einj
+	APEI_IF=`cat /proc/mounts | grep debugfs | cut -d ' ' -f2 | head -1`/apei/einj
 
 	#if einj is not builtin, just insmod it
 	if [ ! -d $APEI_IF ]; then
diff --git a/lib/mce.sh b/lib/mce.sh
index 464f369..0000ccb 100755
--- a/lib/mce.sh
+++ b/lib/mce.sh
@@ -300,17 +300,17 @@
 
 check_debugfs()
 {
-	mount | grep -q /sys/kernel/debug
+	cat /proc/mounts | grep -q debug
 	[ $? -eq 0 ] && return
 	mount -t debugfs none /sys/kernel/debug
-	mount | grep -q /sys/kernel/debug
+	cat /proc/mounts | grep -q /sys/kernel/debug
 	[ $? -ne 0 ] && die "Kernel without debugfs support ?"
 }
 
 # should be called after check_debugfs
 check_mce()
 {
-	DEBUGFS=`mount | grep debugfs | cut -d ' ' -f3 | head -1`
+	DEBUGFS=`cat /proc/mounts | grep debugfs | cut -d ' ' -f2 | head -1`
 	[ ! -d ${DEBUGFS}/mce ] && die "Kernel without CONFIG_X86_MCE_INJECT ?"
 }