FIOBMAP2: inline vn_ioc_bmap2
Reported by: kib Reviewed by: kib MFC after: 2 weeks MFC-With: 349238 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20783
This commit is contained in:
parent
aeb32005f6
commit
36f7426388
@ -1457,25 +1457,6 @@ vn_stat(struct vnode *vp, struct stat *sb, struct ucred *active_cred,
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* generic FIOBMAP2 implementation */
|
||||
static int
|
||||
vn_ioc_bmap2(struct file *fp, struct fiobmap2_arg *arg, struct ucred *cred)
|
||||
{
|
||||
struct vnode *vp = fp->f_vnode;
|
||||
daddr_t lbn = arg->bn;
|
||||
int error;
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
#ifdef MAC
|
||||
error = mac_vnode_check_read(cred, fp->f_cred, vp);
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_BMAP(vp, lbn, NULL, &arg->bn, &arg->runp,
|
||||
&arg->runb);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* File table vnode ioctl routine.
|
||||
*/
|
||||
@ -1485,6 +1466,7 @@ vn_ioctl(struct file *fp, u_long com, void *data, struct ucred *active_cred,
|
||||
{
|
||||
struct vattr vattr;
|
||||
struct vnode *vp;
|
||||
struct fiobmap2_arg *bmarg;
|
||||
int error;
|
||||
|
||||
vp = fp->f_vnode;
|
||||
@ -1500,8 +1482,17 @@ vn_ioctl(struct file *fp, u_long com, void *data, struct ucred *active_cred,
|
||||
*(int *)data = vattr.va_size - fp->f_offset;
|
||||
return (error);
|
||||
case FIOBMAP2:
|
||||
return (vn_ioc_bmap2(fp, (struct fiobmap2_arg*)data,
|
||||
active_cred));
|
||||
bmarg = (struct fiobmap2_arg *)data;
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
#ifdef MAC
|
||||
error = mac_vnode_check_read(active_cred, fp->f_cred,
|
||||
vp);
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_BMAP(vp, bmarg->bn, NULL,
|
||||
&bmarg->bn, &bmarg->runp, &bmarg->runb);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
return (error);
|
||||
case FIONBIO:
|
||||
case FIOASYNC:
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user