Chinaunix首页 | 论坛 | 博客
  • 博客访问: 588771
  • 博文数量: 169
  • 博客积分: 2656
  • 博客等级: 少校
  • 技术积分: 1685
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-30 13:03
文章分类

全部博文(169)

文章存档

2011年(1)

2010年(135)

2009年(33)

我的朋友

分类: 嵌入式

2010-06-18 21:31:56

RAM-disk File system
Q: When I use the RAM-disk as supplied with DosFS2 (configured using the item Hardware->Peripherals->RAM Disk with MSDOS filesystem) it is formatted every time I startup, even if I assign a seperate memory area.

A: Using the device provided as-is this is right. During the initialisation of the device it is formatted. This can be changed by replacing/adding a number of lines to the component INCLUDE_RAM_DISK in the file 10dosfs2.cdf in target\config\comps\vxworks. The definition of INIT_RTN should be changed to:

        INIT_RTN        { void * cbio ; int ramDiskTestFd = -1;\
            cbio=ramDiskDevCreate(RAM_DISK_MEM_ADRS,512,17,RAM_DISK_SIZE/512,0);\
            if(cbio!=NULL){ \
                dosFsDevCreate(RAM_DISK_DEV_name,cbio,RAM_DISK_MAX_FILES,NONE);\
                if(RAM_DISK_FORMAT_ALWAYS == FALSE){ \
                    ramDiskTestFd = open(RAM_DISK_DEV_name, 2, 0);\
                } \
                if((RAM_DISK_FORMAT_ALWAYS != FALSE)||(ramDiskTestFd == -1)){\
                    dosFsVolFormat(cbio,DOS_OPT_BLANK | DOS_OPT_QUIET, NULL);\
                } \
                if(ramDiskTestFd != -1){ \
                    close(ramDiskTestFd);\
                } \
            }}
   
Also a configuration parameter should be added, called RAM_DISK_FORMAT_ALWAYS. To define this parameter the Parameter-definition has to be added:

Parameter RAM_DISK_FORMAT_ALWAYS
        {
        name            Format always, even if already formatted
        TYPE            bool 
        DEFAULT         FALSE
        }
   
When this parameter is set to TRUE the disk is always formatted, just like the original situation. When this parameter is set to FALSE (the default situation) the disk is only formatted when the open of the RAM-disk root does not succeed.

 

阅读(1005) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~