|
|
1.1 ! root 1: #include <stddef.h> ! 2: #include <stdio.h> ! 3: #include <string.h> ! 4: #include "scsi.h" ! 5: #include "juke.h" ! 6: ! 7: allocate(char *vol_id, char *buf) ! 8: { ! 9: int drive, sh; ! 10: char nbuf[512]; ! 11: ! 12: if(j_rdshelves(buf)) /* read in shelf names */ ! 13: return(-1); ! 14: if(j_getstatus(buf)) /* get the jukebox status */ ! 15: return(-1); ! 16: sh = j_shelfof(vol_id); ! 17: if(sh >= 0){ ! 18: sprintf(buf, "there is an existing '%s' on shelf %d", vol_id, sh); ! 19: return(-1); ! 20: } ! 21: sh = j_shelfof(UNALLOCATED); ! 22: if(sh < 0){ ! 23: sprintf(buf, "no unallocated disks"); ! 24: return(-1); ! 25: } ! 26: printf("using unallocated disk from shelf %d\n", sh); ! 27: drive = min(nlun+1, NLUN-1); ! 28: if(j_shelf_to_drive(sh, SIDEB, drive, buf) < 0) ! 29: return(-1); ! 30: sprintf(nbuf, "%sb", vol_id); ! 31: if(j_wvolid(drive, nbuf, buf)) ! 32: return(-1); ! 33: j_wrshelf = 1; ! 34: j_shelf[sh] = strdup(vol_id); ! 35: if(j_drive_to_shelf(drive, sh, SIDEB, buf) < 0) ! 36: return(-1); ! 37: if(j_shelf_to_drive(sh, SIDEA, drive, buf) < 0) ! 38: return(-1); ! 39: sprintf(nbuf, "%sa", vol_id); ! 40: if(j_wvolid(drive, nbuf, buf)) ! 41: return(-1); ! 42: if(j_drive_to_shelf(drive, sh, SIDEA, buf) < 0) ! 43: return(-1); ! 44: return(0); ! 45: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.