gitignore: add .cpio

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-05-13 04:47:59 -04:00
commit f0a9ff299b
27 changed files with 253 additions and 245 deletions

25
include/fs/cpio.h Normal file
View 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_ */

View file

@ -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_ */

View file

@ -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_ */