14
** PSIO_ERROR(): Print out an error message for libpsio.
16
** \param unit = file number
17
** \param errval = error code (defined symbolically, PSIO_ERROR_XXX)
20
void psio_error(unsigned int unit, unsigned int errval)
24
fprintf(stderr, "PSIO_ERROR: unit = %d\n", unit);
25
/* Try to save the TOCs for all open units */
26
/* psio_tocwrite() does not call psio_error() so this is OK */
27
for(i=0; i < PSIO_MAXUNIT; i++) psio_tocwrite(i);
31
fprintf(stderr, "PSIO_ERROR: %d (I/O inititalization failed)\n", PSIO_ERROR_INIT);
34
fprintf(stderr, "PSIO_ERROR: %d (I/O cleanup failed)\n", PSIO_ERROR_DONE);
36
case PSIO_ERROR_MAXVOL:
37
fprintf(stderr, "PSIO_ERROR: %d (maximum number of volumes exceeded)\n", PSIO_ERROR_MAXVOL);
39
case PSIO_ERROR_NOVOLPATH:
40
fprintf(stderr, "PSIO_ERROR: %d (no volume path given)\n", PSIO_ERROR_NOVOLPATH);
42
case PSIO_ERROR_IDENTVOLPATH:
43
fprintf(stderr, "PSIO_ERROR: %d (two identical volume paths)\n", PSIO_ERROR_IDENTVOLPATH);
46
fprintf(stderr, "PSIO_ERROR: %d (file not open or open call failed)\n", PSIO_ERROR_OPEN);
48
case PSIO_ERROR_REOPEN:
49
fprintf(stderr, "PSIO_ERROR: %d (file is already open)\n", PSIO_ERROR_REOPEN);
51
case PSIO_ERROR_CLOSE:
52
fprintf(stderr, "PSIO_ERROR: %d (file close failed)\n", PSIO_ERROR_CLOSE);
54
case PSIO_ERROR_RECLOSE:
55
fprintf(stderr, "PSIO_ERROR: %d (file is already closed)\n", PSIO_ERROR_RECLOSE);
57
case PSIO_ERROR_OSTAT:
58
fprintf(stderr, "PSIO_ERROR: %d (invalid status flag for file open)\n", PSIO_ERROR_OSTAT);
60
case PSIO_ERROR_LSEEK:
61
fprintf(stderr, "PSIO_ERROR: %d (lseek failed)\n", PSIO_ERROR_LSEEK);
63
case PSIO_ERROR_NOTOCENT:
64
fprintf(stderr, "PSIO_ERROR: %d (no such TOC entry)\n", PSIO_ERROR_NOTOCENT);
66
case PSIO_ERROR_TOCENTSZ:
67
fprintf(stderr, "PSIO_ERROR: %d (TOC entry size mismatch)\n", PSIO_ERROR_TOCENTSZ);
69
case PSIO_ERROR_KEYLEN:
70
fprintf(stderr, "PSIO_ERROR: %d (TOC key too long)\n", PSIO_ERROR_KEYLEN);
72
case PSIO_ERROR_BLKSIZ:
73
fprintf(stderr, "PSIO_ERROR: %d (Requested blocksize invalid)\n", PSIO_ERROR_BLKSIZ);
75
case PSIO_ERROR_BLKSTART:
76
fprintf(stderr, "PSIO_ERROR: %d (Incorrect block start address)\n", PSIO_ERROR_BLKSTART);
78
case PSIO_ERROR_BLKEND:
79
fprintf(stderr, "PSIO_ERROR: %d (Incorrect block end address)\n", PSIO_ERROR_BLKEND);
81
case PSIO_ERROR_MAXUNIT:
82
fprintf(stderr, "PSIO_ERROR: %d (Maximum unit number exceeded)\n", PSIO_ERROR_MAXUNIT);
83
fprintf(stderr, "Open failed because unit %d exceeds ", unit);
84
fprintf(stderr, "PSIO_MAXUNIT = %d.\n", PSIO_MAXUNIT);
87
exit(PSI_RETURN_FAILURE);