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
This commit is contained in:
parent
18888679cd
commit
4f72d1cba1
|
@ -96,6 +96,18 @@ filesystems/uffs/flash/nand_ids.c
|
|||
jffs2 = Split('''
|
||||
filesystems/jffs2/dfs_jffs2.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/crc32.c
|
||||
filesystems/jffs2/cyg/crc/posix_crc.c
|
||||
|
@ -104,12 +116,14 @@ filesystems/jffs2/src/build.c
|
|||
filesystems/jffs2/src/compr.c
|
||||
filesystems/jffs2/src/compr_rtime.c
|
||||
filesystems/jffs2/src/compr_rubin.c
|
||||
filesystems/jffs2/src/compr_zlib.c
|
||||
filesystems/jffs2/src/debug.c
|
||||
filesystems/jffs2/src/dir-ecos.c
|
||||
filesystems/jffs2/src/erase.c
|
||||
filesystems/jffs2/src/flashio.c
|
||||
filesystems/jffs2/src/fs-ecos.c
|
||||
filesystems/jffs2/src/gc.c
|
||||
filesystems/jffs2/src/gcthread.c
|
||||
filesystems/jffs2/src/malloc-ecos.c
|
||||
filesystems/jffs2/src/nodelist.c
|
||||
filesystems/jffs2/src/nodemgmt.c
|
||||
|
@ -158,8 +172,9 @@ if GetDepend('RT_USING_DFS_JFFS2'):
|
|||
path = path + [RTT_ROOT + '/components/dfs/filesystems/jffs2/src', \
|
||||
RTT_ROOT + '/components/dfs/filesystems/jffs2/kernel', \
|
||||
RTT_ROOT + '/components/dfs/filesystems/jffs2/include', \
|
||||
RTT_ROOT + '/components/dfs/filesystems/jffs2']
|
||||
CPPDEFINES = CPPDEFINES + ['__ECOS']
|
||||
RTT_ROOT + '/components/dfs/filesystems/jffs2', \
|
||||
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)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# include <stddef.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
//# include <stdlib.h> //remove by prife @ 2012/1/30
|
||||
#endif
|
||||
#ifdef NO_ERRNO_H
|
||||
# ifdef _WIN32_WCE
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "dfs_jffs2.h"
|
||||
#include "porting.h"
|
||||
#include <string.h>
|
||||
|
||||
#define FILE_PATH_MAX 256 /* the longest file path */
|
||||
|
||||
|
@ -32,10 +33,6 @@
|
|||
#error "support only one jffs2 partition on a flash device!"
|
||||
#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
|
||||
struct device_part
|
||||
{
|
||||
|
@ -204,7 +201,6 @@ static int dfs_jffs2_unmount(struct dfs_filesystem* fs)
|
|||
{
|
||||
if (device_partition[index].dev == fs->dev_id)
|
||||
{
|
||||
struct cyg_mtab_entry * mte;
|
||||
result = jffs2_umount(device_partition[index].mte);
|
||||
if (result)
|
||||
return jffs2_result_to_dfs(result);
|
||||
|
@ -237,7 +233,7 @@ static int dfs_jffs2_statfs(struct dfs_filesystem* fs,
|
|||
|
||||
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_blocks = info.nr_blocks;
|
||||
buf->f_bfree = info.free_size; //fixme need test!
|
||||
|
@ -325,8 +321,8 @@ static int dfs_jffs2_open(struct dfs_fd* file)
|
|||
file->data = jffs2_file;
|
||||
file->pos = jffs2_file->f_offset;
|
||||
file->size = 0;
|
||||
jffs2_file_lseek(jffs2_file, &(file->size), SEEK_END);
|
||||
jffs2_file->f_offset = file->pos;
|
||||
jffs2_file_lseek(jffs2_file, (off_t *)(&(file->size)), SEEK_END);
|
||||
jffs2_file->f_offset = (off_t)file->pos;
|
||||
|
||||
if (oflag & DFS_O_APPEND)
|
||||
{
|
||||
|
@ -407,7 +403,7 @@ static int dfs_jffs2_write(struct dfs_fd* file,
|
|||
RT_ASSERT(file->data != NULL);
|
||||
jffs2_file = (cyg_file *)(file->data);
|
||||
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_iovcnt = 1; //must be 1
|
||||
//uio_s.uio_offset //not used...
|
||||
|
@ -525,7 +521,7 @@ static int dfs_jffs2_unlink(struct dfs_filesystem* fs, const char* path)
|
|||
path++;
|
||||
|
||||
/* 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)
|
||||
return jffs2_result_to_dfs(result);
|
||||
|
||||
|
@ -584,7 +580,9 @@ static int dfs_jffs2_stat(struct dfs_filesystem* fs, const char *path, struct st
|
|||
if (result)
|
||||
return -DFS_STATUS_ENOENT;
|
||||
|
||||
result = jffs2_ops_stat(mte, mte->root, path, &s);
|
||||
// result = jffs2_ops_stat(mte, mte->root, path, &s);
|
||||
result = jffs2_porting_stat(mte, mte->root, path, (void *)&s);
|
||||
|
||||
if (result)
|
||||
return jffs2_result_to_dfs(result);
|
||||
/* convert to dfs stat structure */
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#ifndef _JFFS2_FS_SB
|
||||
#define _JFFS2_FS_SB
|
||||
|
||||
#include "jffs2_config.h"
|
||||
#include <linux/types.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#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
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef __LINUX_CONFIG_H__
|
||||
#define __LINUX_CONFIG_H__
|
||||
|
||||
#define CONFIG_JFFS2_FS_DEBUG 0
|
||||
#define GFP_KERNEL 0
|
||||
|
||||
/* #define CONFIG_JFFS2_FS_WRITEBUFFER 0 */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __LINUX_KERNEL_H__
|
||||
//#include <cyg/infra/diag.h>
|
||||
//#include <stdio.h> //mod by prife @ 2011/11/20
|
||||
#include "jffs2_config.h"
|
||||
|
||||
#define jiffies 100
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __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. */
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <linux/kernel.h>
|
||||
#include "nodelist.h"
|
||||
#include "os-ecos.h"
|
||||
|
||||
#include "porting.h"
|
||||
|
||||
|
@ -22,3 +21,9 @@ void jffs2_get_info_from_sb(void * data, struct jffs2_fs_info * info)
|
|||
info->nr_blocks = c->nr_blocks;
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -25,8 +25,10 @@ struct jffs2_stat {
|
|||
long st_mtime; /* Last data modification time */
|
||||
long st_ctime; /* Last file status change time */
|
||||
};
|
||||
|
||||
#ifndef NAME_MAX
|
||||
#define NAME_MAX 14
|
||||
#endif
|
||||
|
||||
struct jffs2_dirent
|
||||
{
|
||||
unsigned long d_type; // Only supported with FATFS, RAMFS, ROMFS,
|
||||
|
@ -35,4 +37,13 @@ struct jffs2_dirent
|
|||
// should be used with caution.
|
||||
char d_name[NAME_MAX+1];
|
||||
};
|
||||
|
||||
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,
|
|||
int pos=0;
|
||||
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);
|
||||
|
||||
|
@ -299,7 +299,7 @@ static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata
|
|||
int outpos = 0;
|
||||
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);
|
||||
|
||||
while (outpos < destlen) {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* $Id: compr_zlib.c,v 1.31 2005/05/20 19:30:06 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "jffs2_config.h"
|
||||
#if !defined(__KERNEL__) && !defined(__ECOS)
|
||||
#error "The userspace support got too messy and was removed. Update your mkfs.jffs2"
|
||||
#endif
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
*/
|
||||
#ifndef _JFFS2_DEBUG_H_
|
||||
#define _JFFS2_DEBUG_H_
|
||||
|
||||
#include "jffs2_config.h"
|
||||
#include <linux/config.h>
|
||||
#include <linux/slab.h> //prife
|
||||
|
||||
#ifndef CONFIG_JFFS2_FS_DEBUG
|
||||
#define CONFIG_JFFS2_FS_DEBUG 0
|
||||
#endif
|
||||
|
|
|
@ -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)) {
|
||||
/* 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) {
|
||||
*bad_offset += i;
|
||||
printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", *datum, *bad_offset);
|
||||
|
|
|
@ -128,7 +128,7 @@ jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs,
|
|||
}
|
||||
ret =
|
||||
jffs2_flash_write(c, to, sizetomalloc,
|
||||
&thislen, cbuf);
|
||||
&thislen, (unsigned char *)cbuf);
|
||||
if (thislen > totvecsize) // in case it was aligned up
|
||||
thislen = totvecsize;
|
||||
totlen += thislen;
|
||||
|
@ -147,7 +147,7 @@ jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs,
|
|||
|
||||
ret =
|
||||
jffs2_flash_write(c, to, lentowrite,
|
||||
&thislen, (char *) &buf);
|
||||
&thislen, (unsigned char *) &buf);
|
||||
if (thislen > vecs[i].iov_len)
|
||||
thislen = vecs[i].iov_len;
|
||||
} // else
|
||||
|
@ -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,
|
||||
// &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);
|
||||
|
||||
//这里 jeb数据结构
|
||||
|
|
|
@ -492,6 +492,10 @@ static int jffs2_read_super(struct super_block *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_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)
|
|||
// }
|
||||
// }
|
||||
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) {
|
||||
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,
|
|||
err = EINVAL;
|
||||
}
|
||||
return err;
|
||||
|
||||
return ENOERR;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
|
@ -126,8 +126,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
|
|||
struct jffs2_raw_node_ref *raw;
|
||||
int ret = 0, inum, nlink;
|
||||
|
||||
// if (down_interruptible(&c->alloc_sem)) //fixme prife !!
|
||||
// return -EINTR;
|
||||
if (down_interruptible(&c->alloc_sem))
|
||||
return -EINTR;
|
||||
|
||||
for (;;) {
|
||||
spin_lock(&c->erase_completion_lock);
|
||||
|
@ -527,7 +527,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
|
|||
if (!node)
|
||||
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)
|
||||
ret = -EIO;
|
||||
if (ret)
|
||||
|
@ -594,7 +594,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
|
|||
nraw->__totlen = rawlen;
|
||||
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)) {
|
||||
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_
|
|||
printk(KERN_WARNING "kmalloc of mdata failed in jffs2_garbage_collect_metadata()\n");
|
||||
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) {
|
||||
printk(KERN_WARNING "read of old metadata failed in jffs2_garbage_collect_metadata(): %d\n", ret);
|
||||
kfree(mdata);
|
||||
|
@ -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.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)) {
|
||||
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
|
|||
|
||||
rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
|
||||
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.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
|
|||
struct jffs2_raw_node_ref *raw;
|
||||
int ret;
|
||||
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 rawlen = ref_totlen(c, jeb, fd->raw);
|
||||
|
||||
|
@ -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
|
||||
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) {
|
||||
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 */
|
||||
|
@ -920,7 +920,7 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
|
|||
uint32_t crc;
|
||||
/* It's partially obsoleted by a later write. So we have to
|
||||
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) {
|
||||
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;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "nodelist.h"
|
||||
//#include <cyg/kernel/kapi.h> prife
|
||||
|
||||
#if defined(CYGOPT_FS_JFFS2_GCTHREAD)
|
||||
|
||||
#define GC_THREAD_FLAG_TRIG 1
|
||||
#define GC_THREAD_FLAG_STOP 2
|
||||
#define GC_THREAD_FLAG_HAS_EXIT 4
|
||||
|
@ -133,10 +135,6 @@ rt_uint32_t cyg_current_time(void)
|
|||
static void
|
||||
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)
|
||||
{
|
||||
struct super_block *sb=OFNI_BS_2SFFJ(c);
|
||||
|
@ -251,3 +249,4 @@ jffs2_garbage_collect_thread(unsigned long data)
|
|||
D1(printk("jffs2_garbage_collect_thread EXIT\n"));
|
||||
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
|
|||
JFFS2_DBG_DENTLIST("add dirent \"%s\", ino #%u\n", new->name, new->ino);
|
||||
|
||||
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 */
|
||||
if (new->version < (*prev)->version) {
|
||||
JFFS2_DBG_DENTLIST("Eep! Marking new dirent node is obsolete, old is \"%s\", ino #%u\n",
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#ifndef __JFFS2_NODELIST_H__
|
||||
#define __JFFS2_NODELIST_H__
|
||||
|
||||
#include "jffs2_config.h"
|
||||
#include <linux/config.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/types.h>
|
||||
|
|
|
@ -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. */
|
||||
|
||||
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) {
|
||||
printk(KERN_WARNING "Read error reading from obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret);
|
||||
goto out_erase_sem;
|
||||
|
@ -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 */
|
||||
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) {
|
||||
printk(KERN_WARNING "Write error in obliterating obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret);
|
||||
goto out_erase_sem;
|
||||
|
|
|
@ -13,8 +13,10 @@
|
|||
|
||||
#ifndef __JFFS2_OS_ECOS_H__
|
||||
#define __JFFS2_OS_ECOS_H__
|
||||
|
||||
#include "jffs2_config.h"
|
||||
#include <rtthread.h>
|
||||
#define malloc rt_malloc
|
||||
#define free rt_free
|
||||
#define printf rt_kprintf
|
||||
|
||||
//#include <pkgconf/fs_jffs2.h>
|
||||
|
@ -43,7 +45,7 @@
|
|||
//#include <errno.h> //fixme
|
||||
|
||||
//#include <dirent.h>
|
||||
#define CYGPKG_FILEIO_DIRENT_DTYPE
|
||||
|
||||
struct dirent
|
||||
{
|
||||
#ifdef CYGPKG_FILEIO_DIRENT_DTYPE
|
||||
|
@ -57,7 +59,7 @@ struct dirent
|
|||
};
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
//#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <cyg/fileio/fileio.h> //prife
|
||||
|
|
|
@ -13,8 +13,10 @@
|
|||
|
||||
#ifndef __JFFS2_OS_RTTHREAD_H__
|
||||
#define __JFFS2_OS_RTTHREAD_H__
|
||||
|
||||
#include "jffs2_config.h"
|
||||
#include <rtthread.h>
|
||||
#define free rt_free
|
||||
#define printf rt_kprintf
|
||||
#define printf rt_kprintf
|
||||
|
||||
//#include <pkgconf/fs_jffs2.h>
|
||||
|
@ -56,8 +58,6 @@ struct dirent
|
|||
char d_name[NAME_MAX+1];
|
||||
};
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <cyg/fileio/fileio.h> //prife
|
||||
|
|
|
@ -26,7 +26,7 @@ struct pushpull {
|
|||
|
||||
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->ofs = ofs;
|
||||
pp->reserve = reserve;
|
||||
|
|
|
@ -35,7 +35,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
|
|||
if (!ri)
|
||||
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) {
|
||||
jffs2_free_raw_inode(ri);
|
||||
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
|
|||
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) {
|
||||
jffs2_mark_node_obsolete(c, ref);
|
||||
break;
|
||||
|
@ -498,7 +498,7 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
|
|||
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) {
|
||||
jffs2_mark_node_obsolete(c, ref);
|
||||
break;
|
||||
|
|
|
@ -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->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;
|
||||
memcpy(fd->name, name, namelen);
|
||||
fd->name[namelen]=0;
|
||||
|
@ -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->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);
|
||||
|
||||
|
@ -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->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);
|
||||
|
||||
|
@ -586,7 +586,7 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
|
|||
up(&dir_f->sem);
|
||||
} else {
|
||||
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);
|
||||
|
||||
|
@ -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->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);
|
||||
|
||||
|
|
|
@ -620,6 +620,7 @@ enum rt_device_class_type
|
|||
#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_SET_TIME 0x11 /**< set time */
|
||||
#define RT_DEVICE_CTRL_BLK_ERASE 0x12 /**< erase */
|
||||
|
||||
typedef struct rt_device *rt_device_t;
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue