提交 4f72d1cb 编写于 作者: G goprife@gmail.com

remove some warning in jffs2, and fix armcc compile error when using scons

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1929 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 18888679
...@@ -96,6 +96,18 @@ filesystems/uffs/flash/nand_ids.c ...@@ -96,6 +96,18 @@ filesystems/uffs/flash/nand_ids.c
jffs2 = Split(''' jffs2 = Split('''
filesystems/jffs2/dfs_jffs2.c filesystems/jffs2/dfs_jffs2.c
filesystems/jffs2/porting.c filesystems/jffs2/porting.c
filesystems/jffs2/cyg/compress/src/adler32.c
filesystems/jffs2/cyg/compress/src/compress.c
filesystems/jffs2/cyg/compress/src/deflate.c
filesystems/jffs2/cyg/compress/src/infback.c
filesystems/jffs2/cyg/compress/src/inffast.c
filesystems/jffs2/cyg/compress/src/inflate.c
filesystems/jffs2/cyg/compress/src/inftrees.c
filesystems/jffs2/cyg/compress/src/trees.c
filesystems/jffs2/cyg/compress/src/uncompr.c
filesystems/jffs2/cyg/compress/src/zutil.c
filesystems/jffs2/cyg/crc/crc16.c filesystems/jffs2/cyg/crc/crc16.c
filesystems/jffs2/cyg/crc/crc32.c filesystems/jffs2/cyg/crc/crc32.c
filesystems/jffs2/cyg/crc/posix_crc.c filesystems/jffs2/cyg/crc/posix_crc.c
...@@ -104,12 +116,14 @@ filesystems/jffs2/src/build.c ...@@ -104,12 +116,14 @@ filesystems/jffs2/src/build.c
filesystems/jffs2/src/compr.c filesystems/jffs2/src/compr.c
filesystems/jffs2/src/compr_rtime.c filesystems/jffs2/src/compr_rtime.c
filesystems/jffs2/src/compr_rubin.c filesystems/jffs2/src/compr_rubin.c
filesystems/jffs2/src/compr_zlib.c
filesystems/jffs2/src/debug.c filesystems/jffs2/src/debug.c
filesystems/jffs2/src/dir-ecos.c filesystems/jffs2/src/dir-ecos.c
filesystems/jffs2/src/erase.c filesystems/jffs2/src/erase.c
filesystems/jffs2/src/flashio.c filesystems/jffs2/src/flashio.c
filesystems/jffs2/src/fs-ecos.c filesystems/jffs2/src/fs-ecos.c
filesystems/jffs2/src/gc.c filesystems/jffs2/src/gc.c
filesystems/jffs2/src/gcthread.c
filesystems/jffs2/src/malloc-ecos.c filesystems/jffs2/src/malloc-ecos.c
filesystems/jffs2/src/nodelist.c filesystems/jffs2/src/nodelist.c
filesystems/jffs2/src/nodemgmt.c filesystems/jffs2/src/nodemgmt.c
...@@ -158,8 +172,9 @@ if GetDepend('RT_USING_DFS_JFFS2'): ...@@ -158,8 +172,9 @@ if GetDepend('RT_USING_DFS_JFFS2'):
path = path + [RTT_ROOT + '/components/dfs/filesystems/jffs2/src', \ path = path + [RTT_ROOT + '/components/dfs/filesystems/jffs2/src', \
RTT_ROOT + '/components/dfs/filesystems/jffs2/kernel', \ RTT_ROOT + '/components/dfs/filesystems/jffs2/kernel', \
RTT_ROOT + '/components/dfs/filesystems/jffs2/include', \ RTT_ROOT + '/components/dfs/filesystems/jffs2/include', \
RTT_ROOT + '/components/dfs/filesystems/jffs2'] RTT_ROOT + '/components/dfs/filesystems/jffs2', \
CPPDEFINES = CPPDEFINES + ['__ECOS'] RTT_ROOT + '/components/dfs/filesystems/jffs2/cyg/compress']
#CPPDEFINES = CPPDEFINES + ['__ECOS', 'CYGOPT_FS_JFFS2_WRITE', 'CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE']
group = DefineGroup('Filesystem', src_local, depend = ['RT_USING_DFS'], CPPPATH = path, CPPDEFINES = CPPDEFINES) group = DefineGroup('Filesystem', src_local, depend = ['RT_USING_DFS'], CPPPATH = path, CPPDEFINES = CPPDEFINES)
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
# include <stddef.h> # include <stddef.h>
# endif # endif
# include <string.h> # include <string.h>
# include <stdlib.h> //# include <stdlib.h> //remove by prife @ 2012/1/30
#endif #endif
#ifdef NO_ERRNO_H #ifdef NO_ERRNO_H
# ifdef _WIN32_WCE # ifdef _WIN32_WCE
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "dfs_jffs2.h" #include "dfs_jffs2.h"
#include "porting.h" #include "porting.h"
#include <string.h>
#define FILE_PATH_MAX 256 /* the longest file path */ #define FILE_PATH_MAX 256 /* the longest file path */
...@@ -31,10 +32,6 @@ ...@@ -31,10 +32,6 @@
#if DEVICE_PART_MAX > 1 #if DEVICE_PART_MAX > 1
#error "support only one jffs2 partition on a flash device!" #error "support only one jffs2 partition on a flash device!"
#endif #endif
extern cyg_fileops jffs2_fileops;
extern cyg_fileops jffs2_dirops;
extern struct cyg_fstab_entry jffs2_fste;
/* make sure the following struct var had been initilased to 0! */ //fixme /* make sure the following struct var had been initilased to 0! */ //fixme
struct device_part struct device_part
...@@ -165,7 +162,7 @@ static int dfs_jffs2_mount(struct dfs_filesystem* fs, ...@@ -165,7 +162,7 @@ static int dfs_jffs2_mount(struct dfs_filesystem* fs,
* s_dev in struct super_block, and mte->data will be * s_dev in struct super_block, and mte->data will be
* filled with jffs2_sb(see the source of jffs2_mount. * filled with jffs2_sb(see the source of jffs2_mount.
*/ */
mte->data = (CYG_ADDRWORD)fs->dev_id; mte->data = (CYG_ADDRWORD)fs->dev_id;
device_partition[index].dev = fs->dev_id; device_partition[index].dev = fs->dev_id;
/* after jffs2_mount, mte->data will not be dev_id any more */ /* after jffs2_mount, mte->data will not be dev_id any more */
...@@ -175,7 +172,7 @@ static int dfs_jffs2_mount(struct dfs_filesystem* fs, ...@@ -175,7 +172,7 @@ static int dfs_jffs2_mount(struct dfs_filesystem* fs,
return jffs2_result_to_dfs(result); return jffs2_result_to_dfs(result);
} }
/* save this pointer */ /* save this pointer */
device_partition[index].mte = mte; device_partition[index].mte = mte;
return 0; return 0;
} }
...@@ -204,7 +201,6 @@ static int dfs_jffs2_unmount(struct dfs_filesystem* fs) ...@@ -204,7 +201,6 @@ static int dfs_jffs2_unmount(struct dfs_filesystem* fs)
{ {
if (device_partition[index].dev == fs->dev_id) if (device_partition[index].dev == fs->dev_id)
{ {
struct cyg_mtab_entry * mte;
result = jffs2_umount(device_partition[index].mte); result = jffs2_umount(device_partition[index].mte);
if (result) if (result)
return jffs2_result_to_dfs(result); return jffs2_result_to_dfs(result);
...@@ -237,7 +233,7 @@ static int dfs_jffs2_statfs(struct dfs_filesystem* fs, ...@@ -237,7 +233,7 @@ static int dfs_jffs2_statfs(struct dfs_filesystem* fs,
RT_ASSERT(mte->data != NULL); RT_ASSERT(mte->data != NULL);
jffs2_get_info_from_sb(mte->data, &info); jffs2_get_info_from_sb((void *)mte->data, &info);
buf->f_bsize = info.sector_size; buf->f_bsize = info.sector_size;
buf->f_blocks = info.nr_blocks; buf->f_blocks = info.nr_blocks;
buf->f_bfree = info.free_size; //fixme need test! buf->f_bfree = info.free_size; //fixme need test!
...@@ -259,7 +255,7 @@ static int dfs_jffs2_open(struct dfs_fd* file) ...@@ -259,7 +255,7 @@ static int dfs_jffs2_open(struct dfs_fd* file)
int result; int result;
cyg_file * jffs2_file; cyg_file * jffs2_file;
struct cyg_mtab_entry * mte; struct cyg_mtab_entry * mte;
const char * name; const char * name;
oflag = file->flags; oflag = file->flags;
...@@ -311,7 +307,7 @@ static int dfs_jffs2_open(struct dfs_fd* file) ...@@ -311,7 +307,7 @@ static int dfs_jffs2_open(struct dfs_fd* file)
if (oflag & DFS_O_TRUNC) mode |= JFFS2_O_TRUNC; if (oflag & DFS_O_TRUNC) mode |= JFFS2_O_TRUNC;
/* Creates a new file. The function fails if the file is already existing. */ /* Creates a new file. The function fails if the file is already existing. */
if (oflag & DFS_O_EXCL) mode |= JFFS2_O_EXCL; if (oflag & DFS_O_EXCL) mode |= JFFS2_O_EXCL;
// if (oflag & DFS_O_APPEND) mode |= JFFS2_O_APPEND; // if (oflag & DFS_O_APPEND) mode |= JFFS2_O_APPEND;
result = jffs2_open(mte, 0, name, mode, jffs2_file); result = jffs2_open(mte, 0, name, mode, jffs2_file);
if (result != 0) if (result != 0)
...@@ -325,16 +321,16 @@ static int dfs_jffs2_open(struct dfs_fd* file) ...@@ -325,16 +321,16 @@ static int dfs_jffs2_open(struct dfs_fd* file)
file->data = jffs2_file; file->data = jffs2_file;
file->pos = jffs2_file->f_offset; file->pos = jffs2_file->f_offset;
file->size = 0; file->size = 0;
jffs2_file_lseek(jffs2_file, &(file->size), SEEK_END); jffs2_file_lseek(jffs2_file, (off_t *)(&(file->size)), SEEK_END);
jffs2_file->f_offset = file->pos; jffs2_file->f_offset = (off_t)file->pos;
if (oflag & DFS_O_APPEND) if (oflag & DFS_O_APPEND)
{ {
file->pos = file->size; file->pos = file->size;
jffs2_file->f_offset = file->size; jffs2_file->f_offset = file->size;
} }
return 0; return 0;
} }
static int dfs_jffs2_close(struct dfs_fd* file) static int dfs_jffs2_close(struct dfs_fd* file)
{ {
...@@ -407,7 +403,7 @@ static int dfs_jffs2_write(struct dfs_fd* file, ...@@ -407,7 +403,7 @@ static int dfs_jffs2_write(struct dfs_fd* file,
RT_ASSERT(file->data != NULL); RT_ASSERT(file->data != NULL);
jffs2_file = (cyg_file *)(file->data); jffs2_file = (cyg_file *)(file->data);
uio_s.uio_iov = &iovec; uio_s.uio_iov = &iovec;
uio_s.uio_iov->iov_base = buf; uio_s.uio_iov->iov_base = (void *)buf;
uio_s.uio_iov->iov_len = len; uio_s.uio_iov->iov_len = len;
uio_s.uio_iovcnt = 1; //must be 1 uio_s.uio_iovcnt = 1; //must be 1
//uio_s.uio_offset //not used... //uio_s.uio_offset //not used...
...@@ -457,7 +453,7 @@ static int dfs_jffs2_getdents(struct dfs_fd* file, ...@@ -457,7 +453,7 @@ static int dfs_jffs2_getdents(struct dfs_fd* file,
struct CYG_IOVEC_TAG iovec; struct CYG_IOVEC_TAG iovec;
struct jffs2_dirent jffs2_d; struct jffs2_dirent jffs2_d;
struct dirent * d; struct dirent * d;
rt_uint32_t index; rt_uint32_t index;
int result; int result;
RT_ASSERT(file->data != RT_NULL); RT_ASSERT(file->data != RT_NULL);
...@@ -525,7 +521,7 @@ static int dfs_jffs2_unlink(struct dfs_filesystem* fs, const char* path) ...@@ -525,7 +521,7 @@ static int dfs_jffs2_unlink(struct dfs_filesystem* fs, const char* path)
path++; path++;
/* judge file type, dir is to be delete by rmdir, others by unlink */ /* judge file type, dir is to be delete by rmdir, others by unlink */
result = jffs2_ops_stat(mte, mte->root, path, &s); result = jffs2_porting_stat(mte, mte->root, path, (void *)&s);
if (result) if (result)
return jffs2_result_to_dfs(result); return jffs2_result_to_dfs(result);
...@@ -555,12 +551,12 @@ static int dfs_jffs2_rename(struct dfs_filesystem* fs, ...@@ -555,12 +551,12 @@ static int dfs_jffs2_rename(struct dfs_filesystem* fs,
result = _find_fs(&mte, fs->dev_id); result = _find_fs(&mte, fs->dev_id);
if (result) if (result)
return -DFS_STATUS_ENOENT; return -DFS_STATUS_ENOENT;
if (*oldpath == '/') if (*oldpath == '/')
oldpath += 1; oldpath += 1;
if (*newpath == '/') if (*newpath == '/')
newpath += 1; newpath += 1;
result = jffs2_rename(mte, mte->root, oldpath, mte->root, newpath); result = jffs2_rename(mte, mte->root, oldpath, mte->root, newpath);
if (result) if (result)
...@@ -572,19 +568,21 @@ static int dfs_jffs2_stat(struct dfs_filesystem* fs, const char *path, struct st ...@@ -572,19 +568,21 @@ static int dfs_jffs2_stat(struct dfs_filesystem* fs, const char *path, struct st
{ {
int result; int result;
struct jffs2_stat s; struct jffs2_stat s;
cyg_mtab_entry * mte; cyg_mtab_entry * mte;
/* deal the path for jffs2 */ /* deal the path for jffs2 */
RT_ASSERT(!((path[0] == '/') && (path[1] == 0))); RT_ASSERT(!((path[0] == '/') && (path[1] == 0)));
if (path[0] == '/') if (path[0] == '/')
path++; path++;
result = _find_fs(&mte, fs->dev_id); result = _find_fs(&mte, fs->dev_id);
if (result) if (result)
return -DFS_STATUS_ENOENT; return -DFS_STATUS_ENOENT;
// result = jffs2_ops_stat(mte, mte->root, path, &s);
result = jffs2_porting_stat(mte, mte->root, path, (void *)&s);
result = jffs2_ops_stat(mte, mte->root, path, &s);
if (result) if (result)
return jffs2_result_to_dfs(result); return jffs2_result_to_dfs(result);
/* convert to dfs stat structure */ /* convert to dfs stat structure */
...@@ -593,16 +591,16 @@ static int dfs_jffs2_stat(struct dfs_filesystem* fs, const char *path, struct st ...@@ -593,16 +591,16 @@ static int dfs_jffs2_stat(struct dfs_filesystem* fs, const char *path, struct st
case JFFS2_S_IFREG: case JFFS2_S_IFREG:
st->st_mode = DFS_S_IFREG | DFS_S_IRUSR | DFS_S_IRGRP | DFS_S_IROTH | st->st_mode = DFS_S_IFREG | DFS_S_IRUSR | DFS_S_IRGRP | DFS_S_IROTH |
DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH; DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH;
break; break;
case JFFS2_S_IFDIR: case JFFS2_S_IFDIR:
st->st_mode = DFS_S_IFDIR | DFS_S_IXUSR | DFS_S_IXGRP | DFS_S_IXOTH; st->st_mode = DFS_S_IFDIR | DFS_S_IXUSR | DFS_S_IXGRP | DFS_S_IXOTH;
break; break;
default: default:
st->st_mode = DFS_DT_UNKNOWN; //fixme st->st_mode = DFS_DT_UNKNOWN; //fixme
break; break;
} }
st->st_dev = 0; st->st_dev = 0;
st->st_size = s.st_size; st->st_size = s.st_size;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#ifndef _JFFS2_FS_SB #ifndef _JFFS2_FS_SB
#define _JFFS2_FS_SB #define _JFFS2_FS_SB
#include "jffs2_config.h"
#include <linux/types.h> #include <linux/types.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
......
#ifndef JFFS2_CONFIG_H
#define JFFS2_CONFIG_H
#define __ECOS /* must be defined */
#define CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE /* should be enabled */
#if defined(CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE)
#define CYGPKG_FILEIO_DIRENT_DTYPE
#endif
#define CYGOPT_FS_JFFS2_WRITE /* if not defined, jffs2 is read only*/
/* jffs2 debug output opion */
#define CONFIG_JFFS2_FS_DEBUG 0 /* 1 or 2 */
/* jffs2 gc thread section */
#define CYGOPT_FS_JFFS2_GCTHREAD
#define CYGNUM_JFFS2_GC_THREAD_PRIORITY 20
#define CYGNUM_JFFS2_GS_THREAD_TICKS 20
#define CYGNUM_JFFS2_GC_THREAD_TICKS 20
//#define CONFIG_JFFS2_FS_WRITEBUFFER /* should not be enabled */
/* zlib section*/
//#define CONFIG_JFFS2_ZLIB
//#define CONFIG_JFFS2_RTIME
//#define CONFIG_JFFS2_RUBIN
//#define CONFIG_JFFS2_CMODE_NONE
//#define CONFIG_JFFS2_CMODE_SIZE
#endif
#ifndef __LINUX_CONFIG_H__ #ifndef __LINUX_CONFIG_H__
#define __LINUX_CONFIG_H__ #define __LINUX_CONFIG_H__
#define CONFIG_JFFS2_FS_DEBUG 0
#define GFP_KERNEL 0 #define GFP_KERNEL 0
/* #define CONFIG_JFFS2_FS_WRITEBUFFER 0 */ /* #define CONFIG_JFFS2_FS_WRITEBUFFER 0 */
/* #define CONFIG_JFFS2_PROC */ /* #define CONFIG_JFFS2_PROC */
/* #define CONFIG_JFFS2_RTIME */ /* #define CONFIG_JFFS2_RTIME */
/* #define CONFIG_JFFS2_RUBIN */ /* #define CONFIG_JFFS2_RUBIN */
/* #define CONFIG_JFFS2_ZLIB */ /* #define CONFIG_JFFS2_ZLIB */
#endif /* __LINUX_CONFIG_H__ */ #endif /* __LINUX_CONFIG_H__ */
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __LINUX_KERNEL_H__ #define __LINUX_KERNEL_H__
//#include <cyg/infra/diag.h> //#include <cyg/infra/diag.h>
//#include <stdio.h> //mod by prife @ 2011/11/20 //#include <stdio.h> //mod by prife @ 2011/11/20
#include "jffs2_config.h"
#define jiffies 100 #define jiffies 100
......
#ifndef __LINUX_SLAB_H__ #ifndef __LINUX_SLAB_H__
#define __LINUX_SLAB_H__ #define __LINUX_SLAB_H__
#include <stdlib.h> //prife //#include <stdlib.h> //prife
#include <asm/page.h> /* Don't ask. Linux headers are a mess. */ #include <asm/page.h> /* Don't ask. Linux headers are a mess. */
......
#include <linux/kernel.h> #include <linux/kernel.h>
#include "nodelist.h" #include "nodelist.h"
#include "os-ecos.h"
#include "porting.h" #include "porting.h"
...@@ -22,3 +21,9 @@ void jffs2_get_info_from_sb(void * data, struct jffs2_fs_info * info) ...@@ -22,3 +21,9 @@ void jffs2_get_info_from_sb(void * data, struct jffs2_fs_info * info)
info->nr_blocks = c->nr_blocks; info->nr_blocks = c->nr_blocks;
info->free_size = c->free_size; //fixme need test! info->free_size = c->free_size; //fixme need test!
} }
int jffs2_porting_stat(cyg_mtab_entry * mte, cyg_dir dir, const char *name,
void * stat_buf)
{
return jffs2_fste.stat(mte, mte->root, name, (struct stat *)stat_buf);
}
#ifndef _PORTING_H #ifndef _PORTING_H
#define _PORTING_H #define _PORTING_H
/* the following should be same with os_sys_stat.h */ /* the following should be same with os_sys_stat.h */
#define JFFS2_S_IFMT 0x000003FF #define JFFS2_S_IFMT 0x000003FF
#define JFFS2_S_IFDIR (1<<0) #define JFFS2_S_IFDIR (1<<0)
#define JFFS2_S_IFREG (1<<3) #define JFFS2_S_IFREG (1<<3)
struct jffs2_fs_info struct jffs2_fs_info
{ {
unsigned sector_size; /* a erasing block size*/ unsigned sector_size; /* a erasing block size*/
unsigned nr_blocks; /* number of blocks in flash */ unsigned nr_blocks; /* number of blocks in flash */
unsigned free_size; unsigned free_size;
}; };
struct jffs2_stat { struct jffs2_stat {
unsigned long st_mode; /* File mode */ unsigned long st_mode; /* File mode */
unsigned int st_ino; /* File serial number */ unsigned int st_ino; /* File serial number */
...@@ -24,9 +24,11 @@ struct jffs2_stat { ...@@ -24,9 +24,11 @@ struct jffs2_stat {
long st_atime; /* Last access time */ long st_atime; /* Last access time */
long st_mtime; /* Last data modification time */ long st_mtime; /* Last data modification time */
long st_ctime; /* Last file status change time */ long st_ctime; /* Last file status change time */
}; };
#ifndef NAME_MAX
#define NAME_MAX 14 #define NAME_MAX 14
#endif
struct jffs2_dirent struct jffs2_dirent
{ {
unsigned long d_type; // Only supported with FATFS, RAMFS, ROMFS, unsigned long d_type; // Only supported with FATFS, RAMFS, ROMFS,
...@@ -34,5 +36,14 @@ struct jffs2_dirent ...@@ -34,5 +36,14 @@ struct jffs2_dirent
// d_type is not part of POSIX so // d_type is not part of POSIX so
// should be used with caution. // should be used with caution.
char d_name[NAME_MAX+1]; char d_name[NAME_MAX+1];
}; };
#endif
extern cyg_fileops jffs2_fileops;
extern cyg_fileops jffs2_dirops;
extern struct cyg_fstab_entry jffs2_fste;
extern void jffs2_get_info_from_sb(void * data, struct jffs2_fs_info * info);
extern int jffs2_porting_stat(cyg_mtab_entry * mte, cyg_dir dir, const char *name,
void * stat_buf);
#endif
...@@ -195,7 +195,7 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in, ...@@ -195,7 +195,7 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,
int pos=0; int pos=0;
struct rubin_state rs; struct rubin_state rs;
init_pushpull(&rs.pp, cpage_out, *dstlen * 8, 0, 32); init_pushpull(&rs.pp, (char *)cpage_out, *dstlen * 8, 0, 32);
init_rubin(&rs, bit_divider, bits); init_rubin(&rs, bit_divider, bits);
...@@ -299,7 +299,7 @@ static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata ...@@ -299,7 +299,7 @@ static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata
int outpos = 0; int outpos = 0;
struct rubin_state rs; struct rubin_state rs;
init_pushpull(&rs.pp, cdata_in, srclen, 0, 0); init_pushpull(&rs.pp, (char *)cdata_in, srclen, 0, 0);
init_decode(&rs, bit_divider, bits); init_decode(&rs, bit_divider, bits);
while (outpos < destlen) { while (outpos < destlen) {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* $Id: compr_zlib.c,v 1.31 2005/05/20 19:30:06 gleixner Exp $ * $Id: compr_zlib.c,v 1.31 2005/05/20 19:30:06 gleixner Exp $
* *
*/ */
#include "jffs2_config.h"
#if !defined(__KERNEL__) && !defined(__ECOS) #if !defined(__KERNEL__) && !defined(__ECOS)
#error "The userspace support got too messy and was removed. Update your mkfs.jffs2" #error "The userspace support got too messy and was removed. Update your mkfs.jffs2"
#endif #endif
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
*/ */
#ifndef _JFFS2_DEBUG_H_ #ifndef _JFFS2_DEBUG_H_
#define _JFFS2_DEBUG_H_ #define _JFFS2_DEBUG_H_
#include "jffs2_config.h"
#include <linux/config.h> #include <linux/config.h>
#include <linux/slab.h> //prife
#ifndef CONFIG_JFFS2_FS_DEBUG #ifndef CONFIG_JFFS2_FS_DEBUG
#define CONFIG_JFFS2_FS_DEBUG 0 #define CONFIG_JFFS2_FS_DEBUG 0
#endif #endif
......
...@@ -333,7 +333,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl ...@@ -333,7 +333,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
} }
for (i=0; i<readlen; i += sizeof(unsigned long)) { for (i=0; i<readlen; i += sizeof(unsigned long)) {
/* It's OK. We know it's properly aligned */ /* It's OK. We know it's properly aligned */
unsigned long *datum = (char *)ebuf + i; unsigned long *datum = (unsigned long *)((char *)ebuf + i);
if (*datum + 1) { if (*datum + 1) {
*bad_offset += i; *bad_offset += i;
printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", *datum, *bad_offset); printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", *datum, *bad_offset);
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
//#include <io.h> //#include <io.h>
//#include <fcntl.h> //#include <fcntl.h>
// #include <string.h> // #include <string.h>
//#include <sys/stat.h> //#include <sys/stat.h>
#include <rtthread.h> #include <rtthread.h>
cyg_bool jffs2_flash_read(struct jffs2_sb_info * c, cyg_bool jffs2_flash_read(struct jffs2_sb_info * c,
...@@ -128,7 +128,7 @@ jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs, ...@@ -128,7 +128,7 @@ jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs,
} }
ret = ret =
jffs2_flash_write(c, to, sizetomalloc, jffs2_flash_write(c, to, sizetomalloc,
&thislen, cbuf); &thislen, (unsigned char *)cbuf);
if (thislen > totvecsize) // in case it was aligned up if (thislen > totvecsize) // in case it was aligned up
thislen = totvecsize; thislen = totvecsize;
totlen += thislen; totlen += thislen;
...@@ -147,7 +147,7 @@ jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs, ...@@ -147,7 +147,7 @@ jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs,
ret = ret =
jffs2_flash_write(c, to, lentowrite, jffs2_flash_write(c, to, lentowrite,
&thislen, (char *) &buf); &thislen, (unsigned char *) &buf);
if (thislen > vecs[i].iov_len) if (thislen > vecs[i].iov_len)
thislen = vecs[i].iov_len; thislen = vecs[i].iov_len;
} // else } // else
...@@ -180,7 +180,7 @@ cyg_bool jffs2_flash_erase(struct jffs2_sb_info * c, ...@@ -180,7 +180,7 @@ cyg_bool jffs2_flash_erase(struct jffs2_sb_info * c,
// err = cyg_io_get_config(sb->s_dev, CYG_IO_GET_CONFIG_FLASH_ERASE, // err = cyg_io_get_config(sb->s_dev, CYG_IO_GET_CONFIG_FLASH_ERASE,
// &e, &len); // &e, &len);
res = rt_device_control(sb->s_dev, RT_DEVICE_CTRL_BLK_ERASE, jeb->offset); res = rt_device_control(sb->s_dev, RT_DEVICE_CTRL_BLK_ERASE, (void *)(jeb->offset));
return ((res == RT_EOK) ? ENOERR : -EIO); return ((res == RT_EOK) ? ENOERR : -EIO);
//这里 jeb数据结构 //这里 jeb数据结构
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* $Id: fs-ecos.c,v 1.44 2005/07/24 15:29:57 dedekind Exp $ * $Id: fs-ecos.c,v 1.44 2005/07/24 15:29:57 dedekind Exp $
* *
*/ */
#include <stdio.h> //prife for SEEK_SET SEEK_CUR SEEK_END #include <stdio.h> //prife for SEEK_SET SEEK_CUR SEEK_END
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -491,6 +491,10 @@ static int jffs2_read_super(struct super_block *sb) ...@@ -491,6 +491,10 @@ static int jffs2_read_super(struct super_block *sb)
struct rt_device_blk_geometry geometry; //fixme need a new struct type! struct rt_device_blk_geometry geometry; //fixme need a new struct type!
c = JFFS2_SB_INFO(sb); c = JFFS2_SB_INFO(sb);
//init some block
init_MUTEX(&c->alloc_sem);
init_MUTEX(&c->erase_free_sem);
rt_memset(&geometry, 0, sizeof(geometry)); rt_memset(&geometry, 0, sizeof(geometry));
rt_device_control(sb->s_dev, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry); rt_device_control(sb->s_dev, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);
...@@ -552,7 +556,7 @@ int jffs2_mount(cyg_fstab_entry * fste, cyg_mtab_entry * mte) ...@@ -552,7 +556,7 @@ int jffs2_mount(cyg_fstab_entry * fste, cyg_mtab_entry * mte)
// } // }
// } // }
jffs2_sb = NULL; jffs2_sb = NULL;
t = mte->data; //get from dfs_jffs2; t = (cyg_io_handle_t)mte->data; //get from dfs_jffs2;
if (jffs2_sb == NULL) { if (jffs2_sb == NULL) {
jffs2_sb = malloc(sizeof (struct super_block)); jffs2_sb = malloc(sizeof (struct super_block));
...@@ -1637,8 +1641,6 @@ static int jffs2_fo_getinfo(struct CYG_FILE_TAG *fp, int key, void *buf, ...@@ -1637,8 +1641,6 @@ static int jffs2_fo_getinfo(struct CYG_FILE_TAG *fp, int key, void *buf,
err = EINVAL; err = EINVAL;
} }
return err; return err;
return ENOERR;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
......
...@@ -126,8 +126,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) ...@@ -126,8 +126,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
struct jffs2_raw_node_ref *raw; struct jffs2_raw_node_ref *raw;
int ret = 0, inum, nlink; int ret = 0, inum, nlink;
// if (down_interruptible(&c->alloc_sem)) //fixme prife !! if (down_interruptible(&c->alloc_sem))
// return -EINTR; return -EINTR;
for (;;) { for (;;) {
spin_lock(&c->erase_completion_lock); spin_lock(&c->erase_completion_lock);
...@@ -527,7 +527,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, ...@@ -527,7 +527,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
if (!node) if (!node)
return -ENOMEM; return -ENOMEM;
ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (char *)node); ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (unsigned char *)node);
if (!ret && retlen != rawlen) if (!ret && retlen != rawlen)
ret = -EIO; ret = -EIO;
if (ret) if (ret)
...@@ -594,7 +594,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, ...@@ -594,7 +594,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
nraw->__totlen = rawlen; nraw->__totlen = rawlen;
nraw->next_phys = NULL; nraw->next_phys = NULL;
ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (char *)node); ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (unsigned char *)node);
if (ret || (retlen != rawlen)) { if (ret || (retlen != rawlen)) {
printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n", printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n",
...@@ -691,7 +691,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_ ...@@ -691,7 +691,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
printk(KERN_WARNING "kmalloc of mdata failed in jffs2_garbage_collect_metadata()\n"); printk(KERN_WARNING "kmalloc of mdata failed in jffs2_garbage_collect_metadata()\n");
return -ENOMEM; return -ENOMEM;
} }
ret = jffs2_read_dnode(c, f, fn, mdata, 0, mdatalen); ret = jffs2_read_dnode(c, f, fn, (unsigned char *)mdata, 0, mdatalen);
if (ret) { if (ret) {
printk(KERN_WARNING "read of old metadata failed in jffs2_garbage_collect_metadata(): %d\n", ret); printk(KERN_WARNING "read of old metadata failed in jffs2_garbage_collect_metadata(): %d\n", ret);
kfree(mdata); kfree(mdata);
...@@ -738,7 +738,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_ ...@@ -738,7 +738,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
ri.data_crc = cpu_to_je32(crc32(0, mdata, mdatalen)); ri.data_crc = cpu_to_je32(crc32(0, mdata, mdatalen));
new_fn = jffs2_write_dnode(c, f, &ri, mdata, mdatalen, phys_ofs, ALLOC_GC); new_fn = jffs2_write_dnode(c, f, &ri, (const unsigned char *)mdata, mdatalen, phys_ofs, ALLOC_GC);
if (IS_ERR(new_fn)) { if (IS_ERR(new_fn)) {
printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn)); printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn));
...@@ -764,7 +764,7 @@ static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_er ...@@ -764,7 +764,7 @@ static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_er
rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
rd.nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); rd.nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT);
rd.nsize = strlen(fd->name); rd.nsize = strlen((const char *)fd->name);
rd.totlen = cpu_to_je32(sizeof(rd) + rd.nsize); rd.totlen = cpu_to_je32(sizeof(rd) + rd.nsize);
rd.hdr_crc = cpu_to_je32(crc32(0, &rd, sizeof(struct jffs2_unknown_node)-4)); rd.hdr_crc = cpu_to_je32(crc32(0, &rd, sizeof(struct jffs2_unknown_node)-4));
...@@ -808,7 +808,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct ...@@ -808,7 +808,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
struct jffs2_raw_node_ref *raw; struct jffs2_raw_node_ref *raw;
int ret; int ret;
size_t retlen; size_t retlen;
int name_len = strlen(fd->name); int name_len = strlen((const char *)fd->name);
uint32_t name_crc = crc32(0, fd->name, name_len); uint32_t name_crc = crc32(0, fd->name, name_len);
uint32_t rawlen = ref_totlen(c, jeb, fd->raw); uint32_t rawlen = ref_totlen(c, jeb, fd->raw);
...@@ -840,7 +840,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct ...@@ -840,7 +840,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
/* This is an obsolete node belonging to the same directory, and it's of the right /* This is an obsolete node belonging to the same directory, and it's of the right
length. We need to take a closer look...*/ length. We need to take a closer look...*/
ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (char *)rd); ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (unsigned char *)rd);
if (ret) { if (ret) {
printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Read error (%d) reading obsolete node at %08x\n", ret, ref_offset(raw)); printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Read error (%d) reading obsolete node at %08x\n", ret, ref_offset(raw));
/* If we can't read it, we don't need to continue to obsolete it. Continue */ /* If we can't read it, we don't need to continue to obsolete it. Continue */
...@@ -920,7 +920,7 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras ...@@ -920,7 +920,7 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
uint32_t crc; uint32_t crc;
/* It's partially obsoleted by a later write. So we have to /* It's partially obsoleted by a later write. So we have to
write it out again with the _same_ version as before */ write it out again with the _same_ version as before */
ret = jffs2_flash_read(c, ref_offset(fn->raw), sizeof(ri), &readlen, (char *)&ri); ret = jffs2_flash_read(c, ref_offset(fn->raw), sizeof(ri), &readlen, (unsigned char *)&ri);
if (readlen != sizeof(ri) || ret) { if (readlen != sizeof(ri) || ret) {
printk(KERN_WARNING "Node read failed in jffs2_garbage_collect_hole. Ret %d, retlen %zd. Data will be lost by writing new hole node\n", ret, readlen); printk(KERN_WARNING "Node read failed in jffs2_garbage_collect_hole. Ret %d, retlen %zd. Data will be lost by writing new hole node\n", ret, readlen);
goto fill; goto fill;
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "nodelist.h" #include "nodelist.h"
//#include <cyg/kernel/kapi.h> prife //#include <cyg/kernel/kapi.h> prife
#if defined(CYGOPT_FS_JFFS2_GCTHREAD)
#define GC_THREAD_FLAG_TRIG 1 #define GC_THREAD_FLAG_TRIG 1
#define GC_THREAD_FLAG_STOP 2 #define GC_THREAD_FLAG_STOP 2
#define GC_THREAD_FLAG_HAS_EXIT 4 #define GC_THREAD_FLAG_HAS_EXIT 4
...@@ -133,10 +135,6 @@ rt_uint32_t cyg_current_time(void) ...@@ -133,10 +135,6 @@ rt_uint32_t cyg_current_time(void)
static void static void
jffs2_garbage_collect_thread(unsigned long data); jffs2_garbage_collect_thread(unsigned long data);
#define CYGNUM_JFFS2_GC_THREAD_PRIORITY 20
#define CYGNUM_JFFS2_GS_THREAD_TICKS 20
#define CYGNUM_JFFS2_GC_THREAD_TICKS 20
void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c)
{ {
struct super_block *sb=OFNI_BS_2SFFJ(c); struct super_block *sb=OFNI_BS_2SFFJ(c);
...@@ -251,3 +249,4 @@ jffs2_garbage_collect_thread(unsigned long data) ...@@ -251,3 +249,4 @@ jffs2_garbage_collect_thread(unsigned long data)
D1(printk("jffs2_garbage_collect_thread EXIT\n")); D1(printk("jffs2_garbage_collect_thread EXIT\n"));
rt_event_send(&sb->s_gc_thread_flags,GC_THREAD_FLAG_HAS_EXIT); rt_event_send(&sb->s_gc_thread_flags,GC_THREAD_FLAG_HAS_EXIT);
} }
#endif
...@@ -28,7 +28,7 @@ void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new ...@@ -28,7 +28,7 @@ void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new
JFFS2_DBG_DENTLIST("add dirent \"%s\", ino #%u\n", new->name, new->ino); JFFS2_DBG_DENTLIST("add dirent \"%s\", ino #%u\n", new->name, new->ino);
while ((*prev) && (*prev)->nhash <= new->nhash) { while ((*prev) && (*prev)->nhash <= new->nhash) {
if ((*prev)->nhash == new->nhash && !strcmp((*prev)->name, new->name)) { if ((*prev)->nhash == new->nhash && !strcmp((const char *)((*prev)->name), (const char *)new->name)) {
/* Duplicate. Free one */ /* Duplicate. Free one */
if (new->version < (*prev)->version) { if (new->version < (*prev)->version) {
JFFS2_DBG_DENTLIST("Eep! Marking new dirent node is obsolete, old is \"%s\", ino #%u\n", JFFS2_DBG_DENTLIST("Eep! Marking new dirent node is obsolete, old is \"%s\", ino #%u\n",
......
...@@ -12,8 +12,9 @@ ...@@ -12,8 +12,9 @@
*/ */
#ifndef __JFFS2_NODELIST_H__ #ifndef __JFFS2_NODELIST_H__
#define __JFFS2_NODELIST_H__ #define __JFFS2_NODELIST_H__
#include "jffs2_config.h"
#include <linux/config.h> #include <linux/config.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/types.h> #include <linux/types.h>
......
...@@ -541,7 +541,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref ...@@ -541,7 +541,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
by jffs2_free_all_node_refs() in erase.c. Which is nice. */ by jffs2_free_all_node_refs() in erase.c. Which is nice. */
D1(printk(KERN_DEBUG "obliterating obsoleted node at 0x%08x\n", ref_offset(ref))); D1(printk(KERN_DEBUG "obliterating obsoleted node at 0x%08x\n", ref_offset(ref)));
ret = jffs2_flash_read(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n); ret = jffs2_flash_read(c, ref_offset(ref), sizeof(n), &retlen, (unsigned char *)&n);
if (ret) { if (ret) {
printk(KERN_WARNING "Read error reading from obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret); printk(KERN_WARNING "Read error reading from obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret);
goto out_erase_sem; goto out_erase_sem;
...@@ -560,7 +560,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref ...@@ -560,7 +560,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
} }
/* XXX FIXME: This is ugly now */ /* XXX FIXME: This is ugly now */
n.nodetype = cpu_to_je16(je16_to_cpu(n.nodetype) & ~JFFS2_NODE_ACCURATE); n.nodetype = cpu_to_je16(je16_to_cpu(n.nodetype) & ~JFFS2_NODE_ACCURATE);
ret = jffs2_flash_write(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n); ret = jffs2_flash_write(c, ref_offset(ref), sizeof(n), &retlen, (unsigned char *)&n);
if (ret) { if (ret) {
printk(KERN_WARNING "Write error in obliterating obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret); printk(KERN_WARNING "Write error in obliterating obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret);
goto out_erase_sem; goto out_erase_sem;
......
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
#ifndef __JFFS2_OS_ECOS_H__ #ifndef __JFFS2_OS_ECOS_H__
#define __JFFS2_OS_ECOS_H__ #define __JFFS2_OS_ECOS_H__
#include "jffs2_config.h"
#include <rtthread.h> #include <rtthread.h>
#define printf rt_kprintf #define malloc rt_malloc
#define free rt_free
#define printf rt_kprintf
//#include <pkgconf/fs_jffs2.h> //#include <pkgconf/fs_jffs2.h>
//#include <cyg/io/io.h> //#include <cyg/io/io.h>
...@@ -43,7 +45,7 @@ ...@@ -43,7 +45,7 @@
//#include <errno.h> //fixme //#include <errno.h> //fixme
//#include <dirent.h> //#include <dirent.h>
#define CYGPKG_FILEIO_DIRENT_DTYPE
struct dirent struct dirent
{ {
#ifdef CYGPKG_FILEIO_DIRENT_DTYPE #ifdef CYGPKG_FILEIO_DIRENT_DTYPE
...@@ -57,7 +59,7 @@ struct dirent ...@@ -57,7 +59,7 @@ struct dirent
}; };
#include <stdlib.h> //#include <stdlib.h>
#include <string.h> #include <string.h>
#include <cyg/fileio/fileio.h> //prife #include <cyg/fileio/fileio.h> //prife
...@@ -161,8 +163,8 @@ struct super_block { ...@@ -161,8 +163,8 @@ struct super_block {
// char s_gc_thread_stack[CYGNUM_HAL_STACK_SIZE_MINIMUM]; // char s_gc_thread_stack[CYGNUM_HAL_STACK_SIZE_MINIMUM];
//#endif //#endif
// cyg_mtab_entry *mte; // cyg_mtab_entry *mte;
//#endif //#endif
#ifdef CYGOPT_FS_JFFS2_GCTHREAD #ifdef CYGOPT_FS_JFFS2_GCTHREAD
struct rt_mutex s_lock; // Lock the inode cache struct rt_mutex s_lock; // Lock the inode cache
struct rt_event s_gc_thread_flags; // Communication with the gcthread struct rt_event s_gc_thread_flags; // Communication with the gcthread
...@@ -172,12 +174,12 @@ struct super_block { ...@@ -172,12 +174,12 @@ struct super_block {
// char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE]; // char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE];
//#else //#else
// char s_gc_thread_stack[CYGNUM_HAL_STACK_SIZE_MINIMUM]; // char s_gc_thread_stack[CYGNUM_HAL_STACK_SIZE_MINIMUM];
//#endif //#endif
#define CYGNUM_JFFS2_GC_THREAD_STACK_SIZE (1024*4) #define CYGNUM_JFFS2_GC_THREAD_STACK_SIZE (1024*4)
char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE]; char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE];
cyg_mtab_entry *mte; cyg_mtab_entry *mte;
#endif #endif
}; };
...@@ -260,6 +262,6 @@ static inline void jffs2_erase_pending_trigger(struct jffs2_sb_info *c) ...@@ -260,6 +262,6 @@ static inline void jffs2_erase_pending_trigger(struct jffs2_sb_info *c)
#define BUG_ON(x) do { if (unlikely(x)) BUG(); } while(0) #define BUG_ON(x) do { if (unlikely(x)) BUG(); } while(0)
#endif #endif
#define __init #define __init
#endif /* __JFFS2_OS_ECOS_H__ */ #endif /* __JFFS2_OS_ECOS_H__ */
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
#ifndef __JFFS2_OS_RTTHREAD_H__ #ifndef __JFFS2_OS_RTTHREAD_H__
#define __JFFS2_OS_RTTHREAD_H__ #define __JFFS2_OS_RTTHREAD_H__
#include "jffs2_config.h"
#include <rtthread.h> #include <rtthread.h>
#define free rt_free
#define printf rt_kprintf
#define printf rt_kprintf #define printf rt_kprintf
//#include <pkgconf/fs_jffs2.h> //#include <pkgconf/fs_jffs2.h>
...@@ -56,8 +58,6 @@ struct dirent ...@@ -56,8 +58,6 @@ struct dirent
char d_name[NAME_MAX+1]; char d_name[NAME_MAX+1];
}; };
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <cyg/fileio/fileio.h> //prife #include <cyg/fileio/fileio.h> //prife
......
...@@ -26,7 +26,7 @@ struct pushpull { ...@@ -26,7 +26,7 @@ struct pushpull {
static inline void init_pushpull(struct pushpull *pp, char *buf, unsigned buflen, unsigned ofs, unsigned reserve) static inline void init_pushpull(struct pushpull *pp, char *buf, unsigned buflen, unsigned ofs, unsigned reserve)
{ {
pp->buf = buf; pp->buf = (unsigned char *)buf;
pp->buflen = buflen; pp->buflen = buflen;
pp->ofs = ofs; pp->ofs = ofs;
pp->reserve = reserve; pp->reserve = reserve;
......
...@@ -35,7 +35,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -35,7 +35,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
if (!ri) if (!ri)
return -ENOMEM; return -ENOMEM;
ret = jffs2_flash_read(c, ref_offset(fd->raw), sizeof(*ri), &readlen, (char *)ri); ret = jffs2_flash_read(c, ref_offset(fd->raw), sizeof(*ri), &readlen, (unsigned char *)ri);
if (ret) { if (ret) {
jffs2_free_raw_inode(ri); jffs2_free_raw_inode(ri);
printk(KERN_WARNING "Error reading node from 0x%08x: %d\n", ref_offset(fd->raw), ret); printk(KERN_WARNING "Error reading node from 0x%08x: %d\n", ref_offset(fd->raw), ret);
......
...@@ -477,7 +477,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf ...@@ -477,7 +477,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
goto free_out; goto free_out;
} }
err = read_direntry(c, ref, &node.d, retlen, &ret_fd, latest_mctime, mctime_ver); err = read_direntry(c, ref, &node.d, retlen, &ret_fd, (int32_t *)latest_mctime, mctime_ver);
if (err == 1) { if (err == 1) {
jffs2_mark_node_obsolete(c, ref); jffs2_mark_node_obsolete(c, ref);
break; break;
...@@ -498,7 +498,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf ...@@ -498,7 +498,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
goto free_out; goto free_out;
} }
err = read_dnode(c, ref, &node.i, retlen, &ret_tn, latest_mctime, mctime_ver); err = read_dnode(c, ref, &node.i, retlen, &ret_tn, (int32_t *)latest_mctime, mctime_ver);
if (err == 1) { if (err == 1) {
jffs2_mark_node_obsolete(c, ref); jffs2_mark_node_obsolete(c, ref);
break; break;
......
...@@ -249,7 +249,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff ...@@ -249,7 +249,7 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
fd->version = je32_to_cpu(rd->version); fd->version = je32_to_cpu(rd->version);
fd->ino = je32_to_cpu(rd->ino); fd->ino = je32_to_cpu(rd->ino);
fd->nhash = full_name_hash(name, strlen(name)); fd->nhash = full_name_hash(name, strlen((const char *)name));
fd->type = rd->type; fd->type = rd->type;
memcpy(fd->name, name, namelen); memcpy(fd->name, name, namelen);
fd->name[namelen]=0; fd->name[namelen]=0;
...@@ -509,7 +509,7 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str ...@@ -509,7 +509,7 @@ int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, str
rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); rd->name_crc = cpu_to_je32(crc32(0, name, namelen));
fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, ALLOC_NORMAL); fd = jffs2_write_dirent(c, dir_f, rd, (const unsigned char *)name, namelen, phys_ofs, ALLOC_NORMAL);
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);
...@@ -571,7 +571,7 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, ...@@ -571,7 +571,7 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); rd->name_crc = cpu_to_je32(crc32(0, name, namelen));
fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, ALLOC_DELETION); fd = jffs2_write_dirent(c, dir_f, rd, (const unsigned char *)name, namelen, phys_ofs, ALLOC_DELETION);
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);
...@@ -586,7 +586,7 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, ...@@ -586,7 +586,7 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
up(&dir_f->sem); up(&dir_f->sem);
} else { } else {
struct jffs2_full_dirent **prev = &dir_f->dents; struct jffs2_full_dirent **prev = &dir_f->dents;
uint32_t nhash = full_name_hash(name, namelen); uint32_t nhash = full_name_hash((const unsigned char *)name, namelen);
down(&dir_f->sem); down(&dir_f->sem);
...@@ -682,7 +682,7 @@ int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint ...@@ -682,7 +682,7 @@ int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint
rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8));
rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); rd->name_crc = cpu_to_je32(crc32(0, name, namelen));
fd = jffs2_write_dirent(c, dir_f, rd, name, namelen, phys_ofs, ALLOC_NORMAL); fd = jffs2_write_dirent(c, dir_f, rd, (const unsigned char *)name, namelen, phys_ofs, ALLOC_NORMAL);
jffs2_free_raw_dirent(rd); jffs2_free_raw_dirent(rd);
......
...@@ -620,6 +620,7 @@ enum rt_device_class_type ...@@ -620,6 +620,7 @@ enum rt_device_class_type
#define RT_DEVICE_CTRL_MTD_FORMAT 0x10 /**< format a MTD device */ #define RT_DEVICE_CTRL_MTD_FORMAT 0x10 /**< format a MTD device */
#define RT_DEVICE_CTRL_RTC_GET_TIME 0x10 /**< get time */ #define RT_DEVICE_CTRL_RTC_GET_TIME 0x10 /**< get time */
#define RT_DEVICE_CTRL_RTC_SET_TIME 0x11 /**< set time */ #define RT_DEVICE_CTRL_RTC_SET_TIME 0x11 /**< set time */
#define RT_DEVICE_CTRL_BLK_ERASE 0x12 /**< erase */
typedef struct rt_device *rt_device_t; typedef struct rt_device *rt_device_t;
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册