Introduce the vn_todev(struct vnode*) function, which returns the dev_t

corresponding to a VBLK or VCHR node, or NODEV.
This commit is contained in:
phk 1999-07-18 14:30:37 +00:00
parent 57f6c4db5c
commit 498fdd6e80
3 changed files with 28 additions and 3 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.209 1999/07/17 18:43:45 phk Exp $
* $Id: vfs_subr.c,v 1.210 1999/07/17 19:38:00 phk Exp $
*/
/*
@ -2975,3 +2975,15 @@ sync_print(ap)
printf("\n");
return (0);
}
/*
* extract the dev_t from a VBLK or VCHR
*/
dev_t
vn_todev(vp)
struct vnode *vp;
{
if (vp->v_type != VBLK && vp->v_type != VCHR)
return (NODEV);
return (vp->v_rdev);
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.209 1999/07/17 18:43:45 phk Exp $
* $Id: vfs_subr.c,v 1.210 1999/07/17 19:38:00 phk Exp $
*/
/*
@ -2975,3 +2975,15 @@ sync_print(ap)
printf("\n");
return (0);
}
/*
* extract the dev_t from a VBLK or VCHR
*/
dev_t
vn_todev(vp)
struct vnode *vp;
{
if (vp->v_type != VBLK && vp->v_type != VCHR)
return (NODEV);
return (vp->v_rdev);
}

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vnode.h 8.7 (Berkeley) 2/4/94
* $Id: vnode.h,v 1.88 1999/06/15 23:36:59 mckusick Exp $
* $Id: vnode.h,v 1.89 1999/06/28 10:35:07 phk Exp $
*/
#ifndef _SYS_VNODE_H_
@ -521,6 +521,7 @@ int vn_rdwr __P((enum uio_rw rw, struct vnode *vp, caddr_t base,
int len, off_t offset, enum uio_seg segflg, int ioflg,
struct ucred *cred, int *aresid, struct proc *p));
int vn_stat __P((struct vnode *vp, struct stat *sb, struct proc *p));
dev_t vn_todev __P((struct vnode *vp));
int vfs_cache_lookup __P((struct vop_lookup_args *ap));
int vfs_object_create __P((struct vnode *vp, struct proc *p,
struct ucred *cred));