1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/***************************************************************************
imgterrs.h
Imgtool errors
***************************************************************************/
#ifndef IMGTERRS_H
#define IMGTERRS_H
/* Error codes */
enum imgtoolerr_t
{
IMGTOOLERR_SUCCESS,
IMGTOOLERR_OUTOFMEMORY,
IMGTOOLERR_UNEXPECTED,
IMGTOOLERR_BUFFERTOOSMALL,
IMGTOOLERR_READERROR,
IMGTOOLERR_WRITEERROR,
IMGTOOLERR_READONLY,
IMGTOOLERR_CORRUPTIMAGE,
IMGTOOLERR_CORRUPTFILE,
IMGTOOLERR_CORRUPTDIR,
IMGTOOLERR_FILENOTFOUND,
IMGTOOLERR_MODULENOTFOUND,
IMGTOOLERR_UNIMPLEMENTED,
IMGTOOLERR_PARAMTOOSMALL,
IMGTOOLERR_PARAMTOOLARGE,
IMGTOOLERR_PARAMNEEDED,
IMGTOOLERR_PARAMNOTNEEDED,
IMGTOOLERR_PARAMCORRUPT,
IMGTOOLERR_BADFILENAME,
IMGTOOLERR_NOSPACE,
IMGTOOLERR_INPUTPASTEND,
IMGTOOLERR_CANNOTUSEPATH,
IMGTOOLERR_INVALIDPATH,
IMGTOOLERR_PATHNOTFOUND,
IMGTOOLERR_DIRNOTEMPTY,
IMGTOOLERR_SEEKERROR,
IMGTOOLERR_NOFORKS,
IMGTOOLERR_FORKNOTFOUND,
IMGTOOLERR_INVALIDPARTITION
};
/* These error codes are actually modifiers that make it easier to distinguish
* the cause of an error
*
* Note - drivers should not use these modifiers
*/
#define IMGTOOLERR_SRC_MODULE 0x1000
#define IMGTOOLERR_SRC_FUNCTIONALITY 0x2000
#define IMGTOOLERR_SRC_IMAGEFILE 0x3000
#define IMGTOOLERR_SRC_FILEONIMAGE 0x4000
#define IMGTOOLERR_SRC_NATIVEFILE 0x5000
#define ERRORCODE(err) ((err) & 0x0fff)
#define ERRORSOURCE(err) ((err) & 0xf000)
#define ERRORPARAM(err) (((err) & 0xf0000) / 0x10000)
#define PARAM_TO_ERROR(errcode, param) ((errcode) | ((param) * 0x10000))
const char *imgtool_error(imgtoolerr_t err);
#endif /* IMGTERRS_H */
|