Source-Changes-HG archive

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

[src/gehenna-devsw]: src/sys/miscfs/fdesc Call the device interfaces via the ...



details:   https://anonhg.NetBSD.org/src/rev/cda41dd9356b
branches:  gehenna-devsw
changeset: 527037:cda41dd9356b
user:      gehenna <gehenna%NetBSD.org@localhost>
date:      Thu May 16 04:02:20 2002 +0000

description:
Call the device interfaces via the device switch.
Replace the direct-access to devsw table with calling devsw APIs.

diffstat:

 sys/miscfs/fdesc/fdesc_vnops.c |  24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diffs (87 lines):

diff -r c30e2589fe6b -r cda41dd9356b sys/miscfs/fdesc/fdesc_vnops.c
--- a/sys/miscfs/fdesc/fdesc_vnops.c    Thu May 16 03:59:40 2002 +0000
+++ b/sys/miscfs/fdesc/fdesc_vnops.c    Thu May 16 04:02:20 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdesc_vnops.c,v 1.69 2002/04/02 17:46:06 jdolecek Exp $        */
+/*     $NetBSD: fdesc_vnops.c,v 1.69.2.1 2002/05/16 04:02:20 gehenna Exp $     */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.69 2002/04/02 17:46:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.69.2.1 2002/05/16 04:02:20 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -186,6 +186,8 @@
 const struct vnodeopv_desc fdesc_vnodeop_opv_desc =
        { &fdesc_vnodeop_p, fdesc_vnodeop_entries };
 
+extern const struct cdevsw ctty_cdevsw;
+
 /*
  * Initialise cache headers
  */
@@ -195,9 +197,7 @@
        int cttymajor;
 
        /* locate the major number */
-       for (cttymajor = 0; cttymajor < nchrdev; cttymajor++)
-               if (cdevsw[cttymajor].d_open == cttyopen)
-                       break;
+       cttymajor = cdevsw_lookup_major(&ctty_cdevsw);
        devctty = makedev(cttymajor, 0);
        fdhashtbl = hashinit(NFDCACHE, HASH_LIST, M_CACHE, M_NOWAIT, &fdhash);
 }
@@ -455,7 +455,7 @@
                return (ENODEV);
 
        case Fctty:
-               return (cttyopen(devctty, ap->a_mode, 0, ap->a_p));
+               return ((*ctty_cdevsw.d_open)(devctty, ap->a_mode, 0, ap->a_p));
        case Froot:
        case Fdevfd:
        case Flink:
@@ -850,7 +850,7 @@
        switch (VTOFDESC(vp)->fd_type) {
        case Fctty:
                VOP_UNLOCK(vp, 0);
-               error = cttyread(devctty, ap->a_uio, ap->a_ioflag);
+               error = (*ctty_cdevsw.d_read)(devctty, ap->a_uio, ap->a_ioflag);
                vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
                break;
 
@@ -878,7 +878,8 @@
        switch (VTOFDESC(vp)->fd_type) {
        case Fctty:
                VOP_UNLOCK(vp, 0);
-               error = cttywrite(devctty, ap->a_uio, ap->a_ioflag);
+               error = (*ctty_cdevsw.d_write)(devctty, ap->a_uio,
+                                              ap->a_ioflag);
                vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
                break;
 
@@ -906,8 +907,9 @@
 
        switch (VTOFDESC(ap->a_vp)->fd_type) {
        case Fctty:
-               error = cttyioctl(devctty, ap->a_command, ap->a_data,
-                                 ap->a_fflag, ap->a_p);
+               error = (*ctty_cdevsw.d_ioctl)(devctty, ap->a_command,
+                                              ap->a_data, ap->a_fflag,
+                                              ap->a_p);
                break;
 
        default:
@@ -931,7 +933,7 @@
 
        switch (VTOFDESC(ap->a_vp)->fd_type) {
        case Fctty:
-               revents = cttypoll(devctty, ap->a_events, ap->a_p);
+               revents = (*ctty_cdevsw.d_poll)(devctty, ap->a_events, ap->a_p);
                break;
 
        default:



Home | Main Index | Thread Index | Old Index