mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 12:21:18 +00:00
fssrv: add skeleton getters for service object sf::SharedPointers
This commit is contained in:
parent
f3dbdc2391
commit
33701bb387
5 changed files with 151 additions and 0 deletions
|
@ -30,4 +30,5 @@
|
|||
#include <stratosphere/fssrv/fscreator/fssrv_storage_on_nca_creator.hpp>
|
||||
#include <stratosphere/fssrv/fssrv_file_system_proxy_server_session_resource_manager.hpp>
|
||||
#include <stratosphere/fssrv/impl/fssrv_file_system_proxy_service_object.hpp>
|
||||
#include <stratosphere/fssrv/fssrv_program_registry_impl.hpp>
|
||||
#include <stratosphere/fssrv/fssrv_file_system_proxy_api.hpp>
|
||||
|
|
|
@ -39,7 +39,39 @@ namespace ams::fssrv {
|
|||
~FileSystemProxyImpl();
|
||||
|
||||
/* TODO */
|
||||
|
||||
public:
|
||||
/* fsp-ldr */
|
||||
Result OpenCodeFileSystemDeprecated(ams::sf::Out<ams::sf::SharedPointer<fssrv::sf::IFileSystem>> out_fs, const fssrv::sf::Path &path, ncm::ProgramId program_id);
|
||||
Result OpenCodeFileSystem(ams::sf::Out<ams::sf::SharedPointer<fssrv::sf::IFileSystem>> out_fs, ams::sf::Out<fs::CodeVerificationData> out_verif, const fssrv::sf::Path &path, ncm::ProgramId program_id);
|
||||
Result IsArchivedProgram(ams::sf::Out<bool> out, u64 process_id);
|
||||
Result SetCurrentProcess(const ams::sf::ClientProcessId &client_pid);
|
||||
};
|
||||
static_assert(sf::IsIFileSystemProxy<FileSystemProxyImpl>);
|
||||
static_assert(sf::IsIFileSystemProxyForLoader<FileSystemProxyImpl>);
|
||||
|
||||
class InvalidFileSystemProxyImplForLoader {
|
||||
public:
|
||||
Result OpenCodeFileSystemDeprecated(ams::sf::Out<ams::sf::SharedPointer<fssrv::sf::IFileSystem>> out_fs, const fssrv::sf::Path &path, ncm::ProgramId program_id) {
|
||||
AMS_UNUSED(out_fs, path, program_id);
|
||||
return fs::ResultPortAcceptableCountLimited();
|
||||
}
|
||||
|
||||
Result OpenCodeFileSystem(ams::sf::Out<ams::sf::SharedPointer<fssrv::sf::IFileSystem>> out_fs, ams::sf::Out<fs::CodeVerificationData> out_verif, const fssrv::sf::Path &path, ncm::ProgramId program_id) {
|
||||
AMS_UNUSED(out_fs, out_verif, path, program_id);
|
||||
return fs::ResultPortAcceptableCountLimited();
|
||||
}
|
||||
|
||||
Result IsArchivedProgram(ams::sf::Out<bool> out, u64 process_id) {
|
||||
AMS_UNUSED(out, process_id);
|
||||
return fs::ResultPortAcceptableCountLimited();
|
||||
}
|
||||
|
||||
Result SetCurrentProcess(const ams::sf::ClientProcessId &client_pid) {
|
||||
AMS_UNUSED(client_pid);
|
||||
return fs::ResultPortAcceptableCountLimited();
|
||||
}
|
||||
};
|
||||
static_assert(sf::IsIFileSystemProxyForLoader<FileSystemProxyImpl>);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/fssrv/sf/fssrv_sf_i_program_registry.hpp>
|
||||
|
||||
namespace ams::fssrv {
|
||||
|
||||
namespace impl {
|
||||
|
||||
class ProgramInfo;
|
||||
|
||||
}
|
||||
|
||||
class ProgramRegistryImpl {
|
||||
NON_COPYABLE(ProgramRegistryImpl);
|
||||
NON_MOVEABLE(ProgramRegistryImpl);
|
||||
private:
|
||||
u64 m_process_id;
|
||||
public:
|
||||
ProgramRegistryImpl();
|
||||
~ProgramRegistryImpl();
|
||||
public:
|
||||
Result RegisterProgram(u64 process_id, u64 program_id, u8 storage_id, const ams::sf::InBuffer &data, s64 data_size, const ams::sf::InBuffer &desc, s64 desc_size);
|
||||
Result UnregisterProgram(u64 process_id);
|
||||
Result SetCurrentProcess(const ams::sf::ClientProcessId &client_pid);
|
||||
Result SetEnabledProgramVerification(bool en);
|
||||
};
|
||||
static_assert(sf::IsIProgramRegistry<ProgramRegistryImpl>);
|
||||
|
||||
class InvalidProgramRegistryImpl {
|
||||
public:
|
||||
Result RegisterProgram(u64 process_id, u64 program_id, u8 storage_id, const ams::sf::InBuffer &data, s64 data_size, const ams::sf::InBuffer &desc, s64 desc_size) {
|
||||
AMS_UNUSED(process_id, program_id, storage_id, data, data_size, desc, desc_size);
|
||||
return fs::ResultPortAcceptableCountLimited();
|
||||
}
|
||||
|
||||
Result UnregisterProgram(u64 process_id) {
|
||||
AMS_UNUSED(process_id);
|
||||
return fs::ResultPortAcceptableCountLimited();
|
||||
}
|
||||
|
||||
Result SetCurrentProcess(const ams::sf::ClientProcessId &client_pid) {
|
||||
AMS_UNUSED(client_pid);
|
||||
return fs::ResultPortAcceptableCountLimited();
|
||||
}
|
||||
|
||||
Result SetEnabledProgramVerification(bool en) {
|
||||
AMS_UNUSED(en);
|
||||
return fs::ResultPortAcceptableCountLimited();
|
||||
}
|
||||
};
|
||||
static_assert(sf::IsIProgramRegistry<InvalidProgramRegistryImpl>);
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "fssrv_allocator_for_service_framework.hpp"
|
||||
|
||||
namespace ams::fssrv::impl {
|
||||
|
||||
namespace {
|
||||
|
||||
using FileSystemProxyServiceFactory = ams::sf::ObjectFactory<AllocatorForServiceFramework::Policy>;
|
||||
using ProgramRegistryServiceFactory = ams::sf::ObjectFactory<AllocatorForServiceFramework::Policy>;
|
||||
using FileSystemProxyForLoaderServiceFactory = ams::sf::ObjectFactory<AllocatorForServiceFramework::Policy>;
|
||||
|
||||
}
|
||||
|
||||
ams::sf::EmplacedRef<fssrv::sf::IFileSystemProxy, fssrv::FileSystemProxyImpl> GetFileSystemProxyServiceObject() {
|
||||
return FileSystemProxyServiceFactory::CreateSharedEmplaced<fssrv::sf::IFileSystemProxy, fssrv::FileSystemProxyImpl>();
|
||||
}
|
||||
|
||||
ams::sf::SharedPointer<fssrv::sf::IProgramRegistry> GetProgramRegistryServiceObject() {
|
||||
return ProgramRegistryServiceFactory::CreateSharedEmplaced<fssrv::sf::IProgramRegistry, fssrv::ProgramRegistryImpl>();
|
||||
}
|
||||
|
||||
ams::sf::SharedPointer<fssrv::sf::IProgramRegistry> GetInvalidProgramRegistryServiceObject() {
|
||||
return ProgramRegistryServiceFactory::CreateSharedEmplaced<fssrv::sf::IProgramRegistry, fssrv::InvalidProgramRegistryImpl>();
|
||||
}
|
||||
|
||||
ams::sf::SharedPointer<fssrv::sf::IFileSystemProxyForLoader> GetFileSystemProxyForLoaderServiceObject() {
|
||||
return FileSystemProxyForLoaderServiceFactory ::CreateSharedEmplaced<fssrv::sf::IFileSystemProxyForLoader, fssrv::FileSystemProxyImpl>();
|
||||
}
|
||||
|
||||
ams::sf::SharedPointer<fssrv::sf::IFileSystemProxyForLoader> GetInvalidFileSystemProxyForLoaderServiceObject() {
|
||||
return FileSystemProxyForLoaderServiceFactory ::CreateSharedEmplaced<fssrv::sf::IFileSystemProxyForLoader, fssrv::InvalidFileSystemProxyImplForLoader>();
|
||||
}
|
||||
|
||||
}
|
|
@ -364,6 +364,7 @@ namespace ams::fs {
|
|||
|
||||
R_DEFINE_ERROR_RANGE(PermissionDenied, 6400, 6449);
|
||||
|
||||
R_DEFINE_ERROR_RESULT(PortAcceptableCountLimited, 6450);
|
||||
R_DEFINE_ERROR_RESULT(NeedFlush, 6454);
|
||||
R_DEFINE_ERROR_RESULT(FileNotClosed, 6455);
|
||||
R_DEFINE_ERROR_RESULT(DirectoryNotClosed, 6456);
|
||||
|
|
Loading…
Reference in a new issue