2021-02-11 13:47:41 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020 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 "htcfs_directory_service_object.hpp"
|
2021-02-13 09:57:24 +00:00
|
|
|
#include "htcfs_client.hpp"
|
2021-02-11 13:47:41 +00:00
|
|
|
|
|
|
|
namespace ams::htcfs {
|
|
|
|
|
|
|
|
DirectoryServiceObject::DirectoryServiceObject(s32 handle) : m_handle(handle) { /* ... */ }
|
|
|
|
|
|
|
|
DirectoryServiceObject::~DirectoryServiceObject() {
|
2021-02-13 09:57:24 +00:00
|
|
|
htcfs::GetClient().CloseDirectory(m_handle);
|
2021-02-11 13:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result DirectoryServiceObject::GetEntryCount(ams::sf::Out<s64> out) {
|
2021-02-13 13:39:02 +00:00
|
|
|
return htcfs::GetClient().GetEntryCount(out.GetPointer(), m_handle);
|
2021-02-11 13:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result DirectoryServiceObject::Read(ams::sf::Out<s64> out, const ams::sf::OutMapAliasArray<fs::DirectoryEntry> &out_entries) {
|
2021-02-13 13:39:02 +00:00
|
|
|
if (out_entries.GetSize() * sizeof(fs::DirectoryEntry) >= ClientImpl::MaxPacketBodySize) {
|
|
|
|
return htcfs::GetClient().ReadDirectoryLarge(out.GetPointer(), out_entries.GetPointer(), out_entries.GetSize(), m_handle);
|
|
|
|
} else {
|
|
|
|
return htcfs::GetClient().ReadDirectory(out.GetPointer(), out_entries.GetPointer(), out_entries.GetSize(), m_handle);
|
|
|
|
}
|
2021-02-11 13:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result DirectoryServiceObject::SetPriorityForDirectory(s32 priority) {
|
2021-02-13 13:39:02 +00:00
|
|
|
return htcfs::GetClient().SetPriorityForDirectory(priority, m_handle);
|
2021-02-11 13:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Result DirectoryServiceObject::GetPriorityForDirectory(ams::sf::Out<s32> out) {
|
2021-02-13 13:39:02 +00:00
|
|
|
return htcfs::GetClient().GetPriorityForDirectory(out.GetPointer(), m_handle);
|
2021-02-11 13:47:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|