[orbis-kernel] Impl sys_getdirentries/sys_getdents

This commit is contained in:
Ivan Chikish 2023-08-14 23:58:28 +03:00
parent 8179a638ad
commit 8f0a90d24b
5 changed files with 89 additions and 4 deletions

View file

@ -1,6 +1,8 @@
#pragma once
#include "KernelAllocator.hpp"
#include "error/ErrorCode.hpp"
#include "stat.hpp"
#include "utils/Rc.hpp"
#include "utils/SharedMutex.hpp"
#include <cstdint>
@ -43,5 +45,6 @@ struct File : RcBase {
const FileOps *ops = nullptr;
Ref<RcBase> device;
std::uint64_t nextOff = 0;
utils::kvector<Dirent> dirEntries;
};
} // namespace orbis

View file

@ -23,4 +23,25 @@ struct Stat {
int32_t lspare;
timespec birthtim; // time of file creation
};
struct Dirent {
uint32_t fileno;
uint16_t reclen;
uint8_t type;
uint8_t namlen;
char name[256];
};
enum {
kDtUnknown = 0,
kDtFifo = 1,
kDtChr = 2,
kDtDir = 4,
kDtBlk = 6,
kDtReg = 8,
kDtLnk = 10,
kDtSock = 12,
kDtWht = 14,
};
} // namespace orbis