Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/gehenna-devsw]: src/sys/compat/linux/common Replace the direct-access to...



details:   https://anonhg.NetBSD.org/src/rev/195d54c051bc
branches:  gehenna-devsw
changeset: 527048:195d54c051bc
user:      gehenna <gehenna%NetBSD.org@localhost>
date:      Thu May 16 04:24:11 2002 +0000

description:
Replace the direct-access to devsw table with calling devsw API.

diffstat:

 sys/compat/linux/common/linux_file.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r bbee044454db -r 195d54c051bc sys/compat/linux/common/linux_file.c
--- a/sys/compat/linux/common/linux_file.c      Thu May 16 04:21:38 2002 +0000
+++ b/sys/compat/linux/common/linux_file.c      Thu May 16 04:24:11 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_file.c,v 1.52 2002/05/13 05:31:42 simonb Exp $   */
+/*     $NetBSD: linux_file.c,v 1.52.2.1 2002/05/16 04:24:11 gehenna Exp $      */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.52 2002/05/13 05:31:42 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.52.2.1 2002/05/16 04:24:11 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -296,6 +296,7 @@
        struct file *fp;
        struct vnode *vp;
        struct vattr va;
+       const struct cdevsw *cdev;
        long pgid;
        struct pgrp *pgrp;
        struct tty *tp, *(*d_tty) __P((dev_t));
@@ -419,7 +420,7 @@
                        return EBADF;
                /* FILE_USE() not needed here */
                if (fp->f_type != DTYPE_VNODE) {
-           notty:
+           not_tty:
                        /* Not a tty, proceed with common fcntl() */
                        cmd = cmd == LINUX_F_SETOWN ? F_SETOWN : F_GETOWN;
                        break;
@@ -428,12 +429,15 @@
                /* check that the vnode is a tty */
                vp = (struct vnode *)fp->f_data;
                if (vp->v_type != VCHR)
-                       goto notty;
+                       goto not_tty;
                if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)))
                        return error;
-               d_tty = cdevsw[major(va.va_rdev)].d_tty;
+               cdev = cdevsw_lookup(va.va_rdev);
+               if (cdev == NULL)
+                       return (ENXIO);
+               d_tty = cdev->d_tty;
                if (!d_tty || (!(tp = (*d_tty)(va.va_rdev))))
-                       goto notty;
+                       goto not_tty;
 
                /* set tty pg_id appropriately */
                if (cmd == LINUX_F_GETOWN) {



Home | Main Index | Thread Index | Old Index