# Copyright 2020 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/param.h>
include <sys/mount.h>
include <sys/stat.h>
include <unistd.h>
include <fcntl.h>

getfh(file ptr[in, filename], fhp ptr[out, fhandle])
lgetfh(file ptr[in, filename], fhp ptr[out, fhandle])
getfhat(fd fd, file ptr[in, filename], fhp ptr[out, fhandle], flags flags[getfhat_flags])

fhlink(fhp ptr[in, fhandle], to ptr[in, filename])
fhlinkat(fhp ptr[in, fhandle], fd fd, to ptr[in, filename])

fhopen(fhp ptr[in, fhandle], flags flags[open_flags]) fd
fhstat(fhp ptr[in, fhandle], statbuf ptr[out, stat])
fhstatfs(fhp ptr[in, fhandle], buf ptr[out, statfs])
freebsd11_fhstatfs(fhp ptr[in, fhandle], buf ptr[out, freebsd11_statfs])

fhreadlink(fhp ptr[in, fhandle], buf buffer[out], bufsize len[buf])

fsid {
	val	array[int32, 2]
}

fid {
	fid_len		int16
	fid_data0	int16
	fid_data	array[int8, MAXFIDSZ]
}

fhandle {
	fh_fsid	fsid
	fh_fid	fid
}

getfhat_flags = AT_SYMLINK_NOFOLLOW
