Added SimpleFS read support

This commit is contained in:
Jozef Nagy 2025-01-29 20:05:50 +01:00
parent 758d681005
commit 4ec95a6a52
Signed by untrusted user who does not match committer: crz
GPG key ID: 459A4811CEAC7068
8 changed files with 174 additions and 107 deletions

View file

@ -20,8 +20,11 @@
#ifndef _FS_UEFI_SFS_H
#define _FS_UEFI_SFS_H
#ifndef AXBOOT_UEFI
#include <vfs/drive.h>
#include <stdint.h>
#endif
struct vfs_drive *sfs_init(char *mountpoint);
size_t sfs_read(char *filename, char *buffer, struct vfs_drive *dev, void *fsdata);
#endif /* _FS_UEFI_SFS_H */

View file

@ -1,25 +0,0 @@
/*********************************************************************************/
/* Module Name: bootmenu.h */
/* Project: AurixOS */
/* */
/* Copyright (c) 2024-2025 Jozef Nagy */
/* */
/* This source is subject to the MIT License. */
/* See License.txt in the root of this repository. */
/* All other rights reserved. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
/* SOFTWARE. */
/*********************************************************************************/
#ifndef _MENU_BOOTMENU_H
#define _MENU_BOOTMENU_H
void main_menu(void);
#endif /* _MENU_BOOTMENU_H */

View file

@ -20,19 +20,15 @@
#ifndef _VFS_VFS_H
#define _VFS_VFS_H
#include <vfs/drive.h>
#include <stdint.h>
#include <stddef.h>
struct vfs_drive;
struct vfs_filesystem {
char *fsname;
uint8_t (*read)(char *, char *, struct vfs_drive *, void *);
size_t (*read)(char *, char *, struct vfs_drive *, void *);
uint8_t (*write)(char *, char *, size_t, struct vfs_drive *, void *);
uint8_t (*mount)(struct vfs_drive *, void *);
uint8_t *fs_data;
void *fsdata;
};
struct vfs_mount {
@ -40,9 +36,14 @@ struct vfs_mount {
struct vfs_drive *drive;
};
void vfs_init(void);
int vfs_init(char *root_mountpoint);
int vfs_read(char *filename, char *buf, size_t len);
/* This function allocates `buf`. Passing a non-NULL value will result in an error. */
/* NOTE: Remember to free the allocated memory afterwards! */
size_t vfs_read(char *filename, char *buf);
int vfs_write(char *filename, char *buf, size_t len);
/* Every platform will define this on its own */
struct vfs_drive *mount_boot_volume(char *mountpoint);
#endif /* _VFS_VFS_H */