From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/ki/kzwrmt.x | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sys/ki/kzwrmt.x (limited to 'sys/ki/kzwrmt.x') diff --git a/sys/ki/kzwrmt.x b/sys/ki/kzwrmt.x new file mode 100644 index 00000000..74ae0dd9 --- /dev/null +++ b/sys/ki/kzwrmt.x @@ -0,0 +1,49 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include +include +include "ki.h" + +# KZWRMT -- Asynchronous write to a magtape file. + +procedure kzwrmt (chan, buf, nbytes, offset) + +int chan #I magtape channel +char buf[ARB] #I buffer containing data +int nbytes #I nbytes to write +long offset #I file offset + +int server +int ki_send() +include "kichan.com" +include "kii.com" + +begin + server = k_node[chan] + + if (server == NULL) { + call zzwrmt (k_oschan[chan], buf, nbytes, offset) + return + } + + # Ignore zero writes and requests on a node closed by an error. + if (nbytes <= 0) { + k_status[chan] = 0 + return + } + + # Send the request followed by the data block. We do not read anything + # back from the remote server until ZAWT is called. Set k_status[chan] + # to WRITE_IN_PROGRESS to tell ZAWT that an await call is needed. + + p_arg[1] = k_oschan[chan] + p_arg[2] = nbytes + p_arg[3] = offset + + if (ki_send (server, KI_ZFIOMT, MT_WR) == ERR) + k_status[chan] = ERR + else { + call ks_awrite (server, buf, nbytes) + call ks_await (server, k_status[chan]) + } +end -- cgit