Merge pull request #827 from lioncash/log

service/lm: Minor changes
This commit is contained in:
bunnei 2018-07-25 22:30:43 -07:00 committed by GitHub
commit 57cd80c410
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 40 deletions

View file

@ -4,10 +4,12 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/client_session.h"
#include "core/hle/service/lm/lm.h" #include "core/hle/service/lm/lm.h"
#include "core/hle/service/service.h"
#include "core/memory.h"
namespace Service::LM { namespace Service::LM {
@ -15,13 +17,12 @@ class Logger final : public ServiceFramework<Logger> {
public: public:
Logger() : ServiceFramework("Logger") { Logger() : ServiceFramework("Logger") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0x00000000, &Logger::Log, "Log"}, {0x00000000, &Logger::Initialize, "Initialize"},
{0x00000001, nullptr, "SetDestination"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
} }
~Logger() = default;
private: private:
struct MessageHeader { struct MessageHeader {
enum Flags : u32_le { enum Flags : u32_le {
@ -66,13 +67,13 @@ private:
}; };
/** /**
* LM::Log service function * ILogger::Initialize service function
* Inputs: * Inputs:
* 0: 0x00000000 * 0: 0x00000000
* Outputs: * Outputs:
* 0: ResultCode * 0: ResultCode
*/ */
void Log(Kernel::HLERequestContext& ctx) { void Initialize(Kernel::HLERequestContext& ctx) {
// This function only succeeds - Get that out of the way // This function only succeeds - Get that out of the way
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -162,30 +163,33 @@ private:
std::ostringstream log_stream; std::ostringstream log_stream;
}; };
void InstallInterfaces(SM::ServiceManager& service_manager) { class LM final : public ServiceFramework<LM> {
std::make_shared<LM>()->InstallAsService(service_manager); public:
explicit LM() : ServiceFramework{"lm"} {
static const FunctionInfo functions[] = {
{0x00000000, &LM::OpenLogger, "OpenLogger"},
};
RegisterHandlers(functions);
} }
/** /**
* LM::Initialize service function * LM::OpenLogger service function
* Inputs: * Inputs:
* 0: 0x00000000 * 0: 0x00000000
* Outputs: * Outputs:
* 0: ResultCode * 0: ResultCode
*/ */
void LM::Initialize(Kernel::HLERequestContext& ctx) { void OpenLogger(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushIpcInterface<Logger>(); rb.PushIpcInterface<Logger>();
LOG_DEBUG(Service_LM, "called"); LOG_DEBUG(Service_LM, "called");
} }
LM::LM() : ServiceFramework("lm") {
static const FunctionInfo functions[] = {
{0x00000000, &LM::Initialize, "Initialize"},
}; };
RegisterHandlers(functions);
void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<LM>()->InstallAsService(service_manager);
} }
} // namespace Service::LM } // namespace Service::LM

View file

@ -4,21 +4,12 @@
#pragma once #pragma once
#include <vector> namespace Service::SM {
#include "core/hle/kernel/kernel.h" class ServiceManager;
#include "core/hle/service/service.h" }
namespace Service::LM { namespace Service::LM {
class LM final : public ServiceFramework<LM> {
public:
LM();
~LM() = default;
private:
void Initialize(Kernel::HLERequestContext& ctx);
};
/// Registers all LM services with the specified service manager. /// Registers all LM services with the specified service manager.
void InstallInterfaces(SM::ServiceManager& service_manager); void InstallInterfaces(SM::ServiceManager& service_manager);