gitignore: add .cpio
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
49abcba0aa
commit
f0a9ff299b
27 changed files with 253 additions and 245 deletions
|
|
@ -29,6 +29,8 @@
|
|||
#define INODE_SOCKET 0x6
|
||||
#define INODE_SYMLINK 0x7
|
||||
|
||||
#define I_NO_FREE 0x1
|
||||
|
||||
typedef struct _inode inode_t;
|
||||
typedef struct _dirent dirent_t;
|
||||
typedef struct _fs fs_t;
|
||||
|
|
@ -36,8 +38,7 @@ typedef struct _fs fs_t;
|
|||
struct fs_type {
|
||||
char name[256];
|
||||
dirent_t *(*fs_mount)(int flags, struct block_device *bdev);
|
||||
void (*fs_umount)(fs_t *fs);
|
||||
bool (*fs_detect)(struct block_device *bdev);
|
||||
int (*fs_umount)(fs_t *fs);
|
||||
};
|
||||
|
||||
struct fs_ops {
|
||||
|
|
@ -51,9 +52,9 @@ struct inode_ops {
|
|||
ssize_t (*read)(inode_t *inode, char *buf, size_t size, size_t offset);
|
||||
ssize_t (*write)(inode_t *inode, char *buf, size_t size, size_t offset);
|
||||
/* for directory files */
|
||||
int (*creat)(inode_t *inode, const char *name, u64 mode, dirent_t **out);
|
||||
int (*mkdir)(inode_t *inode, const char *name, dirent_t **out);
|
||||
int (*creat)(inode_t *inode, const char *name, dirent_t **out);
|
||||
int (*link)(inode_t *inode, const char *name, dirent_t **out);
|
||||
int (*link)(inode_t *inode, inode_t *link_inode, const char *name, dirent_t **out);
|
||||
int (*unlink)(inode_t *inode, const char *name);
|
||||
int (*readdir)(inode_t *parent);
|
||||
};
|
||||
|
|
@ -65,13 +66,19 @@ struct _fs {
|
|||
|
||||
inode_t *root_inode;
|
||||
|
||||
bool mounted;
|
||||
dirent_t *mount_point;
|
||||
|
||||
spinlock_t lock;
|
||||
struct fs_ops fs_ops;
|
||||
};
|
||||
|
||||
struct _dirent {
|
||||
inode_t *inode;
|
||||
u64 ino_num;
|
||||
union {
|
||||
u64 ino_num;
|
||||
fs_t *fs_ptr;
|
||||
};
|
||||
|
||||
size_t rec_len;
|
||||
size_t name_len;
|
||||
|
|
@ -88,6 +95,8 @@ struct _inode {
|
|||
u64 ino_num;
|
||||
u64 file_size;
|
||||
|
||||
u64 flags;
|
||||
|
||||
list_t dentries;
|
||||
|
||||
void *data;
|
||||
|
|
@ -99,11 +108,27 @@ struct _inode {
|
|||
struct inode_ops i_ops;
|
||||
};
|
||||
|
||||
struct ram_file {
|
||||
u64 type;
|
||||
u64 extra;
|
||||
char *name;
|
||||
size_t name_len;
|
||||
|
||||
void *data;
|
||||
size_t data_size;
|
||||
size_t file_size;
|
||||
};
|
||||
|
||||
void vfs_init();
|
||||
inode_t *inode_create();
|
||||
void inode_free(inode_t *inode);
|
||||
dirent_t *inode_find_dirent(inode_t *inode, const char *name);
|
||||
void vfs_register(struct fs_type *fs);
|
||||
|
||||
dirent_t *dirent_create(const char *name);
|
||||
void dirent_free(dirent_t *dirent);
|
||||
|
||||
dirent_t *inode_find_dirent(inode_t *inode, const char *name);
|
||||
inode_t *inode_create();
|
||||
void inode_free(inode_t *inode);
|
||||
void inode_inc_ref(inode_t *inode);
|
||||
void inode_dec_ref(inode_t *inode);
|
||||
|
||||
#endif /* _VFS_H_ */
|
||||
|
|
|
|||
Loading…
Reference in a new issue