Hi all. I've read this document. I was looking for how to use long file names and I found a part that is not covered there. There's an example which shows translation of "The quick brown.fox" to LFN entries. After all LFN entries there's also one 'short entry'. I found that in it's name there's only the part which fits there. So from the string above there's only "T H E Q U I ~ F O X". And creation of these names is the point of my question:
Is there any standard way how to build name of short entry following LFNs?
What about usage of unicode charcters only (char>255)? There's written that unreadable unicode char should be replaced with '_', but I don't know if it also applies on SFNs.
Thanks.
[SOLVED] FAT32 filesystem short entry of LFN
[SOLVED] FAT32 filesystem short entry of LFN
Last edited by HugeCode on Sun May 12, 2013 6:02 am, edited 2 times in total.
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: FAT32 filesystem short entgry of LFN
The algorithm is standardised (from my memory), and I think it is provided in the official documentation (intended for UEFI implementers). A quick descripton of the method used is
- All invalid characters are replaced by '_'
- Lowercase characters are converted to uppercase
- The name is truncated to 6 characters if the non-extension part is longer than 8 (or not unique) and '~' plus a number is appended (such that the 8.3 name is unique)
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: FAT32 filesystem short entgry of LFN
Isn't the document I put here official (it's from microsoft)?
BTW what from extension is put to 3 chars in short entry? Start or end?
Also I saw numbers after ~. Does it something to do with number of LFN entries following?
I'm fed up a bit from my FAT code, because Windows doesn't accept it (invalid short entry -> invalid checksum -> invalid long file name -> "There's a problem with this drive. Scan the drive now and fix it.").
Thanks.
BTW what from extension is put to 3 chars in short entry? Start or end?
Also I saw numbers after ~. Does it something to do with number of LFN entries following?
I'm fed up a bit from my FAT code, because Windows doesn't accept it (invalid short entry -> invalid checksum -> invalid long file name -> "There's a problem with this drive. Scan the drive now and fix it.").
Thanks.
Re: FAT32 filesystem short entgry of LFN
Found it. The older one contains it:
http://msdn.microsoft.com/en-us/library ... 63080.aspx
Just an optional question: can number tail rewrite the extension?
EDIT:
What the hack is this? No tails, only mess of characters. Why?
http://msdn.microsoft.com/en-us/library ... 63080.aspx
Just an optional question: can number tail rewrite the extension?
EDIT:
What the hack is this? No tails, only mess of characters. Why?
Last edited by HugeCode on Thu Apr 25, 2013 11:08 am, edited 1 time in total.
Re: FAT32 filesystem short entgry of LFN
All ~1 are tails. No they can not overwrite the extension.HugeCode wrote:Found it. The older one contains it:
http://msdn.microsoft.com/en-us/library ... 63080.aspx
Just an optional question: can number tail rewrite the extension?
EDIT:
What the hack is this? No tails, only mess of characters. Why?
Learn to read.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: FAT32 filesystem short entgry of LFN
So if you force a single-digit tail to be insufficient, it'll need to find space elsewhere to create unique filenames, and that has to be earlier in the 8.3 string.dozniak wrote:A.ll ~1 are tails. No they can not overwrite the extension.
Re: FAT32 filesystem short entgry of LFN
And if you look carefully at your dump, you'll see that it takes only 2 first characters of the long filename and then generates a 4-character random identifier, then finishes it with a tail.Combuster wrote:So if you force a single-digit tail to be insufficient, it'll need to find space elsewhere to create unique filenames, and that has to be earlier in the 8.3 string.dozniak wrote:A.ll ~1 are tails. No they can not overwrite the extension.
Learn to read.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: FAT32 filesystem short entgry of LFN
Note that you can omit the short name. Linux, for example, does this because the "FAT LFN" patent only covers cases where you create a file with both the long and short names.
Re: FAT32 filesystem short entgry of LFN
So if I understand it correctly, faster way for LFN SFN entry generation is to create random numbers (based on actual time) so they won't mess and there's no need to perform check in directory to generate correct tail number.
Thank you all.
Thank you all.