MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kern_getfhat

Function kern_getfhat

freebsd/kern/vfs_syscalls.c:4325–4356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4323}
4324
4325int
4326kern_getfhat(struct thread *td, int flags, int fd, const char *path,
4327 enum uio_seg pathseg, fhandle_t *fhp, enum uio_seg fhseg)
4328{
4329 struct nameidata nd;
4330 fhandle_t fh;
4331 struct vnode *vp;
4332 int error;
4333
4334 error = priv_check(td, PRIV_VFS_GETFH);
4335 if (error != 0)
4336 return (error);
4337 NDINIT_AT(&nd, LOOKUP, at2cnpflags(flags, AT_SYMLINK_NOFOLLOW |
4338 AT_RESOLVE_BENEATH) | LOCKLEAF | AUDITVNODE1, pathseg, path,
4339 fd, td);
4340 error = namei(&nd);
4341 if (error != 0)
4342 return (error);
4343 NDFREE_NOTHING(&nd);
4344 vp = nd.ni_vp;
4345 bzero(&fh, sizeof(fh));
4346 fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
4347 error = VOP_VPTOFH(vp, &fh.fh_fid);
4348 vput(vp);
4349 if (error == 0) {
4350 if (fhseg == UIO_USERSPACE)
4351 error = copyout(&fh, fhp, sizeof (fh));
4352 else
4353 memcpy(fhp, &fh, sizeof(fh));
4354 }
4355 return (error);
4356}
4357
4358#ifndef _SYS_SYSPROTO_H_
4359struct fhlink_args {

Callers 3

sys_lgetfhFunction · 0.85
sys_getfhFunction · 0.85
sys_getfhatFunction · 0.85

Calls 8

at2cnpflagsFunction · 0.85
nameiFunction · 0.85
NDFREE_NOTHINGFunction · 0.85
bzeroFunction · 0.85
vputFunction · 0.85
priv_checkFunction · 0.70
copyoutFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected