FreeBSD/sys/fs/nfsclient/nfs_clvnops.c
/*
 * nfs special file access vnode op.
 * Essentially just get vattr and then imitate iaccess() since the device is
 * local to the client.
 */
nfs special file access vnode op.
Essentially just get vattr and then imitate iaccess() since the device is
local to the client.
nfs special file access vnode op . Essentially just get vattr and then imitate iaccess () since the device is local to the client .
static int
nfsspec_access(struct vop_access_args *ap)
{
	struct vattr *vap;
	struct ucred *cred = ap->a_cred;
	struct vnode *vp = ap->a_vp;
	accmode_t accmode = ap->a_accmode;
	struct vattr vattr;
	int error;
	if ((accmode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY)) {
		switch (vp->v_type) {
		case VREG:
		case VDIR:
		case VLNK:
			return (EROFS);
		default:
			break;
		}
	}
	vap = &vattr;
	error = VOP_GETATTR(vp, vap, cred);
	if (error)
		goto out;
	error  = vaccess(vp->v_type, vap->va_mode, vap->va_uid, vap->va_gid,
	    accmode, cred, NULL);
out:
	return error;
}
static int nfsspec_access ( struct vop_access_args * ap ) { struct vattr * vap ; struct ucred * cred = ap -> a_cred ; struct vnode * vp = ap -> a_vp ; accmode_t accmode = ap -> a_accmode ; struct vattr vattr ; int error ; if ( ( accmode & VWRITE ) && ( vp -> v_mount -> mnt_flag & MNT_RDONLY ) ) { switch ( vp -> v_type ) { case VREG : case VDIR : case VLNK : return ( EROFS ) ; default : break ; } } vap = & vattr ; error = VOP_GETATTR ( vp , vap , cred ) ; if ( error ) goto out ; error = vaccess ( vp -> v_type , vap -> va_mode , vap -> va_uid , vap -> va_gid , accmode , cred , NULL ) ; out : return error ; }
nfs special file access vnode op.
nfs special file access vnode op .
/*
	 * Disallow write attempts on filesystems mounted read-only;
	 * unless the file is a socket, fifo, or a block or character
	 * device resident on the filesystem.
	 */