Check kos_fuse_init() return value, exit if it fails.
This commit is contained in:
@@ -69,6 +69,7 @@ kos_fuse_init:
|
|||||||
mov ecx, msg_not_xfs_partition
|
mov ecx, msg_not_xfs_partition
|
||||||
mov edx, msg_not_xfs_partition.size
|
mov edx, msg_not_xfs_partition.size
|
||||||
int 0x80
|
int 0x80
|
||||||
|
xor eax, eax
|
||||||
@@:
|
@@:
|
||||||
mov [fs_struct], eax
|
mov [fs_struct], eax
|
||||||
|
|
||||||
@@ -262,7 +263,7 @@ include_debug_strings
|
|||||||
partition_offset dd 2048*512
|
partition_offset dd 2048*512
|
||||||
alloc_pos dd alloc_base
|
alloc_pos dd alloc_base
|
||||||
sf70_params rd 6
|
sf70_params rd 6
|
||||||
msg_not_xfs_partition db 'not xfs partition',0x0a ; TODO: return codes, report in C
|
msg_not_xfs_partition db 'not XFS partition',0x0a ; TODO: return codes, report in C
|
||||||
msg_not_xfs_partition.size = $ - msg_not_xfs_partition
|
msg_not_xfs_partition.size = $ - msg_not_xfs_partition
|
||||||
IncludeIGlobals
|
IncludeIGlobals
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#define KOS_H_INCLUDED
|
#define KOS_H_INCLUDED
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
struct bdfe {
|
struct bdfe {
|
||||||
uint32_t attr;
|
uint32_t attr;
|
||||||
@@ -22,7 +23,7 @@ struct bdfe {
|
|||||||
#define KF_LABEL 0x08
|
#define KF_LABEL 0x08
|
||||||
#define KF_FOLDER 0x10
|
#define KF_FOLDER 0x10
|
||||||
|
|
||||||
void kos_fuse_init(int fd);
|
bool kos_fuse_init(int fd);
|
||||||
uint8_t *kos_fuse_readdir(const char *path, off_t offset);
|
uint8_t *kos_fuse_readdir(const char *path, off_t offset);
|
||||||
void *kos_fuse_getattr(const char *path);
|
void *kos_fuse_getattr(const char *path);
|
||||||
long *kos_fuse_read(const char *path, char *buf, size_t size, off_t offset);
|
long *kos_fuse_read(const char *path, char *buf, size_t size, off_t offset);
|
||||||
|
4
kofu.c
4
kofu.c
@@ -22,7 +22,9 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
char cmd_buf[4096];
|
char cmd_buf[4096];
|
||||||
int fd = open(argv[1], O_RDONLY);
|
int fd = open(argv[1], O_RDONLY);
|
||||||
kos_fuse_init(fd);
|
if (!kos_fuse_init(fd)) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
//msg_few_args db 'usage: xfskos image [offset]',0x0a
|
//msg_few_args db 'usage: xfskos image [offset]',0x0a
|
||||||
//msg_file_not_found db 'file not found: '
|
//msg_file_not_found db 'file not found: '
|
||||||
|
1
kofuse.c
1
kofuse.c
@@ -61,6 +61,7 @@ static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
|
|||||||
static int hello_open(const char *path, struct fuse_file_info *fi) {
|
static int hello_open(const char *path, struct fuse_file_info *fi) {
|
||||||
// if (strcmp(path+1, "blah") != 0)
|
// if (strcmp(path+1, "blah") != 0)
|
||||||
// return -ENOENT;
|
// return -ENOENT;
|
||||||
|
(void) path;
|
||||||
|
|
||||||
if ((fi->flags & O_ACCMODE) != O_RDONLY)
|
if ((fi->flags & O_ACCMODE) != O_RDONLY)
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
Reference in New Issue
Block a user