Implement the code related to the GetMixedComponentVersion()

Change-Id: I98aad97b4cb6498b7f2fc03a2d5ee7c9e949d5f1
Signed-off-by: Chen Gong <curry.gong@amd.com>
Dieser Commit ist enthalten in:
Chen Gong
2024-08-25 00:18:48 +08:00
committet von Galantsev, Dmitrii
Ursprung 8db404f84f
Commit 1edd04d84e
9 geänderte Dateien mit 153 neuen und 1 gelöschten Zeilen
+2
Datei anzeigen
@@ -125,6 +125,8 @@ class RdcAPIServiceImpl final : public ::rdc::RdcAPI::Service {
const ::rdc::DiagnosticTestCaseRunRequest* request,
::rdc::DiagnosticTestCaseRunResponse* reply) override;
::grpc::Status GetMixedComponentVersion(::grpc::ServerContext* context, const ::rdc::GetMixedComponentVersionRequest* request,
::rdc::GetMixedComponentVersionResponse* reply) override;
private:
bool copy_gpu_usage_info(const rdc_gpu_usage_info_t& src, ::rdc::GpuUsageInfo* target);
rdc_handle_t rdc_handle_;
+32 -1
Datei anzeigen
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "rdc/rdc_api_service.h"
#include "rdc/rdc_server_main.h"
#include <assert.h>
#include <grpcpp/grpcpp.h>
@@ -31,6 +31,7 @@ THE SOFTWARE.
#include "rdc.grpc.pb.h" // NOLINT
#include "rdc/rdc.h"
#include "rdc/rdc_private.h"
#include "rdc_lib/RdcLogger.h"
#include "rdc_lib/rdc_common.h"
@@ -660,5 +661,35 @@ bool RdcAPIServiceImpl::copy_gpu_usage_info(const rdc_gpu_usage_info_t& src,
return ::grpc::Status::OK;
}
::grpc::Status RdcAPIServiceImpl::GetMixedComponentVersion(::grpc::ServerContext* context,
const ::rdc::GetMixedComponentVersionRequest* request,
::rdc::GetMixedComponentVersionResponse* reply) {
(void)(context);
if (!reply) {
return ::grpc::Status(::grpc::StatusCode::INTERNAL, "Empty reply");
}
mixed_component_t component = static_cast<mixed_component_t>(request->component_id());
if (component == RDCD_COMPONENT) {
std::string version = RDC_SERVER_VERSION_STRING;
std::string hash;
std::string rdcdversion;
#ifdef CURRENT_GIT_HASH
hash = QUOTE(CURRENT_GIT_HASH);
rdcdversion = version + "+" + hash;
#else
hash = "";
rdcdversion = version;
#endif
reply->set_version(rdcdversion);
reply->set_status(RDC_ST_OK);
return ::grpc::Status::OK;
} else {
return ::grpc::Status(::grpc::StatusCode::INVALID_ARGUMENT, "The provided request parameters are invalid");
}
}
} // namespace rdc
} // namespace amd