| #pragma once | |
| #include <atomic> | |
| #include "smbios.grpc.pb.h" | |
| #include "smbios_file.h" | |
| #include "grpcpp/server_context.h" | |
| #include "grpcpp/support/status.h" | |
| namespace blobs { | |
| constexpr auto objectPrefix = "/xyz/openbmc_project/grpcblobs/system"; | |
| class SmbiosTransferServiceImpl final | |
| : public phosphor::smbios::grpc_gen::SmbiosTransferService::Service { | |
| public: | |
| explicit SmbiosTransferServiceImpl(int instanceNumber) | |
| : phosphor::smbios::grpc_gen::SmbiosTransferService::Service(), | |
| instance(instanceNumber) {} | |
| grpc::Status SmbiosTransfer( | |
| grpc::ServerContext* context, | |
| const phosphor::smbios::SmbiosTransferRequest* request, | |
| [[maybe_unused]] phosphor::smbios::SmbiosTransferResponse* response); | |
| bool acceptEntry(const SmbiosEntry& entry, bool isWrite); | |
| protected: | |
| [[nodiscard]] bool claimLinkBusy(); | |
| void writeThenStart(const SmbiosEntry& entry, bool isWrite); | |
| void sendSignalToSmbiosApp(); | |
| private: | |
| int instance; | |
| std::atomic_flag linkBusy; | |
| static constexpr const char* smbiosAppPidFile = "/var/run/smbiosmdrv2app.pid"; | |
| }; | |
| } // namespace blobs |