Use free from libc, fix ls_range

This commit is contained in:
Ivan Baravy 2018-06-13 04:29:17 +03:00
parent bd2e078d13
commit f3f0024d22
3 changed files with 28 additions and 11 deletions

View File

@ -67,8 +67,8 @@ s512_xfs_v4_ftype1_btree_dirs.img:
sudo mount $(LOOP_DEV)p1 $(TEMP_DIR)
sudo chown $(shell whoami) $(TEMP_DIR) -R
#
mkdir $(TEMP_DIR)/btree1
$(MKDIRRANGE) $(TEMP_DIR)/btree1 293181
mkdir $(TEMP_DIR)/btree
$(MKDIRRANGE) $(TEMP_DIR)/btree 293181
sudo umount $(TEMP_DIR)
sudo losetup -d $(LOOP_DEV)

24
kofu.c
View File

@ -40,12 +40,22 @@ char **split_args(char *s) {
}
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);
uint32_t requested = f70->size;
f70->size = DIRENTS_TO_READ;
for (; requested; requested -= f70->size) {
if (f70->size > requested) {
f70->size = requested;
}
int status = kos_fuse_lfn(f70);
f70->offset += f70->size;
printf("status = %d\n", status);
if (status != F70_SUCCESS && status != F70_END_OF_FILE) {
abort();
} else {
struct f70s1ret *dir = f70->buf;
for (size_t i = 0; i < dir->cnt; i++) {
printf("%s\n", dir->bdfes[i].name);
}
}
}
}
@ -53,7 +63,7 @@ void ls_range(struct f70s1arg *f70) {
void ls_all(struct f70s1arg *f70) {
while (true) {
int status = kos_fuse_lfn(f70);
// printf("status = %d\n", status);
printf("status = %d\n", status);
if (status != F70_SUCCESS && status != F70_END_OF_FILE) {
abort();
}

View File

@ -6,6 +6,9 @@ __DEBUG_LEVEL__ = 1
extrn malloc
malloc fix __malloc
_malloc fix malloc
extrn free
free fix __free
_free fix free
include 'macros.inc'
include 'proc32.inc'
include 'struct.inc'
@ -191,11 +194,15 @@ proc alloc_pages _cnt
endp
free:
__free:
ccall _free, eax
ret
proc kernel_free blah
proc kernel_free base
mov eax, [base]
call free
xor eax, eax
ret
endp