mcstop+release: argument for rmmod path specification

Change-Id: I80e4e7136a90bc65050ab8f7d39615581c47f317
This commit is contained in:
Balazs Gerofi
2019-10-03 13:58:20 +09:00
parent 309145587f
commit 41d37bcd30

View File

@@ -19,9 +19,13 @@ mem=""
cpus="" cpus=""
kill_in_use="" kill_in_use=""
while getopts k OPT RMMOD_PATH=/sbin/rmmod
while getopts r:k OPT
do do
case ${OPT} in case ${OPT} in
r)
RMMOD_PATH=${OPTARG}
;;
k) k)
kill_in_use=1 kill_in_use=1
;; ;;
@@ -35,6 +39,11 @@ if [[ "$#" -ge "$OPTIND" ]]; then
exit 1 exit 1
fi fi
if [ ! -f ${RMMOD_PATH} ]; then
echo "error: ${RMMOD_PATH} doesn't exist, please specify by -r <path_to_rmmod>"
exit 1
fi
# No SMP module? Exit. # No SMP module? Exit.
if ! grep ihk_smp_@ARCH@ /proc/modules &>/dev/null; then exit 0; fi if ! grep ihk_smp_@ARCH@ /proc/modules &>/dev/null; then exit 0; fi
@@ -109,7 +118,7 @@ fi
# Remove delegator if loaded # Remove delegator if loaded
if grep mcctrl /proc/modules &>/dev/null; then if grep mcctrl /proc/modules &>/dev/null; then
if ! sudo rmmod mcctrl 2>/dev/null; then if ! sudo ${RMMOD_PATH} mcctrl 2>/dev/null; then
echo "error: removing mcctrl" >&2 echo "error: removing mcctrl" >&2
exit 1 exit 1
fi fi
@@ -117,7 +126,7 @@ fi
# Remove SMP module # Remove SMP module
if grep ihk_smp_@ARCH@ /proc/modules &>/dev/null; then if grep ihk_smp_@ARCH@ /proc/modules &>/dev/null; then
if ! sudo rmmod ihk_smp_@ARCH@ 2>/dev/null; then if ! sudo ${RMMOD_PATH} ihk_smp_@ARCH@ 2>/dev/null; then
echo "error: removing ihk_smp_@ARCH@" >&2 echo "error: removing ihk_smp_@ARCH@" >&2
exit 1 exit 1
fi fi
@@ -125,7 +134,7 @@ fi
# Remove core module # Remove core module
if grep -E 'ihk\s' /proc/modules &>/dev/null; then if grep -E 'ihk\s' /proc/modules &>/dev/null; then
if ! sudo rmmod ihk 2>/dev/null; then if ! sudo ${RMMOD_PATH} ihk 2>/dev/null; then
echo "error: removing ihk" >&2 echo "error: removing ihk" >&2
exit 1 exit 1
fi fi