comparison rvinterf/etmsync/fserr.c @ 289:244f08f58e51

fc-fsio: error decoding implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 28 Feb 2014 23:12:52 +0000
parents
children
comparison
equal deleted inserted replaced
288:e33d71e9033f 289:244f08f58e51
1 /*
2 * FFS error decoding
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <strings.h>
10 #include "etm.h"
11 #include "ffs.h"
12 #include "ffserr.h"
13
14 static struct errtab {
15 int errcode;
16 char *desc;
17 } errtab[] = {
18 {TMFFS_ERR_NODEVICE, "EFFS_NODEVICE: flash device unknown"},
19 {TMFFS_ERR_CORRUPTED, "EFFS_CORRUPTED: filesystem corrupted"},
20 {TMFFS_ERR_NOPREFORMAT, "EFFS_NOPREFORMAT: ffs not preformatted"},
21 {TMFFS_ERR_NOFORMAT, "EFFS_NOFORMAT: ffs not formatted"},
22 {TMFFS_ERR_BADFORMAT,
23 "EFFS_BADFORMAT: incompatible ffs version, reformat needed"},
24 {TMFFS_ERR_MAGIC, "EFFS_MAGIC: bad magic"},
25 {TMFFS_ERR_AGAIN, "EFFS_AGAIN: not ready, try again later"},
26 {TMFFS_ERR_NOSYS, "EFFS_NOSYS: function not implemented"},
27 {TMFFS_ERR_DRIVER, "EFFS_DRIVER: ffs device driver error"},
28 {TMFFS_ERR_NOSPACE, "EFFS_NOSPACE: out of data space"},
29 {TMFFS_ERR_FSFULL, "EFFS_FSFULL: file system full, no free inodes"},
30 {TMFFS_ERR_BADNAME, "EFFS_BADNAME: bad filename"},
31 {TMFFS_ERR_NOTFOUND, "EFFS_NOTFOUND: object not found"},
32 {TMFFS_ERR_EXISTS, "EFFS_EXISTS: object exists"},
33 {TMFFS_ERR_ACCESS, "EFFS_ACCESS: access permission violation"},
34 {TMFFS_ERR_NAMETOOLONG, "EFFS_NAMETOOLONG"},
35 {TMFFS_ERR_INVALID, "EFFS_INVALID"},
36 {TMFFS_ERR_DIRNOTEMPTY, "EFFS_DIRNOTEMPTY"},
37 {TMFFS_ERR_NOTADIR, "EFFS_NOTADIR"},
38 {TMFFS_ERR_SPARE, "EFFS_SPARE"},
39 {TMFFS_ERR_FILETOOBIG, "EFFS_FILETOOBIG"},
40 {TMFFS_ERR_NOTAFILE, "EFFS_NOTAFILE"},
41 {TMFFS_ERR_PATHTOODEEP, "EFFS_PATHTOODEEP"},
42 {TMFFS_ERR_NUMFD, "EFFS_NUMFD: max number of open files reached"},
43 {TMFFS_ERR_BADFD, "EFFS_BADFD: bad file descriptor"},
44 {TMFFS_ERR_BADOP, "EFFS_BADOP: bad operation"},
45 {TMFFS_ERR_LOCKED, "EFFS_LOCKED: the file is locked"},
46 {TMFFS_ERR_TOOBIG, "EFFS_TOOBIG: tmffs buffer overflow"},
47 {TMFFS_ERR_MEMORY, "EFFS_MEMORY: out of memory"},
48 {TMFFS_ERR_MSGSEND, "EFFS_MSGSEND: message send failed"},
49 {TMFFS_ERR_SIBLINGLOOP, "EFFS_SIBLINGLOOP: directory sibling loop"},
50 {TMFFS_ERR_NOBLOCKS, "EFFS_NOBLOCKS: debug error?"},
51 {TMFFS_ERR_DBR, "EFFS_DBR: debug error?"},
52 {TMFFS_ERR_RECLAIMLOOP, "EFFS_RECLAIMLOOP: debug error?"},
53 {0, 0}
54 };
55
56 report_ffs_err(oper, errcode)
57 char *oper;
58 {
59 struct errtab *tp;
60 char *errdesc;
61
62 for (tp = errtab; tp->errcode; tp++)
63 if (tp->errcode == errcode)
64 break;
65 errdesc = tp->desc;
66 if (!errdesc)
67 errdesc = "unknown";
68 printf("%s: FFS error %d (%s)\n", oper, errcode, errdesc);
69 }