Annotation of coherent/d/286_KERNEL/USRSRC/io/fdisk.c, revision 1.1

1.1     ! root        1: /* (-lgl
        !             2:  *     COHERENT Driver Kit Version 1.1.0
        !             3:  *     Copyright (c) 1982, 1990 by Mark Williams Company.
        !             4:  *     All rights reserved. May not be copied without permission.
        !             5:  -lgl) */
        !             6: /**
        !             7:  *
        !             8:  * fdisk( dev, fp )    --      Fixed Disk Configuration
        !             9:  * dev_t dev;
        !            10:  * struct fdisk_s *fp;
        !            11:  *
        !            12:  *     Input:  dev = special device to read partition information from
        !            13:  *             fp  = pointer to memory-resident partition info (to update)
        !            14:  *
        !            15:  *     Action: Open special device for reading.
        !            16:  *             Read first block from the device.
        !            17:  *             If valid signature present on block,
        !            18:  *                     copy partition information to memory
        !            19:  *
        !            20:  *     Return: 1 = partition information successfully updated
        !            21:  *             0 = failure (could not read block, or bad signature)
        !            22:  */
        !            23: 
        !            24: #include <sys/coherent.h>
        !            25: #include <sys/uproc.h>
        !            26: #include <errno.h>
        !            27: #include <sys/inode.h>
        !            28: #include <sys/fdisk.h>
        !            29: #include <sys/buf.h>
        !            30: #include <sys/con.h>
        !            31: 
        !            32: fdisk( dev, fp )
        !            33: dev_t dev;
        !            34: register struct fdisk_s *fp;
        !            35: {
        !            36:        register struct hdisk_s *hp;
        !            37:        BUF *bp;
        !            38:        int s, i;
        !            39:        int ret = 0;
        !            40: 
        !            41:        s = sphi( );
        !            42:        dopen( dev, IPR, DFBLK );
        !            43: 
        !            44:        if ( u.u_error == 0 ) {         /* special device now open */
        !            45: 
        !            46:                if (bp = bread(dev, (daddr_t) 0, 1)) {  /* data read */
        !            47: 
        !            48:                        /* buffer cache is in kernel data space */
        !            49:                        hp = FP_OFF(bp->b_faddr);
        !            50: 
        !            51:                        if ( hp->hd_sig == HDSIG ) {    /* valid data */
        !            52: 
        !            53:                                for (i=0; i < NPARTN; ++i)
        !            54:                                        *fp++ = hp->hd_partn[i];
        !            55: 
        !            56:                                ret   = 1;
        !            57:                        }
        !            58:                        brelease( bp );
        !            59:                }
        !            60:                dclose( dev );
        !            61:        }
        !            62:        spl( s );
        !            63:        return ret;
        !            64: }

unix.superglobalmegacorp.com

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