forked from nvmecompliance/tnvme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trackable.cpp
82 lines (71 loc) · 3.28 KB
/
trackable.cpp
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
/*
* Copyright (c) 2011, Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "trackable.h"
#include "tnvme.h"
#include "Exception/frmwkEx.h"
SharedTrackablePtr Trackable::NullTrackablePtr;
Trackable::Trackable(ObjType objBeingCreated)
{
if (objBeingCreated >= OBJTYPE_FENCE)
throw FrmwkEx(HERE, "Illegal constructor");
mObjType = objBeingCreated;
}
Trackable::~Trackable()
{
LOG_DBG("Destroying trackable obj: %s", GetObjName(mObjType).c_str());
}
string
Trackable::GetObjName(ObjType obj)
{
string name;
switch (obj) {
case OBJ_MEMBUFFER: name = "MemBuffer"; break;
case OBJ_ACQ: name = "ACQ"; break;
case OBJ_ASQ: name = "ASQ"; break;
case OBJ_IOCQ: name = "IOCQ"; break;
case OBJ_IOSQ: name = "IOSQ"; break;
case OBJ_ADMINCMD: name = "AdminCmd"; break;
case OBJ_IDENTIFY: name = "Identify"; break;
case OBJ_CREATEIOCQ: name = "CreateIOCQ"; break;
case OBJ_CREATEIOSQ: name = "CreateIOSQ"; break;
case OBJ_DELETEIOCQ: name = "DeleteIOCQ"; break;
case OBJ_DELETEIOSQ: name = "DeleteIOSQ"; break;
case OBJ_GETFEATURES: name = "GetFeatures"; break;
case OBJ_SETFEATURES: name = "SetFeatures"; break;
case OBJ_GETLOGPAGE: name = "GetLogPage"; break;
case OBJ_FWACTIVATE: name = "FwActivate"; break;
case OBJ_FWIMGDNLD: name = "FwImgDnld"; break;
case OBJ_FORMATNVM: name = "FormatNVM"; break;
case OBJ_ASYNCEVENTREQ: name = "AsyncEventReq"; break;
case OBJ_SECURITYSEND: name = "SecuritySend"; break;
case OBJ_SECURITYRCV: name = "SecurityRcv"; break;
case OBJ_NVMCMD: name = "NVMCmd"; break;
case OBJ_WRITE: name = "Write"; break;
case OBJ_READ: name = "Read"; break;
case OBJ_FLUSH: name = "Flush"; break;
case OBJ_DATASETMGMT: name = "DatasetMgmt"; break;
case OBJ_WRITEZEROES: name = "WriteZeroes"; break; // Not yet implemented
case OBJ_RESERVATIONREGISTER: name = "ReservationRegister"; break;
case OBJ_RESERVATIONREPORT: name = "ReservationReport"; break;
case OBJ_RESERVATIONACQUIRE: name = "ReservationAcquire"; break;
case OBJ_RESERVATIONRELEASE: name = "ReservationRelease"; break;
case OBJ_NAMESPACEATTACH: name = "NamespaceAttach"; break;
case OBJ_NAMESPACEMANAGEMENT: name = "NamespaceManagement"; break;
default:
throw FrmwkEx(HERE, "Forgot to label this unknown obj");
}
return name;
}