#!/bin/sh
#
# devmap_name.sh
#
# Simple shell script replacement for devmap_name
#
# Usage: devmap_name <major> <minor>
#

DMSETUP=/sbin/dmsetup

if [ ! -x $DMSETUP ]; then
    exit 1
fi

get_table_name()
{
    local maj=$1
    local min=$2

    $DMSETUP ls | while read name devt; do
	if [ "$devt" = "($maj, $min)" ]; then
	    echo "$name"
	fi
    done
}

get_table_name $1 $2
