diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 3dc3cbc6c357..49b054f3f74a 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_file.c,v 1.25 1999/05/08 06:39:26 phk Exp $ + * $Id: linux_file.c,v 1.26 1999/05/11 19:54:19 phk Exp $ */ #include "opt_compat.h" @@ -199,7 +199,6 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args) struct filedesc *fdp; struct file *fp; struct vnode *vp; - struct vattr va; long pgid; struct pgrp *pgrp; struct tty *tp, *(*d_tty) __P((dev_t)); @@ -302,12 +301,9 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args) return fcntl(p, &fcntl_args); } vp = (struct vnode *)fp->f_data; - if (vp->v_type != VCHR) + dev = vn_todev(vp); + if (vp->v_type != VCHR || dev == NODEV) return EINVAL; - if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) - return error; - - dev = udev2dev(va.va_rdev, 0); /* XXX vp->v_rdev ? */ d_tty = devsw(dev)->d_devtotty; if (!d_tty || (!(tp = (*d_tty)(dev)))) return EINVAL; diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index 4c04d070afc1..1ebdce235973 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -1,4 +1,4 @@ -/* $Id: ccd.c,v 1.49 1999/06/27 09:28:43 peter Exp $ */ +/* $Id: ccd.c,v 1.50 1999/07/17 19:58:37 phk Exp $ */ /* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ @@ -306,7 +306,6 @@ ccdinit(ccd, cpaths, p) register size_t size; register int ix; struct vnode *vp; - struct vattr va; size_t minsize; int maxsecsize; struct partinfo dpart; @@ -359,24 +358,7 @@ ccdinit(ccd, cpaths, p) ci->ci_path = malloc(ci->ci_pathlen, M_DEVBUF, M_WAITOK); bcopy(tmppath, ci->ci_path, ci->ci_pathlen); - /* - * XXX: Cache the component's dev_t. - */ - if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)) != 0) { -#ifdef DEBUG - if (ccddebug & (CCDB_FOLLOW|CCDB_INIT)) - printf("ccd%d: %s: getattr failed %s = %d\n", - ccd->ccd_unit, ci->ci_path, - "error", error); -#endif - while (ci >= cs->sc_cinfo) { - free(ci->ci_path, M_DEVBUF); - ci--; - } - free(cs->sc_cinfo, M_DEVBUF); - return (error); - } - ci->ci_dev = udev2dev(va.va_rdev, vp->v_type == VBLK ? 1 : 0); + ci->ci_dev = vn_todev(vp); /* * Get partition information for the component. diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index 4c04d070afc1..1ebdce235973 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -1,4 +1,4 @@ -/* $Id: ccd.c,v 1.49 1999/06/27 09:28:43 peter Exp $ */ +/* $Id: ccd.c,v 1.50 1999/07/17 19:58:37 phk Exp $ */ /* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ @@ -306,7 +306,6 @@ ccdinit(ccd, cpaths, p) register size_t size; register int ix; struct vnode *vp; - struct vattr va; size_t minsize; int maxsecsize; struct partinfo dpart; @@ -359,24 +358,7 @@ ccdinit(ccd, cpaths, p) ci->ci_path = malloc(ci->ci_pathlen, M_DEVBUF, M_WAITOK); bcopy(tmppath, ci->ci_path, ci->ci_pathlen); - /* - * XXX: Cache the component's dev_t. - */ - if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)) != 0) { -#ifdef DEBUG - if (ccddebug & (CCDB_FOLLOW|CCDB_INIT)) - printf("ccd%d: %s: getattr failed %s = %d\n", - ccd->ccd_unit, ci->ci_path, - "error", error); -#endif - while (ci >= cs->sc_cinfo) { - free(ci->ci_path, M_DEVBUF); - ci--; - } - free(cs->sc_cinfo, M_DEVBUF); - return (error); - } - ci->ci_dev = udev2dev(va.va_rdev, vp->v_type == VBLK ? 1 : 0); + ci->ci_dev = vn_todev(vp); /* * Get partition information for the component. diff --git a/sys/i386/linux/linux_file.c b/sys/i386/linux/linux_file.c index 3dc3cbc6c357..49b054f3f74a 100644 --- a/sys/i386/linux/linux_file.c +++ b/sys/i386/linux/linux_file.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_file.c,v 1.25 1999/05/08 06:39:26 phk Exp $ + * $Id: linux_file.c,v 1.26 1999/05/11 19:54:19 phk Exp $ */ #include "opt_compat.h" @@ -199,7 +199,6 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args) struct filedesc *fdp; struct file *fp; struct vnode *vp; - struct vattr va; long pgid; struct pgrp *pgrp; struct tty *tp, *(*d_tty) __P((dev_t)); @@ -302,12 +301,9 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args) return fcntl(p, &fcntl_args); } vp = (struct vnode *)fp->f_data; - if (vp->v_type != VCHR) + dev = vn_todev(vp); + if (vp->v_type != VCHR || dev == NODEV) return EINVAL; - if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) - return error; - - dev = udev2dev(va.va_rdev, 0); /* XXX vp->v_rdev ? */ d_tty = devsw(dev)->d_devtotty; if (!d_tty || (!(tp = (*d_tty)(dev)))) return EINVAL;