Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > 330d23739d2091aabf309a2b6b951b73 > files > 2

megactl-0.4.1-8mdv2010.0.src.rpm

# Author: Adam Cécile <acecile@mandriva.com>
# License: Public domain

create_node() {
    # Since 2.6.25rc2 linux kernel, megadev0 is created dynamically by udev
    # See http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=90a95af85f22c82f87e5fb714bac7ee06673b0ff
    if [ ! -e /dev/megadev0 ]; then
        # Not available, try to create it by hand for kernel pre 2.6.25rc2
        grep -q 'megadev$' /proc/devices && MEGARAID="ok"
        if [ ! -z ${MEGARAID} ]; then
            MAJOR=`grep 'megadev$' /proc/devices | head -n 1 | awk '{ print $1 }'`
            mknod /dev/megadev0 c $MAJOR 0
            return $?
        fi
    fi
    if [ -e /dev/megadev0 ]; then
        return 0
    else
        return 1
    fi
}

create_node_sas() {
    grep -q 'megaraid_sas_ioctl$' /proc/devices && MEGARAIDSAS="ok"
    if [ ! -z ${MEGARAIDSAS} ]; then
        MAJOR=`grep 'megaraid_sas_ioctl$' /proc/devices | head -n 1 | awk '{ print $1 }'`
        test -e /dev/megaraid_sas_ioctl_node || mknod /dev/megaraid_sas_ioctl_node c $MAJOR 0
        return 0
    else
        return 1
    fi
}