48 lines
994 B
C
48 lines
994 B
C
|
|
#ifndef __SYS_VFS_H__
|
|
#define __SYS_VFS_H__
|
|
|
|
typedef struct VFSOp VFSOp;
|
|
typedef struct VNode VNode;
|
|
|
|
typedef struct VFS {
|
|
VFSOp *op;
|
|
Disk *disk;
|
|
Spinlock lock;
|
|
uint64_t refCount;
|
|
// FS Fields
|
|
void *fsptr;
|
|
uint64_t fsval;
|
|
VNode *root;
|
|
} VFS;
|
|
|
|
typedef struct VNode {
|
|
VFSOp *op;
|
|
Disk *disk;
|
|
Spinlock lock;
|
|
uint64_t refCount;
|
|
// FS Fields
|
|
void *fsptr;
|
|
uint64_t fsval;
|
|
} VNode;
|
|
|
|
typedef struct VFSOp {
|
|
// VFS Operations
|
|
int (*unmount)(VFS *fs);
|
|
int (*getroot)(VFS *fs, VNode **dn);
|
|
// VNode Operations
|
|
int (*lookup)(VNode *dn, VNode **fn, const char *name);
|
|
int (*open)(VNode *fn);
|
|
int (*close)(VNode *fn);
|
|
int (*read)(VNode *fn, void *buf, uint64_t off, uint64_t len);
|
|
} VFSOp;
|
|
|
|
int VFS_MountRoot(Disk *root);
|
|
VNode *VFS_Lookup(const char *path);
|
|
int VFS_Open(VNode *fn);
|
|
int VFS_Close(VNode *fn);
|
|
int VFS_Read(VNode *fn, void *buf, uint64_t off, uint64_t len);
|
|
|
|
#endif /* __SYS_VFS_H__ */
|
|
|