FAT: on LFNs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

FAT: on LFNs

Post by eddyb »

I'm writing a FAT driver and i did bootsector, direntries parsing and i can read a file. i have no FAT parsing, as i have no file over 4k on the test partition :mrgreen: .
Well, i want to do LFNs(Long FileName entryes) and i don't know all about it. here i have some question:
1. A valid LFN entry won't have the first byte 0x00?
2. All the LFN entries are before the direntry associated?
3. Are they in some order or they can be in a random order?
4. The first LFN entry for a file(the first on the disk) is the last one?(i mean the order byte to be | 0x40)

thanks, eddyb.
LoseThos
Member
Member
Posts: 112
Joined: Tue Oct 30, 2007 6:41 pm
Location: Las Vegas, NV USA
Contact:

Re: FAT: on LFNs

Post by LoseThos »

System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: FAT: on LFNs

Post by System123 »

Here are some answers.
shiner wrote:All the LFN entries are before the direntry associated?
Yes, The LFN entry is right before the standard entry.
shiner wrote:A valid LFN entry won't have the first byte 0x00?
The first byte of the LFN is normally 0x41. The 0x01 part tells us that it is the 1st LFN for the standard entry. The 0x40 tells us that this LFN is also the last one for the standard entry. So the first byte of a valiid LFN can not be 0x00 but it could be 0x01
shiner wrote:Are they in some order or they can be in a random order?
Not sure what you are referring to. The LFN entries follow on each other ie:
  • LFN Entry 1 (0x01)
  • LFN Entry 2 (0x02)
  • LFN Entry 3 (Last one - 0x40)
  • Standard Entry
shiner wrote:The first LFN entry for a file(the first on the disk) is the last one?(i mean the order byte to be | 0x40)
AFAIK and don't take my word for it, the entries are in order. ie the 1st LFN is the first part of the filename and has 0x01

Regard
System123
Gizmic OS
Currently - Busy with FAT12 driver and VFS
LoseThos
Member
Member
Posts: 112
Joined: Tue Oct 30, 2007 6:41 pm
Location: Las Vegas, NV USA
Contact:

Re: FAT: on LFNs

Post by LoseThos »

My FAT code works except short file names. You must make a unique name with a tilde,Number Micro~1. You must check for unique short names. That's more trouble than it's worth... I said screw-it.

I have a native file system with 26 letter names, max. I simply don't allow FAT names longer and never will. "LFN" in my operating systenm is "LEx file node". There are upto 8 levels deep for #include and each level is a LFN.
System123
Member
Member
Posts: 196
Joined: Mon Jul 07, 2008 1:25 am

Re: FAT: on LFNs

Post by System123 »

Short names are easy to implement. I just keep an array of used names on the disk for reference
Gizmic OS
Currently - Busy with FAT12 driver and VFS
LoseThos
Member
Member
Posts: 112
Joined: Tue Oct 30, 2007 6:41 pm
Location: Las Vegas, NV USA
Contact:

Re: FAT: on LFNs

Post by LoseThos »

Long names are easier. I say "Works great for my operating system, you use windows you're on your own if it processes short names."
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: FAT: on LFNs

Post by AJ »

Just a word of warning in case you didn't already know - I believe that LFN handling in FAT is one of the areas of FAT that has current patents relating to it. While unlikely that a hobby OS will be flagged by MS, be careful and make sure you're not doing anything illegal.

Cheers,
Adam
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: FAT: on LFNs

Post by eddyb »

LoseThos wrote:http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx
I should say No RTFMs, i've read that doc.
anyway, thanks, cause i have the answers:
1, there a non-zero number
2, yep
3, maybe random
4, yeah

Edit:
AJ: heard that thing depends on where do you live. i'm in romania and i've read somewhere they apply only to US
Last edited by eddyb on Tue Jan 06, 2009 12:53 pm, edited 2 times in total.
LoseThos
Member
Member
Posts: 112
Joined: Tue Oct 30, 2007 6:41 pm
Location: Las Vegas, NV USA
Contact:

Re: FAT: on LFNs

Post by LoseThos »

(please use proper words - Combuster)

http://www.microsoft.com/whdc/system/pl ... atgen.mspx
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: FAT: on LFNs

Post by Troy Martin »

LoseThos: You seriously got to calm the frickkin' hell down.
Image
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
Post Reply