void closesim::dofh (const nfs_fh3 *fhp, bool openit) { if (fhtimer *fht = fhtab [*fhp]) { if (openit) fhopen (fht); else fhtouch (fht); } else { fht = fhalloc (*fhp); if (openit) fhopen (fht); } }
static int fhb_fhopen(struct fhb_handle *handle, int flags) { int ret; #if defined(HAVE_GETFH) && defined(HAVE_FHOPEN) { fhandle_t fh; memcpy(&fh, handle, sizeof(fh)); ret = fhopen(&fh, flags); if (ret >= 0) return ret; } #endif #ifdef KERBEROS /* really KAFS */ { struct ViceIoctl vice_ioctl; vice_ioctl.in = (caddr_t) handle; vice_ioctl.in_size = sizeof(*handle); vice_ioctl.out = NULL; vice_ioctl.out_size = 0; ret = k_pioctl(NULL, VIOC_FHOPEN, &vice_ioctl, flags); if (ret >= 0) return ret; } #endif errx(1, "fhopen/k_pioctl"); }
void priv_vfs_fhopen(int asroot, int injail, struct test *test) { int errno_saved, error, fd; fd = fhopen(&fh, O_RDONLY); if (fd >= 0) { error = 0; errno_saved = errno; close(fd); errno = errno_saved; } else error = -1; if (asroot && injail) expect("priv_vfs_fhopen(asroot, injail)", error, -1, EPERM); if (asroot && !injail) expect("priv_vfs_fhopen(asroot, !injail)", error, 0, 0); if (!asroot && injail) expect("priv_vfs_fhopen(!asroot, injail)", error, -1, EPERM); if (!asroot && !injail) expect("priv_vfs_fhopen(!asroot, !injail)", error, -1, EPERM); }