Annotation of 40BSD/sys/dev/dsort.c, revision 1.1.1.1

1.1       root        1: /*     dsort.c 4.1     11/9/80 */
                      2: 
                      3: /*
                      4:  * generalized seek sort for disk
                      5:  */
                      6: 
                      7: #include "../h/param.h"
                      8: #include "../h/systm.h"
                      9: #include "../h/buf.h"
                     10: 
                     11: #define        b_cylin b_resid
                     12: 
                     13: disksort(dp, bp)
                     14: register struct buf *dp, *bp;
                     15: {
                     16:        register struct buf *ap;
                     17:        struct buf *tp;
                     18: 
                     19:        ap = dp->b_actf;
                     20:        if(ap == NULL) {
                     21:                dp->b_actf = bp;
                     22:                dp->b_actl = bp;
                     23:                bp->av_forw = NULL;
                     24:                return;
                     25:        }
                     26:        tp = NULL;
                     27:        for(; ap != NULL; ap = ap->av_forw) {
                     28:                if ((bp->b_flags&B_READ) && (ap->b_flags&B_READ) == 0) {
                     29:                        if (tp == NULL)
                     30:                                tp = ap;
                     31:                        break;
                     32:                }
                     33:                if ((bp->b_flags&B_READ) == 0 && (ap->b_flags&B_READ))
                     34:                        continue;
                     35:                if(ap->b_cylin <= bp->b_cylin)
                     36:                        if(tp == NULL || ap->b_cylin >= tp->b_cylin)
                     37:                                tp = ap;
                     38:        }
                     39:        if(tp == NULL)
                     40:                tp = dp->b_actl;
                     41:        bp->av_forw = tp->av_forw;
                     42:        tp->av_forw = bp;
                     43:        if(tp == dp->b_actl)
                     44:                dp->b_actl = bp;
                     45: }

unix.superglobalmegacorp.com

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