|
|
1.1 root 1: #define _POSIX_SOURCE
2: #include <stddef.h>
3: #include <stdlib.h>
4: #include <stdio.h>
5: #include <unistd.h>
6: #include <string.h>
7: #include "jukeface.h"
8: #include "jukebox.h"
9:
10: j_warm(Jukebox *j, char *buf)
11: {
12: int side, i;
13: int drive, sh;
14: char vol_id[512];
15:
16: if(j_rdshelves(j, buf)) /* read in shelf names */
17: return(-1);
18: drive = j->nluns-1;
19: if(j_shstatus(j, buf)) /* get the jukebox status */
20: return(-1);
21: for(;;){
22: for(sh = 0; sh < j->nshelves; sh++)
23: if(j->shelves[sh] == 0) break;
24: if(sh >= j->nshelves)
25: break;
26: if((i = j_load_unloaded(drive, buf)) < 0)
27: return(-1);
28: if(i == 0)
29: break; /* no more disks */
30: if(j_dr_to_sh(drive, sh, SIDEA, buf))
31: return(-1);
32: if(getvol(sh, drive, vol_id, &side)){
33: strcpy(buf, vol_id);
34: return(-1);
35: }
36: printf("%s -> %d\n", vol_id, sh);
37: if(j_dr_to_sh(drive, sh, side, buf) < 0)
38: return(-1);
39: j_wrshelf = 1;
40: j->names[sh] = strdup(vol_id);
41: j->shelves[sh] = 1;
42: sleep(3);
43: }
44: return(0);
45: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.