Rename WM_ and wm_ prefixes to BA_ and ba_
authorBryn M. Reeves <bmr@redhat.com>
Wed, 31 Oct 2012 20:04:52 +0000 (20:04 +0000)
committerBryn M. Reeves <bmr@redhat.com>
Wed, 31 Oct 2012 20:05:55 +0000 (20:05 +0000)
Complete rename from WwidMap to BlkdevAlias

99-blkdevalias.rules
blkdevalias

index 345b4f7..e693823 100644 (file)
@@ -1,22 +1,22 @@
 KERNEL=="sd*[^0-9]" ENV{DEVTYPE}=="disk" \
     PROGRAM="/sbin/scsi_id -g -u -d$tempnode" \
     IMPORT="/sbin/blkdevalias map %c" \
 KERNEL=="sd*[^0-9]" ENV{DEVTYPE}=="disk" \
     PROGRAM="/sbin/scsi_id -g -u -d$tempnode" \
     IMPORT="/sbin/blkdevalias map %c" \
-    SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_USER}" GROUP="$env{WM_GROUP}"
+    SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}"
 
 KERNEL=="sd*[1-9]*" ENV{DEVTYPE}=="partition" \
     PROGRAM="/sbin/scsi_id -g -u -d/dev/$parent" \
     IMPORT="/sbin/blkdevalias map %c" \
 
 KERNEL=="sd*[1-9]*" ENV{DEVTYPE}=="partition" \
     PROGRAM="/sbin/scsi_id -g -u -d/dev/$parent" \
     IMPORT="/sbin/blkdevalias map %c" \
-    SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_USER}" GROUP="$env{WM_GROUP}" \
+    SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}" \
     OPTIONS+={link_priority=5}
 
 KERNEL=="dm*" ENV{DM_UUID}=="mpath*" \
     PROGRAM="/sbin/scsi_id -g -u -d$tempnode" \
     IMPORT="/sbin/blkdevalias map %c" \
     OPTIONS+={link_priority=5}
 
 KERNEL=="dm*" ENV{DM_UUID}=="mpath*" \
     PROGRAM="/sbin/scsi_id -g -u -d$tempnode" \
     IMPORT="/sbin/blkdevalias map %c" \
-    SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_USER}" GROUP="$env{WM_GROUP}" \
+    SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}" \
     OPTIONS+="link_priority=10"
 
 KERNEL=="dm*" ENV{DM_UUID}=="part*mpath*" \
     PROGRAM="/sbin/scsi_id -g -u -d/dev/$parent" \
     IMPORT="/sbin/blkdevalias map %c" \
     OPTIONS+="link_priority=10"
 
 KERNEL=="dm*" ENV{DM_UUID}=="part*mpath*" \
     PROGRAM="/sbin/scsi_id -g -u -d/dev/$parent" \
     IMPORT="/sbin/blkdevalias map %c" \
-    SYMLINK+="$env{WM_NAME}" OWNER="$env{WM_USER}" GROUP="$env{WM_GROUP}" \
+    SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}" \
     OPTIONS+="link_priority=15"
     OPTIONS+="link_priority=15"
index 9058235..a176ebb 100755 (executable)
@@ -3,21 +3,21 @@ declare -A WWIDMAP
 declare -A NAMEMAP
 declare -A TYPEMAP
 
 declare -A NAMEMAP
 declare -A TYPEMAP
 
-WM_DEBUG=yes
-WM_DEFAULT_USER="oracle"
-WM_DEFAULT_GROUP="oracle"
-WM_CONF_PATH="/etc/blkdevalias"
-WM_DEV_PATH="oracleasm/disks"
-WM_MAP_PATH="${WM_CONF_PATH}/map"
-WM_CONF="${WM_CONF_PATH}/conf"
-WM_USER="$WM_DEFAULT_USER"
-WM_GROUP="$WM_DEFAULT_GROUP"
-WM_LOCK="/var/lock/wm.lock"
-WM_SCSI_ID="/sbin/scsi_id"
-WM_SCSI_ID_FLAGS="-g -u"
+BA_DEBUG=yes
+BA_DEFAULT_USER="oracle"
+BA_DEFAULT_GROUP="oracle"
+BA_CONF_PATH="/etc/blkdevalias"
+BA_DEV_PATH="oracleasm/disks"
+BA_MAP_PATH="${BA_CONF_PATH}/map"
+BA_CONF="${BA_CONF_PATH}/conf"
+BA_USER="$BA_DEFAULT_USER"
+BA_GROUP="$BA_DEFAULT_GROUP"
+BA_LOCK="/var/lock/blkdevalias"
+BA_SCSI_ID="/sbin/scsi_id"
+BA_SCSI_ID_FLAGS="-g -u"
 
 # load config
 
 # load config
-. $WM_CONF
+. $BA_CONF
 
 error () {
     echo "ERROR: $@" 1>&2
 
 error () {
     echo "ERROR: $@" 1>&2
@@ -28,7 +28,7 @@ warn () {
 }
 
 debug () {
 }
 
 debug () {
-    [ "$WM_DEBUG" == "yes" ] && echo "$@" 1>&2
+    [ "$BA_DEBUG" == "yes" ] && echo "$@" 1>&2
 }
 
 # debug print
 }
 
 # debug print
@@ -41,8 +41,8 @@ print_wwid_mapping() {
 }
 
 # store the WWID map to disk
 }
 
 # store the WWID map to disk
-wm_store_wwid_map() {
-    TMP_MAP=$(mktemp --tmpdir=$WM_CONF_DIR)
+ba_store_wwid_map() {
+    TMP_MAP=$(mktemp --tmpdir=$BA_CONF_DIR)
     if [ ! -f "$TMP_MAP" ]; then
         error "could not write temporary file"
         exit 1
     if [ ! -f "$TMP_MAP" ]; then
         error "could not write temporary file"
         exit 1
@@ -50,13 +50,13 @@ wm_store_wwid_map() {
     for WWID in ${!WWIDMAP[@]}; do
         echo "$WWID ${WWIDMAP[$WWID]} ${TYPEMAP[$WWID]}"
     done  >> $TMP_MAP
     for WWID in ${!WWIDMAP[@]}; do
         echo "$WWID ${WWIDMAP[$WWID]} ${TYPEMAP[$WWID]}"
     done  >> $TMP_MAP
-    mv $TMP_MAP $WM_MAP_PATH
+    mv $TMP_MAP $BA_MAP_PATH
 }
 
 # read the WWID map from disk
 }
 
 # read the WWID map from disk
-wm_load_wwid_map() {
-    if [ ! -f "$WM_MAP_PATH" ] || [ ! -r "$WM_MAP_PATH"  ]; then
-        error "$WM_MAP_PATH does not exist or is not readable"
+ba_load_wwid_map() {
+    if [ ! -f "$BA_MAP_PATH" ] || [ ! -r "$BA_MAP_PATH"  ]; then
+        error "$BA_MAP_PATH does not exist or is not readable"
         exit 1
     fi
     while read WWID NNAME TYPE; do
         exit 1
     fi
     while read WWID NNAME TYPE; do
@@ -66,7 +66,7 @@ wm_load_wwid_map() {
         WWIDMAP[$WWID]="$NNAME"
         NAMEMAP[$NNAME]="$WWID"
         TYPEMAP[$WWID]="$TYPE"
         WWIDMAP[$WWID]="$NNAME"
         NAMEMAP[$NNAME]="$WWID"
         TYPEMAP[$WWID]="$TYPE"
-    done < $WM_MAP_PATH
+    done < $BA_MAP_PATH
 }
 
 # add_wwid_mapping <wwid> <nickname> <sd|mpath>
 }
 
 # add_wwid_mapping <wwid> <nickname> <sd|mpath>
@@ -109,11 +109,11 @@ del_wwid_mapping() {
     unset TYPEMAP[$WWID]
 }
 
     unset TYPEMAP[$WWID]
 }
 
-wm_scsi_id () {
-    $WM_SCSI_ID $WM_SCSI_ID_FLAGS $1
+ba_scsi_id () {
+    $BA_SCSI_ID $BA_SCSI_ID_FLAGS $1
 }
 
 }
 
-wm_configure () {
+ba_configure () {
     cat <<EOF
 Configuring the udev wwid map.
 
     cat <<EOF
 Configuring the udev wwid map.
 
@@ -124,44 +124,44 @@ will abort.
 
 EOF
 
 
 EOF
 
-    echo -n "Default user to own device nodes [$WM_USER]: "
-    read _WM_USER
-    if [ "$_WM_USER" != "" ]; then
-        WM_USER=$_WM_USER;
+    echo -n "Default user to own device nodes [$BA_USER]: "
+    read _BA_USER
+    if [ "$_BA_USER" != "" ]; then
+        BA_USER=$_BA_USER;
     fi
     fi
-    echo -n "Default group to own device nodes [$WM_GROUP]: "
-    read _WM_GROUP
-    if [ "$_WM_GROUP" != "" ]; then
-        WM_GROUP=$_WM_GROUP;
+    echo -n "Default group to own device nodes [$BA_GROUP]: "
+    read _BA_GROUP
+    if [ "$_BA_GROUP" != "" ]; then
+        BA_GROUP=$_BA_GROUP;
     fi
     fi
-    echo -n "Default device directory [$WM_DEV_PATH]: "
-    read _WM_DEV_PATH
-    if [ "$_WM_DEV_PATH" != "" ]; then
-        WM_DEV_PATH=$_WM_DEV_PATH;
+    echo -n "Default device directory [$BA_DEV_PATH]: "
+    read _BA_DEV_PATH
+    if [ "$_BA_DEV_PATH" != "" ]; then
+        BA_DEV_PATH=$_BA_DEV_PATH;
     fi
     fi
-    debug "WM_DEV_PATH=\"$WM_DEV_PATH\""
-    debug "WM_USER=\"$WM_USER\""
-    debug "WM_GROUP=\"$WM_GROUP\""
+    debug "BA_DEV_PATH=\"$BA_DEV_PATH\""
+    debug "BA_USER=\"$BA_USER\""
+    debug "BA_GROUP=\"$BA_GROUP\""
     echo -n "Writing wwid map configuration: "
     echo -n "Writing wwid map configuration: "
-    TMP_CONF=$(mktemp --tmpdir=$WM_CONF_PATH)
+    TMP_CONF=$(mktemp --tmpdir=$BA_CONF_PATH)
     if [ ! -f "$TMP_CONF" ]; then
         echo
         error "could not write temporary file"
         exit 1
     fi
     if [ ! -f "$TMP_CONF" ]; then
         echo
         error "could not write temporary file"
         exit 1
     fi
-    echo "WM_DEV_PATH=\"$WM_DEV_PATH\"" >> $TMP_CONF
-    echo "WM_USER=\"$WM_USER\"" >> $TMP_CONF
-    echo "WM_GROUP=\"$WM_GROUP\"" >> $TMP_CONF
-    mv $TMP_CONF $WM_CONF
+    echo "BA_DEV_PATH=\"$BA_DEV_PATH\"" >> $TMP_CONF
+    echo "BA_USER=\"$BA_USER\"" >> $TMP_CONF
+    echo "BA_GROUP=\"$BA_GROUP\"" >> $TMP_CONF
+    mv $TMP_CONF $BA_CONF
     if [ "$?" != 0 ]; then
     if [ "$?" != 0 ]; then
-        error "could not create configuration file $WM_CONF"
+        error "could not create configuration file $BA_CONF"
         exit
     fi
     echo -e "done\n"
 }
 
 # createdisk <nickname> <device>
         exit
     fi
     echo -e "done\n"
 }
 
 # createdisk <nickname> <device>
-wm_createdisk () {
+ba_createdisk () {
     local WWID DEV NNAME
     NNAME="$1"
     DEV="$2"
     local WWID DEV NNAME
     NNAME="$1"
     DEV="$2"
@@ -169,13 +169,13 @@ wm_createdisk () {
         echo "Usage: $0 createdisk <nickname> <device>"
         exit 2
     fi
         echo "Usage: $0 createdisk <nickname> <device>"
         exit 2
     fi
-    debug "wm_createdisk: WWID=\"$WWID\" DEV=\"$DEV\" NNAME=\"$NNAME\""
-    WWID=$(wm_scsi_id $DEV)
+    debug "ba_createdisk: WWID=\"$WWID\" DEV=\"$DEV\" NNAME=\"$NNAME\""
+    WWID=$(ba_scsi_id $DEV)
     add_wwid_mapping $WWID $NNAME "sd"
     add_wwid_mapping $WWID $NNAME "sd"
-    wm_store_wwid_map
+    ba_store_wwid_map
 }
 
 }
 
-wm_deletedisk () {
+ba_deletedisk () {
     local WWID NNAME
     NNAME=$1
     if [ "$NNAME" == "" ]; then
     local WWID NNAME
     NNAME=$1
     if [ "$NNAME" == "" ]; then
@@ -191,16 +191,16 @@ wm_deletedisk () {
     echo -n "Removing wwid map disk \"$NNAME\":"
     del_wwid_mapping $WWID \
     && echo "                                  [  OK  ]"
     echo -n "Removing wwid map disk \"$NNAME\":"
     del_wwid_mapping $WWID \
     && echo "                                  [  OK  ]"
-    wm_store_wwid_map
+    ba_store_wwid_map
 }
 
 }
 
-wm_list_disks () {
+ba_list_disks () {
     for D in ${WWIDMAP[@]}; do
         echo $D
     done | sort -V
 }
 
     for D in ${WWIDMAP[@]}; do
         echo $D
     done | sort -V
 }
 
-wm_querydisk () {
+ba_querydisk () {
     local LISTDEV ONDEV WWID NNAME
     if [ "$1" == "-d" ]; then
         LISTDEV=1
     local LISTDEV ONDEV WWID NNAME
     if [ "$1" == "-d" ]; then
         LISTDEV=1
@@ -212,13 +212,13 @@ wm_querydisk () {
         exit 2
     fi
     WWID=${NAMEMAP[$NNAME]}
         exit 2
     fi
     WWID=${NAMEMAP[$NNAME]}
-    debug "wm_querydisk: NNAME=\"$NNAME\" WWID=\"$WWID\" LISTDEV=\"$LISTDEV\""
+    debug "ba_querydisk: NNAME=\"$NNAME\" WWID=\"$WWID\" LISTDEV=\"$LISTDEV\""
     if [ "$LISTDEV" == "1" ]; then
     if [ "$LISTDEV" == "1" ]; then
-        DEV="/dev/$WM_DEV_PATH/$(readlink "/dev/$WM_DEV_PATH/$NNAME")"
+        DEV="/dev/$BA_DEV_PATH/$(readlink "/dev/$BA_DEV_PATH/$NNAME")"
         MAJ="$[0x$(stat --format "%t" $DEV)]"
         MIN="$[0x$(stat --format "%T" $DEV)]"
         ONDEV="on device [$MAJ,$MIN]"
         MAJ="$[0x$(stat --format "%t" $DEV)]"
         MIN="$[0x$(stat --format "%T" $DEV)]"
         ONDEV="on device [$MAJ,$MIN]"
-        debug "wm_querydisk: DEV=\"$DEV\" MAJ=\"$MAJ\" MIN=\"$MIN\""
+        debug "ba_querydisk: DEV=\"$DEV\" MAJ=\"$MAJ\" MIN=\"$MIN\""
     fi
     if [ "$WWID" != "" ]; then
         echo "$NNAME is a valid blkdevalias disk$ONDEV"
     fi
     if [ "$WWID" != "" ]; then
         echo "$NNAME is a valid blkdevalias disk$ONDEV"
@@ -227,47 +227,47 @@ wm_querydisk () {
     exit 1
 }
 
     exit 1
 }
 
-wm_scandisks () {
+ba_scandisks () {
     warn "(unimplemented)"
 }
 
     warn "(unimplemented)"
 }
 
-wm_map () {
+ba_map () {
     local WWID
     WWID="$1"
     if [ "$WWID" == "" ] || [ "${WWIDMAP[$WWID]}" == "" ]; then
         echo "Usage: $0 map <wwid>" 1>&2
         exit 2
     fi
     local WWID
     WWID="$1"
     if [ "$WWID" == "" ] || [ "${WWIDMAP[$WWID]}" == "" ]; then
         echo "Usage: $0 map <wwid>" 1>&2
         exit 2
     fi
-    echo "WM_WWID=$WWID"
-    echo "WM_NAME=$WM_DEV_PATH/${WWIDMAP[$WWID]}"
-    echo "WM_TYPE=${TYPEMAP[$WWID]}"
-    echo "WM_USER=$WM_USER"
-    echo "WM_GROUP=$WM_GROUP"
+    echo "BA_WWID=$WWID"
+    echo "BA_NAME=$BA_DEV_PATH/${WWIDMAP[$WWID]}"
+    echo "BA_TYPE=${TYPEMAP[$WWID]}"
+    echo "BA_USER=$BA_USER"
+    echo "BA_GROUP=$BA_GROUP"
 }
 
 # no point optimizing this out for configure
 }
 
 # no point optimizing this out for configure
-wm_load_wwid_map
+ba_load_wwid_map
 case "$1" in
     configure)
 case "$1" in
     configure)
-        wm_configure
+        ba_configure
         ;;
     createdisk)
         ;;
     createdisk)
-        wm_createdisk $2 $3
+        ba_createdisk $2 $3
         ;;
     deletedisk)
         ;;
     deletedisk)
-        wm_deletedisk $2
+        ba_deletedisk $2
         ;;
     listdisks)
         ;;
     listdisks)
-        wm_list_disks
+        ba_list_disks
         ;;
     querydisk)
         ;;
     querydisk)
-        wm_querydisk $2 $3
+        ba_querydisk $2 $3
         ;;
     scandisks)
         ;;
     scandisks)
-        wm_scandisks
+        ba_scandisks
         ;;
     map)
         ;;
     map)
-        wm_map $2
+        ba_map $2
         ;;
     *)
         echo -n "Usage: $0 "
         ;;
     *)
         echo -n "Usage: $0 "