Annotation of coherent/d/286_KERNEL/USRSRC/coh/null.c, revision 1.1.1.1

1.1       root        1: /* $Header: /newbits/286_KERNEL/USRSRC/coh/RCS/null.c,v 1.1 92/01/09 13:28:56 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/01/09  13:28:56  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: #include <sys/uproc.h>
                     34: 
                     35: /*
                     36:  * Functions for configuration.
                     37:  */
                     38: int    nlread();
                     39: int    nlwrite();
                     40: int    nulldev();
                     41: int    nonedev();
                     42: 
                     43: /*
                     44:  * Configuration table.
                     45:  */
                     46: CON nlcon ={
                     47:        DFCHR,                          /* Flags */
                     48:        0,                              /* Major index */
                     49:        nulldev,                        /* Open */
                     50:        nulldev,                        /* Close */
                     51:        nulldev,                        /* Block */
                     52:        nlread,                         /* Read */
                     53:        nlwrite,                        /* Write */
                     54:        nonedev,                        /* Ioctl */
                     55:        nulldev,                        /* Powerfail */
                     56:        nulldev,                        /* Timeout */
                     57:        nulldev,                        /* Load */
                     58:        nulldev                         /* Unload */
                     59: };
                     60: 
                     61: /*
                     62:  * Null/memory read routine.
                     63:  */
                     64: nlread(dev, iop)
                     65: dev_t dev;
                     66: register IO *iop;
                     67: {
                     68:        register unsigned n;
                     69: 
                     70:        switch (minor(dev)) {
                     71:        case 0:
                     72:                n = 0;
                     73:                break;
                     74: 
                     75:        case 1:
                     76:                n = pucopy((long)iop->io_seek, iop->io_base, iop->io_ioc);
                     77:                break;
                     78: 
                     79:        case 2:
                     80:                n = kucopy((vaddr_t)iop->io_seek, iop->io_base, iop->io_ioc);
                     81:                break;
                     82: 
                     83:        default:
                     84:                u.u_error = ENXIO;
                     85:                return;
                     86:        }
                     87:        iop->io_ioc -= n;
                     88:        if (u.u_error == EFAULT)
                     89:                u.u_error = 0;
                     90: }
                     91: 
                     92: /*
                     93:  * Null/memory write routine.
                     94:  */
                     95: nlwrite(dev, iop)
                     96: dev_t dev;
                     97: register IO *iop;
                     98: {
                     99:        register unsigned n;
                    100: 
                    101:        switch (minor(dev)) {
                    102:        case 0:
                    103:                n = iop->io_ioc;
                    104:                break;
                    105: 
                    106:        case 1:
                    107:                n = upcopy(iop->io_base, (long)iop->io_seek, iop->io_ioc);
                    108:                break;
                    109: 
                    110:        case 2:
                    111:                n = ukcopy(iop->io_base, (vaddr_t)iop->io_seek, iop->io_ioc);
                    112:                break;
                    113: 
                    114:        default:
                    115:                u.u_error = ENXIO;
                    116:                return;
                    117:        }
                    118:        iop->io_ioc -= n;
                    119:        if (u.u_error == EFAULT)
                    120:                u.u_error = 0;
                    121: }

unix.superglobalmegacorp.com

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