aboutsummaryrefslogtreecommitdiffstats
path: root/sys/netbsd/fs.txt
blob: fab2472eab7527b4ea4781bd946cd182e00f93a8 (plain)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# Copyright 2017 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

include <sys/types.h>
include <sys/fstypes.h>
include <sys/mount.h>
include <sys/statvfs.h>
include <sys/param.h>
include <sys/stat.h>
include <sys/ucred.h>
include <fcntl.h>
include <unistd.h>

resource fd[int32]: 0xffffffffffffffff, AT_FDCWD
resource fd_dir[fd]

resource pid[int32]: 0, 0xffffffffffffffff
resource uid[int32]: 0, 0xffffffffffffffff
resource gid[int32]: 0, 0xffffffffffffffff

resource dev[int64]: 0, 0xffffffffffffffff

type mode int32
type ino int64
type nlink int32

compat_43_ocreat(path ptr[in, filename], mode flags[open_mode])
open(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd
# Just so that we have something that creates fd_dir resources.
open$dir(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd_dir
openat(fd fd_dir[opt], file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd
close(fd fd)
read(fd fd, buf buffer[out], count len[buf])
readv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec])
pread(fd fd, buf buffer[in], nbyte len[buf], off fileoff)
preadv(fd fd, vec ptr[in, array[iovec_out]], vlen len[vec], off fileoff)
write(fd fd, buf buffer[in], count len[buf])
writev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec])
pwrite(fd fd, buf buffer[in], nbyte len[buf], off fileoff)
pwritev(fd fd, vec ptr[in, array[iovec_in]], vlen len[vec], off fileoff)
lseek(fd fd, pad const[0], offset fileoff, whence flags[seek_whence])
compat_43_olseek(fd fd, offset fileoff[int64], whence flags[seek_whence])
dup(oldfd fd) fd
dup2(oldfd fd, newfd fd) fd
dup3(oldfd fd, newfd fd, flags flags[dup_flags]) fd
pipe2(pipefd ptr[out, pipefd], flags flags[pipe_flags])

pathconf(file ptr[in, filename], name flags[conf_value])
fpathconf(fd fd, name flags[conf_value])

compat_40_mount(type ptr[in, string[filesystem_types]], path ptr[in, filename], flags flags[mount_flags], data buffer[in])
__mount50(type ptr[in, string[filesystem_types]], path ptr[in, filename], flags flags[mount_flags], data buffer[in], len len[data])
unmount(path ptr[in, filename], flags flags[mount_flags])

compat_90_statvfs1(path ptr[in, filename], buf ptr[out, statvfs90], f flags[vfs_flags])
compat_90_fstatvfs1(fd fd, buf ptr[out, statvfs90], f flags[vfs_flags])

compat_30_getfh(path ptr[in, filename], fhp ptr[out, compat_30_fhandle])
__getfh30(fname ptr[in, filename], fhp buffer[out], fh_size ptr[in, intptr])
compat_30_fhopen(fhp ptr[in, compat_30_fhandle], f flags[fhopen_flags]) fd
__fhopen40(fhp buffer[in], fh_size len[fhp], f flags[fhopen_flags]) fd
compat_30_fhstat(fhp ptr[in, compat_30_fhandle], sb ptr[out, stat13])
compat_30___fhstat30(fhp ptr[in, compat_30_fhandle], sb ptr[out, stat30])
__fhstat50(fhp buffer[in], fh_size len[fhp], sb ptr[out, stat])
compat_30_fhstatvfs1(fhp ptr[in, compat_30_fhandle], buf ptr[out, statvfs90], f flags[vfs_flags])
compat_90_fhstatvfs1(fhp buffer[in], fh_size len[fhp], buf ptr[out, statvfs90], f flags[vfs_flags])
__fhstatvfs190(fhp buffer[in], fh_size len[fhp], buf ptr[out, statvfs], f flags[vfs_flags])
compat_90_getvfsstat(buf ptr[out, statvfs90, opt], bufsize len[buf], f flags[vfs_flags])
__getvfsstat90(buf ptr[out, statvfs, opt], bufsize len[buf], flags flags[vfs_flags])

compat_20_getfsstat(buf ptr[out, statfs12, opt], size len[buf], f flags[getfsstat_flags])

pipefd {
	rfd	fd
	wfd	fd
}

iovec_in {
	addr	buffer[in]
	len	len[addr, intptr]
}

iovec_out {
	addr	buffer[out]
	len	len[addr, intptr]
}

stat {
	st_dev		dev
	st_mode		mode
	st_ino		ino
	st_nlink	nlink
	st_uid		uid
	st_gid		gid
	st_rdev		dev
	st_atim		timespec
	st_mtim		timespec
	st_ctim		timespec
	st_birthtim	timespec
	st_size		intptr
	st_blocks	intptr
	st_blksize	int32
	st_flags	int32
	st_gen		int32
	st_spare	array[int32, 2]
}

stat12 {
	dev	int32
	ino	int32
	mode	int16
	nlink	int16
	uid	uid
	gid	gid
	rdev	int32
	atim	timespec50
	mtim	timespec50
	ctim	timespec50
	size	int32
	blocks	int64
	blksize	int32
	flags	int32
	gen	int32
	lspare	int32
	qspare	array[int64, 2]
}

stat13 {
	st_dev		int32
	st_ino		int32
	st_mode		mode
	st_nlink	nlink
	st_uid		int32
	st_gid		int32
	st_rdev		int32
	st_atim		timespec50
	st_mtim		timespec50
	st_ctim		timespec50
	st_size		intptr
	st_blocks	intptr
	st_blksize	int32
	st_flags	int32
	st_gen		int32
	st_spare0	int32
	st_birthtim	timespec50
}

stat30 {
	st_dev		int32
	st_mode		mode
	st_ino		intptr
	st_nlink	nlink
	st_uid		int32
	st_gid		int32
	st_rdev		int32
	st_atim		timespec50
	st_mtim		timespec50
	st_ctim		timespec50
	st_birthtim	timespec50
	st_size		intptr
	st_blocks	intptr
	st_blksize	int32
	st_flags	int32
	st_gen		int32
	st_spare	array[int32, 2]
}

stat43 {
	dev	int16
	ino	int32
	mode	int16
	nlink	int16
	uid	int16
	gid	int16
	rdev	int16
	size	int32
	atim	timespec50
	mtim	timespec50
	ctim	timespec50
	blksize	int32
	blocks	int32
	flags	int32
	gen	int32
}

define MFSNAMELEN	16
define MNAMELEN	90

statfs12 {
	type		int16
	oflags		int16
	bsize		intptr
	iosize		intptr
	blocks		intptr
	bfree		intptr
	bavail		intptr
	files		intptr
	ffree		intptr
	fsid		fsid_t
	owner		uid
	flags		flags[mount_flags, intptr]
	swrites		intptr
	aswrites	intptr
	spare		array[intptr, 1]
	fstype		array[int8, MFSNAMELEN]
	mnton		array[int8, MNAMELEN]
	mntfrom		array[int8, MNAMELEN]
}

fsid_t {
	val	array[int32, 2]
}

compat_30_fhandle {
	fh_fsid	fsid_t
	fh_fid	compat_30_fid
}

compat_30_fid {
	fid_len		int16
	fid_reserved	int16
	fid_data	array[int8, 16]
}

statvfs90 {
	f_flag		flags[statvfs_flags, int64]
	f_bsize		intptr
	f_frsize	intptr
	f_iosize	intptr
	f_blocks	intptr
	f_bfree		intptr
	f_bavail	intptr
	f_bresvd	intptr
	f_files		intptr
	f_ffree		intptr
	f_favail	intptr
	f_fresvd	intptr
	f_syncreads	intptr
	f_syncwrites	intptr
	f_asyncreads	intptr
	f_asyncwrites	intptr
	f_fsidx		fsid_t
	f_fsid		intptr
	f_namemax	intptr
	f_owner		int32
	f_spare		array[int32, 4]
	f_fstypename	array[int8, 32]
	f_mntonname	array[int8, 1024]
	f_mntfromname	array[int8, 1024]
}

statvfs {
	f_flag		flags[statvfs_flags, int64]
	f_bsize		intptr
	f_frsize	intptr
	f_iosize	intptr
	f_blocks	intptr
	f_bfree		intptr
	f_bavail	intptr
	f_bresvd	intptr
	f_files		intptr
	f_ffree		intptr
	f_favail	intptr
	f_fresvd	intptr
	f_syncreads	intptr
	f_syncwrites	intptr
	f_asyncreads	intptr
	f_asyncwrites	intptr
	f_fsidx		fsid_t
	f_fsid		intptr
	f_namemax	intptr
	f_owner		int32
	f_spare		array[intptr, 4]
	f_fstypename	array[int8, 32]
	f_mntonname	array[int8, 1024]
	f_mntfromname	array[int8, 1024]
	f_mntfromlabel	array[int8, 1024]
}

filesystem_types = "ffs", "nfs", "mfs", "msdos", "lfs", "fdesc", "null", "overlay", "umap", "kernfs", "procfs", "afs", "cd9660", "union", "adosfs", "ext2fs", "coda", "filecore", "ntfs", "smbfs", "ptyfs", "tmpfs", "udf", "sysvbfs", "puffs", "hfs", "efs", "zfs", "nilfs", "rumpfs", "v7fs", "autofs"
open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_CREAT, O_TRUNC, O_EXCL, O_SHLOCK, O_EXLOCK, O_NOFOLLOW, O_CLOEXEC, O_NOSIGPIPE, O_DSYNC, O_SYNC, O_RSYNC, O_ALT_IO, O_NOCTTY, O_DIRECT, O_DIRECTORY, O_ASYNC
open_mode = S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR, S_IRWXG, S_IRGRP, S_IWGRP, S_IXGRP, S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH, S_ISUID, S_ISGID, S_ISVTX
seek_whence = SEEK_SET, SEEK_CUR, SEEK_END
pipe_flags = O_NONBLOCK, O_CLOEXEC, O_NOSIGPIPE
mount_flags = MNT_RDONLY, MNT_SYNCHRONOUS, MNT_NOEXEC, MNT_NOSUID, MNT_NODEV, MNT_UNION, MNT_ASYNC, MNT_NOCOREDUMP, MNT_RELATIME, MNT_IGNORE, MNT_DISCARD, MNT_EXTATTR, MNT_LOG, MNT_NOATIME, MNT_AUTOMOUNTED, MNT_SYMPERM, MNT_NODEVMTIME, MNT_SOFTDEP, MNT_EXRDONLY, MNT_EXPORTED, MNT_DEFEXPORTED, MNT_EXPORTANON, MNT_EXKERB, MNT_EXNORESPORT, MNT_EXPUBLIC, MNT_LOCAL, MNT_QUOTA, MNT_ROOTFS
getfsstat_flags = MNT_NOWAIT, MNT_WAIT, MNT_LAZY
conf_value = _PC_LINK_MAX, _PC_MAX_CANON, _PC_MAX_INPUT, _PC_NAME_MAX, _PC_PATH_MAX, _PC_PIPE_BUF, _PC_CHOWN_RESTRICTED, _PC_NO_TRUNC, _PC_VDISABLE, _PC_SYNC_IO, _PC_FILESIZEBITS, _PC_SYMLINK_MAX, _PC_2_SYMLINKS, _PC_ACL_EXTENDED, _PC_MIN_HOLE_SIZE, _PC_ACL_PATH_MAX, _PC_ACL_NFS4
fhopen_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_TRUNC, O_EXCL, O_SHLOCK, O_EXLOCK, O_NOFOLLOW, O_CLOEXEC, O_NOSIGPIPE, O_DSYNC, O_SYNC, O_RSYNC, O_ALT_IO, O_NOCTTY, O_DIRECT, O_DIRECTORY, O_ASYNC
vfs_flags = ST_NOWAIT, ST_WAIT
statvfs_flags = ST_RDONLY, ST_NOEXEC, ST_NOSUID, ST_NODEV, ST_UNION, ST_SYNCHRONOUS, ST_ASYNC, ST_NOCOREDUMP, ST_NOATIME, ST_SYMPERM, ST_NODEVMTIME, ST_LOG, ST_LOCAL, ST_QUOTA, ST_ROOTFS, ST_EXRDONLY, ST_EXPORTED, ST_DEFEXPORTED, ST_EXPORTANON, ST_EXKERB, ST_EXNORESPORT, ST_EXPUBLIC