Annotation of coherent/d/PS2_KERNEL/coh.286/null.c, revision 1.1

1.1     ! root        1: /* $Header: /kernel/kersrc/coh.286/RCS/null.c,v 1.1 92/07/17 15:18:09 bin Exp Locker: bin $ */
        !             2: /* (lgl-
        !             3:  *     The information contained herein is a trade secret of Mark Williams
        !             4:  *     Company, and  is confidential information.  It is provided  under a
        !             5:  *     license agreement,  and may be  copied or disclosed  only under the
        !             6:  *     terms of  that agreement.  Any  reproduction or disclosure  of this
        !             7:  *     material without the express written authorization of Mark Williams
        !             8:  *     Company or persuant to the license agreement is unlawful.
        !             9:  *
        !            10:  *     COHERENT Version 2.3.37
        !            11:  *     Copyright (c) 1982, 1983, 1984.
        !            12:  *     An unpublished work by Mark Williams Company, Chicago.
        !            13:  *     All rights reserved.
        !            14:  -lgl) */
        !            15: /*
        !            16:  * Null and memory driver.
        !            17:  *  Minor device 0 is /dev/null
        !            18:  *  Minor device 1 is physical memory
        !            19:  *  Minor device 2 is kernel data
        !            20:  *
        !            21:  * $Log:       null.c,v $
        !            22:  * Revision 1.1  92/07/17  15:18:09  bin
        !            23:  * Initial revision
        !            24:  * 
        !            25:  * Revision 1.1        88/03/24  16:14:04      src
        !            26:  * Initial revision
        !            27:  * 
        !            28:  */
        !            29: #include <sys/coherent.h>
        !            30: #include <sys/con.h>
        !            31: #include <errno.h>
        !            32: #include <sys/stat.h>
        !            33: 
        !            34: /*
        !            35:  * Functions for configuration.
        !            36:  */
        !            37: int    nlread();
        !            38: int    nlwrite();
        !            39: int    nulldev();
        !            40: int    nonedev();
        !            41: 
        !            42: /*
        !            43:  * Configuration table.
        !            44:  */
        !            45: CON nlcon ={
        !            46:        DFCHR,                          /* Flags */
        !            47:        0,                              /* Major index */
        !            48:        nulldev,                        /* Open */
        !            49:        nulldev,                        /* Close */
        !            50:        nulldev,                        /* Block */
        !            51:        nlread,                         /* Read */
        !            52:        nlwrite,                        /* Write */
        !            53:        nonedev,                        /* Ioctl */
        !            54:        nulldev,                        /* Powerfail */
        !            55:        nulldev,                        /* Timeout */
        !            56:        nulldev,                        /* Load */
        !            57:        nulldev                         /* Unload */
        !            58: };
        !            59: 
        !            60: /*
        !            61:  * Null/memory read routine.
        !            62:  */
        !            63: nlread(dev, iop)
        !            64: dev_t dev;
        !            65: register IO *iop;
        !            66: {
        !            67:        register unsigned n;
        !            68: 
        !            69:        switch (minor(dev)) {
        !            70:        case 0:
        !            71:                n = 0;
        !            72:                break;
        !            73: 
        !            74:        case 1:
        !            75:                n = pucopy((long)iop->io_seek, iop->io_base, iop->io_ioc);
        !            76:                break;
        !            77: 
        !            78:        case 2:
        !            79:                n = kucopy((vaddr_t)iop->io_seek, iop->io_base, iop->io_ioc);
        !            80:                break;
        !            81: 
        !            82:        default:
        !            83:                u.u_error = ENXIO;
        !            84:                return;
        !            85:        }
        !            86:        iop->io_ioc -= n;
        !            87:        if (u.u_error == EFAULT)
        !            88:                u.u_error = 0;
        !            89: }
        !            90: 
        !            91: /*
        !            92:  * Null/memory write routine.
        !            93:  */
        !            94: nlwrite(dev, iop)
        !            95: dev_t dev;
        !            96: register IO *iop;
        !            97: {
        !            98:        register unsigned n;
        !            99: 
        !           100:        switch (minor(dev)) {
        !           101:        case 0:
        !           102:                n = iop->io_ioc;
        !           103:                break;
        !           104: 
        !           105:        case 1:
        !           106:                n = upcopy(iop->io_base, (long)iop->io_seek, iop->io_ioc);
        !           107:                break;
        !           108: 
        !           109:        case 2:
        !           110:                n = ukcopy(iop->io_base, (vaddr_t)iop->io_seek, iop->io_ioc);
        !           111:                break;
        !           112: 
        !           113:        default:
        !           114:                u.u_error = ENXIO;
        !           115:                return;
        !           116:        }
        !           117:        iop->io_ioc -= n;
        !           118:        if (u.u_error == EFAULT)
        !           119:                u.u_error = 0;
        !           120: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.