Add sys_exec () and libprocess wrapper, fix ramdisk tar parsing
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m26s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m26s
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <limine/requests.h>
|
||||
#include <m/fs_desc_buffer.h>
|
||||
#include <m/status.h>
|
||||
#include <sys/debug.h>
|
||||
|
||||
struct ramdisk_tar_header {
|
||||
char filename[100];
|
||||
@@ -24,15 +25,16 @@ struct ramdisk_tar_file {
|
||||
size_t size;
|
||||
};
|
||||
|
||||
#define RAMDISK_FILES_MAX 128
|
||||
#define RAMDISK_PATH "/boot/mop3dist.tar"
|
||||
#define RAMDISK_FILES_MAX 128
|
||||
#define RAMDISK_FILENAME_MAX 128
|
||||
#define RAMDISK_PATH "/boot/mop3dist.tar"
|
||||
|
||||
static struct ramdisk_tar_file ramdisk_files[RAMDISK_FILES_MAX];
|
||||
|
||||
static struct ramdisk_tar_file* ramdisk_get_file (const char* filename) {
|
||||
for (size_t i = 0; i < RAMDISK_FILES_MAX; i++) {
|
||||
if ((ramdisk_files[i].header != NULL) &&
|
||||
(memcmp (ramdisk_files[i].header->filename, filename, strlen (filename)) == 0))
|
||||
(strncmp (ramdisk_files[i].header->filename, filename, RAMDISK_FILENAME_MAX) == 0))
|
||||
return &ramdisk_files[i];
|
||||
}
|
||||
return NULL;
|
||||
@@ -52,10 +54,10 @@ static size_t ramdisk_tar_get_size (uint8_t* in) {
|
||||
static size_t ramdisk_tar_parse (uint8_t* addr) {
|
||||
size_t i;
|
||||
|
||||
for (i = 0;; i++) {
|
||||
for (i = 0; i < RAMDISK_FILES_MAX; i++) {
|
||||
struct ramdisk_tar_header* hdr = (struct ramdisk_tar_header*)addr;
|
||||
|
||||
if (hdr->filename[i] == '\0')
|
||||
if (hdr->filename[0] == '\0')
|
||||
break;
|
||||
|
||||
size_t size = ramdisk_tar_get_size (hdr->size);
|
||||
@@ -64,10 +66,7 @@ static size_t ramdisk_tar_parse (uint8_t* addr) {
|
||||
ramdisk_files[i].content = (uint8_t*)((uintptr_t)hdr + 512);
|
||||
ramdisk_files[i].size = ramdisk_tar_get_size ((uint8_t*)hdr->size);
|
||||
|
||||
addr += ((size / 512) + 1) * 512;
|
||||
|
||||
if (size % 512)
|
||||
addr += 512;
|
||||
addr += 512 + ((size + 511) & ~511);
|
||||
}
|
||||
|
||||
return i;
|
||||
@@ -83,7 +82,7 @@ bool ramdiskfs_mount (struct vfs_mountpoint* mountpoint) {
|
||||
for (size_t i = 0; i < module->module_count; i++) {
|
||||
struct limine_file* file = module->modules[i];
|
||||
|
||||
if (memcmp (file->path, RAMDISK_PATH, strlen (RAMDISK_PATH)) == 0) {
|
||||
if (strncmp (file->path, RAMDISK_PATH, strlen (RAMDISK_PATH)) == 0) {
|
||||
rd_addr = file->address;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user