diff options
| author | Miguel <m.i@gmx.at> | 2018-09-14 23:10:16 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-14 23:10:16 +0200 |
| commit | c4b20a0ebbde1348e1e085e2ea3be35345d92b7c (patch) | |
| tree | 611b68c1d288cace070152c628bb0e0e211bb500 /fs | |
| parent | fdf6100721870780319bc7cc766a0bb5b4789965 (diff) | |
tuining userspace and files
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/elf.c | 1 | ||||
| -rw-r--r-- | fs/elf.h | 8 | ||||
| -rw-r--r-- | fs/ext2.c | 4 | ||||
| -rw-r--r-- | fs/ext2.h | 2 | ||||
| -rw-r--r-- | fs/fs.c | 21 | ||||
| -rw-r--r-- | fs/fs.h | 24 | ||||
| -rw-r--r-- | fs/mount.h | 2 |
7 files changed, 12 insertions, 50 deletions
@@ -2,6 +2,7 @@ #include "log.h" #include <stdint.h> #include "ext2.h" +#include "elf.h" #include "lib/string/string.h" #define EI_NIDENT 16 @@ -1,3 +1,9 @@ -//https://docs.oracle.com/cd/E19455-01/806-3773/elf-2/index.html +/** @file + * == elf == + * https://docs.oracle.com/cd/E19455-01/806-3773/elf-2/index.html + */ + +#include "multiboot.h" + uint32_t load_elf(char *name, uint32_t *alloc); void elf_multiboot_read(multiboot_information *info); @@ -8,7 +8,7 @@ #include "lib/string/string.h" -#include "fs.h" +#include "interface/fs.h" // THE SUPERBLOCK typedef struct ext2_superblock_struct @@ -226,7 +226,7 @@ static uint32_t ext2_filename_to_inode_traverse(uint32_t ext2_start_addr, char * uint32_t ret=ext2_read_dir(VMEM_EXT2_RAMIMAGE,inode_start, &dirs,&pos); if(!ret)break; - if(!strcmp_l(first,dirs.name,len)) + if(strlen(dirs.name)==len && !strcmp_l(first,dirs.name,len)) { klog("found inode %d %s%s (in inode %d)",dirs.inode,dirs.name,dirs.type==FS_FILE_TYPE_DIR?"/ ":" ",inode_start); if(final)return dirs.inode; @@ -14,7 +14,7 @@ */ #include <stdint.h> -#include "fs.h" +#include "interface/fs.h" /** klog some basic info about the ext2 fs */ void ext2_dump_info(uint32_t ext2_start_addr); diff --git a/fs/fs.c b/fs/fs.c deleted file mode 100644 index a9cf5f6..0000000 --- a/fs/fs.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "kernel/kernel.h" -// abstraction layer for filesystems - -#include "fs.h" -#include "ext2.h" - -// returns number of entries in the directory specified by name. -// fills 0-max into *dirs - -int fs_readdir(const char *name,fs_dirent *dirs,int max) -{ - int inode_nr=ext2_filename_to_inode(VMEM_EXT2_RAMIMAGE,name); - if(inode_nr<1)return -1; - return ext2_read_dir(VMEM_EXT2_RAMIMAGE, inode_nr,dirs,0); // TODO: hardcoded, fix this -} - -void fs_content(char *path, uint32_t dest, uint32_t max_bytes) -{ - int inode= ext2_filename_to_inode(VMEM_EXT2_RAMIMAGE, path); -// ext2_inode_content(VMEM_EXT2_RAMIMAGE,inode,dest,max_bytes); -} diff --git a/fs/fs.h b/fs/fs.h deleted file mode 100644 index f5c9a6e..0000000 --- a/fs/fs.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef FOOLOS_FS -#define FOOLOS_FS - -#include <stdint.h> -#include "kernel/multiboot.h" - -enum FS_FILE_TYPE{ - FS_FILE_TYPE_DIR = 1, - FS_FILE_TYPE_FILE = 2 -}; - -typedef struct fs_dirent_struct -{ - uint32_t inode; - uint8_t type; - char name[255]; - -}fs_dirent; - -int fs_readdir(const char *name,fs_dirent *dirs,int max); -void fs_content(char *path, uint32_t dest, uint32_t max_bytes); -void fs_mount(multiboot_information *info); // mounts ext2 ramimage from module as root - -#endif @@ -5,7 +5,7 @@ #include <stdint.h> #include "file.h" -#include "fs.h" +#include "interface/fs.h" typedef struct mount_struct { |
