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
|
|
@ -342,6 +342,5 @@ struct sata_device {
|
|||
};
|
||||
|
||||
int ahci_access_sectors(struct sata_device *dev, paddr_t lba, uint16_t count, paddr_t buf, bool write);
|
||||
void ahci_init();
|
||||
|
||||
#endif /* _AHCI_H_ */
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ struct pci_device {
|
|||
};
|
||||
|
||||
void pci_register_host(struct pci_host *host);
|
||||
void pci_init();
|
||||
u32 pci_config_read(struct pci_host *host, u32 bus, u32 slot, u32 func, u32 offset);
|
||||
void pci_config_write(struct pci_host *host, u32 bus, u32 slot, u32 func, u32 offset, u32 val);
|
||||
size_t pci_find_device(u16 minor, u16 major, list_t *out);
|
||||
|
|
|
|||
25
include/fs/cpio.h
Normal file
25
include/fs/cpio.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef _CPIO_H_
|
||||
#define _CPIO_H_
|
||||
|
||||
#define CPIO_NEWC_MAGIC "070701"
|
||||
#define CPIO_TRAILER "TRAILER!!!"
|
||||
|
||||
struct cpio_newc_header {
|
||||
char c_magic[6];
|
||||
char c_ino[8];
|
||||
char c_mode[8];
|
||||
char c_uid[8];
|
||||
char c_gid[8];
|
||||
char c_nlink[8];
|
||||
char c_mtime[8];
|
||||
char c_filesize[8];
|
||||
char c_devmajor[8];
|
||||
char c_devminor[8];
|
||||
char c_rdevmajor[8];
|
||||
char c_rdevminor[8];
|
||||
char c_namesize[8];
|
||||
char c_check[8];
|
||||
};
|
||||
|
||||
#endif /* _CPIO_H_ */
|
||||
|
|
@ -4,5 +4,7 @@
|
|||
|
||||
#include <fs/vfs.h>
|
||||
|
||||
dirent_t *ramfs_mount(int flags, struct block_device *bdev);
|
||||
int ramfs_umount(fs_t *fs);
|
||||
|
||||
#endif /* _RAMFS_H_ */
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ struct mem_zone {
|
|||
|
||||
size_t mem_get_zones(struct mem_zone **ret);
|
||||
void mem_init();
|
||||
void *align(void *p, size_t align);
|
||||
|
||||
extern vaddr_t hhdm_start;
|
||||
extern vaddr_t hhdm_end;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@
|
|||
#include <kernel/spinlock.h>
|
||||
|
||||
typedef struct _list_item {
|
||||
void *ptr;
|
||||
union {
|
||||
void *ptr;
|
||||
u64 val;
|
||||
};
|
||||
struct _list_head *list;
|
||||
struct _list_item *next;
|
||||
struct _list_item *prev;
|
||||
|
|
@ -17,7 +20,6 @@ typedef struct _list_head {
|
|||
spinlock_t lock;
|
||||
} list_t;
|
||||
|
||||
|
||||
void list_create(list_t *list);
|
||||
list_item_t *list_insert(list_t *list, void *item);
|
||||
void list_remove(list_item_t *item);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ size_t npow2(size_t n);
|
|||
void bitmap_set(char *bitmap, size_t n, uint64_t b);
|
||||
void bitmap_clear(char *bitmap, size_t n);
|
||||
uint8_t bitmap_get(char *bitmap, size_t n);
|
||||
u64 hex_to_int(char *ascii_hex, size_t n);
|
||||
|
||||
#define MIN(a, b) ({ \
|
||||
typeof(a) _a = (a); \
|
||||
|
|
|
|||
|
|
@ -15,24 +15,27 @@ typedef struct _rbnode_t {
|
|||
int color;
|
||||
|
||||
u64 key;
|
||||
u64 value;
|
||||
union {
|
||||
u64 value;
|
||||
void *ptr;
|
||||
};
|
||||
} rbnode_t;
|
||||
|
||||
/* we use this rbtree_tstructure because the root node will potentially be
|
||||
* changed when we insert or delete a node
|
||||
*/
|
||||
typedef struct _rbtree_t{
|
||||
typedef struct _rbtree_t {
|
||||
rbnode_t *root;
|
||||
spinlock_t lock;
|
||||
size_t num_nodes;
|
||||
} rbtree_t;
|
||||
|
||||
rbnode_t *rbt_insert(rbtree_t*tree, u64 key);
|
||||
void rbt_delete(rbtree_t*tree, rbnode_t *del);
|
||||
void rbt_destroy(rbtree_t*tree);
|
||||
rbnode_t *rbt_search(rbtree_t*tree, u64 key);
|
||||
rbnode_t *rbt_insert(rbtree_t *tree, u64 key);
|
||||
void rbt_delete(rbtree_t *tree, rbnode_t *del);
|
||||
void rbt_destroy(rbtree_t *tree);
|
||||
rbnode_t *rbt_search(rbtree_t *tree, u64 key);
|
||||
rbnode_t *rbt_successor(rbnode_t *node);
|
||||
u64 rbt_next_key(rbtree_t*tree);
|
||||
u64 rbt_next_key(rbtree_t *tree);
|
||||
rbnode_t *rbt_minimum(rbnode_t *node);
|
||||
|
||||
void rbt_init();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ bool strempty(const char *s);
|
|||
char **strsplit(const char *str, char delim, int *num);
|
||||
size_t strlen(const char *c);
|
||||
int atoi(const char *a);
|
||||
char *dirname(const char *path);
|
||||
char *basename(const char *path);
|
||||
|
||||
#endif /* __ASM__ */
|
||||
#endif /* _STRING_H_ */
|
||||
|
|
|
|||
Loading…
Reference in a new issue