EmbeddedRelated.com
Forums

Free FAT12/FAT16/FAT32 filesystem (C)

Started by larwe January 9, 2006
larwe schrieb:
> Hi Steve, > > >>filesystem file which I can also mount on FC3. (I used mkdosfs). Anyway >>for some reason when the file is mounted as a loopback device, I can >>only create names in lower case. Your test program in main.c has >>strings in upper case. So I change your memcmp calls with strncasecmp. > > > Not sure what this will achieve. The directory entry should contain > uppercase characters. > > There is an oddity about the vfat driver in Linux, that it tries to > prettify directory output by silently lowercasing 8.3 names when you > list dir contents. IIRC if a filename you create COULD be represented > as 8.3, it is stored on disk as the 8.3 uppercase version. Even if you > specified lowercase when you created it, there will be no LFN entry > containing this information. This fact is however semi-invisible under > both Windows and Linux because of the magic translation in vfat and the > case-agnosticism of Windows. >
Look at the chapter 'Mount options for vfat' in the MOUNT(8) manual page. shortname=[lower|win95|winnt|mixed] Defines the behaviour for creation and display of filenames which fit into 8.3 characters. If a long name for a file exists, it will always be preferred display. There are four modes: ... Anton
larwe wrote:
> Sagaert Johan wrote: > >>have a look here >> >>http://sourceforge.net/projects/efsl > > > Unfortunately it tries to load an advertisement from ad.doubleclick.net > (which is blocked by my anti-advertising software) and some Javascript > or something on the page sees that the advertisement could not load, > tries again, tries again, ... and locks the browser up hard. > > I'm not spending time on a site that's so determined to show me > graphical spam. > > There is no advertising on zws.com :) >
Hmm, it worked just fine for me, with no ads. Using Firefox 1.5, with images & Javascript disabled (my usual browsing configuration).
Anton Hadinger wrote:
> larwe schrieb: > > Hi Steve, > > > > > >>filesystem file which I can also mount on FC3. (I used mkdosfs). Anyway > >>for some reason when the file is mounted as a loopback device, I can > >>only create names in lower case. Your test program in main.c has > >>strings in upper case. So I change your memcmp calls with strncasecmp. > > > > > > Not sure what this will achieve. The directory entry should contain > > uppercase characters. > > > > There is an oddity about the vfat driver in Linux, that it tries to > > prettify directory output by silently lowercasing 8.3 names when you > > list dir contents. IIRC if a filename you create COULD be represented > > as 8.3, it is stored on disk as the 8.3 uppercase version. Even if you > > specified lowercase when you created it, there will be no LFN entry > > containing this information. This fact is however semi-invisible under > > both Windows and Linux because of the magic translation in vfat and the > > case-agnosticism of Windows. > > > Look at the chapter 'Mount options for vfat' in the MOUNT(8) manual page. > > shortname=[lower|win95|winnt|mixed] > > Defines the behaviour for creation and display of filenames > which fit into 8.3 characters. If a long name for a file exists, > it will always be preferred display. There are four modes: > ... > > Anton
Hello, yes - if I mount the filesystem as vfat I can tell it to show names. ie: "sudo mount dostest mnt_here/ -o loop -o uid=500 -t vfat -o shortname=mixed" The problem I was trying to avoid was using long file names since dosfs does not support them. So before I did the mount with -t msdos. It does not accept the shortname options. With vfat it seems the files are created with uppercase names, even if I enter lowercase ones. Bizarre. In any case changing the memcmp to strncasecmp as I recommended to Larwe is optional, but I believe useful to extend fsdos portability. I really don't understand the difference between the linux file types of msdos, umsdos, and vfat. Thanks for the suggestion, ~Steve
stevecalfee@hotmail.com wrote:

> I really don't understand the difference between the linux file types > of msdos, umsdos, and vfat.
I believe that MSDOS does not support long file names, while VFAT does. UMSDOS is a filesystem that emulates unix file system functionality on top of a DOS (FAT) filesystem, such as permissions, ownership, etc. It was used in the old days for running linux on a DOS partition without having to repartition your drive. It is crucially important that if you use umsdos, you do not touch the files when inside DOS/windows :) ttyl, --buddy