Page 1 of 1
FAT: on LFNs
Posted: Tue Jan 06, 2009 11:33 am
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
.
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.
Re: FAT: on LFNs
Posted: Tue Jan 06, 2009 12:02 pm
by LoseThos
Re: FAT: on LFNs
Posted: Tue Jan 06, 2009 12:11 pm
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
Re: FAT: on LFNs
Posted: Tue Jan 06, 2009 12:25 pm
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.
Re: FAT: on LFNs
Posted: Tue Jan 06, 2009 12:29 pm
by System123
Short names are easy to implement. I just keep an array of used names on the disk for reference
Re: FAT: on LFNs
Posted: Tue Jan 06, 2009 12:39 pm
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."
Re: FAT: on LFNs
Posted: Tue Jan 06, 2009 12:45 pm
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
Re: FAT: on LFNs
Posted: Tue Jan 06, 2009 12:48 pm
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
Re: FAT: on LFNs
Posted: Tue Jan 06, 2009 12:49 pm
by LoseThos
Re: FAT: on LFNs
Posted: Tue Jan 06, 2009 5:35 pm
by Troy Martin
LoseThos: You seriously got to calm the frickkin' hell down.