blob: 559353d87ff697dca4b6b87ecdb58294f843174c (
plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#ifndef ERRLMANAGER_H
#define ERRLMANAGER_H
/**
* @file errlmanager.H
*
* @brief Error Log management for Host Boot environment.
*
*/
/*****************************************************************************/
// I n c l u d e s
/*****************************************************************************/
#include <stdint.h>
#include <stdlib.h>
#include <util/singleton.H>
#include <errl/errltypes.H>
namespace ERRORLOG
{
/**
* @brief Global function to log an error
* Writes the log to PNOR where committed logs are kept.
* If there's not enough room, remove the latest log(s) to make
* enough room to commit this log.
* The error log will be automatically deleted after the
* commit. The input handle will be set to NULL.
* For Host Boot environment, there's no individual committer
* (i.e. committer = Host Boot), so no component ID of
* committer is specified.
* This function is global in order to workaround the singleton
* linker issue in HostBoot (linker can't find singleton outside of
* a module).
*
* @param[in,out] io_err Error log handle to be committed
*
* @return None
*/
void errlCommit(errlHndl_t& io_err);
/*****************************************************************************/
// Forward class declarations
/*****************************************************************************/
class ErrlEntry;
class ErrlManager;
// Singleton - Use "theErrlManager::instance()" to access the singleton
typedef Singleton<ErrlManager> theErrlManager;
/**
* @brief Error log manager
* This class provides interfaces to perform some specific tasks
* on existing error objects such as committing a log, sending the
* log to the SP, etc..
*/
class ErrlManager
{
public:
/**
* @brief Commit an error log by sending it to the repository
* Writes the log to PNOR where committed logs are kept.
* If there's not enough room, remove the latest log(s) to make
* enough room to commit this log.
* The error log will be automatically deleted after the
* commit. The input handle will be set to NULL.
* For Host Boot environment, there's no individual committer
* (i.e. committer = Host Boot), so no component ID of
* committer is specified.
*
* @param[in,out] io_err Error log handle to be committed
*
* @return None
*/
void commitErrLog(errlHndl_t& io_err);
/**
* @brief Returns a unique error log ID
*
* This routine generates a unique Error ID and assign it to
* the input error log
*
* @return Unique generated error log ID
*/
uint32_t getUniqueErrId();
protected:
/**
* @brief Destructor
*
* Releases all resources owned by the handle. If the log has not
* been committed, it effectively aborts the log.
* All logs (committed or not) must be deleted to avoid a resource leak.
*
* @return None
*
*/
~ErrlManager();
/**
* @brief Default constructor
* Protected so only SingletonHolder can call
*/
ErrlManager();
private:
/**
* @brief Disabled copy constructor and assignment operator
*/
ErrlManager(const ErrlManager& i_right);
ErrlManager& operator=(const ErrlManager& i_right);
uint32_t iv_currLogId;
};
} // End namespace
#endif //ERRLMANAGER_H
|