#!/bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
#  
#  
# Licensed Materials - Property of IBM 
#  
# (C) COPYRIGHT International Business Machines Corp. 2005,2007 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)90 1.10.1.11 src/avs/fs/mmfs/ts/admin/mmprodname.sh, mmfs, avs_rgpfs24, rgpfs24s012a 4/6/07 16:11:47
#############################################################
#
#  This file contains external product-related information.
#  It must be kept in sync with the corresponding packaging
#  files and the GPFS daemon counterpart prodname.h file.
#
#############################################################
sourceFile="mmprodname.sh"
[[ -n $DEBUGprodname ]] && set -x


# Set product release information.
# Must match the information in src/packages/gpfs/base/Makefile
# and src/packages/gpfs/base/gpfs.base.spec.
productVersion="3.1.0.12"
compatibleProductVersion="3.1.0.0"
initialProductVersion="3.1.0.0"    # first multi-release enabled version

# Set version numbers for communication between daemons.
# Must match the values in ts/classes/basic/prodname.h.
currentDaemonVersion=913           # CURRENT_DAEMON_VERSION_NO
compatibleDaemonVersion=901        # COMPATIBLE_DAEMON_VERSION_NO
initialDaemonVersion=901           # first multi-release enabled version


####################################################################
#
# Function:  Converts the input value to the corresponding
#            daemon version as per prodname.h (e.g. 700).
#
# Input:     $1 - release version string or daemon version
#
# Output:    daemon version (0 if unknown)
#
# Returns:   always 0
#
####################################################################
function releaseToDaemonVersion  # <releaseVersion>
{
  typeset sourceFile="mmprodname.sh"
  [[ -n $DEBUG || -n $DEBUGreleaseToDaemonVersion ]] && set -x
  $mmTRACE_ENTER "$*"
  typeset inValue=$1
  typeset result=0


  if [[ $inValue = 9[0-9][0-9] || $inValue = 8[0-9][0-9] || $inValue = 70[0-1] ]]
  then
    result=$inValue

  else
    case $inValue
    in
      2.2.0.[0-4])  result=700 ;;
      2.2.1.[0-9])  result=700 ;;
      2.2.1.1[0-3]) result=701 ;;

      2.3.0.0)      result=804 ;;
      2.3.0.1)      result=805 ;;
      2.3.0.2)      result=806 ;;
      2.3.0.3)      result=808 ;;
      2.3.0.4)      result=809 ;;
      2.3.0.5)      result=810 ;;
      2.3.0.6)      result=811 ;;
      2.3.0.7)      result=812 ;;
      2.3.0.8)      result=813 ;;
      2.3.0.9)      result=814 ;;
      2.3.0.10)     result=815 ;;
      2.3.0.11)     result=816 ;;
      2.3.0.12)     result=817 ;;
      2.3.0.13)     result=818 ;;
      2.3.0.14)     result=819 ;;
      2.3.0.15)     result=820 ;;
      2.3.0.16)     result=821 ;;
      2.3.0.17)     result=822 ;;
      2.3.0.18)     result=823 ;;
      2.3.0.19)     result=824 ;;
      2.3.0.20)     result=825 ;;
      2.3.0.21)     result=826 ;;
      2.3.0.22)     result=827 ;;

      3.1.0.0)      result=901 ;;
      3.1.0.1)      result=902 ;;
      3.1.0.2)      result=903 ;;
      3.1.0.3)      result=904 ;;
      3.1.0.4)      result=905 ;;
      3.1.0.5)      result=906 ;;
      3.1.0.6)      result=907 ;;
      3.1.0.7)      result=908 ;;
      3.1.0.8)      result=909 ;;
      3.1.0.9)      result=910 ;;
      3.1.0.10)     result=911 ;;
      3.1.0.11)     result=912 ;;
      3.1.0.12)     result=913 ;;

      * )           result=0   ;;

    esac  # end of case $inValue
  fi  #end of if [[ $inValue = 9[0-9][0-9] || $inValue = 8[0-9][0-9] || $inValue = 70[0-1] ]]

  print -- "$result"
  return 0

}  #------- end of function releaseToDaemonVersion --------------


####################################################################
#
# Function:  Converts the input value to the corresponding
#            product version string (e.g. 2.2.0.0).
#
# Input:     $1 - daemon version or release string
#
# Output:    release version or "unknown"
#
# Returns:   always 0
#
####################################################################
function releaseToProductVersion  # <daemonVersion>
{
  typeset sourceFile="mmprodname.sh"
  [[ -n $DEBUG || -n $DEBUGreleaseToProductVersion ]] && set -x
  $mmTRACE_ENTER "$*"
  typeset inValue=$1
  typeset result="unknown"


  if [[ $inValue = [23].[1234].[01].+([0-9]) ]]
  then
    result=$inValue

  else
    case $inValue
    in
      700)  result="2.2.0.0" ;;
      701)  result="2.2.1.10" ;;

      800)  result="2.3.0.0" ;;
      804)  result="2.3.0.0" ;;
      805)  result="2.3.0.1" ;;
      806)  result="2.3.0.2" ;;
      808)  result="2.3.0.3" ;;
      809)  result="2.3.0.4" ;;
      810)  result="2.3.0.5" ;;
      811)  result="2.3.0.6" ;;
      812)  result="2.3.0.7" ;;
      813)  result="2.3.0.8" ;;
      814)  result="2.3.0.9" ;;
      815)  result="2.3.0.10" ;;
      816)  result="2.3.0.11" ;;
      817)  result="2.3.0.12" ;;
      818)  result="2.3.0.13" ;;
      819)  result="2.3.0.14" ;;
      820)  result="2.3.0.15" ;;
      821)  result="2.3.0.16" ;;
      822)  result="2.3.0.17" ;;
      823)  result="2.3.0.18" ;;
      824)  result="2.3.0.19" ;;
      825)  result="2.3.0.20" ;;
      826)  result="2.3.0.21" ;;
      827)  result="2.3.0.22" ;;


      900)  result="3.1.0.0" ;;
      901)  result="3.1.0.0" ;;
      902)  result="3.1.0.1" ;;
      903)  result="3.1.0.2" ;;
      904)  result="3.1.0.3" ;;
      905)  result="3.1.0.4" ;;
      906)  result="3.1.0.5" ;;
      907)  result="3.1.0.6" ;;
      908)  result="3.1.0.7" ;;
      909)  result="3.1.0.8" ;;
      910)  result="3.1.0.9" ;;
      911)  result="3.1.0.10" ;;
      912)  result="3.1.0.11" ;;
      913)  result="3.1.0.12" ;;

      *  )  result="unknown" ;;

    esac  # end of case $inValue
  fi  # end of if [[ $inValue = [23].[1234].[01].+([0-9]) ]]

  print -- "$result"
  return 0

}  #------ end of function releaseToProductVersion ---------------


############################################################################
#
# Function:  Converts the input values to the corresponding
#            product version strings (e.g. 2.2.0.0)
#
# Input:     $* - a sequence of daemon version(s) or release string(s)
#
# Output:    release version(s) or "unknown"(s)
#
# Returns:   always 0
#
############################################################################
function releaseToProductVersionMult  # <daemonVersion> <daemonVersion> ...
{
  [[ -n $DEBUG || -n $DEBUGreleaseToProductVersionMult ]] && set -x
  $mmTRACE_ENTER "$*"
  typeset inValueList=$*
  typeset inValue

  for inValue in $inValueList
  do
     releaseToProductVersion $inValue
  done
  return 0

}  #------ end of function releaseToProductVersionMult ------------

