#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # # # Licensed Materials - Property of IBM # # (C) COPYRIGHT International Business Machines Corp. 2004,2005 # 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 # @(#)12 1.2 src/avs/fs/mmfs/ts/admin/mmdynamicmap.sh, mmfs, avs_rgpfs24, rgpfs240610b 4/4/05 10:44:21 ######################################################################### # # Usage: mmdynamicmap Device # ######################################################################### # Include global declarations and service routines. . /usr/lpp/mmfs/bin/mmglobfuncs . /usr/lpp/mmfs/bin/mmsdrfsdef . /usr/lpp/mmfs/bin/mmfsfuncs sourceFile="mmdynamicmap.sh" [[ -n $DEBUG || -n $DEBUGmmdynamicmap ]] && set -x $mmTRACE_ENTER "$*" # Local variables usageMsg=34 ###################### # Mainline processing ###################### ###################################### # Process the command line arguments. ###################################### [[ $arg1 = '-?' || $arg1 = '-h' || $arg1 = '--help' || $arg1 = '--' ]] && \ syntaxError "help" $usageMsg [[ $argc -lt 1 ]] && \ syntaxError "missingArgs" $usageMsg # The first argument is always the file system name. device=$arg1 [[ $argc -gt 1 ]] && \ syntaxError "extraArg" $usageMsg $arg2 # Strip away any /dev/ prefix from the device id. deviceName=${device##+(/)dev+(/)} fqDeviceName="/dev/${deviceName}" # Verify the device name. if [[ $deviceName != ${deviceName#*/} ]] then if [[ $deviceName = ${deviceName#/} ]] then printErrorMsg 170 $mmcmd $device else printErrorMsg 169 $mmcmd $device fi rc=22 # EINVAL cleanupAndExit $rc fi ##################################################################### # Set up trap exception handling and call the gpfsInit function. # It will ensure that the local copy of the mmsdrfs and the rest # of the GPFS system files are up-to-date. # # Note: To avoid undesired side effects, tell gpfsInit to restrict # mount point checking only to the file system that is subject # to the current invocation of the mmdynamicmap command. ##################################################################### trap pretrap2 HUP INT QUIT KILL export MOUNT_POINT_CHECK="$deviceName" gpfsInitOutput=$(gpfsInit nolock) setGlobalVar $? $gpfsInitOutput unset MOUNT_POINT_CHECK ###################################################### # Retrieve the mount information for the file system. # If the device is not found, return 19 (ENODEV). ###################################################### efOptions=$($awk -F: ' \ BEGIN { \ { n = 0 } \ { mountPoint = "" } \ { fsType = "" } \ } \ /':$SG_HEADR:$deviceName:'/ { \ if ( $'$FS_TYPE_Field' == "'$remotefs'" ) { \ { fsType = "remotefs" } \ { remoteDevName = $'$REMOTE_DEV_NAME_Field' } \ } \ else { \ { fsType = "localfs" } \ } \ } \ /':$SG_MOUNT:$deviceName:'/ { \ { printf $'$RW_OPT_Field' } \ if ( $'$MTIME_OPT_Field' != "" ) { \ { printf ","$'$MTIME_OPT_Field' } \ } \ if ( $'$ATIME_OPT_Field' != "" ) { \ { printf ","$'$ATIME_OPT_Field' } \ } \ if ( $'$OTHER_OPT_Field' != "" ) { \ { printf ","$'$OTHER_OPT_Field' } \ } \ if ( $'$QUOTA_OPT_Field' != "" ) { \ { printf ",quota="$'$QUOTA_OPT_Field' } \ } \ if ( fsType == "remotefs" ) { \ { printf ",dev="$'$NODESETID_Field'"\\:"remoteDevName } \ { printf ",ldev='$deviceName'" } \ } \ else { \ { printf ",dev='$deviceName'" } \ } \ { exit } \ } \ END { \ if ( fsType == "" ) { \ # Filesystem not found - return ENODEV \ { exit '$MM_DeviceNotFound' } \ } \ else { \ # Filesystem found - finish the line. \ { printf "\n" } \ { exit 0 } \ } \ } \ ' $mmsdrfsFile) rc=$? if [[ $rc -ne 0 || -z $efOptions ]] then [[ $rc -eq 0 ]] && rc=1 if [[ $rc -eq $MM_DeviceNotFound ]] then # File system not found. printErrorMsg 288 $mmcmd $device else # Unexpected error. checkForErrors awk $rc fi cleanupAndExit $rc fi ################################# # Put out the result and return. ################################# print -- "-fstype=gpfs,$efOptions :$fqDeviceName" cleanupAndExit 0