Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > FAT32 file system - Adding and removing files.

Reply
Thread Tools

FAT32 file system - Adding and removing files.

 
 
superhac007@gmail.com
Guest
Posts: n/a
 
      09-17-2009
Hi,

I am looking for information on how to add and remove files from a
fat32 file system. Specifically the pseudo mechanics not actual
code. I have some idea, but I'm not sure if this is the optimum way.

For adding I am assuming the following steps:

1) add the file entry to the directory. Do I find the first available
entry (0x00) or can I replace a deleted directory entry (0xE5)?

2) Find an available cluster in the FAT Table. Do I search for the
first available entry location that is set to 0x00000000?

3) Break up the file data among clusters and update the FAT entries,
and set starting cluster of file.

for deleting:

1) set the filename length to 0xE5. Then do I reset the clusters that
make up that file to (0x00000000)?

Thanks,

Steve



 
Reply With Quote
 
 
 
 
Seebs
Guest
Posts: n/a
 
      09-17-2009
On 2009-09-17, http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> wrote:
> Hi,
>
> I am looking for information on how to add and remove files from a
> fat32 file system. Specifically the pseudo mechanics not actual
> code. I have some idea, but I'm not sure if this is the optimum way.


You might try a DOS or Windows newsgroup, as this has entirely to do with
a filesystem. You could write this code in any language you wanted, and
it would be essentially the same.

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / (E-Mail Removed)
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
 
Reply With Quote
 
 
 
 
superhac007@gmail.com
Guest
Posts: n/a
 
      09-17-2009
On Sep 17, 4:02*pm, Kenneth Brody <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > Hi,

>
> > *I am looking for information on how to add and remove files from a
> > fat32 file system. *Specifically the pseudo mechanics not actual
> > code. *I have some idea, but I'm not sure if this is the optimum way.

>
> [...]
>
> I would recommend using fopen() and remove().
>
> --
> Kenneth Brody


lol...

This is a from scratch parser. As in I am parsing the disk raw. I've
got the boot sector parsed, fat table parsed, and can navigate the
directories, but I am looking for the proper way to add and remove
files. I can't seem to find any examples on the web.

Steve

 
Reply With Quote
 
Beej Jorgensen
Guest
Posts: n/a
 
      09-17-2009
(E-Mail Removed) <(E-Mail Removed)> wrote:
>For adding I am assuming the following steps:
>for deleting:


Seems unlikely that people here would know, but I could recommend the
Linux kernel source as a reference:

http://lxr.linux.no/linux+v2.6.31/fs/fat/dir.c#L1230
http://lxr.linux.no/linux+v2.6.31/fs/fat/dir.c#L984

But, to be honest, I don't know a thing about it.

-Beej

 
Reply With Quote
 
Chris M. Thomasson
Guest
Posts: n/a
 
      09-18-2009
"Seebs" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 2009-09-17, (E-Mail Removed) <(E-Mail Removed)> wrote:
>> Hi,
>>
>> I am looking for information on how to add and remove files from a
>> fat32 file system. Specifically the pseudo mechanics not actual
>> code. I have some idea, but I'm not sure if this is the optimum way.

>
> You might try a DOS or Windows newsgroup, as this has entirely to do with
> a filesystem. You could write this code in any language you wanted, and
> it would be essentially the same.


How would you react to the following statement:


You cannot create low-level algorithm X in any language you wanted to, C/C++
aside of course!!!!!:


http://groups.google.com/group/comp....ae596a08b7afd9


without resorting to unsafe coding practices wrt said languages
safe-guards...






;^)

 
Reply With Quote
 
superhac007@gmail.com
Guest
Posts: n/a
 
      09-18-2009
On Sep 17, 6:39*pm, Beej Jorgensen <(E-Mail Removed)> wrote:
> (E-Mail Removed) <(E-Mail Removed)> wrote:
> >For adding I am assuming the following steps:
> >for deleting:

>
> Seems unlikely that people here would know, but I could recommend the
> Linux kernel source as a reference:
>
> http://lxr.linux.no/linux+v2.6.31/fs...fat/dir.c#L984
>
> But, to be honest, I don't know a thing about it.
>
> -Beej


Thanks Beej. That was exactly what I was looking for. For some
reason I never thought of looking at the Linux modules for FAT, even
though I'm working on Linux!! It appears that I was pretty close with
my assumptions on first glance.

I'm with you before I started this project I never looked at how file
systems worked. Its an obscure topic, and most people would just use
ready made drivers. I learned quite a bit so far, and now have a
great appreciation for the role it fulfills.


Thanks again,

Steve
 
Reply With Quote
 
robertwessel2@yahoo.com
Guest
Posts: n/a
 
      09-18-2009
On Sep 18, 8:39*am, "(E-Mail Removed)" <(E-Mail Removed)>
wrote:
> On Sep 17, 6:39*pm, Beej Jorgensen <(E-Mail Removed)> wrote:
>
> > (E-Mail Removed) <(E-Mail Removed)> wrote:
> > >For adding I am assuming the following steps:
> > >for deleting:

>
> > Seems unlikely that people here would know, but I could recommend the
> > Linux kernel source as a reference:

>
> >http://lxr.linux.no/linux+v2.6.31/fs...tp://lxr.linux....

>
> > But, to be honest, I don't know a thing about it.

>
> > -Beej

>
> Thanks Beej. *That was exactly what I was looking for. *For some
> reason I never thought of looking at the Linux modules for FAT, even
> though I'm working on Linux!! *It appears that I was pretty close with
> my assumptions on first glance.



While OT, this is pretty much the definitive specification for FAT:

http://www.microsoft.com/whdc/system...re/fatgen.mspx
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File size limit on FAT32 file system. Amod C++ 1 11-14-2005 12:03 PM
File size limit on the FAT32 file system Amod C++ 1 11-14-2005 12:03 PM
Help needed with Winrar and DVD sized file on FAT32 system Arawak Computer Support 3 04-19-2004 06:24 PM
System FAT32 & Virtual memory Enid HODSON Computer Support 2 07-17-2003 05:28 PM
File System (Fat32/NTFS) Question Grimtooth Computer Support 5 07-16-2003 10:09 AM



Advertisments