aboutsummaryrefslogtreecommitdiff
path: root/sys/ki/kbzstt.x
blob: 0610dd7f94679657f44234a69910ea1664adcd26 (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
48
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<mach.h>
include	<config.h>
include	<fio.h>
include	"ki.h"

# KB_ZSTT -- Get file status on a binary device.  We are called only if the
# device does not reside on the local node.

procedure kb_zstt (device, chan, what, lvalue)

int	device			# device driver code
int	chan			# channel assigned device
int	what			# file parameter to be returned
long	lvalue			# receives the parameter value

int	server, ks_maxbufsize
int	ki_sendrcv()
include	"kichan.com"
include	"kinode.com"
include	"kii.com"
data	ks_maxbufsize /-1/

begin
	server   = k_node[chan]
	p_arg[1] = k_oschan[chan]
	p_arg[2] = what

	if (ki_sendrcv (server, device, BF_STT) == ERR)
	    lvalue = ERR
	else {
	    lvalue = p_arg[1]

	    # The maximum buffer (transfer) size for a device is determined
	    # by the the network interface or by the device, whichever is
	    # smaller.

	    if (what == FSTT_MAXBUFSIZE || what == FSTT_OPTBUFSIZE) {
		if (ks_maxbufsize < 0)
		    call zsttks (n_kschan[server], FSTT_MAXBUFSIZE, ks_maxbufsize)
		if (lvalue == 0)
		    lvalue = ks_maxbufsize
		else if (ks_maxbufsize > 0)
		    lvalue = min (lvalue, ks_maxbufsize)
	    }
	}
end