annotate rvinterf/etmsync/fserr.c @ 875:dab341e172de

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