Annotation of researchv10no/cmd/worm/oscsi/iodr_sh.c, revision 1.1

1.1     ! root        1: #include       "scsi.h"
        !             2: #include       "juke.h"
        !             3: 
        !             4: j_shelf_to_drive(int sh, Side side, int dr, char *err)
        !             5: {
        !             6:        struct scsi_cmd cmd;
        !             7:        struct scsi_return ret;
        !             8: 
        !             9:        set6(cmd, 0xD6, dr<<5, 0, (sh<<1)|side, 0, 0);
        !            10:        return(s_io(0, &cmd, 0, &ret, 0, err));
        !            11: }
        !            12: 
        !            13: j_drive_to_shelf(int dr, int sh, Side side, char *err)
        !            14: {
        !            15:        struct scsi_cmd cmd;
        !            16:        struct scsi_return ret;
        !            17: 
        !            18:        if(sh < 0)
        !            19:                set6(cmd, 0xD7, dr<<5, 0, 0, 0, 0);
        !            20:        else
        !            21:                set6(cmd, 0xD7, (dr<<5)|1, 0, (sh<<1)|side, 0, 0);
        !            22:        return(s_io(0, &cmd, 0, &ret, 0, err));
        !            23: }
        !            24: 
        !            25: int
        !            26: j_empty_drive(long tlimit, char *buf)
        !            27: {      
        !            28:        int i, tstop;
        !            29:        
        !            30:        tstop = time((long *)0) + tlimit;
        !            31:        while(time((long *)0) <= tstop){
        !            32:                setnlun();              /* in case it changes */
        !            33:                /* look for empty drives */
        !            34:                for(i = 0; i < nlun; i++)
        !            35:                        if(!j_status.lun[i].diskin)
        !            36:                                return(i);
        !            37:                /* look for spun down drives */
        !            38:                for(i = 0; i < nlun; i++){
        !            39:                        if(!j_status.lun[i].ready){
        !            40:                                if(j_drive_to_shelf(i, -1, SIDEA, buf))
        !            41:                                        return(-1);
        !            42:                                else
        !            43:                                        return(i);
        !            44:                        }
        !            45:                }
        !            46:                sleep(10);
        !            47:                if(j_getstatus(buf))    /* get the jukebox status */
        !            48:                        return(-1);
        !            49:        }
        !            50:        return(-1);
        !            51: }

unix.superglobalmegacorp.com

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