diff options
author | Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com> | 2018-12-03 15:08:59 +0530 |
---|---|---|
committer | Vernon Mauery <vernon.mauery@linux.intel.com> | 2018-12-11 14:29:30 +0000 |
commit | a45cb34ff6e6c778e2d2b86518afb8bc0a54d189 (patch) | |
tree | 605604911d40cc575c6be9fa927e6922de1e571c /user_channel | |
parent | ae4b040bd08839efcbc08a78d4f6ce6d77e66050 (diff) | |
download | phosphor-host-ipmid-a45cb34ff6e6c778e2d2b86518afb8bc0a54d189.tar.gz phosphor-host-ipmid-a45cb34ff6e6c778e2d2b86518afb8bc0a54d189.zip |
Update const uint8_t& to const uint8_t
Update const uint8_t& to const uint8_t usage. Passing by reference
for small types are costly than passing it by value and hence the
change is done
Unit-Test
1. Performed build and verified regular user account creation
and RMCP+ login
Change-Id: Ic2dd76795749148f82564677dde2a5db08520454
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
Diffstat (limited to 'user_channel')
-rw-r--r-- | user_channel/channel_layer.cpp | 32 | ||||
-rw-r--r-- | user_channel/channel_layer.hpp | 32 | ||||
-rw-r--r-- | user_channel/channel_mgmt.cpp | 38 | ||||
-rw-r--r-- | user_channel/channel_mgmt.hpp | 38 | ||||
-rw-r--r-- | user_channel/user_layer.cpp | 20 | ||||
-rw-r--r-- | user_channel/user_layer.hpp | 20 | ||||
-rw-r--r-- | user_channel/user_mgmt.cpp | 20 | ||||
-rw-r--r-- | user_channel/user_mgmt.hpp | 19 |
8 files changed, 107 insertions, 112 deletions
diff --git a/user_channel/channel_layer.cpp b/user_channel/channel_layer.cpp index 32f4ded..ae23f3f 100644 --- a/user_channel/channel_layer.cpp +++ b/user_channel/channel_layer.cpp @@ -23,7 +23,7 @@ namespace ipmi { -bool doesDeviceExist(const uint8_t& chNum) +bool doesDeviceExist(const uint8_t chNum) { // TODO: This is not the reliable way to find the device // associated with ethernet interface as the channel number to @@ -42,34 +42,34 @@ bool doesDeviceExist(const uint8_t& chNum) return true; } -bool isValidPrivLimit(const uint8_t& privLimit) +bool isValidPrivLimit(const uint8_t privLimit) { return ((privLimit >= PRIVILEGE_CALLBACK) && (privLimit <= PRIVILEGE_OEM)); } -bool isValidAccessMode(const uint8_t& accessMode) +bool isValidAccessMode(const uint8_t accessMode) { return ( (accessMode >= static_cast<uint8_t>(EChannelAccessMode::disabled)) && (accessMode <= static_cast<uint8_t>(EChannelAccessMode::shared))); } -bool isValidChannel(const uint8_t& chNum) +bool isValidChannel(const uint8_t chNum) { return getChannelConfigObject().isValidChannel(chNum); } -bool isValidAuthType(const uint8_t& chNum, const EAuthType& authType) +bool isValidAuthType(const uint8_t chNum, const EAuthType& authType) { return getChannelConfigObject().isValidAuthType(chNum, authType); } -EChannelSessSupported getChannelSessionSupport(const uint8_t& chNum) +EChannelSessSupported getChannelSessionSupport(const uint8_t chNum) { return getChannelConfigObject().getChannelSessionSupport(chNum); } -int getChannelActiveSessions(const uint8_t& chNum) +int getChannelActiveSessions(const uint8_t chNum) { return getChannelConfigObject().getChannelActiveSessions(chNum); } @@ -80,48 +80,48 @@ ipmi_ret_t ipmiChannelInit() return IPMI_CC_OK; } -ipmi_ret_t getChannelInfo(const uint8_t& chNum, ChannelInfo& chInfo) +ipmi_ret_t getChannelInfo(const uint8_t chNum, ChannelInfo& chInfo) { return getChannelConfigObject().getChannelInfo(chNum, chInfo); } -ipmi_ret_t getChannelAccessData(const uint8_t& chNum, +ipmi_ret_t getChannelAccessData(const uint8_t chNum, ChannelAccess& chAccessData) { return getChannelConfigObject().getChannelAccessData(chNum, chAccessData); } -ipmi_ret_t setChannelAccessData(const uint8_t& chNum, +ipmi_ret_t setChannelAccessData(const uint8_t chNum, const ChannelAccess& chAccessData, - const uint8_t& setFlag) + const uint8_t setFlag) { return getChannelConfigObject().setChannelAccessData(chNum, chAccessData, setFlag); } -ipmi_ret_t getChannelAccessPersistData(const uint8_t& chNum, +ipmi_ret_t getChannelAccessPersistData(const uint8_t chNum, ChannelAccess& chAccessData) { return getChannelConfigObject().getChannelAccessPersistData(chNum, chAccessData); } -ipmi_ret_t setChannelAccessPersistData(const uint8_t& chNum, +ipmi_ret_t setChannelAccessPersistData(const uint8_t chNum, const ChannelAccess& chAccessData, - const uint8_t& setFlag) + const uint8_t setFlag) { return getChannelConfigObject().setChannelAccessPersistData( chNum, chAccessData, setFlag); } -ipmi_ret_t getChannelAuthTypeSupported(const uint8_t& chNum, +ipmi_ret_t getChannelAuthTypeSupported(const uint8_t chNum, uint8_t& authTypeSupported) { return getChannelConfigObject().getChannelAuthTypeSupported( chNum, authTypeSupported); } -ipmi_ret_t getChannelEnabledAuthType(const uint8_t& chNum, const uint8_t& priv, +ipmi_ret_t getChannelEnabledAuthType(const uint8_t chNum, const uint8_t priv, EAuthType& authType) { return getChannelConfigObject().getChannelEnabledAuthType(chNum, priv, diff --git a/user_channel/channel_layer.hpp b/user_channel/channel_layer.hpp index fa15378..3a9b5f5 100644 --- a/user_channel/channel_layer.hpp +++ b/user_channel/channel_layer.hpp @@ -142,7 +142,7 @@ struct ChannelInfo * * @return true if valid, false otherwise */ -bool isValidChannel(const uint8_t& chNum); +bool isValidChannel(const uint8_t chNum); /** @brief determines whether channel device exist * @@ -150,7 +150,7 @@ bool isValidChannel(const uint8_t& chNum); * * @return true if valid, false otherwise */ -bool doesDeviceExist(const uint8_t& chNum); +bool doesDeviceExist(const uint8_t chNum); /** @brief determines whether privilege limit is valid * @@ -158,7 +158,7 @@ bool doesDeviceExist(const uint8_t& chNum); * * @return true if valid, false otherwise */ -bool isValidPrivLimit(const uint8_t& privLimit); +bool isValidPrivLimit(const uint8_t privLimit); /** @brief determines whether access mode is valid * @@ -166,7 +166,7 @@ bool isValidPrivLimit(const uint8_t& privLimit); * * @return true if valid, false otherwise */ -bool isValidAccessMode(const uint8_t& accessMode); +bool isValidAccessMode(const uint8_t accessMode); /** @brief determines valid authentication type based on channel number * @@ -175,7 +175,7 @@ bool isValidAccessMode(const uint8_t& accessMode); * * @return true if valid, false otherwise */ -bool isValidAuthType(const uint8_t& chNum, const EAuthType& authType); +bool isValidAuthType(const uint8_t chNum, const EAuthType& authType); /** @brief determines supported session type of a channel * @@ -183,7 +183,7 @@ bool isValidAuthType(const uint8_t& chNum, const EAuthType& authType); * * @return EChannelSessSupported - supported session type */ -EChannelSessSupported getChannelSessionSupport(const uint8_t& chNum); +EChannelSessSupported getChannelSessionSupport(const uint8_t chNum); /** @brief determines number of active sessions on a channel * @@ -191,7 +191,7 @@ EChannelSessSupported getChannelSessionSupport(const uint8_t& chNum); * * @return numer of active sessions */ -int getChannelActiveSessions(const uint8_t& chNum); +int getChannelActiveSessions(const uint8_t chNum); /** @brief initializes channel management * @@ -206,7 +206,7 @@ ipmi_ret_t ipmiChannelInit(); * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t getChannelInfo(const uint8_t& chNum, ChannelInfo& chInfo); +ipmi_ret_t getChannelInfo(const uint8_t chNum, ChannelInfo& chInfo); /** @brief provides channel access data * @@ -215,7 +215,7 @@ ipmi_ret_t getChannelInfo(const uint8_t& chNum, ChannelInfo& chInfo); * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t getChannelAccessData(const uint8_t& chNum, +ipmi_ret_t getChannelAccessData(const uint8_t chNum, ChannelAccess& chAccessData); /** @brief to set channel access data @@ -226,9 +226,9 @@ ipmi_ret_t getChannelAccessData(const uint8_t& chNum, * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t setChannelAccessData(const uint8_t& chNum, +ipmi_ret_t setChannelAccessData(const uint8_t chNum, const ChannelAccess& chAccessData, - const uint8_t& setFlag); + const uint8_t setFlag); /** @brief to get channel access data persistent data * @@ -237,7 +237,7 @@ ipmi_ret_t setChannelAccessData(const uint8_t& chNum, * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t getChannelAccessPersistData(const uint8_t& chNum, +ipmi_ret_t getChannelAccessPersistData(const uint8_t chNum, ChannelAccess& chAccessData); /** @brief to set channel access data persistent data @@ -248,9 +248,9 @@ ipmi_ret_t getChannelAccessPersistData(const uint8_t& chNum, * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t setChannelAccessPersistData(const uint8_t& chNum, +ipmi_ret_t setChannelAccessPersistData(const uint8_t chNum, const ChannelAccess& chAccessData, - const uint8_t& setFlag); + const uint8_t setFlag); /** @brief provides supported authentication type for the channel * @@ -259,7 +259,7 @@ ipmi_ret_t setChannelAccessPersistData(const uint8_t& chNum, * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t getChannelAuthTypeSupported(const uint8_t& chNum, +ipmi_ret_t getChannelAuthTypeSupported(const uint8_t chNum, uint8_t& authTypeSupported); /** @brief provides enabled authentication type for the channel @@ -270,7 +270,7 @@ ipmi_ret_t getChannelAuthTypeSupported(const uint8_t& chNum, * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t getChannelEnabledAuthType(const uint8_t& chNum, const uint8_t& priv, +ipmi_ret_t getChannelEnabledAuthType(const uint8_t chNum, const uint8_t priv, EAuthType& authType); } // namespace ipmi diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp index 14b350e..7d93e0d 100644 --- a/user_channel/channel_mgmt.cpp +++ b/user_channel/channel_mgmt.cpp @@ -358,14 +358,14 @@ ChannelConfig::ChannelConfig() : bus(ipmid_get_sd_bus_connection()) } } -ChannelData* ChannelConfig::getChannelDataPtr(const uint8_t& chNum) +ChannelData* ChannelConfig::getChannelDataPtr(const uint8_t chNum) { // reload data before using it. checkAndReloadVolatileData(); return &channelData[chNum]; } -bool ChannelConfig::isValidChannel(const uint8_t& chNum) +bool ChannelConfig::isValidChannel(const uint8_t chNum) { if (chNum > maxIpmiChannels) { @@ -383,14 +383,14 @@ bool ChannelConfig::isValidChannel(const uint8_t& chNum) } EChannelSessSupported - ChannelConfig::getChannelSessionSupport(const uint8_t& chNum) + ChannelConfig::getChannelSessionSupport(const uint8_t chNum) { EChannelSessSupported chSessSupport = (EChannelSessSupported)channelData[chNum].chInfo.sessionSupported; return chSessSupport; } -bool ChannelConfig::isValidAuthType(const uint8_t& chNum, +bool ChannelConfig::isValidAuthType(const uint8_t chNum, const EAuthType& authType) { if ((authType < EAuthType::md2) || (authType > EAuthType::oem)) @@ -409,7 +409,7 @@ bool ChannelConfig::isValidAuthType(const uint8_t& chNum, return true; } -int ChannelConfig::getChannelActiveSessions(const uint8_t& chNum) +int ChannelConfig::getChannelActiveSessions(const uint8_t chNum) { // TODO: TEMPORARY FIX // Channels active session count is managed separatly @@ -419,7 +419,7 @@ int ChannelConfig::getChannelActiveSessions(const uint8_t& chNum) return channelData[chNum].activeSessCount; } -ipmi_ret_t ChannelConfig::getChannelInfo(const uint8_t& chNum, +ipmi_ret_t ChannelConfig::getChannelInfo(const uint8_t chNum, ChannelInfo& chInfo) { if (!isValidChannel(chNum)) @@ -435,7 +435,7 @@ ipmi_ret_t ChannelConfig::getChannelInfo(const uint8_t& chNum, return IPMI_CC_OK; } -ipmi_ret_t ChannelConfig::getChannelAccessData(const uint8_t& chNum, +ipmi_ret_t ChannelConfig::getChannelAccessData(const uint8_t chNum, ChannelAccess& chAccessData) { if (!isValidChannel(chNum)) @@ -464,9 +464,9 @@ ipmi_ret_t ChannelConfig::getChannelAccessData(const uint8_t& chNum, } ipmi_ret_t - ChannelConfig::setChannelAccessData(const uint8_t& chNum, + ChannelConfig::setChannelAccessData(const uint8_t chNum, const ChannelAccess& chAccessData, - const uint8_t& setFlag) + const uint8_t setFlag) { if (!isValidChannel(chNum)) { @@ -531,7 +531,7 @@ ipmi_ret_t } ipmi_ret_t - ChannelConfig::getChannelAccessPersistData(const uint8_t& chNum, + ChannelConfig::getChannelAccessPersistData(const uint8_t chNum, ChannelAccess& chAccessData) { if (!isValidChannel(chNum)) @@ -560,8 +560,8 @@ ipmi_ret_t } ipmi_ret_t ChannelConfig::setChannelAccessPersistData( - const uint8_t& chNum, const ChannelAccess& chAccessData, - const uint8_t& setFlag) + const uint8_t chNum, const ChannelAccess& chAccessData, + const uint8_t setFlag) { if (!isValidChannel(chNum)) { @@ -648,7 +648,7 @@ ipmi_ret_t ChannelConfig::setChannelAccessPersistData( } ipmi_ret_t - ChannelConfig::getChannelAuthTypeSupported(const uint8_t& chNum, + ChannelConfig::getChannelAuthTypeSupported(const uint8_t chNum, uint8_t& authTypeSupported) { if (!isValidChannel(chNum)) @@ -661,8 +661,8 @@ ipmi_ret_t return IPMI_CC_OK; } -ipmi_ret_t ChannelConfig::getChannelEnabledAuthType(const uint8_t& chNum, - const uint8_t& priv, +ipmi_ret_t ChannelConfig::getChannelEnabledAuthType(const uint8_t chNum, + const uint8_t priv, EAuthType& authType) { if (!isValidChannel(chNum)) @@ -715,7 +715,7 @@ EChannelAccessMode std::distance(accessModeList.begin(), iter)); } -std::string ChannelConfig::convertToAccessModeString(const uint8_t& value) +std::string ChannelConfig::convertToAccessModeString(const uint8_t value) { if (accessModeList.size() <= value) { @@ -740,7 +740,7 @@ CommandPrivilege return static_cast<CommandPrivilege>(std::distance(privList.begin(), iter)); } -std::string ChannelConfig::convertToPrivLimitString(const uint8_t& value) +std::string ChannelConfig::convertToPrivLimitString(const uint8_t value) { if (privList.size() <= value) { @@ -797,7 +797,7 @@ EChannelProtocolType return static_cast<EChannelProtocolType>(it->second); } -uint8_t ChannelConfig::convertToChannelIndexNumber(const uint8_t& chNum) +uint8_t ChannelConfig::convertToChannelIndexNumber(const uint8_t chNum) { // TODO: There is limitation in current design. we cannot detect exact @@ -884,7 +884,7 @@ int ChannelConfig::writeJsonFile(const std::string& configFile, return 0; } -void ChannelConfig::setDefaultChannelConfig(const uint8_t& chNum, +void ChannelConfig::setDefaultChannelConfig(const uint8_t chNum, const std::string& chName) { channelData[chNum].chName = chName; diff --git a/user_channel/channel_mgmt.hpp b/user_channel/channel_mgmt.hpp index 5c35041..09d2a71 100644 --- a/user_channel/channel_mgmt.hpp +++ b/user_channel/channel_mgmt.hpp @@ -75,7 +75,7 @@ class ChannelConfig * * @return true if valid, false otherwise */ - bool isValidChannel(const uint8_t& chNum); + bool isValidChannel(const uint8_t chNum); /** @brief determines valid authentication type * @@ -84,7 +84,7 @@ class ChannelConfig * * @return true if valid, false otherwise */ - bool isValidAuthType(const uint8_t& chNum, const EAuthType& authType); + bool isValidAuthType(const uint8_t chNum, const EAuthType& authType); /** @brief determines supported session type of a channel * @@ -92,7 +92,7 @@ class ChannelConfig * * @return EChannelSessSupported - supported session type */ - EChannelSessSupported getChannelSessionSupport(const uint8_t& chNum); + EChannelSessSupported getChannelSessionSupport(const uint8_t chNum); /** @brief determines number of active sessions on a channel * @@ -100,7 +100,7 @@ class ChannelConfig * * @return numer of active sessions */ - int getChannelActiveSessions(const uint8_t& chNum); + int getChannelActiveSessions(const uint8_t chNum); /** @brief provides channel info details * @@ -109,7 +109,7 @@ class ChannelConfig * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t getChannelInfo(const uint8_t& chNum, ChannelInfo& chInfo); + ipmi_ret_t getChannelInfo(const uint8_t chNum, ChannelInfo& chInfo); /** @brief provides channel access data * @@ -118,7 +118,7 @@ class ChannelConfig * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t getChannelAccessData(const uint8_t& chNum, + ipmi_ret_t getChannelAccessData(const uint8_t chNum, ChannelAccess& chAccessData); /** @brief to set channel access data @@ -129,9 +129,9 @@ class ChannelConfig * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t setChannelAccessData(const uint8_t& chNum, + ipmi_ret_t setChannelAccessData(const uint8_t chNum, const ChannelAccess& chAccessData, - const uint8_t& setFlag); + const uint8_t setFlag); /** @brief to get channel access data persistent data * @@ -140,7 +140,7 @@ class ChannelConfig * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t getChannelAccessPersistData(const uint8_t& chNum, + ipmi_ret_t getChannelAccessPersistData(const uint8_t chNum, ChannelAccess& chAccessData); /** @brief to set channel access data persistent data @@ -151,9 +151,9 @@ class ChannelConfig * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t setChannelAccessPersistData(const uint8_t& chNum, + ipmi_ret_t setChannelAccessPersistData(const uint8_t chNum, const ChannelAccess& chAccessData, - const uint8_t& setFlag); + const uint8_t setFlag); /** @brief provides supported authentication type for the channel * @@ -162,7 +162,7 @@ class ChannelConfig * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t getChannelAuthTypeSupported(const uint8_t& chNum, + ipmi_ret_t getChannelAuthTypeSupported(const uint8_t chNum, uint8_t& authTypeSupported); /** @brief provides enabled authentication type for the channel @@ -173,8 +173,8 @@ class ChannelConfig * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t getChannelEnabledAuthType(const uint8_t& chNum, - const uint8_t& priv, + ipmi_ret_t getChannelEnabledAuthType(const uint8_t chNum, + const uint8_t priv, EAuthType& authType); /** @brief conver to channel privilege from system privilege @@ -203,7 +203,7 @@ class ChannelConfig * * @return 0 for success, -errno for failure. */ - ChannelData* getChannelDataPtr(const uint8_t& chNum); + ChannelData* getChannelDataPtr(const uint8_t chNum); uint32_t signalFlag = 0; @@ -231,7 +231,7 @@ class ChannelConfig * @param[in] chNum - channel number * @param[in] chName - channel name */ - void setDefaultChannelConfig(const uint8_t& chNum, + void setDefaultChannelConfig(const uint8_t chNum, const std::string& chName); /** @brief function to load all channel configuration @@ -335,7 +335,7 @@ class ChannelConfig * * @return access mode in string */ - std::string convertToAccessModeString(const uint8_t& value); + std::string convertToAccessModeString(const uint8_t value); /** @brief function to convert privilege value to string * @@ -343,7 +343,7 @@ class ChannelConfig * * @return privilege in string */ - std::string convertToPrivLimitString(const uint8_t& value); + std::string convertToPrivLimitString(const uint8_t value); /** @brief function to convert session support string to value type * @@ -376,7 +376,7 @@ class ChannelConfig * * @return channel index */ - uint8_t convertToChannelIndexNumber(const uint8_t& chNum); + uint8_t convertToChannelIndexNumber(const uint8_t chNum); /** @brief function to convert channel name to network interface name * diff --git a/user_channel/user_layer.cpp b/user_channel/user_layer.cpp index 5a4d7ad..30aa12c 100644 --- a/user_channel/user_layer.cpp +++ b/user_channel/user_layer.cpp @@ -57,17 +57,17 @@ ipmi_ret_t ipmiRenameUserEntryPassword(const std::string& userName, return IPMI_CC_OK; } -bool ipmiUserIsValidUserId(const uint8_t& userId) +bool ipmiUserIsValidUserId(const uint8_t userId) { return UserAccess::isValidUserId(userId); } -bool ipmiUserIsValidChannel(const uint8_t& chNum) +bool ipmiUserIsValidChannel(const uint8_t chNum) { return UserAccess::isValidChannel(chNum); } -bool ipmiUserIsValidPrivilege(const uint8_t& priv) +bool ipmiUserIsValidPrivilege(const uint8_t priv) { return UserAccess::isValidPrivilege(priv); } @@ -77,12 +77,12 @@ uint8_t ipmiUserGetUserId(const std::string& userName) return getUserAccessObject().getUserId(userName); } -ipmi_ret_t ipmiUserSetUserName(const uint8_t& userId, const char* userName) +ipmi_ret_t ipmiUserSetUserName(const uint8_t userId, const char* userName) { return getUserAccessObject().setUserName(userId, userName); } -ipmi_ret_t ipmiUserGetUserName(const uint8_t& userId, std::string& userName) +ipmi_ret_t ipmiUserGetUserName(const uint8_t userId, std::string& userName) { return getUserAccessObject().getUserName(userId, userName); } @@ -109,12 +109,12 @@ ipmi_ret_t ipmiUserGetAllCounts(uint8_t& maxChUsers, uint8_t& enabledUsers, return IPMI_CC_OK; } -ipmi_ret_t ipmiUserUpdateEnabledState(const uint8_t& userId, const bool& state) +ipmi_ret_t ipmiUserUpdateEnabledState(const uint8_t userId, const bool& state) { return getUserAccessObject().setUserEnabledState(userId, state); } -ipmi_ret_t ipmiUserCheckEnabled(const uint8_t& userId, bool& state) +ipmi_ret_t ipmiUserCheckEnabled(const uint8_t userId, bool& state) { if (!UserAccess::isValidUserId(userId)) { @@ -125,8 +125,7 @@ ipmi_ret_t ipmiUserCheckEnabled(const uint8_t& userId, bool& state) return IPMI_CC_OK; } -ipmi_ret_t ipmiUserGetPrivilegeAccess(const uint8_t& userId, - const uint8_t& chNum, +ipmi_ret_t ipmiUserGetPrivilegeAccess(const uint8_t userId, const uint8_t chNum, PrivAccess& privAccess) { @@ -148,8 +147,7 @@ ipmi_ret_t ipmiUserGetPrivilegeAccess(const uint8_t& userId, return IPMI_CC_OK; } -ipmi_ret_t ipmiUserSetPrivilegeAccess(const uint8_t& userId, - const uint8_t& chNum, +ipmi_ret_t ipmiUserSetPrivilegeAccess(const uint8_t userId, const uint8_t chNum, const PrivAccess& privAccess, const bool& otherPrivUpdates) { diff --git a/user_channel/user_layer.hpp b/user_channel/user_layer.hpp index 8c81188..956c925 100644 --- a/user_channel/user_layer.hpp +++ b/user_channel/user_layer.hpp @@ -91,7 +91,7 @@ ipmi_ret_t ipmiRenameUserEntryPassword(const std::string& userName, * * @return true if valid, false otherwise */ -bool ipmiUserIsValidUserId(const uint8_t& userId); +bool ipmiUserIsValidUserId(const uint8_t userId); /** @brief determines valid channel * @@ -99,7 +99,7 @@ bool ipmiUserIsValidUserId(const uint8_t& userId); * * @return true if valid, false otherwise */ -bool ipmiUserIsValidChannel(const uint8_t& chNum); +bool ipmiUserIsValidChannel(const uint8_t chNum); /** @brief determines valid privilege level * @@ -107,7 +107,7 @@ bool ipmiUserIsValidChannel(const uint8_t& chNum); * * @return true if valid, false otherwise */ -bool ipmiUserIsValidPrivilege(const uint8_t& priv); +bool ipmiUserIsValidPrivilege(const uint8_t priv); /** @brief get user id corresponding to the user name * @@ -124,7 +124,7 @@ uint8_t ipmiUserGetUserId(const std::string& userName); * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t ipmiUserSetUserName(const uint8_t& userId, const char* userName); +ipmi_ret_t ipmiUserSetUserName(const uint8_t userId, const char* userName); /** @brief get user name * @@ -133,7 +133,7 @@ ipmi_ret_t ipmiUserSetUserName(const uint8_t& userId, const char* userName); * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t ipmiUserGetUserName(const uint8_t& userId, std::string& userName); +ipmi_ret_t ipmiUserGetUserName(const uint8_t userId, std::string& userName); /** @brief provides available fixed, max, and enabled user counts * @@ -153,7 +153,7 @@ ipmi_ret_t ipmiUserGetAllCounts(uint8_t& maxChUsers, uint8_t& enabledUsers, * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t ipmiUserUpdateEnabledState(const uint8_t& userId, const bool& state); +ipmi_ret_t ipmiUserUpdateEnabledState(const uint8_t userId, const bool& state); /** @brief determines whether user is enabled * @@ -162,7 +162,7 @@ ipmi_ret_t ipmiUserUpdateEnabledState(const uint8_t& userId, const bool& state); * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t ipmiUserCheckEnabled(const uint8_t& userId, bool& state); +ipmi_ret_t ipmiUserCheckEnabled(const uint8_t userId, bool& state); /** @brief provides user privilege access data * @@ -172,8 +172,7 @@ ipmi_ret_t ipmiUserCheckEnabled(const uint8_t& userId, bool& state); * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t ipmiUserGetPrivilegeAccess(const uint8_t& userId, - const uint8_t& chNum, +ipmi_ret_t ipmiUserGetPrivilegeAccess(const uint8_t userId, const uint8_t chNum, PrivAccess& privAccess); /** @brief sets user privilege access data @@ -185,8 +184,7 @@ ipmi_ret_t ipmiUserGetPrivilegeAccess(const uint8_t& userId, * * @return IPMI_CC_OK for success, others for failure. */ -ipmi_ret_t ipmiUserSetPrivilegeAccess(const uint8_t& userId, - const uint8_t& chNum, +ipmi_ret_t ipmiUserSetPrivilegeAccess(const uint8_t userId, const uint8_t chNum, const PrivAccess& privAccess, const bool& otherPrivUpdate); diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp index af72540..8ba4a94 100644 --- a/user_channel/user_mgmt.cpp +++ b/user_channel/user_mgmt.cpp @@ -508,13 +508,13 @@ UserAccess::UserAccess() : bus(ipmid_get_sd_bus_connection()) } } -UserInfo* UserAccess::getUserInfo(const uint8_t& userId) +UserInfo* UserAccess::getUserInfo(const uint8_t userId) { checkAndReloadUserData(); return &usersTbl.user[userId]; } -void UserAccess::setUserInfo(const uint8_t& userId, UserInfo* userInfo) +void UserAccess::setUserInfo(const uint8_t userId, UserInfo* userInfo) { checkAndReloadUserData(); std::copy(reinterpret_cast<uint8_t*>(userInfo), @@ -523,17 +523,17 @@ void UserAccess::setUserInfo(const uint8_t& userId, UserInfo* userInfo) writeUserData(); } -bool UserAccess::isValidChannel(const uint8_t& chNum) +bool UserAccess::isValidChannel(const uint8_t chNum) { return (chNum < ipmiMaxChannels); } -bool UserAccess::isValidUserId(const uint8_t& userId) +bool UserAccess::isValidUserId(const uint8_t userId) { return ((userId <= ipmiMaxUsers) && (userId != reservedUserId)); } -bool UserAccess::isValidPrivilege(const uint8_t& priv) +bool UserAccess::isValidPrivilege(const uint8_t priv) { return ((priv >= PRIVILEGE_CALLBACK && priv <= PRIVILEGE_OEM) || priv == privNoAccess); @@ -633,7 +633,7 @@ bool UserAccess::isValidUserName(const char* userNameInChar) return true; } -ipmi_ret_t UserAccess::setUserEnabledState(const uint8_t& userId, +ipmi_ret_t UserAccess::setUserEnabledState(const uint8_t userId, const bool& enabledState) { if (!isValidUserId(userId)) @@ -660,8 +660,8 @@ ipmi_ret_t UserAccess::setUserEnabledState(const uint8_t& userId, return IPMI_CC_OK; } -ipmi_ret_t UserAccess::setUserPrivilegeAccess(const uint8_t& userId, - const uint8_t& chNum, +ipmi_ret_t UserAccess::setUserPrivilegeAccess(const uint8_t userId, + const uint8_t chNum, const UserPrivAccess& privAccess, const bool& otherPrivUpdates) { @@ -747,7 +747,7 @@ uint8_t UserAccess::getUserId(const std::string& userName) return usrIndex; } -ipmi_ret_t UserAccess::getUserName(const uint8_t& userId, std::string& userName) +ipmi_ret_t UserAccess::getUserName(const uint8_t userId, std::string& userName) { if (!isValidUserId(userId)) { @@ -759,7 +759,7 @@ ipmi_ret_t UserAccess::getUserName(const uint8_t& userId, std::string& userName) return IPMI_CC_OK; } -ipmi_ret_t UserAccess::setUserName(const uint8_t& userId, +ipmi_ret_t UserAccess::setUserName(const uint8_t userId, const char* userNameInChar) { if (!isValidUserId(userId)) diff --git a/user_channel/user_mgmt.hpp b/user_channel/user_mgmt.hpp index 5755fa0..a54486f 100644 --- a/user_channel/user_mgmt.hpp +++ b/user_channel/user_mgmt.hpp @@ -92,7 +92,7 @@ class UserAccess * * @return true if valid, false otherwise */ - static bool isValidChannel(const uint8_t& chNum); + static bool isValidChannel(const uint8_t chNum); /** @brief determines valid userId * @@ -100,7 +100,7 @@ class UserAccess * * @return true if valid, false otherwise */ - static bool isValidUserId(const uint8_t& userId); + static bool isValidUserId(const uint8_t userId); /** @brief determines valid user privilege * @@ -108,7 +108,7 @@ class UserAccess * * @return true if valid, false otherwise */ - static bool isValidPrivilege(const uint8_t& priv); + static bool isValidPrivilege(const uint8_t priv); /** @brief determines sync index to be mapped with common-user-management * @@ -155,7 +155,7 @@ class UserAccess * * @return UserInfo for the specified user id */ - UserInfo* getUserInfo(const uint8_t& userId); + UserInfo* getUserInfo(const uint8_t userId); /** @brief sets user information * @@ -163,7 +163,7 @@ class UserAccess * @param[in] userInfo - user information * */ - void setUserInfo(const uint8_t& userId, UserInfo* userInfo); + void setUserInfo(const uint8_t userId, UserInfo* userInfo); /** @brief provides user name * @@ -172,7 +172,7 @@ class UserAccess * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t getUserName(const uint8_t& userId, std::string& userName); + ipmi_ret_t getUserName(const uint8_t userId, std::string& userName); /** @brief to set user name * @@ -181,7 +181,7 @@ class UserAccess * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t setUserName(const uint8_t& userId, const char* userNameInChar); + ipmi_ret_t setUserName(const uint8_t userId, const char* userNameInChar); /** @brief to set user enabled state * @@ -190,7 +190,7 @@ class UserAccess * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t setUserEnabledState(const uint8_t& userId, + ipmi_ret_t setUserEnabledState(const uint8_t userId, const bool& enabledState); /** @brief to set user privilege and access details @@ -203,8 +203,7 @@ class UserAccess * * @return IPMI_CC_OK for success, others for failure. */ - ipmi_ret_t setUserPrivilegeAccess(const uint8_t& userId, - const uint8_t& chNum, + ipmi_ret_t setUserPrivilegeAccess(const uint8_t userId, const uint8_t chNum, const UserPrivAccess& privAccess, const bool& otherPrivUpdates); |