flat assembler
Message board for the users of flat assembler.

Index > MenuetOS > Directory routines for function 58

Goto page 1, 2, 3, 4  Next
Author
Thread Post new topic Reply to topic
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
I have added MAKEDIR and DELETE for hd into fat32.inc/fs.inc
They are not yet fully tested, so use with care.
Makedir can only make one directory at time.
Delete can only remove long filename name fields if they are in one sector

fileinfo.mode = 2 ; delete file/directory (directory must be empty)
fileinfo.mode = 4 ; makedir

Code:
fileinfo:                      ; fileinfo for function 58
    .mode            dd 4        ; 2=delete, 4=makedir
    .start_block     dd 0x0      ; block to read
    .blocks          dd 0x0      ; num of blocks
    .address         dd 0x20000  ; return data pointer
    .workarea        dd 0x10000  ; work area for os
    namez:           times 128 db 0


  mov  eax,58
  mov  ebx,fileinfo
  int  0x40
    


Comments/suggestions/ideas?


Last edited by ATV on 20 Oct 2004, 08:13; edited 1 time in total
Post 18 Oct 2004, 07:21
View user's profile Send private message Reply with quote
daneel



Joined: 19 May 2004
Posts: 56
daneel
Very good job! MOS need more FS support Smile
Post 18 Oct 2004, 17:14
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
Updated fat32.inc/fs.inc support for long filename delete over sector limit

What about file read/write/seek, byte/sector level?
Byte level need more code into kernel, but it's easy to use in applications.
Sector level is easy to add into kernel, but need more application code.


Last edited by ATV on 08 Nov 2004, 08:17; edited 2 times in total
Post 20 Oct 2004, 08:14
View user's profile Send private message Reply with quote
drh3xx



Joined: 11 Sep 2004
Posts: 34
drh3xx
I'd opt for byte level access. Sure it's more code in the kernel but the whole point of an OS is to make coding an app easyier.

Bearing in mind we can now delete LFN's how hard will it be to add support for them when creating/loading/updating a file/directory? I have some trouble with my FAT32 access and I think LFN's might be the problem.

Keep up the good work ATV Smile
Post 20 Oct 2004, 09:33
View user's profile Send private message Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
drh3xx, are you going over 9 directory deep because fs.inc currently can handle path with deepnes of 8+1?
Code:
Just change fs.inc (line 143-):
    mov   ecx,127
    cld
    rep   stosb
    mov   ecx,9

with:
    mov   ecx,41*12+12
    cld
    rep   stosb
    mov   ecx,41
    
Create LFN need lots of code, so it's far in future.

About direct byte read/write using func 58 and whole path/fat travel per byte makes it so slow that nobody want use it. So i need more future guidelines for MeOS because that need somekind file handle table inside kernel (hd_base / partition / dir_entry_pos / current_filepos / user_prog_id / ...) and maybe sector buffer for each handle.

Is there reserved mode numbers under func 58?

Do i have free hands to do almost anything?
Post 23 Oct 2004, 07:30
View user's profile Send private message Reply with quote
bloglite



Joined: 21 Feb 2004
Posts: 109
Location: East Tennessee U.S.A.
bloglite
I don't speak for everyone but the idea here is to create functional code and the optimization of that code.

By all means fix what needs fixing. Comment your code well so others know what you did,

There is plenty to be done. (a new to-do list may be in order.)

What eventually shows in the "official release" is what we have to start with in each "evolution".

Being able to easily modify or make your own version of this OS is IMHO the best part.

Lots of talented people and as evidenced in these forums some quick learners
are on board. It just gets better and better. Encourage others too!

G'day, Mark
Post 23 Oct 2004, 10:34
View user's profile Send private message Visit poster's website Reply with quote
drh3xx



Joined: 11 Sep 2004
Posts: 34
drh3xx
No ATV only using Root->Directory->File setup so that's not the problem.
It works for some directories (without LFN) but not others (also not LFN) it's really odd. I wondered if it might be to do with LFNs because if I create a dir with 8 char name it seems to work but if I rename a LFN directory to 8 chars then sometimes it does and sometimes it doesn't.

Do M$ cut corners in this situation which results in this odd behavior?
Post 23 Oct 2004, 12:17
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
ATV wrote:
Updated fat32.inc/fs.inc support for long filename delete over sector limit

What about file read/write/seek, byte/sector level?
Byte level need more code into kernel, but it's easy to use in applications.
Sector level is easy to add into kernel, but need more application code.

In the file 'filelib.asm' part of jpegview source, there is a routine for reading files at the byte level.
Also it would be useful that menuetos returns the correct value for directory size , the size of directories depends on the number of clusters,
in the fat entry the directory size is always 0 and this is the value returned by menuetos,at least it was some months ago.
Post 23 Oct 2004, 13:06
View user's profile Send private message Visit poster's website Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
Updated fat32.inc

Now file_read return also dirsize in bytes

Tip for testing:
[partition_count] can be returned after set_FAT32_variables call

Note:
in russian kernel.asm need to remove Mario79 added part2_ld/fat32part routine in sys_setup and replace it with single line:
Code:
    mov [fat32part],ebx    
before it can use new fat32.inc

I have written partition travel / fat16 / make directory / remove file/directory and now return of directory size. What's next, any ideas?


Last edited by ATV on 08 Nov 2004, 08:18; edited 1 time in total
Post 30 Oct 2004, 07:05
View user's profile Send private message Reply with quote
Mario79



Joined: 11 Mar 2004
Posts: 4
Location: Russian Federation
Mario79
You such clever, think up to itself the purpose! Four months I understood the code of the driver Fat32 and wrote Fat16 (2 months for a kernel 076, and then 2 months altered for a kernel 077). But you have appeared and has told - " As ridiculously your code reminds to me - BASIC ". I need only to have a drink of alcohol and will be hung up on a good cord. You have taken away for me sense of life...
Best regards!
Post 30 Oct 2004, 13:20
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
ATV, it seems that your code is not using the disk cache.
Post 30 Oct 2004, 15:13
View user's profile Send private message Visit poster's website Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
Mario79, I don't know what to say. Coding should be fun and interesting and there is always something to learn.

Octavio, Every read is done thru hd_read and it uses disk cache. Write is different, after write/delete will be forced to write it to disk. That prevent disk corrupt if user turn off computer. There is "cache_max equ 1000" at start of fat32.inc that's maximum sector count for cache (1000*512=512000 bytes) maybe you are over that. Maybe find_empty_read_slot need some work too.
Do anybody know why there is limited use of cache "mov ecx,cache_max-15" and "cmp [fat_search_start],cache_max-10"? Or is it bug?

What about dos like FindFirst/FindNext for MeOS? Function number? Data structure?
Post 04 Nov 2004, 08:22
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
ATV wrote:
That prevent disk corrupt if user turn off computer. There is "cache_max equ 1000" at start of fat32.inc that's maximum sector count for cache (1000*512=512000 bytes) maybe you are over that. Maybe find_empty_read_slot need some work too.What about dos like FindFirst/FindNext for MeOS? Function number? Data structure?

preventing disk corrupt is a bit more complex than this,and is not a cache problem. but caching write operations will increase performance.
menuetos uses fixed data structures because is simpler than dinamic memory allocation, but in other OS the cache uses all free memory on the system. find_empty_read_slot needs very little work if the correct algoritm is used like a fifo ramdom list ,also for disk operations it would be better to read/write at least 4kb at a time and use this size also for the cache.
about findfirst/findnext ,on my os i can select files by number (position on the dir struct).
also it would be interesting to implement a 'move' like in dos,that just copy
the directory entry of the file but not the file itself,is faster than
copy-delete.
Post 04 Nov 2004, 17:47
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
Well, I would be more concerned about bugs, than that of disk write failures. This is up to user and user should NOT be mad, when he/she doesn't turn off computer as supposed to or takes a HDD out while running or haven't got UPS or whatever.
PR rates are much higher when users won't be furious about disk write failures, because OS didn't do it right Razz

Another view to look from: we went assembly with this project. Prabability theory says that there is much less chance that HDD won't be able to finish writing on time or sth... and if I recall right, HDD parking won't happen before cache is empty and the HDD has some conductors(is this the word in English? the one that holds energy but prevents it from flowing through) that have enough juice to park head from anywhere on the disk.
Post 04 Nov 2004, 19:07
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
Support for rename/move file or directory (only for hd)
Code:
fileinfo:                         ; fileinfo for function 58
    .mode            dd 5         ; 2=delete, 4=makedir, 5=rename
    .start_block     dd 0x0       ; block to read
    .blocks          dd 0x0       ; num of blocks
    .address         dd 0x20000   ; return data pointer
    .workarea        dd 0x10000   ; work area for os
    dirnamez:        times 256 db 0 ; 2 successive asciiz names
    
Notes:
- Makedir can only make one directory at time
- Delete can only remove empty directory
- Rename can only rename/move file/dir inside current hd
- Rename dirnamez field need 2 successive asciiz name (full source and full destination)
ex. "/HD/1/MEOSTEST/TEST.TXT",0,"/HD/1/DOC/OLD.TXT",0
ex. "/HD/1/WINDOWS",0,"/HD/1/RECYCLED/WIN",0


Last edited by ATV on 23 Nov 2004, 08:30; edited 1 time in total
Post 08 Nov 2004, 08:20
View user's profile Send private message Reply with quote
Barak



Joined: 25 Jul 2003
Posts: 22
Location: Nesher, Israel
Barak
I'm not an asm programmer but in other languages I would do an if (check) statment to see if a directory is empty and if not I will delete all of its info and then delete the directory.

But what am I talking about, you already have thought of it i belive.
Post 08 Nov 2004, 13:03
View user's profile Send private message ICQ Number Reply with quote
Wishing



Joined: 21 Feb 2004
Posts: 56
Location: NY
Wishing
Yeah.. do that ^ .... that way we can NEVER make a new directory since it
immediately would get deleted before we put anything in it Razz
Post 09 Nov 2004, 08:56
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger ICQ Number Reply with quote
Barak



Joined: 25 Jul 2003
Posts: 22
Location: Nesher, Israel
Barak
no no no, i mean when someone wants to delete a folder that is not empty.

Razz
Post 09 Nov 2004, 13:40
View user's profile Send private message ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
I understand what you are saying and also
think that it is possible, but I haven't seen
this so far Sad for example DOS commands.
There is some tricky part there.
Post 09 Nov 2004, 14:52
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
ATV
Updated Removedir clear whole directory structure

Barak, Is this what you mean? Is it really kernels job to clear all?

Little competition, because we need more space for MenuetOS.
How much time it takes in your computer to clear "/hd/1/windows"?
(my old P100 with 1003 files in FAT16 = 11s)


Last edited by ATV on 17 Nov 2004, 09:16; edited 1 time in total
Post 11 Nov 2004, 08:05
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3, 4  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.