Annotation of 43BSDReno/sys/stand/dev.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution is only permitted until one year after the first shipment
        !             6:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
        !             7:  * binary forms are permitted provided that: (1) source distributions retain
        !             8:  * this entire copyright notice and comment, and (2) distributions including
        !             9:  * binaries display the following acknowledgement:  This product includes
        !            10:  * software developed by the University of California, Berkeley and its
        !            11:  * contributors'' in the documentation or other materials provided with the
        !            12:  * distribution and in all advertising materials mentioning features or use
        !            13:  * of this software.  Neither the name of the University nor the names of
        !            14:  * its contributors may be used to endorse or promote products derived from
        !            15:  * this software without specific prior written permission.
        !            16:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            17:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            18:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            19:  *
        !            20:  *     @(#)dev.c       7.8 (Berkeley) 6/28/90
        !            21:  */
        !            22: 
        !            23: #include "sys/param.h"
        !            24: #include "saio.h"
        !            25: 
        !            26: /*
        !            27:  * NB: the value "io->i_dev", used to offset the devsw[] array
        !            28:  * in the routines below, is munged by the vaxstand Makefile to work
        !            29:  * for certain boots.
        !            30:  */
        !            31: 
        !            32: devread(io)
        !            33:        register struct iob *io;
        !            34: {
        !            35:        int cc;
        !            36: 
        !            37:        io->i_flgs |= F_RDDATA;
        !            38:        io->i_error = 0;
        !            39:        cc = (*devsw[io->i_dev].dv_strategy)(io, READ);
        !            40:        io->i_flgs &= ~F_TYPEMASK;
        !            41:        return (cc);
        !            42: }
        !            43: 
        !            44: devwrite(io)
        !            45:        register struct iob *io;
        !            46: {
        !            47:        int cc;
        !            48: 
        !            49:        io->i_flgs |= F_WRDATA;
        !            50:        io->i_error = 0;
        !            51:        cc = (*devsw[io->i_dev].dv_strategy)(io, WRITE);
        !            52:        io->i_flgs &= ~F_TYPEMASK;
        !            53:        return (cc);
        !            54: }
        !            55: 
        !            56: devopen(io)
        !            57:        register struct iob *io;
        !            58: {
        !            59:        int ret;
        !            60: 
        !            61:        if (!(ret = (*devsw[io->i_dev].dv_open)(io)))
        !            62:                return (0);
        !            63:        printf("%s(%d,%d,%d,%d): ", devsw[io->i_dev].dv_name,
        !            64:                io->i_adapt, io->i_ctlr, io->i_unit, io->i_part);
        !            65:        switch(ret) {
        !            66:        case EIO:
        !            67:                break;          /* already reported */
        !            68:        case EADAPT:
        !            69:                printf("bad adaptor number\n");
        !            70:                break;
        !            71:        case ECTLR:
        !            72:                printf("bad controller number\n");
        !            73:                break;
        !            74:        case EUNIT:
        !            75:                printf("bad drive number\n");
        !            76:                break;
        !            77:        case EPART:
        !            78:                printf("bad partition\n");
        !            79:                break;
        !            80:        case ERDLAB:
        !            81:                printf("can't read disk label\n");
        !            82:                break;
        !            83:        case EUNLAB:
        !            84:                printf("unlabeled\n");
        !            85:                break;
        !            86:        case ENXIO:
        !            87:                printf("bad device specification\n");
        !            88:                break;
        !            89:        default:
        !            90:                printf("unknown open error\n");
        !            91:                break;
        !            92:        }
        !            93:        return (ret);
        !            94: }
        !            95: 
        !            96: devclose(io)
        !            97:        register struct iob *io;
        !            98: {
        !            99:        (*devsw[io->i_dev].dv_close)(io);
        !           100: }
        !           101: 
        !           102: devioctl(io, cmd, arg)
        !           103:        register struct iob *io;
        !           104:        int cmd;
        !           105:        caddr_t arg;
        !           106: {
        !           107:        return ((*devsw[io->i_dev].dv_ioctl)(io, cmd, arg));
        !           108: }
        !           109: 
        !           110: /*ARGSUSED*/
        !           111: nullsys(io)
        !           112:        struct iob *io;
        !           113: {}
        !           114: 
        !           115: /*ARGSUSED*/
        !           116: nodev(io)
        !           117:        struct iob *io;
        !           118: {
        !           119:        errno = EBADF;
        !           120: }
        !           121: 
        !           122: /*ARGSUSED*/
        !           123: noioctl(io, cmd, arg)
        !           124:        struct iob *io;
        !           125:        int cmd;
        !           126:        caddr_t arg;
        !           127: {
        !           128:        return (ECMD);
        !           129: }

unix.superglobalmegacorp.com

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