Add ranged ls and f70status enum.
This commit is contained in:
parent
d02cbfd7ef
commit
2c3cd9c7c1
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
*.swp
|
||||
.vim
|
||||
.exrc
|
||||
*.o
|
||||
kofu
|
||||
kofuse
|
||||
|
41
kofu.c
41
kofu.c
@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
@ -37,25 +38,49 @@ char **split_args(char *s) {
|
||||
return argv;
|
||||
}
|
||||
|
||||
void kofu_ls(char **arg) {
|
||||
struct f70s1ret *dir = (struct f70s1ret*)malloc(sizeof(struct f70s1ret) + sizeof(struct bdfe) * DIRENTS_TO_READ);
|
||||
struct f70s1arg f70 = {1, 0, CP866, DIRENTS_TO_READ, dir, 0, arg[1]};
|
||||
void ls_range(struct f70s1arg *f70) {
|
||||
int status = kos_fuse_lfn(f70);
|
||||
// printf("status = %d\n", status);
|
||||
if (status == F70_SUCCESS || status == F70_END_OF_FILE) {
|
||||
struct f70s1ret *dir = f70->buf;
|
||||
for (size_t i = 0; i < dir->cnt; i++) {
|
||||
printf("%s\n", dir->bdfes[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ls_all(struct f70s1arg *f70) {
|
||||
while (true) {
|
||||
int status = kos_fuse_lfn(&f70);
|
||||
printf("status = %d\n", status);
|
||||
if (status != 0 && status != 6) {
|
||||
int status = kos_fuse_lfn(f70);
|
||||
// printf("status = %d\n", status);
|
||||
if (status != F70_SUCCESS && status != F70_END_OF_FILE) {
|
||||
abort();
|
||||
}
|
||||
f70.offset += dir->cnt;
|
||||
struct f70s1ret *dir = f70->buf;
|
||||
f70->offset += dir->cnt;
|
||||
|
||||
for (size_t i = 0; i < dir->cnt; i++) {
|
||||
printf("%s\n", dir->bdfes[i].name);
|
||||
}
|
||||
|
||||
if (status == 6) {
|
||||
if (status == F70_END_OF_FILE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kofu_ls(char **arg) {
|
||||
struct f70s1ret *dir = (struct f70s1ret*)malloc(sizeof(struct f70s1ret) + sizeof(struct bdfe) * DIRENTS_TO_READ);
|
||||
struct f70s1arg f70 = {1, 0, CP866, DIRENTS_TO_READ, dir, 0, arg[1]};
|
||||
if (arg[2]) {
|
||||
sscanf(arg[2], "%"SCNu32, &f70.size);
|
||||
if (arg[3]) {
|
||||
sscanf(arg[3], "%"SCNu32, &f70.offset);
|
||||
}
|
||||
ls_range(&f70);
|
||||
} else {
|
||||
ls_all(&f70);
|
||||
}
|
||||
free(dir);
|
||||
return;
|
||||
}
|
||||
|
2
kofuse.c
2
kofuse.c
@ -52,7 +52,7 @@ static int kofuse_getattr(const char *path, struct stat *stbuf,
|
||||
static int kofuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
|
||||
off_t offset, struct fuse_file_info *fi,
|
||||
enum fuse_readdir_flags flags) {
|
||||
(void) offset;
|
||||
(void) offset; // TODO
|
||||
(void) fi;
|
||||
(void) flags;
|
||||
|
||||
|
@ -44,10 +44,9 @@ kos_fuse_init:
|
||||
mov [file_disk.Sectors], eax
|
||||
mov [file_disk.Logical], 512
|
||||
stdcall disk_add, disk_functions, disk_name, file_disk, DISK_NO_INSERT_NOTIFICATION
|
||||
mov [disk], eax
|
||||
stdcall disk_media_changed, [disk], 1
|
||||
|
||||
mov eax, [disk]
|
||||
push eax
|
||||
stdcall disk_media_changed, eax, 1
|
||||
pop eax
|
||||
mov eax, [eax + DISK.NumPartitions]
|
||||
|
||||
pop ebp edi esi ebx
|
||||
@ -279,7 +278,6 @@ ide_channel8_mutex MUTEX
|
||||
|
||||
section '.bss' writeable align 16
|
||||
file_disk FILE_DISK
|
||||
disk dd ?
|
||||
alloc_base rb 8*1024*1024
|
||||
IncludeUGlobals
|
||||
; crap
|
||||
|
16
kolibri.h
16
kolibri.h
@ -10,6 +10,22 @@ enum encoding {
|
||||
UTF8,
|
||||
};
|
||||
|
||||
enum f70status {
|
||||
F70_SUCCESS,
|
||||
F70_DISK_BASE,
|
||||
F70_UNSUPPORTED_FS,
|
||||
F70_UNKNOWN_FS,
|
||||
F70_PARTITION,
|
||||
F70_FILE_NOT_FOUND,
|
||||
F70_END_OF_FILE,
|
||||
F70_MEMORY_POINTER,
|
||||
F70_DISK_FULL,
|
||||
F70_FS_FAIL,
|
||||
F70_ACCESS_DENIED,
|
||||
F70_DEVICE,
|
||||
F70_OUT_OF_MEMORY,
|
||||
};
|
||||
|
||||
struct bdfe {
|
||||
uint32_t attr;
|
||||
uint32_t enc;
|
||||
|
Loading…
Reference in New Issue
Block a user