Use dyndisk KolibriOS code, add test prototypes.

This commit is contained in:
Ivan Baravy 2018-05-06 22:58:05 +03:00
parent f3946d5a7d
commit 9c7ebc5136
8 changed files with 41 additions and 31 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@
*.o *.o
kofu kofu
kofuse kofuse
*.img
*.xz

1
README Normal file
View File

@ -0,0 +1 @@
Find img files here: https://baravy.by/kofuse/img/

2
img/sum Normal file
View File

@ -0,0 +1,2 @@
SHA3-256 (xfs4_crc0_ftype0.img) = 32ee5a4aba6dd518f8ebebffea617a6c587c26315e0930ecd20acba191733283
SHA3-256 (xfs4_crc0_ftype1.img) = ba8a3b4de31fcbd640e9a69166422a5ed08f71cdba28ac5cd3bcdd71ee5a6276

View File

@ -51,6 +51,8 @@ public kos_fuse_init
kos_fuse_init: kos_fuse_init:
push ebx esi edi ebp push ebx esi edi ebp
mov [pg_data.pages_free], (128*1024*1024)/0x1000
mov eax, [esp + 0x14] mov eax, [esp + 0x14]
mov [fd], eax mov [fd], eax
@ -78,26 +80,24 @@ kos_fuse_init:
;char *kos_fuse_readdir(const char *path, off_t offset) ;char *kos_fuse_readdir(const char *path, off_t offset)
public kos_fuse_readdir public kos_fuse_readdir
kos_fuse_readdir: kos_fuse_readdir:
;DEBUGF 1, '#kos_fuse_readdir\n'
push ebx esi edi ebp push ebx esi edi ebp
mov edx, sf70_params mov edx, sf70_params
mov dword[edx + 0x00], 1 mov dword[edx + 0x00], 1
mov eax, [esp + 0x18] ; offset mov eax, [esp + 0x18] ; offset
mov [edx + 0x04], eax mov [edx + 0x04], eax
mov dword[edx + 0x08], 1 mov dword[edx + 0x08], 1 ; cp866
mov dword[edx + 0x0c], 100 mov dword[edx + 0x0c], 100
mov dword[edx + 0x10], sf70_buffer mov dword[edx + 0x10], sf70_buffer
mov eax, [esp + 0x14] ; path mov eax, [esp + 0x14] ; path
inc eax ; skip '/' mov byte[edx + 0x14], 0
mov [edx + 0x14], eax mov [edx + 0x15], eax
mov ebp, [fs_struct]
mov ebx, sf70_params mov ebx, sf70_params
mov esi, eax pushad ; file_system_lfn writes here
push 0 call file_system_lfn
call xfs_ReadFolder popad
pop eax
pop ebp edi esi ebx pop ebp edi esi ebx
mov eax, sf70_buffer mov eax, sf70_buffer
ret ret
@ -106,6 +106,7 @@ kos_fuse_readdir:
;void *kos_fuse_getattr(const char *path) ;void *kos_fuse_getattr(const char *path)
public kos_fuse_getattr public kos_fuse_getattr
kos_fuse_getattr: kos_fuse_getattr:
;DEBUGF 1, '#kos_fuse_getattr\n'
push ebx esi edi ebp push ebx esi edi ebp
mov edx, sf70_params mov edx, sf70_params
@ -115,16 +116,13 @@ kos_fuse_getattr:
mov dword[edx + 0x0c], 0 mov dword[edx + 0x0c], 0
mov dword[edx + 0x10], sf70_buffer mov dword[edx + 0x10], sf70_buffer
mov eax, [esp + 0x14] ; path mov eax, [esp + 0x14] ; path
inc eax ; skip '/' mov byte[edx + 0x14], 0
mov [edx + 0x14], eax mov [edx + 0x15], eax
mov ebp, [fs_struct]
mov ebx, sf70_params mov ebx, sf70_params
mov esi, eax pushad ; file_system_lfn writes here
push 0 call file_system_lfn
call xfs_GetFileInfo popad
pop eax
pop ebp edi esi ebx pop ebp edi esi ebx
mov eax, sf70_buffer mov eax, sf70_buffer
ret ret
@ -169,7 +167,7 @@ proc disk_read stdcall, userdata, buffer, startsector:qword, numsectors
mov ebx, [fd] mov ebx, [fd]
mov edx, SEEK_SET mov edx, SEEK_SET
int 0x80 int 0x80
DEBUGF 1, "lseek: %x\n", eax ;DEBUGF 1, "lseek: %x\n", eax
popad popad
pushad pushad
@ -180,7 +178,7 @@ DEBUGF 1, "lseek: %x\n", eax
mov edx, [edx] mov edx, [edx]
imul edx, 512 imul edx, 512
int 0x80 int 0x80
DEBUGF 1, "read: %d\n", eax ;DEBUGF 1, "read: %d\n", eax
popad popad
movi eax, DISK_STATUS_OK movi eax, DISK_STATUS_OK
@ -248,7 +246,8 @@ proc alloc_kernel_space _size
ret ret
endp endp
proc alloc_pages _size proc alloc_pages _cnt
mov eax, [_cnt]
shl eax, 12 shl eax, 12
call malloc call malloc
ret ret
@ -260,8 +259,9 @@ endp
free: free:
ret ret
kernel_free: proc kernel_free blah
ret ret
endp
mutex_init: mutex_init:
@ -357,12 +357,11 @@ ends
file_disk FILE_DISK file_disk FILE_DISK
;partition_offset dd 2048*512
alloc_pos dd alloc_base alloc_pos dd alloc_base
sf70_params rd 6 sf70_params rd 6
msg_no_partition db 'no partition detected',0x0a msg_no_partition db 'no partition detected',0x0a
msg_no_partition.size = $ - msg_no_partition msg_no_partition.size = $ - msg_no_partition
disk_name db 'hd',0 disk_name db 'hd0',0
current_slot dd ? current_slot dd ?
pg_data PG_DATA pg_data PG_DATA
ide_channel1_mutex MUTEX ide_channel1_mutex MUTEX
@ -377,7 +376,12 @@ IncludeIGlobals
section '.bss' writeable align 16 section '.bss' writeable align 16
;mbr_buffer rb 4096*3 fd rd 1
disk dd ?
alloc_base rb 32*1024*1024
fs_struct rd 1
sf70_buffer rb 16*1024*1024
IncludeUGlobals
DiskNumber db ? DiskNumber db ?
ChannelNumber db ? ChannelNumber db ?
DevErrorCode dd ? DevErrorCode dd ?
@ -386,9 +390,3 @@ CDDataBuf_pointer dd ?
DRIVE_DATA: rb 0x4000 DRIVE_DATA: rb 0x4000
cdpos dd ? cdpos dd ?
cd_appl_data rd 1 cd_appl_data rd 1
fd rd 1
disk dd ?
alloc_base rb 4*1024*1024
fs_struct rd 1
sf70_buffer rb 1024*1024
IncludeUGlobals

View File

@ -12,7 +12,7 @@ kofuse: kofuse.o kocdecl.o
$(CC) $(LDFLAGS) $^ -o $@ `pkg-config fuse3 --libs` $(CC) $(LDFLAGS) $^ -o $@ `pkg-config fuse3 --libs`
kocdecl.o: kocdecl.asm kocdecl.h $(KERNEL_TRUNK)/fs/ext.inc $(KERNEL_TRUNK)/fs/xfs.inc $(KERNEL_TRUNK)/fs/xfs.asm kocdecl.o: kocdecl.asm kocdecl.h $(KERNEL_TRUNK)/fs/ext.inc $(KERNEL_TRUNK)/fs/xfs.inc $(KERNEL_TRUNK)/fs/xfs.asm
INCLUDE="$(KERNEL_TRUNK);$(KERNEL_TRUNK)/fs;$(KERNEL_TRUNK)/blkdev" $(FASM) $< $@ -m 123456 INCLUDE="$(KERNEL_TRUNK);$(KERNEL_TRUNK)/fs;$(KERNEL_TRUNK)/blkdev" $(FASM) $< $@ -m 1234567
kofu.o: kofu.c kocdecl.h kofu.o: kofu.c kocdecl.h
$(CC) $(CFLAGS) -c $< $(CC) $(CFLAGS) -c $<

2
test/t_all Normal file
View File

@ -0,0 +1,2 @@
ls /hd0/1/123
stat /hd0/1/123/two

4
test/t_ls Normal file
View File

@ -0,0 +1,4 @@
ls /hd0/1
ls /hd0/1/
ls /hd0/1/123
ls /hd0/1/123/

1
test/t_stat Normal file
View File

@ -0,0 +1 @@
stat /hd0/1/123/two