Results 1 to 6 of 6
Hi,
I'm developing on PXA300 (with flash memory formatted with a JFFS2) a program that use mmap whit MAP_SHARED argument.
The program use this to map on memory files and ...
- 07-07-2009 #1Just Joined!
- Join Date
- Jun 2009
- Posts
- 9
mmap with map_shared option an jffs2
Hi,
I'm developing on PXA300 (with flash memory formatted with a JFFS2) a program that use mmap whit MAP_SHARED argument.
The program use this to map on memory files and to store any change on files.
This option it's not supported by JFFS2 and, if I use MAP_PRIVATE, I did not change on files.
I tried to use ramdisk.
To do this I formatted and mount the ramdisk, and I copied the files that I want map on ramdisk.
mke2fs -m 0 /dev/ram0
mount -t ext2 /dev/ram0 /usr/local/ws/LINUX/
cp /usr/local/ws/prog/ /usr/local/ws/LINUX/
I have the same error (Invalid argument) on mmap function:
/* mmap */
pMemRegEvt=mmap(0,szMemRegEvt,PROT_READ | PROT_WRITE,
MAP_SHARED,fd_evt,0);
I try, also, to partition mtd and format it with ext2.
mkfs.ext2 /dev/mtdblock6
mount /dev/mtdblock6 /usr/local/ws/LINUX/
then copy application and files in new partition and start it, but I have the same error.
Can you help me?
PS
If I can map on ramdisk this files, I can copy on file system via cron, inserting on crontab
* * * * * cp /usr/local/ws/LINUX/* /usr/local/ws/prog/
Is it right?
- 07-07-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
First, do not use memory mapped files on a flash device. Every write to memory will modify the flash drive and will result in a very reduced life expectancy for the device.
Second, memory mapping files to a ram drive makes no sense. Just do unbuffered writes (no write-behind) to a file on the ram drive. Periodic writing (cron) of the ram drive to flash then makes some sense.
It seems to me that you are violating the kiss principal. Think about what you really are trying to accomplish (write down the salient points) and then determine what the best approach may be by documenting what are the pros and cons of each approach.
Notice I haven't even got to the point of looking at your code as I don't think that's really the issue here.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 07-07-2009 #3Just Joined!
- Join Date
- Jun 2009
- Posts
- 9
thank you Rubberman,
I inherited this program and I have to make it works on the JFFS2.
if I have to change a part of it I prefer to rewrite it.... but I do not have time!
I promise to you that I'll do it
but now can you suggest me some ideas to make it work?
- 07-07-2009 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 07-08-2009 #5Just Joined!
- Join Date
- Jun 2009
- Posts
- 9
thank rubberman,
I tried via tmpfs and now seems to works:
mount -t tmpfs none /usr/local/ws/LINUX/
Now my problem is that if I turn off the system, I less my files.
How can I do to save its recursively?
bye
- 07-10-2009 #6Just Joined!
- Join Date
- Jun 2009
- Posts
- 9
with a partition /dev/mtdblock6 formatted with a ext2 fs woks to.
I think to use it


Reply With Quote
