mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
feat: Massive OS expansion with IPC, Sound & TTS, Block layer, FAT32/ext2/sysfs, Signals, Syscalls, Modules, Drivers & 50+ LazyBox applets
This commit is contained in:
1 parent
5662be29f5
commit
d680335f05
64 files changed
+2370
-166
No files matched your search
@@ -0,0 +1,65 @@
|
||||
#ifndef _FS_EXT2_H
|
||||
#define _FS_EXT2_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <fs/vfs.h>
|
||||
|
||||
#define EXT2_SUPER_MAGIC 0xEF53
|
||||
|
||||
/* ext2 Superblock Definition */
|
||||
typedef struct {
|
||||
uint32_t s_inodes_count;
|
||||
uint32_t s_blocks_count;
|
||||
uint32_t s_r_blocks_count;
|
||||
uint32_t s_free_blocks_count;
|
||||
uint32_t s_free_inodes_count;
|
||||
uint32_t s_first_data_block;
|
||||
uint32_t s_log_block_size;
|
||||
uint32_t s_log_frag_size;
|
||||
uint32_t s_blocks_per_group;
|
||||
uint32_t s_frags_per_group;
|
||||
uint32_t s_inodes_per_group;
|
||||
uint32_t s_mtime;
|
||||
uint32_t s_wtime;
|
||||
uint16_t s_mnt_count;
|
||||
uint16_t s_max_mnt_count;
|
||||
uint16_t s_magic;
|
||||
uint16_t s_state;
|
||||
uint16_t s_errors;
|
||||
uint16_t s_minor_rev_level;
|
||||
uint32_t s_lastcheck;
|
||||
uint32_t s_checkinterval;
|
||||
uint32_t s_creator_os;
|
||||
uint32_t s_rev_level;
|
||||
uint16_t s_def_resuid;
|
||||
uint16_t s_def_resgid;
|
||||
} __attribute__((packed)) ext2_superblock_t;
|
||||
|
||||
/* ext2 Inode Structure */
|
||||
typedef struct {
|
||||
uint16_t i_mode;
|
||||
uint16_t i_uid;
|
||||
uint32_t i_size;
|
||||
uint32_t i_atime;
|
||||
uint32_t i_ctime;
|
||||
uint32_t i_mtime;
|
||||
uint32_t i_dtime;
|
||||
uint16_t i_gid;
|
||||
uint16_t i_links_count;
|
||||
uint32_t i_blocks;
|
||||
uint32_t i_flags;
|
||||
uint32_t i_osd1;
|
||||
uint32_t i_block[15];
|
||||
uint32_t i_generation;
|
||||
uint32_t i_file_acl;
|
||||
uint32_t i_dir_acl;
|
||||
uint32_t i_faddr;
|
||||
uint8_t i_osd2[12];
|
||||
} __attribute__((packed)) ext2_inode_t;
|
||||
|
||||
void ext2_init(void);
|
||||
vfs_node_t* ext2_mount(const char* block_device_name);
|
||||
|
||||
#endif // _FS_EXT2_H
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef _FS_FAT32_H
|
||||
#define _FS_FAT32_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <fs/vfs.h>
|
||||
|
||||
/* FAT32 Extended BIOS Parameter Block */
|
||||
typedef struct {
|
||||
uint8_t jmp[3];
|
||||
char oem[8];
|
||||
uint16_t bytes_per_sector;
|
||||
uint8_t sectors_per_cluster;
|
||||
uint16_t reserved_sectors;
|
||||
uint8_t fat_count;
|
||||
uint16_t root_entries;
|
||||
uint16_t total_sectors_short;
|
||||
uint8_t media_type;
|
||||
uint16_t table_size_16;
|
||||
uint16_t sectors_per_track;
|
||||
uint16_t head_side_count;
|
||||
uint32_t hidden_sectors;
|
||||
uint32_t total_sectors_32;
|
||||
|
||||
// FAT32 Extended
|
||||
uint32_t table_size_32;
|
||||
uint16_t extended_flags;
|
||||
uint16_t fat_version;
|
||||
uint32_t root_cluster;
|
||||
uint16_t fat_info;
|
||||
uint16_t backup_boot_sector;
|
||||
uint8_t reserved[12];
|
||||
uint8_t drive_number;
|
||||
uint8_t reserved1;
|
||||
uint8_t boot_signature;
|
||||
uint32_t volume_id;
|
||||
char volume_label[11];
|
||||
char fat_type_label[8];
|
||||
} __attribute__((packed)) fat32_bpb_t;
|
||||
|
||||
typedef struct {
|
||||
char name[11];
|
||||
uint8_t attr;
|
||||
uint8_t nt_reserved;
|
||||
uint8_t creation_time_tenth;
|
||||
uint16_t creation_time;
|
||||
uint16_t creation_date;
|
||||
uint16_t last_access_date;
|
||||
uint16_t cluster_high;
|
||||
uint16_t write_time;
|
||||
uint16_t write_date;
|
||||
uint16_t cluster_low;
|
||||
uint32_t file_size;
|
||||
} __attribute__((packed)) fat32_dirent_t;
|
||||
|
||||
void fat32_init(void);
|
||||
vfs_node_t* fat32_mount(const char* block_device_name);
|
||||
|
||||
#endif // _FS_FAT32_H
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef _FS_SYSFS_H
|
||||
#define _FS_SYSFS_H
|
||||
|
||||
#include <fs/vfs.h>
|
||||
|
||||
void sysfs_init(void);
|
||||
vfs_node_t* sysfs_create_entry(const char* path, const char* value);
|
||||
|
||||
#endif // _FS_SYSFS_H
|
||||
@@ -72,6 +72,7 @@ typedef struct {
|
||||
void vfs_init(void);
|
||||
vfs_node_t* vfs_namei(const char* path);
|
||||
int vfs_open(const char* path, uint32_t flags);
|
||||
int vfs_open_node(vfs_node_t* node, uint32_t flags);
|
||||
ssize_t vfs_read(int fd, void* buffer, size_t size);
|
||||
ssize_t vfs_write(int fd, const void* buffer, size_t size);
|
||||
off_t vfs_lseek(int fd, off_t offset, int whence);
|
||||
|
||||
Reference in new issue
Block a user