4 # name of the file with module
5 MODULE_FILE=swap_driver
10 # name of device visible in /proc/devices
14 DEVICE_FILE=__DEV_DIR__/${DEVICE}
16 MAJOR=`sed "/${DEVICE_NAME}/ ! d" /proc/devices | sed "s/ ${DEVICE_NAME}//"`
17 if [ "${MAJOR}" != "" ] ; then
18 echo "SWAP Driver is already loaded!"
21 MAJOR=`sed "/${DEVICE_NAME}/ ! d" /proc/devices | sed "s/ ${DEVICE_NAME}//"`
22 if [ "${MAJOR}" != "" ] ; then
23 echo "Error: Unable to unload driver module '${MODULE_FILE}'"
29 echo "loading module '${MODULE_FILE}'"
30 ./bin/insmod.sh ${MODULE_FILE}.ko device_name=${DEVICE_NAME}
32 echo "Error: Unable to load Swap Driver!"
36 MAJOR=`sed "/${DEVICE_NAME}/ ! d" /proc/devices | sed "s/ ${DEVICE_NAME}//"`
38 if [ ! -c ${DEVICE_FILE} ] ; then
39 echo "WARNING: Creating device node with major number [${DEVICE_MAJOR}]!"
40 mknod ${DEVICE_FILE} c ${DEVICE_MAJOR} 0
42 echo "Error: Unable to create device node!"
45 chmod a+r ${DEVICE_FILE}