Merge upstream Atmosphere master into boot-storage
This commit is contained in:
29 files changed
+1497
-163
No files matched your search
@@ -70,11 +70,11 @@ namespace ams::fs {
|
||||
virtual Result Read(s64 offset, void *buffer, size_t size) override;
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override;
|
||||
virtual Result Flush() override;
|
||||
virtual Result GetSize(s64 *out_size) override;
|
||||
virtual Result SetSize(s64 size) override;
|
||||
virtual Result GetSize(s64 *out_size) override;
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override;
|
||||
};
|
||||
|
||||
|
||||
/* ACCURATE_TO_VERSION: Unknown */
|
||||
class FileStorageBasedFileSystem : public FileStorage {
|
||||
NON_COPYABLE(FileStorageBasedFileSystem);
|
||||
@@ -86,7 +86,7 @@ namespace ams::fs {
|
||||
|
||||
Result Initialize(std::shared_ptr<fs::fsa::IFileSystem> base_file_system, const fs::Path &path, fs::OpenMode mode);
|
||||
};
|
||||
|
||||
|
||||
class FileHandleStorage : public IStorage, public impl::Newable {
|
||||
private:
|
||||
static constexpr s64 InvalidSize = -1;
|
||||
@@ -114,5 +114,5 @@ namespace ams::fs {
|
||||
virtual Result SetSize(s64 size) override;
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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 <stratosphere/fs/fs_common.hpp>
|
||||
#include <stratosphere/fs/fs_file.hpp>
|
||||
#include <stratosphere/fs/fs_istorage.hpp>
|
||||
#include <stratosphere/fs/fs_operate_range.hpp>
|
||||
|
||||
namespace ams::fs {
|
||||
|
||||
class IStorageForBatchRead : public IStorage {
|
||||
public:
|
||||
virtual ~IStorageForBatchRead() { /* ... */ }
|
||||
|
||||
virtual Result BatchRead(void *out0, void *out1, void *out2, void *out3, void *out4, void *out5, void *out6, const void *in) = 0;
|
||||
};
|
||||
|
||||
class ReadOnlyStorageAdapterForBatchRead : public IStorageForBatchRead {
|
||||
private:
|
||||
std::shared_ptr<IStorageForBatchRead> m_shared_storage;
|
||||
std::unique_ptr<IStorageForBatchRead> m_unique_storage;
|
||||
IStorageForBatchRead *m_storage;
|
||||
public:
|
||||
explicit ReadOnlyStorageAdapterForBatchRead(IStorageForBatchRead *s) : m_unique_storage(s) {
|
||||
m_storage = m_unique_storage.get();
|
||||
}
|
||||
explicit ReadOnlyStorageAdapterForBatchRead(std::shared_ptr<IStorageForBatchRead> s) : m_shared_storage(s) {
|
||||
m_storage = m_shared_storage.get();
|
||||
}
|
||||
explicit ReadOnlyStorageAdapterForBatchRead(std::unique_ptr<IStorageForBatchRead> s) : m_unique_storage(std::move(s)) {
|
||||
m_storage = m_unique_storage.get();
|
||||
}
|
||||
explicit ReadOnlyStorageAdapterForBatchRead(IStorage *s) : m_unique_storage(static_cast<IStorageForBatchRead *>(s)) {
|
||||
m_storage = m_unique_storage.get();
|
||||
}
|
||||
explicit ReadOnlyStorageAdapterForBatchRead(std::shared_ptr<IStorage> s) : m_shared_storage(std::static_pointer_cast<IStorageForBatchRead>(s)) {
|
||||
m_storage = m_shared_storage.get();
|
||||
}
|
||||
explicit ReadOnlyStorageAdapterForBatchRead(std::unique_ptr<IStorage> s) : m_unique_storage(std::unique_ptr<IStorageForBatchRead>(static_cast<IStorageForBatchRead *>(s.release()))) {
|
||||
m_storage = m_unique_storage.get();
|
||||
}
|
||||
|
||||
virtual ~ReadOnlyStorageAdapterForBatchRead() { /* ... */ }
|
||||
public:
|
||||
virtual Result Read(s64 offset, void *buffer, size_t size) override {
|
||||
R_RETURN(m_storage->Read(offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||
/* TODO: Better result? Is it possible to get a more specific one? */
|
||||
AMS_UNUSED(offset, buffer, size);
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
R_RETURN(m_storage->Flush());
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
/* TODO: Better result? Is it possible to get a more specific one? */
|
||||
AMS_UNUSED(size);
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override {
|
||||
R_RETURN(m_storage->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
|
||||
R_RETURN(m_storage->OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
|
||||
}
|
||||
|
||||
virtual Result BatchRead(void *out0, void *out1, void *out2, void *out3, void *out4, void *out5, void *out6, const void *in) override {
|
||||
/* TODO */
|
||||
AMS_UNUSED(out0, out1, out2, out3, out4, out5, out6, in);
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concept PointerToStorageForBatchRead = ::ams::util::RawOrSmartPointerTo<T, ::ams::fs::IStorageForBatchRead>;
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
#pragma once
|
||||
#include <stratosphere/fs/fs_common.hpp>
|
||||
#include <stratosphere/fs/fs_istorage.hpp>
|
||||
#include <stratosphere/fs/fs_istorage_for_batch_read.hpp>
|
||||
#include <stratosphere/fs/impl/fs_newable.hpp>
|
||||
|
||||
namespace ams::fs {
|
||||
@@ -33,29 +34,72 @@ namespace ams::fs {
|
||||
public:
|
||||
virtual Result Read(s64 offset, void *buffer, size_t size) override {
|
||||
R_RETURN(fsStorageRead(std::addressof(m_base_storage), offset, buffer, size));
|
||||
};
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||
R_RETURN(fsStorageWrite(std::addressof(m_base_storage), offset, buffer, size));
|
||||
};
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
R_RETURN(fsStorageFlush(std::addressof(m_base_storage)));
|
||||
};
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
R_RETURN(fsStorageSetSize(std::addressof(m_base_storage), size));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out_size) override {
|
||||
R_RETURN(fsStorageGetSize(std::addressof(m_base_storage), out_size));
|
||||
};
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
R_RETURN(fsStorageSetSize(std::addressof(m_base_storage), size));
|
||||
};
|
||||
}
|
||||
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
|
||||
/* TODO: How to deal with this? */
|
||||
AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size);
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
class RemoteStorageForBatchRead : public IStorageForBatchRead, public impl::Newable {
|
||||
NON_COPYABLE(RemoteStorageForBatchRead);
|
||||
NON_MOVEABLE(RemoteStorageForBatchRead);
|
||||
private:
|
||||
::FsStorageForBatchRead m_base_storage;
|
||||
public:
|
||||
RemoteStorageForBatchRead(::FsStorageForBatchRead &s) : m_base_storage(s) { /* ... */}
|
||||
|
||||
virtual ~RemoteStorageForBatchRead() { fsStorageForBatchReadClose(std::addressof(m_base_storage)); }
|
||||
public:
|
||||
virtual Result Read(s64 offset, void *buffer, size_t size) override {
|
||||
R_RETURN(fsStorageForBatchReadRead(std::addressof(m_base_storage), offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
|
||||
R_RETURN(fsStorageForBatchReadWrite(std::addressof(m_base_storage), offset, buffer, size));
|
||||
}
|
||||
|
||||
virtual Result Flush() override {
|
||||
R_RETURN(fsStorageForBatchReadFlush(std::addressof(m_base_storage)));
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override {
|
||||
R_RETURN(fsStorageForBatchReadSetSize(std::addressof(m_base_storage), size));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out_size) override {
|
||||
R_RETURN(fsStorageForBatchReadGetSize(std::addressof(m_base_storage), out_size));
|
||||
}
|
||||
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override {
|
||||
/* TODO: How to deal with this? */
|
||||
AMS_UNUSED(dst, dst_size, op_id, offset, size, src, src_size);
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
}
|
||||
|
||||
virtual Result BatchRead(void *out0, void *out1, void *out2, void *out3, void *out4, void *out5, void *out6, const void *in) override {
|
||||
/* TODO */
|
||||
AMS_UNUSED(out0, out1, out2, out3, out4, out5, out6, in);
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
+70
-10
@@ -16,6 +16,7 @@
|
||||
#pragma once
|
||||
#include <stratosphere/fs/fs_common.hpp>
|
||||
#include <stratosphere/fs/fs_istorage.hpp>
|
||||
#include <stratosphere/fs/fs_istorage_for_batch_read.hpp>
|
||||
#include <stratosphere/fs/impl/fs_newable.hpp>
|
||||
|
||||
namespace ams::fs::impl {
|
||||
@@ -33,22 +34,22 @@ namespace ams::fs::impl {
|
||||
virtual Result Read(s64 offset, void *buffer, size_t size) override final {
|
||||
R_RETURN(m_x->Read(offset, sf::OutNonSecureBuffer(buffer, size), static_cast<s64>(size)));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override final {
|
||||
R_RETURN(m_x->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result Flush() override final {
|
||||
R_RETURN(m_x->Flush());
|
||||
}
|
||||
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override final {
|
||||
R_RETURN(m_x->Write(offset, sf::InNonSecureBuffer(buffer, size), static_cast<s64>(size)));
|
||||
}
|
||||
|
||||
|
||||
virtual Result Flush() override final {
|
||||
R_RETURN(m_x->Flush());
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override final {
|
||||
R_RETURN(m_x->SetSize(size));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override final {
|
||||
R_RETURN(m_x->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override final {
|
||||
AMS_UNUSED(src, src_size);
|
||||
@@ -72,5 +73,64 @@ namespace ams::fs::impl {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename StorageInterfaceForBatchRead>
|
||||
class StorageServiceObjectAdapterForBatchRead : public ::ams::fs::impl::Newable, public ::ams::fs::IStorageForBatchRead {
|
||||
NON_COPYABLE(StorageServiceObjectAdapterForBatchRead);
|
||||
NON_MOVEABLE(StorageServiceObjectAdapterForBatchRead);
|
||||
private:
|
||||
sf::SharedPointer<StorageInterfaceForBatchRead> m_x;
|
||||
public:
|
||||
explicit StorageServiceObjectAdapterForBatchRead(sf::SharedPointer<StorageInterfaceForBatchRead> &&o) : m_x(o) { /* ... */}
|
||||
virtual ~StorageServiceObjectAdapterForBatchRead() { /* ... */ }
|
||||
public:
|
||||
virtual Result Read(s64 offset, void *buffer, size_t size) override final {
|
||||
R_RETURN(m_x->Read(offset, sf::OutNonSecureBuffer(buffer, size), static_cast<s64>(size)));
|
||||
}
|
||||
|
||||
virtual Result Write(s64 offset, const void *buffer, size_t size) override final {
|
||||
R_RETURN(m_x->Write(offset, sf::InNonSecureBuffer(buffer, size), static_cast<s64>(size)));
|
||||
}
|
||||
|
||||
virtual Result Flush() override final {
|
||||
R_RETURN(m_x->Flush());
|
||||
}
|
||||
|
||||
virtual Result SetSize(s64 size) override final {
|
||||
R_RETURN(m_x->SetSize(size));
|
||||
}
|
||||
|
||||
virtual Result GetSize(s64 *out) override final {
|
||||
R_RETURN(m_x->GetSize(out));
|
||||
}
|
||||
|
||||
virtual Result OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) override final {
|
||||
AMS_UNUSED(src, src_size);
|
||||
switch (op_id) {
|
||||
case OperationId::Invalidate:
|
||||
{
|
||||
fs::QueryRangeInfo dummy_range_info;
|
||||
R_RETURN(m_x->OperateRange(std::addressof(dummy_range_info), static_cast<s32>(op_id), offset, size));
|
||||
}
|
||||
case OperationId::QueryRange:
|
||||
{
|
||||
R_UNLESS(dst != nullptr, fs::ResultNullptrArgument());
|
||||
R_UNLESS(dst_size == sizeof(fs::QueryRangeInfo), fs::ResultInvalidSize());
|
||||
|
||||
R_RETURN(m_x->OperateRange(reinterpret_cast<fs::QueryRangeInfo *>(dst), static_cast<s32>(op_id), offset, size));
|
||||
}
|
||||
default:
|
||||
{
|
||||
R_THROW(fs::ResultUnsupportedOperateRangeForStorageServiceObjectAdapter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual Result BatchRead(void *out0, void *out1, void *out2, void *out3, void *out4, void *out5, void *out6, const void *in) override final {
|
||||
/* TODO */
|
||||
AMS_UNUSED(out0, out1, out2, out3, out4, out5, out6, in);
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
+53
@@ -18,10 +18,12 @@
|
||||
#include <stratosphere/fs/fs_query_range.hpp>
|
||||
#include <stratosphere/fssystem/fssystem_utility.hpp>
|
||||
#include <stratosphere/fssrv/sf/fssrv_sf_istorage.hpp>
|
||||
#include <stratosphere/fssrv/sf/fssrv_sf_istorage_for_batch_read.hpp>
|
||||
|
||||
namespace ams::fs {
|
||||
|
||||
class IStorage;
|
||||
class IStorageForBatchRead;
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +46,16 @@ namespace ams::fssrv::impl {
|
||||
Result OperateRange(ams::sf::Out<fs::StorageQueryRangeInfo> out, s32 op_id, s64 offset, s64 size);
|
||||
};
|
||||
static_assert(fssrv::sf::IsIStorage<StorageInterfaceAdapter>);
|
||||
|
||||
class StorageInterfaceAdapterForBatchRead : public StorageInterfaceAdapter {
|
||||
NON_COPYABLE(StorageInterfaceAdapterForBatchRead);
|
||||
public:
|
||||
explicit StorageInterfaceAdapterForBatchRead(std::shared_ptr<fs::IStorageForBatchRead> &&storage) : StorageInterfaceAdapter(storage) { /* ... */ }
|
||||
public:
|
||||
/* Command API. */
|
||||
Result BatchRead(const ams::sf::OutNonSecureBuffer &out0, const ams::sf::OutNonSecureBuffer &out1, const ams::sf::OutNonSecureBuffer &out2, const ams::sf::OutNonSecureBuffer &out3, const ams::sf::OutNonSecureBuffer &out4, const ams::sf::OutNonSecureBuffer &out5, const ams::sf::OutNonSecureBuffer &out6, const ams::sf::InBuffer &in);
|
||||
};
|
||||
static_assert(fssrv::sf::IsIStorageForBatchRead<StorageInterfaceAdapterForBatchRead>);
|
||||
|
||||
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||
class RemoteStorage {
|
||||
@@ -82,6 +94,47 @@ namespace ams::fssrv::impl {
|
||||
}
|
||||
};
|
||||
static_assert(fssrv::sf::IsIStorage<RemoteStorage>);
|
||||
|
||||
class RemoteStorageForBatchRead {
|
||||
NON_COPYABLE(RemoteStorageForBatchRead);
|
||||
NON_MOVEABLE(RemoteStorageForBatchRead);
|
||||
private:
|
||||
::FsStorageForBatchRead m_base_storage;
|
||||
public:
|
||||
RemoteStorageForBatchRead(::FsStorageForBatchRead &s) : m_base_storage(s) { /* ... */}
|
||||
|
||||
virtual ~RemoteStorageForBatchRead() { fsStorageForBatchReadClose(std::addressof(m_base_storage)); }
|
||||
public:
|
||||
Result Read(s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size) {
|
||||
R_RETURN(fsStorageForBatchReadRead(std::addressof(m_base_storage), offset, buffer.GetPointer(), size));
|
||||
}
|
||||
|
||||
Result Write(s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size) {
|
||||
R_RETURN(fsStorageForBatchReadWrite(std::addressof(m_base_storage), offset, buffer.GetPointer(), size));
|
||||
}
|
||||
|
||||
Result Flush(){
|
||||
R_RETURN(fsStorageForBatchReadFlush(std::addressof(m_base_storage)));
|
||||
}
|
||||
|
||||
Result SetSize(s64 size) {
|
||||
R_RETURN(fsStorageForBatchReadSetSize(std::addressof(m_base_storage), size));
|
||||
}
|
||||
|
||||
Result GetSize(ams::sf::Out<s64> out) {
|
||||
R_RETURN(fsStorageForBatchReadGetSize(std::addressof(m_base_storage), out.GetPointer()));
|
||||
}
|
||||
|
||||
Result OperateRange(ams::sf::Out<fs::StorageQueryRangeInfo> out, s32 op_id, s64 offset, s64 size) {
|
||||
static_assert(sizeof(::FsRangeInfo) == sizeof(fs::StorageQueryRangeInfo));
|
||||
R_RETURN(fsStorageForBatchReadOperateRange(std::addressof(m_base_storage), static_cast<::FsOperationId>(op_id), offset, size, reinterpret_cast<::FsRangeInfo *>(out.GetPointer())));
|
||||
}
|
||||
|
||||
Result BatchRead(const ams::sf::OutNonSecureBuffer &out0, const ams::sf::OutNonSecureBuffer &out1, const ams::sf::OutNonSecureBuffer &out2, const ams::sf::OutNonSecureBuffer &out3, const ams::sf::OutNonSecureBuffer &out4, const ams::sf::OutNonSecureBuffer &out5, const ams::sf::OutNonSecureBuffer &out6, const ams::sf::InBuffer &in) {
|
||||
R_RETURN(fsStorageForBatchReadBatchRead(std::addressof(m_base_storage), out0.GetPointer(), out1.GetPointer(), out2.GetPointer(), out3.GetPointer(), out4.GetPointer(), out5.GetPointer(), out6.GetPointer(), in.GetPointer()));
|
||||
}
|
||||
};
|
||||
static_assert(fssrv::sf::IsIStorageForBatchRead<RemoteStorageForBatchRead>);
|
||||
#endif
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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/sf.hpp>
|
||||
#include <stratosphere/fs/fs_file.hpp>
|
||||
#include <stratosphere/fs/fs_query_range.hpp>
|
||||
|
||||
#define AMS_FSSRV_I_STORAGE_FOR_BATCH_READ_INTERFACE_INFO(C, H) \
|
||||
AMS_SF_METHOD_INFO(C, H, 0, Result, Read, (s64 offset, const ams::sf::OutNonSecureBuffer &buffer, s64 size), (offset, buffer, size)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 1, Result, Write, (s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size), (offset, buffer, size)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 2, Result, Flush, (), ()) \
|
||||
AMS_SF_METHOD_INFO(C, H, 3, Result, SetSize, (s64 size), (size)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 4, Result, GetSize, (ams::sf::Out<s64> out), (out)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 5, Result, OperateRange, (ams::sf::Out<ams::fs::StorageQueryRangeInfo> out, s32 op_id, s64 offset, s64 size), (out, op_id, offset, size)) \
|
||||
AMS_SF_METHOD_INFO(C, H, 10, Result, BatchRead, (const ams::sf::OutNonSecureBuffer &out0, const ams::sf::OutNonSecureBuffer &out1, const ams::sf::OutNonSecureBuffer &out2, const ams::sf::OutNonSecureBuffer &out3, const ams::sf::OutNonSecureBuffer &out4, const ams::sf::OutNonSecureBuffer &out5, const ams::sf::OutNonSecureBuffer &out6, const ams::sf::InBuffer &in), (out0, out1, out2, out3, out4, out5, out6, in))
|
||||
|
||||
AMS_SF_DEFINE_INTERFACE(ams::fssrv::sf, IStorageForBatchRead, AMS_FSSRV_I_STORAGE_FOR_BATCH_READ_INTERFACE_INFO, 0xCD2D5606)
|
||||
@@ -158,7 +158,40 @@ namespace ams::socket {
|
||||
char *ai_canonname;
|
||||
AddrInfo *ai_next;
|
||||
};
|
||||
|
||||
|
||||
/* NOTE: We are using the c-ares structs under ams::socket. */
|
||||
/* Should we include c-ares instead somewhere? */
|
||||
struct ares_addrinfo_node {
|
||||
int ai_ttl;
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
socklen_t ai_addrlen;
|
||||
struct sockaddr *ai_addr;
|
||||
struct ares_addrinfo_node *ai_next;
|
||||
};
|
||||
|
||||
struct ares_addrinfo_cname {
|
||||
int ttl;
|
||||
char *alias;
|
||||
char *name;
|
||||
struct ares_addrinfo_cname *next;
|
||||
};
|
||||
|
||||
struct ares_addrinfo {
|
||||
struct ares_addrinfo_cname *cnames;
|
||||
struct ares_addrinfo_node *nodes;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct ares_addrinfo_hints {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
};
|
||||
|
||||
struct TimeVal {
|
||||
long tv_sec;
|
||||
long tv_usec;
|
||||
|
||||
@@ -58,6 +58,11 @@ namespace ams::fs {
|
||||
Result FileStorage::Flush() {
|
||||
R_RETURN(m_base_file->Flush());
|
||||
}
|
||||
|
||||
Result FileStorage::SetSize(s64 size) {
|
||||
m_size = InvalidSize;
|
||||
R_RETURN(m_base_file->SetSize(size));
|
||||
}
|
||||
|
||||
Result FileStorage::GetSize(s64 *out_size) {
|
||||
R_TRY(this->UpdateSize());
|
||||
@@ -65,11 +70,6 @@ namespace ams::fs {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FileStorage::SetSize(s64 size) {
|
||||
m_size = InvalidSize;
|
||||
R_RETURN(m_base_file->SetSize(size));
|
||||
}
|
||||
|
||||
Result FileStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
switch (op_id) {
|
||||
case OperationId::Invalidate:
|
||||
@@ -102,7 +102,7 @@ namespace ams::fs {
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
|
||||
Result FileHandleStorage::UpdateSize() {
|
||||
R_SUCCEED_IF(m_size != InvalidSize);
|
||||
R_RETURN(GetFileSize(std::addressof(m_size), m_handle));
|
||||
@@ -149,6 +149,11 @@ namespace ams::fs {
|
||||
Result FileHandleStorage::Flush() {
|
||||
R_RETURN(FlushFile(m_handle));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::SetSize(s64 size) {
|
||||
m_size = InvalidSize;
|
||||
R_RETURN(SetFileSize(m_handle, size));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::GetSize(s64 *out_size) {
|
||||
R_TRY(this->UpdateSize());
|
||||
@@ -156,11 +161,6 @@ namespace ams::fs {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result FileHandleStorage::SetSize(s64 size) {
|
||||
m_size = InvalidSize;
|
||||
R_RETURN(SetFileSize(m_handle, size));
|
||||
}
|
||||
|
||||
Result FileHandleStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
AMS_UNUSED(src, src_size);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ams::fssrv::impl {
|
||||
}));
|
||||
}
|
||||
|
||||
Result StorageInterfaceAdapter::Write(s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size) {
|
||||
Result StorageInterfaceAdapter::Write(s64 offset, const ams::sf::InNonSecureBuffer &buffer, s64 size) {
|
||||
/* Check pre-conditions. */
|
||||
R_UNLESS(0 <= offset, fs::ResultInvalidOffset());
|
||||
R_UNLESS(0 <= size, fs::ResultInvalidSize());
|
||||
@@ -42,16 +42,16 @@ namespace ams::fssrv::impl {
|
||||
R_RETURN(m_base_storage->Write(offset, buffer.GetPointer(), size));
|
||||
}
|
||||
|
||||
Result StorageInterfaceAdapter::Flush() {
|
||||
Result StorageInterfaceAdapter::Flush() {
|
||||
R_RETURN(m_base_storage->Flush());
|
||||
}
|
||||
|
||||
Result StorageInterfaceAdapter::SetSize(s64 size) {
|
||||
Result StorageInterfaceAdapter::SetSize(s64 size) {
|
||||
R_UNLESS(size >= 0, fs::ResultInvalidSize());
|
||||
R_RETURN(m_base_storage->SetSize(size));
|
||||
}
|
||||
|
||||
Result StorageInterfaceAdapter::GetSize(ams::sf::Out<s64> out) {
|
||||
Result StorageInterfaceAdapter::GetSize(ams::sf::Out<s64> out) {
|
||||
R_RETURN(m_base_storage->GetSize(out.GetPointer()));
|
||||
}
|
||||
|
||||
@@ -72,5 +72,11 @@ namespace ams::fssrv::impl {
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result StorageInterfaceAdapterForBatchRead::BatchRead(const ams::sf::OutNonSecureBuffer &out0, const ams::sf::OutNonSecureBuffer &out1, const ams::sf::OutNonSecureBuffer &out2, const ams::sf::OutNonSecureBuffer &out3, const ams::sf::OutNonSecureBuffer &out4, const ams::sf::OutNonSecureBuffer &out5, const ams::sf::OutNonSecureBuffer &out6, const ams::sf::InBuffer &in) {
|
||||
/* TODO */
|
||||
AMS_UNUSED(out0, out1, out2, out3, out4, out5, out6, in);
|
||||
R_THROW(fs::ResultUnsupportedOperation());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,6 +33,9 @@ namespace ams::os {
|
||||
|
||||
/* Create the critical section. */
|
||||
util::ConstructAt(shared_memory->cs_shared_memory);
|
||||
|
||||
/* Set state to initialized. */
|
||||
shared_memory->state = SharedMemoryType::State_Initialized;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace ams::os {
|
||||
|
||||
/* Create the critical section. */
|
||||
util::ConstructAt(tmem->cs_transfer_memory);
|
||||
|
||||
/* Set state to created. */
|
||||
tmem->state = TransferMemoryType::State_Created;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user