blob: 406c14ba33dd303fb41b8f38c93592d4534f7fc5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <mach.h>
include <config.h>
include "ki.h"
# KB_ZAWR -- Asynchronous write to a binary device. We are called only if
# the device does not reside on the local node.
procedure kb_zawr (device, chan, ibuf, nbytes, loffset)
int device # device driver code
int chan # channel assigned device
char ibuf[nbytes] # receives data
int nbytes # number of bytes to write
long loffset # file offset
int server
int ki_send()
include "kichan.com"
include "kii.com"
begin
server = k_node[chan]
if (nbytes <= 0) {
k_status[chan] = 0
return
}
# Send the request followed by the data block. We must wait for the
# write into the network channel to complete since the channel is
# multiplexed. Note that this is not the same as waiting for the
# data transfer to the physical device to complete; that transfer is
# at least partially asynchronous.
p_arg[1] = k_oschan[chan]
p_arg[2] = nbytes
p_arg[3] = loffset
if (ki_send (server, device, BF_AWR) == ERR)
k_status[chan] = ERR
else {
call ks_awrite (server, ibuf, nbytes)
call ks_await (server, k_status[chan])
}
end
|