summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2018-02-19 00:32:00 -0500
committerGravatar Subv2018-03-01 19:03:52 -0500
commitd140c8ecf7514e925340cbd3340991c8df0d0c15 (patch)
treed0a91ded4bde7eb1d73f9e6617871d8ff37f08bd /src
parentResultCode: Mark any error code that isn't 0 as an error. (diff)
downloadyuzu-d140c8ecf7514e925340cbd3340991c8df0d0c15.tar.gz
yuzu-d140c8ecf7514e925340cbd3340991c8df0d0c15.tar.xz
yuzu-d140c8ecf7514e925340cbd3340991c8df0d0c15.zip
Filesystem: Added a SaveData Factory and associated Disk_FileSystem.
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/file_sys/disk_filesystem.cpp147
-rw-r--r--src/core/file_sys/disk_filesystem.h66
-rw-r--r--src/core/file_sys/filesystem.h25
-rw-r--r--src/core/file_sys/romfs_filesystem.cpp12
-rw-r--r--src/core/file_sys/romfs_filesystem.h7
-rw-r--r--src/core/file_sys/savedata_factory.cpp41
-rw-r--r--src/core/file_sys/savedata_factory.h31
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp11
-rw-r--r--src/core/hle/service/filesystem/filesystem.h1
10 files changed, 329 insertions, 16 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 1bc536075..6ad04d19d 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -7,6 +7,8 @@ add_library(core STATIC
7 core_timing.cpp 7 core_timing.cpp
8 core_timing.h 8 core_timing.h
9 file_sys/directory.h 9 file_sys/directory.h
10 file_sys/disk_filesystem.cpp
11 file_sys/disk_filesystem.h
10 file_sys/errors.h 12 file_sys/errors.h
11 file_sys/filesystem.cpp 13 file_sys/filesystem.cpp
12 file_sys/filesystem.h 14 file_sys/filesystem.h
@@ -18,6 +20,8 @@ add_library(core STATIC
18 file_sys/romfs_factory.h 20 file_sys/romfs_factory.h
19 file_sys/romfs_filesystem.cpp 21 file_sys/romfs_filesystem.cpp
20 file_sys/romfs_filesystem.h 22 file_sys/romfs_filesystem.h
23 file_sys/savedata_factory.cpp
24 file_sys/savedata_factory.h
21 file_sys/storage.h 25 file_sys/storage.h
22 frontend/emu_window.cpp 26 frontend/emu_window.cpp
23 frontend/emu_window.h 27 frontend/emu_window.h
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp
new file mode 100644
index 000000000..be7574fdb
--- /dev/null
+++ b/src/core/file_sys/disk_filesystem.cpp
@@ -0,0 +1,147 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <cstring>
6#include <memory>
7#include "common/common_types.h"
8#include "common/logging/log.h"
9#include "core/file_sys/disk_filesystem.h"
10
11namespace FileSys {
12
13std::string Disk_FileSystem::GetName() const {
14 return "Disk";
15}
16
17ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std::string& path,
18 Mode mode) const {
19 ASSERT_MSG(mode == Mode::Read || mode == Mode::Write, "Other file modes are not supported");
20
21 std::string full_path = base_directory + path;
22 auto file = std::make_shared<FileUtil::IOFile>(full_path, mode == Mode::Read ? "rb" : "wb");
23
24 if (!file->IsOpen()) {
25 // TODO(Subv): Find out the correct error code.
26 return ResultCode(-1);
27 }
28
29 return MakeResult<std::unique_ptr<StorageBackend>>(
30 std::make_unique<Disk_Storage>(std::move(file)));
31}
32
33ResultCode Disk_FileSystem::DeleteFile(const Path& path) const {
34 LOG_WARNING(Service_FS, "(STUBBED) called");
35 // TODO(bunnei): Use correct error code
36 return ResultCode(-1);
37}
38
39ResultCode Disk_FileSystem::RenameFile(const Path& src_path, const Path& dest_path) const {
40 LOG_WARNING(Service_FS, "(STUBBED) called");
41 // TODO(wwylele): Use correct error code
42 return ResultCode(-1);
43}
44
45ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const {
46 LOG_WARNING(Service_FS, "(STUBBED) called");
47 // TODO(wwylele): Use correct error code
48 return ResultCode(-1);
49}
50
51ResultCode Disk_FileSystem::DeleteDirectoryRecursively(const Path& path) const {
52 LOG_WARNING(Service_FS, "(STUBBED) called");
53 // TODO(wwylele): Use correct error code
54 return ResultCode(-1);
55}
56
57ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const {
58 LOG_WARNING(Service_FS, "(STUBBED) called");
59
60 std::string full_path = base_directory + path;
61 if (size == 0) {
62 FileUtil::CreateEmptyFile(full_path);
63 return RESULT_SUCCESS;
64 }
65
66 FileUtil::IOFile file(full_path, "wb");
67 // Creates a sparse file (or a normal file on filesystems without the concept of sparse files)
68 // We do this by seeking to the right size, then writing a single null byte.
69 if (file.Seek(size - 1, SEEK_SET) && file.WriteBytes("", 1) == 1) {
70 return RESULT_SUCCESS;
71 }
72
73 LOG_ERROR(Service_FS, "Too large file");
74 // TODO(Subv): Find out the correct error code
75 return ResultCode(-1);
76}
77
78ResultCode Disk_FileSystem::CreateDirectory(const Path& path) const {
79 LOG_WARNING(Service_FS, "(STUBBED) called");
80 // TODO(wwylele): Use correct error code
81 return ResultCode(-1);
82}
83
84ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& dest_path) const {
85 LOG_WARNING(Service_FS, "(STUBBED) called");
86 // TODO(wwylele): Use correct error code
87 return ResultCode(-1);
88}
89
90ResultVal<std::unique_ptr<DirectoryBackend>> Disk_FileSystem::OpenDirectory(
91 const Path& path) const {
92 return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<Disk_Directory>());
93}
94
95u64 Disk_FileSystem::GetFreeSpaceSize() const {
96 LOG_WARNING(Service_FS, "(STUBBED) called");
97 return 0;
98}
99
100ResultVal<FileSys::EntryType> Disk_FileSystem::GetEntryType(const std::string& path) const {
101 std::string full_path = base_directory + path;
102 if (!FileUtil::Exists(full_path)) {
103 // TODO(Subv): Find out what this actually means
104 return ResultCode(ErrorModule::FS, 1);
105 }
106
107 // TODO(Subv): Find out the EntryType values
108 UNIMPLEMENTED_MSG("Unimplemented GetEntryType");
109}
110
111ResultVal<size_t> Disk_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
112 LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
113 file->Seek(offset, SEEK_SET);
114 return MakeResult<size_t>(file->ReadBytes(buffer, length));
115}
116
117ResultVal<size_t> Disk_Storage::Write(const u64 offset, const size_t length, const bool flush,
118 const u8* buffer) const {
119 LOG_WARNING(Service_FS, "(STUBBED) called");
120 file->Seek(offset, SEEK_SET);
121 size_t written = file->WriteBytes(buffer, length);
122 if (flush) {
123 file->Flush();
124 }
125 return MakeResult<size_t>(written);
126}
127
128u64 Disk_Storage::GetSize() const {
129 return file->GetSize();
130}
131
132bool Disk_Storage::SetSize(const u64 size) const {
133 LOG_WARNING(Service_FS, "(STUBBED) called");
134 return false;
135}
136
137u32 Disk_Directory::Read(const u32 count, Entry* entries) {
138 LOG_WARNING(Service_FS, "(STUBBED) called");
139 return 0;
140}
141
142bool Disk_Directory::Close() const {
143 LOG_WARNING(Service_FS, "(STUBBED) called");
144 return true;
145}
146
147} // namespace FileSys
diff --git a/src/core/file_sys/disk_filesystem.h b/src/core/file_sys/disk_filesystem.h
new file mode 100644
index 000000000..53767b949
--- /dev/null
+++ b/src/core/file_sys/disk_filesystem.h
@@ -0,0 +1,66 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <cstddef>
8#include <memory>
9#include <string>
10#include "common/common_types.h"
11#include "common/file_util.h"
12#include "core/file_sys/directory.h"
13#include "core/file_sys/filesystem.h"
14#include "core/file_sys/storage.h"
15#include "core/hle/result.h"
16
17namespace FileSys {
18
19class Disk_FileSystem : public FileSystemBackend {
20public:
21 explicit Disk_FileSystem(std::string base_directory)
22 : base_directory(std::move(base_directory)) {}
23
24 std::string GetName() const override;
25
26 ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const std::string& path,
27 Mode mode) const override;
28 ResultCode DeleteFile(const Path& path) const override;
29 ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override;
30 ResultCode DeleteDirectory(const Path& path) const override;
31 ResultCode DeleteDirectoryRecursively(const Path& path) const override;
32 ResultCode CreateFile(const std::string& path, u64 size) const override;
33 ResultCode CreateDirectory(const Path& path) const override;
34 ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override;
35 ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override;
36 u64 GetFreeSpaceSize() const override;
37 ResultVal<EntryType> GetEntryType(const std::string& path) const override;
38
39protected:
40 std::string base_directory;
41};
42
43class Disk_Storage : public StorageBackend {
44public:
45 Disk_Storage(std::shared_ptr<FileUtil::IOFile> file) : file(std::move(file)) {}
46
47 ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override;
48 ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) const override;
49 u64 GetSize() const override;
50 bool SetSize(u64 size) const override;
51 bool Close() const override {
52 return false;
53 }
54 void Flush() const override {}
55
56private:
57 std::shared_ptr<FileUtil::IOFile> file;
58};
59
60class Disk_Directory : public DirectoryBackend {
61public:
62 u32 Read(const u32 count, Entry* entries) override;
63 bool Close() const override;
64};
65
66} // namespace FileSys
diff --git a/src/core/file_sys/filesystem.h b/src/core/file_sys/filesystem.h
index 02705506b..df4e66a0b 100644
--- a/src/core/file_sys/filesystem.h
+++ b/src/core/file_sys/filesystem.h
@@ -27,11 +27,14 @@ enum LowPathType : u32 {
27 Wchar = 4, 27 Wchar = 4,
28}; 28};
29 29
30union Mode { 30enum EntryType : u32 {
31 u32 hex; 31 Directory = 0,
32 BitField<0, 1, u32> read_flag; 32 File = 1,
33 BitField<1, 1, u32> write_flag; 33};
34 BitField<2, 1, u32> create_flag; 34
35enum class Mode : u32 {
36 Read = 1,
37 Write = 2,
35}; 38};
36 39
37class Path { 40class Path {
@@ -86,7 +89,7 @@ public:
86 * @param size The size of the new file, filled with zeroes 89 * @param size The size of the new file, filled with zeroes
87 * @return Result of the operation 90 * @return Result of the operation
88 */ 91 */
89 virtual ResultCode CreateFile(const Path& path, u64 size) const = 0; 92 virtual ResultCode CreateFile(const std::string& path, u64 size) const = 0;
90 93
91 /** 94 /**
92 * Delete a file specified by its path 95 * Delete a file specified by its path
@@ -138,8 +141,8 @@ public:
138 * @param mode Mode to open the file with 141 * @param mode Mode to open the file with
139 * @return Opened file, or error code 142 * @return Opened file, or error code
140 */ 143 */
141 virtual ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const Path& path, 144 virtual ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const std::string& path,
142 const Mode& mode) const = 0; 145 Mode mode) const = 0;
143 146
144 /** 147 /**
145 * Open a directory specified by its path 148 * Open a directory specified by its path
@@ -153,6 +156,12 @@ public:
153 * @return The number of free bytes in the archive 156 * @return The number of free bytes in the archive
154 */ 157 */
155 virtual u64 GetFreeSpaceSize() const = 0; 158 virtual u64 GetFreeSpaceSize() const = 0;
159
160 /**
161 * Get the type of the specified path
162 * @return The type of the specified path or error code
163 */
164 virtual ResultVal<EntryType> GetEntryType(const std::string& path) const = 0;
156}; 165};
157 166
158class FileSystemFactory : NonCopyable { 167class FileSystemFactory : NonCopyable {
diff --git a/src/core/file_sys/romfs_filesystem.cpp b/src/core/file_sys/romfs_filesystem.cpp
index ca1463d7c..f1f9b4d04 100644
--- a/src/core/file_sys/romfs_filesystem.cpp
+++ b/src/core/file_sys/romfs_filesystem.cpp
@@ -14,8 +14,8 @@ std::string RomFS_FileSystem::GetName() const {
14 return "RomFS"; 14 return "RomFS";
15} 15}
16 16
17ResultVal<std::unique_ptr<StorageBackend>> RomFS_FileSystem::OpenFile(const Path& path, 17ResultVal<std::unique_ptr<StorageBackend>> RomFS_FileSystem::OpenFile(const std::string& path,
18 const Mode& mode) const { 18 Mode mode) const {
19 return MakeResult<std::unique_ptr<StorageBackend>>( 19 return MakeResult<std::unique_ptr<StorageBackend>>(
20 std::make_unique<RomFS_Storage>(romfs_file, data_offset, data_size)); 20 std::make_unique<RomFS_Storage>(romfs_file, data_offset, data_size));
21} 21}
@@ -48,7 +48,7 @@ ResultCode RomFS_FileSystem::DeleteDirectoryRecursively(const Path& path) const
48 return ResultCode(-1); 48 return ResultCode(-1);
49} 49}
50 50
51ResultCode RomFS_FileSystem::CreateFile(const Path& path, u64 size) const { 51ResultCode RomFS_FileSystem::CreateFile(const std::string& path, u64 size) const {
52 LOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive (%s).", 52 LOG_CRITICAL(Service_FS, "Attempted to create a file in an ROMFS archive (%s).",
53 GetName().c_str()); 53 GetName().c_str());
54 // TODO(bunnei): Use correct error code 54 // TODO(bunnei): Use correct error code
@@ -79,6 +79,12 @@ u64 RomFS_FileSystem::GetFreeSpaceSize() const {
79 return 0; 79 return 0;
80} 80}
81 81
82ResultVal<FileSys::EntryType> RomFS_FileSystem::GetEntryType(const std::string& path) const {
83 LOG_CRITICAL(Service_FS, "Called within an ROMFS archive (path %s).", path.c_str());
84 // TODO(wwylele): Use correct error code
85 return ResultCode(-1);
86}
87
82ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const { 88ResultVal<size_t> RomFS_Storage::Read(const u64 offset, const size_t length, u8* buffer) const {
83 LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length); 89 LOG_TRACE(Service_FS, "called offset=%llu, length=%zu", offset, length);
84 romfs_file->Seek(data_offset + offset, SEEK_SET); 90 romfs_file->Seek(data_offset + offset, SEEK_SET);
diff --git a/src/core/file_sys/romfs_filesystem.h b/src/core/file_sys/romfs_filesystem.h
index 900ea567a..cedd70645 100644
--- a/src/core/file_sys/romfs_filesystem.h
+++ b/src/core/file_sys/romfs_filesystem.h
@@ -29,17 +29,18 @@ public:
29 29
30 std::string GetName() const override; 30 std::string GetName() const override;
31 31
32 ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const Path& path, 32 ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const std::string& path,
33 const Mode& mode) const override; 33 Mode mode) const override;
34 ResultCode DeleteFile(const Path& path) const override; 34 ResultCode DeleteFile(const Path& path) const override;
35 ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override; 35 ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override;
36 ResultCode DeleteDirectory(const Path& path) const override; 36 ResultCode DeleteDirectory(const Path& path) const override;
37 ResultCode DeleteDirectoryRecursively(const Path& path) const override; 37 ResultCode DeleteDirectoryRecursively(const Path& path) const override;
38 ResultCode CreateFile(const Path& path, u64 size) const override; 38 ResultCode CreateFile(const std::string& path, u64 size) const override;
39 ResultCode CreateDirectory(const Path& path) const override; 39 ResultCode CreateDirectory(const Path& path) const override;
40 ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override; 40 ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override;
41 ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override; 41 ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override;
42 u64 GetFreeSpaceSize() const override; 42 u64 GetFreeSpaceSize() const override;
43 ResultVal<EntryType> GetEntryType(const std::string& path) const override;
43 44
44protected: 45protected:
45 std::shared_ptr<FileUtil::IOFile> romfs_file; 46 std::shared_ptr<FileUtil::IOFile> romfs_file;
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp
new file mode 100644
index 000000000..0df754e7c
--- /dev/null
+++ b/src/core/file_sys/savedata_factory.cpp
@@ -0,0 +1,41 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <cinttypes>
6#include <memory>
7#include "common/common_types.h"
8#include "common/logging/log.h"
9#include "common/string_util.h"
10#include "core/file_sys/disk_filesystem.h"
11#include "core/file_sys/savedata_factory.h"
12
13namespace FileSys {
14
15SaveData_Factory::SaveData_Factory(std::string nand_directory)
16 : nand_directory(std::move(nand_directory)) {}
17
18ResultVal<std::unique_ptr<FileSystemBackend>> SaveData_Factory::Open(const Path& path) {
19 // TODO(Subv): Somehow obtain these values.
20 u64 title_id = 0;
21 u32 user = 0;
22 std::string save_directory = Common::StringFromFormat("%ssave/%016" PRIX64 "/%08X",
23 nand_directory.c_str(), title_id, user);
24 auto archive = std::make_unique<Disk_FileSystem>(save_directory);
25 return MakeResult<std::unique_ptr<FileSystemBackend>>(std::move(archive));
26}
27
28ResultCode SaveData_Factory::Format(const Path& path,
29 const FileSys::ArchiveFormatInfo& format_info) {
30 LOG_ERROR(Service_FS, "Unimplemented Format archive %s", GetName().c_str());
31 // TODO(bunnei): Find the right error code for this
32 return ResultCode(-1);
33}
34
35ResultVal<ArchiveFormatInfo> SaveData_Factory::GetFormatInfo(const Path& path) const {
36 LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str());
37 // TODO(bunnei): Find the right error code for this
38 return ResultCode(-1);
39}
40
41} // namespace FileSys
diff --git a/src/core/file_sys/savedata_factory.h b/src/core/file_sys/savedata_factory.h
new file mode 100644
index 000000000..726743fde
--- /dev/null
+++ b/src/core/file_sys/savedata_factory.h
@@ -0,0 +1,31 @@
1// Copyright 2018 yuzu emulator team
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <memory>
8#include <string>
9#include "common/common_types.h"
10#include "core/file_sys/filesystem.h"
11#include "core/hle/result.h"
12
13namespace FileSys {
14
15/// File system interface to the SaveData archive
16class SaveData_Factory final : public FileSystemFactory {
17public:
18 explicit SaveData_Factory(std::string nand_directory);
19
20 std::string GetName() const override {
21 return "SaveData_Factory";
22 }
23 ResultVal<std::unique_ptr<FileSystemBackend>> Open(const Path& path) override;
24 ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) override;
25 ResultVal<ArchiveFormatInfo> GetFormatInfo(const Path& path) const override;
26
27private:
28 std::string nand_directory;
29};
30
31} // namespace FileSys
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 4b47548fd..32752aea5 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -3,7 +3,9 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <boost/container/flat_map.hpp> 5#include <boost/container/flat_map.hpp>
6#include "common/file_util.h"
6#include "core/file_sys/filesystem.h" 7#include "core/file_sys/filesystem.h"
8#include "core/file_sys/savedata_factory.h"
7#include "core/hle/service/filesystem/filesystem.h" 9#include "core/hle/service/filesystem/filesystem.h"
8#include "core/hle/service/filesystem/fsp_srv.h" 10#include "core/hle/service/filesystem/fsp_srv.h"
9 11
@@ -41,12 +43,17 @@ ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenFileSystem(Type type,
41 return itr->second->Open(path); 43 return itr->second->Open(path);
42} 44}
43 45
44void UnregisterFileSystems() { 46void RegisterFileSystems() {
45 filesystem_map.clear(); 47 filesystem_map.clear();
48
49 std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
50
51 auto savedata = std::make_unique<FileSys::SaveData_Factory>(std::move(nand_directory));
52 RegisterFileSystem(std::move(savedata), Type::SaveData);
46} 53}
47 54
48void InstallInterfaces(SM::ServiceManager& service_manager) { 55void InstallInterfaces(SM::ServiceManager& service_manager) {
49 UnregisterFileSystems(); 56 RegisterFileSystems();
50 std::make_shared<FSP_SRV>()->InstallAsService(service_manager); 57 std::make_shared<FSP_SRV>()->InstallAsService(service_manager);
51} 58}
52 59
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index a674c9493..80f318676 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -25,6 +25,7 @@ namespace FileSystem {
25/// Supported FileSystem types 25/// Supported FileSystem types
26enum class Type { 26enum class Type {
27 RomFS = 1, 27 RomFS = 1,
28 SaveData = 2,
28}; 29};
29 30
30/** 31/**