aboutsummaryrefslogtreecommitdiff
path: root/sys/ki/kfiosf.x
blob: c14cc13ceb8aea6c8568ab513fa8028fc69ff4b7 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

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

# KFIOSF -- Static file driver.  Since the static file driver may permit
# portions of a data file to be mapped into virtual memory, use the binary
# file driver if the file resides on a remote node.

procedure kopnsf (osfn, mode, chan)

char	osfn[ARB]
int	mode, chan

int	server
int	ki_connect(), ki_getchan()
include	"kii.com"

begin
	server = ki_connect (osfn)

	if (server == NULL) {
	    call strpak (p_sbuf[p_arg[1]], p_sbuf, SZ_SBUF)
	    call zopnsf (p_sbuf, mode, chan)
	    if (chan != ERR)
		chan = ki_getchan (server, chan)
	} else
	    call kb_zopn (KI_ZFIOBF, osfn, mode, chan)
end


procedure kclssf (chan, status)

int	chan
int	status
include	"kichan.com"

begin
	# Possible if an abort occurs during the open.
	if (chan <= 0) {
	    status = OK
	    return
	}

	if (k_node[chan] == NULL) {
	    call zclssf (k_oschan[chan], status)
	    call ki_freechan (chan)
	} else
	    call kb_zcls (KI_ZFIOBF, chan, status)
end


procedure kardsf (chan, buf, max_bytes, offset)

int	chan
char	buf[ARB]
int	max_bytes
long	offset
include	"kichan.com"

begin
	if (k_node[chan] == NULL)
	    call zardsf (k_oschan[chan], buf, max_bytes, offset)
	else
	    call kb_zard (KI_ZFIOBF, chan, buf, max_bytes, offset)
end


procedure kawrsf (chan, buf, nbytes, offset)

int	chan
char	buf[ARB]
int	nbytes
long	offset
include	"kichan.com"

begin
	if (k_node[chan] == NULL)
	    call zawrsf (k_oschan[chan], buf, nbytes, offset)
	else
	    call kb_zawr (KI_ZFIOBF, chan, buf, nbytes, offset)
end


procedure kawtsf (chan, status)

int	chan
int	status
include	"kichan.com"

begin
	if (k_node[chan] == NULL)
	    call zawtsf (k_oschan[chan], status)
	else
	    call kb_zawt (KI_ZFIOBF, chan, status)
end


procedure ksttsf (chan, what, lvalue)

int	chan
int	what
long	lvalue
include	"kichan.com"

begin
	if (k_node[chan] == NULL)
	    call zsttsf (k_oschan[chan], what, lvalue)
	else
	    call kb_zstt (KI_ZFIOBF, chan, what, lvalue)
end