mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 13:48:21 +00:00
vfs: getdirent
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#ifndef _DIRENT_H_INCLUDE
|
||||
#define _DIRENT_H_INCLUDE
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define DT_UNKNOWN 0
|
||||
#define DT_FIFO 1
|
||||
#define DT_CHR 2
|
||||
#define DT_DIR 4
|
||||
#define DT_BLK 6
|
||||
#define DT_REG 8
|
||||
#define DT_LNK 10
|
||||
#define DT_SOCK 12
|
||||
#define DT_WHT 14
|
||||
|
||||
typedef struct {
|
||||
ino_t d_ino;
|
||||
off_t d_off;
|
||||
unsigned short d_reclen;
|
||||
unsigned char d_type;
|
||||
char d_name[1024];
|
||||
} dent_t;
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <hashtable.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
|
||||
struct _vnode_t;
|
||||
struct _fscalls_t;
|
||||
@@ -56,6 +57,8 @@ typedef struct _fscalls_t {
|
||||
int (*write)(int* error, vnode_t* node, void* buff, size_t count, size_t offset);
|
||||
// read from a file
|
||||
int (*read)(int* error, vnode_t* node, void* buff, size_t count, size_t offset);
|
||||
// get dir ents
|
||||
int (*getdirent)(dirnode_t* node, dent_t* buff, size_t count, uintmax_t offset, size_t* readcount);
|
||||
} fscalls_t;
|
||||
|
||||
|
||||
@@ -68,6 +71,7 @@ int vfs_create(dirnode_t* ref, char* path, mode_t mode);
|
||||
int vfs_write(int* error, vnode_t* node, void* buff, size_t count, size_t offset);
|
||||
int vfs_read(int* error, vnode_t* node, void* buff, size_t count, size_t offset);
|
||||
int vfs_isatty(vnode_t* node);
|
||||
int vfs_getdirent(dirnode_t* node, dent_t* buff, size_t count, uintmax_t offset, size_t* readcount);
|
||||
|
||||
void vfs_init();
|
||||
dirnode_t* vfs_root();
|
||||
|
||||
Reference in New Issue
Block a user