On 08/18/2009 08:01 PM, Lionel Dyck wrote:
> I've been playing with rexx on z/linux along with trying to learn how to
> use the cmsfs toolset. Here is my first attempt that may be useful for
> others.

Nice one.

> #!/usr/bin/rexx
> /* REXX routine to read a cms file from the Linux Guest 191 Disk */

> /* Mount the users 191 disk */
> 'chccwdev -e 191'
> 
> /* sleep 2 seconds to wait for the mount */
> call syssleep(2)

Waiting for the udev event queue to run empty is a safer way to wait for
the device to become online and available to Linux.
Depending on the version of your Linux you may use:
'udevadm settle'
or
'udevsettle'

> file = '/proc/dasd/devices'
> 
> do forever
>    line = strip(linein(file))
>    if length(line) = 0 then leave
>    parse value line with '0.0.'addr'(' x ' is 'disk  .
>    if addr = '0191' then leave
>    end

Not sure, but this looks like an endless loop with busy waiting,
possibly eating unnecessary CPU cycles.
Chccwdev already loops (CPU friendly) to see if the device comes online
within some timeout and finally reports the outcome with an exit
errorlevel, that you may evaluate above to decide on continuation.

> 'chccwdev -d 191'

Here you could do "udevadm settle" again just to be sure that no events
caused by setting the device offline are pending when your script exits.

My 2ct,
Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Erich Baier
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to