ts-7000
[Top] [All Lists]

[ts-7000] Re: Suggestions needed for SD cards and writeable partitions

To:
Subject: [ts-7000] Re: Suggestions needed for SD cards and writeable partitions
From: "Frank" <>
Date: Thu, 07 Oct 2010 03:30:46 -0000
If you can follow Eric's suggestion, I'd go with that first.

Otherwise, if you have the source code for the application that is writing to 
the file, add the fsync() system call following every write() and before 
calling close().

If the above doesn't work (I expect it should, although read below for the fsck 
requirement), you can also try writing to the block device in /dev.  I don't 
know how this might be buffered when it comes to MTD though, so some 
experimentation may be required.  What I'm thinking is that your code could 
open the device (such as /dev/mtd/1) and write to it directly and not use a 
filesystem at all.  Issues would be:  is data buffered before being written 
(would require the fsync() call), maintaining data size (no filesystem = no 
file size info), and determining when the partition is full (again, no 
filesystem = no space available checks).

Background:

When a filesystem is mounted, the superblock on the media is marked 
"is_mounted".  Unmounting the filesystem clears that flag.  When the system is 
booted it checks that value when the mount is attempted.  If the flag is false, 
the mount proceeds normally.  If the flag is set, then the filesystem was 
mounted when power was lost and the fsck is required/reported depending on 
various configuration settings.

--- In  "eric.robishaw" <> wrote:
> > So, does anyone have more real-world experience here?  Technically, I'm 
> > only writing to a very small preferences/settings file and never leave the 
> > file open for more than it takes to write out a few dozen words and then 
> > the file is immediately closed.  The chance that the file is open when 
> > power is turned off is really small.
> 
> Seems to me if you have only one file you're concerned about, it would be 
> easier to use a backup-copy scheme than messing with file system 
> implementations and all that.  Always have 2 copies of the file.  If you 
> can't read the latest, revert to the previous one.




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU