[ox] Remove now superfluous [[nodiscards]] from ox::Error functions
This commit is contained in:
@@ -79,19 +79,19 @@ class FileStoreTemplate {
|
||||
|
||||
[[nodiscard]] static Error format(void *buffer, size_t bufferSize);
|
||||
|
||||
[[nodiscard]] Error setSize(InodeId_t buffSize);
|
||||
Error setSize(InodeId_t buffSize);
|
||||
|
||||
[[nodiscard]] Error incLinks(InodeId_t id);
|
||||
Error incLinks(InodeId_t id);
|
||||
|
||||
[[nodiscard]] Error decLinks(InodeId_t id);
|
||||
Error decLinks(InodeId_t id);
|
||||
|
||||
[[nodiscard]] Error write(InodeId_t id, void *data, FsSize_t dataLen, uint8_t fileType = 0);
|
||||
Error write(InodeId_t id, void *data, FsSize_t dataLen, uint8_t fileType = 0);
|
||||
|
||||
[[nodiscard]] Error remove(InodeId_t id);
|
||||
Error remove(InodeId_t id);
|
||||
|
||||
[[nodiscard]] Error read(InodeId_t id, void *data, FsSize_t dataSize, FsSize_t *size = nullptr) const;
|
||||
Error read(InodeId_t id, void *data, FsSize_t dataSize, FsSize_t *size = nullptr) const;
|
||||
|
||||
[[nodiscard]] Error read(InodeId_t id, FsSize_t readStart, FsSize_t readSize, void *data, FsSize_t *size = nullptr) const;
|
||||
Error read(InodeId_t id, FsSize_t readStart, FsSize_t readSize, void *data, FsSize_t *size = nullptr) const;
|
||||
|
||||
const ptrarith::Ptr<uint8_t, std::size_t> read(InodeId_t id) const;
|
||||
|
||||
@@ -106,15 +106,15 @@ class FileStoreTemplate {
|
||||
* @return 0 if read is a success
|
||||
*/
|
||||
template<typename T>
|
||||
[[nodiscard]] ox::Error read(InodeId_t id, FsSize_t readStart,
|
||||
Error read(InodeId_t id, FsSize_t readStart,
|
||||
FsSize_t readSize, T *data,
|
||||
FsSize_t *size) const;
|
||||
|
||||
[[nodiscard]] ValErr<StatInfo> stat(InodeId_t id);
|
||||
ValErr<StatInfo> stat(InodeId_t id);
|
||||
|
||||
[[nodiscard]] ox::Error resize();
|
||||
Error resize();
|
||||
|
||||
[[nodiscard]] ox::Error resize(std::size_t size, void *newBuff = nullptr);
|
||||
Error resize(std::size_t size, void *newBuff = nullptr);
|
||||
|
||||
[[nodiscard]] InodeId_t spaceNeeded(FsSize_t size);
|
||||
|
||||
@@ -124,13 +124,13 @@ class FileStoreTemplate {
|
||||
|
||||
[[nodiscard]] char *buff();
|
||||
|
||||
[[nodiscard]] Error walk(Error(*cb)(uint8_t, uint64_t, uint64_t));
|
||||
Error walk(Error(*cb)(uint8_t, uint64_t, uint64_t));
|
||||
|
||||
[[nodiscard]] ValErr<InodeId_t> generateInodeId();
|
||||
ValErr<InodeId_t> generateInodeId();
|
||||
|
||||
bool valid() const;
|
||||
|
||||
[[nodiscard]] ox::Error compact();
|
||||
Error compact();
|
||||
|
||||
private:
|
||||
FileStoreData *fileStoreData() const;
|
||||
|
16
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
16
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
@@ -43,7 +43,7 @@ struct OX_PACKED DirectoryEntry {
|
||||
public:
|
||||
DirectoryEntry() = default;
|
||||
|
||||
[[nodiscard]] ox::Error init(InodeId_t inode, const char *name, InodeId_t bufferSize) {
|
||||
Error init(InodeId_t inode, const char *name, InodeId_t bufferSize) {
|
||||
m_bufferSize = bufferSize;
|
||||
auto d = data();
|
||||
if (d.valid()) {
|
||||
@@ -99,23 +99,23 @@ class Directory {
|
||||
/**
|
||||
* Initializes Directory.
|
||||
*/
|
||||
[[nodiscard]] ox::Error init() noexcept;
|
||||
Error init() noexcept;
|
||||
|
||||
[[nodiscard]] ox::Error mkdir(PathIterator path, bool parents, FileName *nameBuff = nullptr);
|
||||
Error mkdir(PathIterator path, bool parents, FileName *nameBuff = nullptr);
|
||||
|
||||
/**
|
||||
* @param parents indicates the operation should create non-existent directories in the path, like mkdir -p
|
||||
*/
|
||||
[[nodiscard]] ox::Error write(PathIterator it, InodeId_t inode, FileName *nameBuff = nullptr) noexcept;
|
||||
Error write(PathIterator it, InodeId_t inode, FileName *nameBuff = nullptr) noexcept;
|
||||
|
||||
[[nodiscard]] ox::Error remove(PathIterator it, FileName *nameBuff = nullptr) noexcept;
|
||||
Error remove(PathIterator it, FileName *nameBuff = nullptr) noexcept;
|
||||
|
||||
template<typename F>
|
||||
[[nodiscard]] ox::Error ls(F cb) noexcept;
|
||||
Error ls(F cb) noexcept;
|
||||
|
||||
[[nodiscard]] ValErr<typename FileStore::InodeId_t> findEntry(const FileName &name) const noexcept;
|
||||
ValErr<typename FileStore::InodeId_t> findEntry(const FileName &name) const noexcept;
|
||||
|
||||
[[nodiscard]] ValErr<typename FileStore::InodeId_t> find(PathIterator name, FileName *nameBuff = nullptr) const noexcept;
|
||||
ValErr<typename FileStore::InodeId_t> find(PathIterator name, FileName *nameBuff = nullptr) const noexcept;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -68,7 +68,7 @@ class FileAddress {
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr ValErr<uint64_t> getInode() const noexcept {
|
||||
ValErr<uint64_t> getInode() const noexcept {
|
||||
switch (m_type) {
|
||||
case FileAddressType::Inode:
|
||||
return m_data.inode;
|
||||
@@ -77,7 +77,7 @@ class FileAddress {
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr ValErr<const char*> getPath() const noexcept {
|
||||
ValErr<const char*> getPath() const noexcept {
|
||||
switch (m_type) {
|
||||
case FileAddressType::Path:
|
||||
return m_data.path;
|
||||
|
8
deps/ox/src/ox/fs/filesystem/filesystem.cpp
vendored
8
deps/ox/src/ox/fs/filesystem/filesystem.cpp
vendored
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace ox {
|
||||
|
||||
[[nodiscard]] ox::ValErr<uint8_t*> FileSystem::read(FileAddress addr) {
|
||||
ValErr<uint8_t*> FileSystem::read(FileAddress addr) {
|
||||
switch (addr.type()) {
|
||||
case FileAddressType::Inode:
|
||||
return read(addr.getInode().value);
|
||||
@@ -22,7 +22,7 @@ namespace ox {
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] ox::Error FileSystem::read(FileAddress addr, void *buffer, std::size_t size) {
|
||||
Error FileSystem::read(FileAddress addr, void *buffer, std::size_t size) {
|
||||
switch (addr.type()) {
|
||||
case FileAddressType::Inode:
|
||||
return read(addr.getInode().value, buffer, size);
|
||||
@@ -34,7 +34,7 @@ namespace ox {
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] ox::Error FileSystem::read(FileAddress addr, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) {
|
||||
Error FileSystem::read(FileAddress addr, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) {
|
||||
switch (addr.type()) {
|
||||
case FileAddressType::Inode:
|
||||
return read(addr.getInode().value, readStart, readSize, buffer, size);
|
||||
@@ -46,7 +46,7 @@ namespace ox {
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] ox::Error FileSystem::remove(FileAddress addr, bool recursive) {
|
||||
Error FileSystem::remove(FileAddress addr, bool recursive) {
|
||||
switch (addr.type()) {
|
||||
case FileAddressType::Inode:
|
||||
return remove(addr.getInode().value, recursive);
|
||||
|
82
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
82
deps/ox/src/ox/fs/filesystem/filesystem.hpp
vendored
@@ -21,48 +21,48 @@ class FileSystem {
|
||||
public:
|
||||
virtual ~FileSystem() = default;
|
||||
|
||||
[[nodiscard]] virtual ox::Error mkdir(const char *path, bool recursive = false) = 0;
|
||||
virtual Error mkdir(const char *path, bool recursive = false) = 0;
|
||||
|
||||
/**
|
||||
* Moves an entry from one directory to another.
|
||||
* @param src the path to the file
|
||||
* @param dest the path of the destination directory
|
||||
*/
|
||||
[[nodiscard]] virtual ox::Error move(const char *src, const char *dest) = 0;
|
||||
virtual Error move(const char *src, const char *dest) = 0;
|
||||
|
||||
[[nodiscard]] virtual ox::Error read(const char *path, void *buffer, std::size_t buffSize) = 0;
|
||||
virtual Error read(const char *path, void *buffer, std::size_t buffSize) = 0;
|
||||
|
||||
[[nodiscard]] virtual ox::ValErr<uint8_t*> read(const char *path) = 0;
|
||||
virtual ValErr<uint8_t*> read(const char *path) = 0;
|
||||
|
||||
[[nodiscard]] virtual ox::Error read(uint64_t inode, void *buffer, std::size_t size) = 0;
|
||||
virtual Error read(uint64_t inode, void *buffer, std::size_t size) = 0;
|
||||
|
||||
[[nodiscard]] virtual ox::Error read(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) = 0;
|
||||
virtual Error read(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) = 0;
|
||||
|
||||
[[nodiscard]] virtual ox::ValErr<uint8_t*> read(uint64_t inode) = 0;
|
||||
virtual ValErr<uint8_t*> read(uint64_t inode) = 0;
|
||||
|
||||
[[nodiscard]] ox::Error read(FileAddress addr, void *buffer, std::size_t size);
|
||||
Error read(FileAddress addr, void *buffer, std::size_t size);
|
||||
|
||||
[[nodiscard]] ox::Error read(FileAddress addr, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size);
|
||||
Error read(FileAddress addr, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size);
|
||||
|
||||
[[nodiscard]] ox::ValErr<uint8_t*> read(FileAddress addr);
|
||||
ValErr<uint8_t*> read(FileAddress addr);
|
||||
|
||||
[[nodiscard]] virtual ox::Error remove(const char *path, bool recursive = false) = 0;
|
||||
virtual Error remove(const char *path, bool recursive = false) = 0;
|
||||
|
||||
[[nodiscard]] ox::Error remove(FileAddress addr, bool recursive = false);
|
||||
Error remove(FileAddress addr, bool recursive = false);
|
||||
|
||||
[[nodiscard]] virtual ox::Error resize(uint64_t size, void *buffer = nullptr) = 0;
|
||||
virtual Error resize(uint64_t size, void *buffer = nullptr) = 0;
|
||||
|
||||
[[nodiscard]] virtual ox::Error write(const char *path, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) = 0;
|
||||
virtual Error write(const char *path, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) = 0;
|
||||
|
||||
[[nodiscard]] virtual ox::Error write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) = 0;
|
||||
virtual Error write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) = 0;
|
||||
|
||||
[[nodiscard]] ox::Error write(FileAddress addr, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile);
|
||||
Error write(FileAddress addr, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile);
|
||||
|
||||
[[nodiscard]] virtual ox::ValErr<FileStat> stat(uint64_t inode) = 0;
|
||||
virtual ValErr<FileStat> stat(uint64_t inode) = 0;
|
||||
|
||||
[[nodiscard]] virtual ox::ValErr<FileStat> stat(const char *path) = 0;
|
||||
virtual ValErr<FileStat> stat(const char *path) = 0;
|
||||
|
||||
[[nodiscard]] ox::ValErr<FileStat> stat(FileAddress addr);
|
||||
ValErr<FileStat> stat(FileAddress addr);
|
||||
|
||||
[[nodiscard]] virtual uint64_t spaceNeeded(uint64_t size) = 0;
|
||||
|
||||
@@ -72,7 +72,7 @@ class FileSystem {
|
||||
|
||||
[[nodiscard]] virtual char *buff() = 0;
|
||||
|
||||
[[nodiscard]] virtual ox::Error walk(ox::Error(*cb)(uint8_t, uint64_t, uint64_t)) = 0;
|
||||
virtual Error walk(ox::Error(*cb)(uint8_t, uint64_t, uint64_t)) = 0;
|
||||
|
||||
[[nodiscard]] virtual bool valid() const = 0;
|
||||
|
||||
@@ -107,39 +107,39 @@ class FileSystemTemplate: public FileSystem {
|
||||
|
||||
[[nodiscard]] static ox::Error format(void *buff, uint64_t buffSize);
|
||||
|
||||
[[nodiscard]] ox::Error mkdir(const char *path, bool recursive = false) override;
|
||||
Error mkdir(const char *path, bool recursive = false) override;
|
||||
|
||||
[[nodiscard]] ox::Error move(const char *src, const char *dest) override;
|
||||
Error move(const char *src, const char *dest) override;
|
||||
|
||||
[[nodiscard]] ox::Error read(const char *path, void *buffer, std::size_t buffSize) override;
|
||||
Error read(const char *path, void *buffer, std::size_t buffSize) override;
|
||||
|
||||
[[nodiscard]] ox::ValErr<uint8_t*> read(const char*) override;
|
||||
ValErr<uint8_t*> read(const char*) override;
|
||||
|
||||
[[nodiscard]] ox::Error read(uint64_t inode, void *buffer, std::size_t size) override;
|
||||
Error read(uint64_t inode, void *buffer, std::size_t size) override;
|
||||
|
||||
[[nodiscard]] ox::Error read(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) override;
|
||||
Error read(uint64_t inode, std::size_t readStart, std::size_t readSize, void *buffer, std::size_t *size) override;
|
||||
|
||||
[[nodiscard]] ox::ValErr<uint8_t*> read(uint64_t) override;
|
||||
ValErr<uint8_t*> read(uint64_t) override;
|
||||
|
||||
template<typename F>
|
||||
[[nodiscard]] ox::Error ls(const char *dir, F cb);
|
||||
Error ls(const char *dir, F cb);
|
||||
|
||||
[[nodiscard]] ox::Error remove(const char *path, bool recursive = false) override;
|
||||
Error remove(const char *path, bool recursive = false) override;
|
||||
|
||||
/**
|
||||
* Resizes FileSystem to minimum possible size.
|
||||
*/
|
||||
[[nodiscard]] ox::Error resize();
|
||||
Error resize();
|
||||
|
||||
[[nodiscard]] ox::Error resize(uint64_t size, void *buffer = nullptr) override;
|
||||
Error resize(uint64_t size, void *buffer = nullptr) override;
|
||||
|
||||
[[nodiscard]] ox::Error write(const char *path, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override;
|
||||
Error write(const char *path, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override;
|
||||
|
||||
[[nodiscard]] ox::Error write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override;
|
||||
Error write(uint64_t inode, void *buffer, uint64_t size, uint8_t fileType = FileType_NormalFile) override;
|
||||
|
||||
[[nodiscard]] ox::ValErr<FileStat> stat(uint64_t inode) override;
|
||||
ValErr<FileStat> stat(uint64_t inode) override;
|
||||
|
||||
[[nodiscard]] ox::ValErr<FileStat> stat(const char *path) override;
|
||||
ValErr<FileStat> stat(const char *path) override;
|
||||
|
||||
uint64_t spaceNeeded(uint64_t size) override;
|
||||
|
||||
@@ -149,19 +149,19 @@ class FileSystemTemplate: public FileSystem {
|
||||
|
||||
char *buff() override;
|
||||
|
||||
[[nodiscard]] ox::Error walk(ox::Error(*cb)(uint8_t, uint64_t, uint64_t)) override;
|
||||
Error walk(ox::Error(*cb)(uint8_t, uint64_t, uint64_t)) override;
|
||||
|
||||
bool valid() const override;
|
||||
|
||||
private:
|
||||
[[nodiscard]] ValErr<FileSystemData> fileSystemData() const noexcept;
|
||||
ValErr<FileSystemData> fileSystemData() const noexcept;
|
||||
|
||||
/**
|
||||
* Finds the inode ID at the given path.
|
||||
*/
|
||||
[[nodiscard]] ValErr<uint64_t> find(const char *path) const noexcept;
|
||||
ValErr<uint64_t> find(const char *path) const noexcept;
|
||||
|
||||
[[nodiscard]] ValErr<Directory> rootDir() const noexcept;
|
||||
ValErr<Directory> rootDir() const noexcept;
|
||||
|
||||
};
|
||||
|
||||
@@ -236,7 +236,7 @@ ox::Error FileSystemTemplate<FileStore, Directory>::read(const char *path, void
|
||||
}
|
||||
|
||||
template<typename FileStore, typename Directory>
|
||||
[[nodiscard]] ox::ValErr<uint8_t*> FileSystemTemplate<FileStore, Directory>::read(const char *path) {
|
||||
ValErr<uint8_t*> FileSystemTemplate<FileStore, Directory>::read(const char *path) {
|
||||
auto fd = fileSystemData();
|
||||
oxReturnError(fd.error);
|
||||
Directory rootDir(m_fs, fd.value.rootDirInode);
|
||||
@@ -256,7 +256,7 @@ ox::Error FileSystemTemplate<FileStore, Directory>::read(uint64_t inode, std::si
|
||||
}
|
||||
|
||||
template<typename FileStore, typename Directory>
|
||||
[[nodiscard]] ox::ValErr<uint8_t*> FileSystemTemplate<FileStore, Directory>::read(uint64_t inode) {
|
||||
ValErr<uint8_t*> FileSystemTemplate<FileStore, Directory>::read(uint64_t inode) {
|
||||
auto data = m_fs.read(inode);
|
||||
if (!data.valid()) {
|
||||
return OxError(1);
|
||||
|
Reference in New Issue
Block a user