diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/README.OpenSource b/README.OpenSource new file mode 100755 index 0000000000000000000000000000000000000000..b57ec7bf3cd3771c6c1fb4f6a1c27dac3852543d --- /dev/null +++ b/README.OpenSource @@ -0,0 +1,11 @@ +[ + { + "Name" : "rt-thread", + "License" : "Apache License V2.0", + "License File" : "COPYRIGHT", + "Version Number" : "4.0.2", + "Owner" : "tonghaoyang1@huawei.com", + "Upstream URL" : "http://code.google.com/p/rt-thread/", + "Description" : "The Real-Time Thread(RT-Thread) Operating System is an open source real-time operating system developed by the RT-Thread Studio based in China, more on kernel and components Introduction." + } +] diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/README_zh.md b/README_zh.md old mode 100755 new mode 100644 diff --git a/components/dfs/filesystems/jffs2/cyg/fileio/fileio.h b/components/dfs/filesystems/jffs2/cyg/fileio/fileio.h old mode 100755 new mode 100644 diff --git a/components/dfs/filesystems/jffs2/include/port/fcntl.h b/components/dfs/filesystems/jffs2/include/port/fcntl.h old mode 100755 new mode 100644 diff --git a/components/dfs/filesystems/jffs2/jffs2_config.h b/components/dfs/filesystems/jffs2/jffs2_config.h old mode 100755 new mode 100644 index ef5e44a9ceca3d70356688124140a6635162f603..538d5b39f6103d1f7b2cec6625359bf95bdeba95 --- a/components/dfs/filesystems/jffs2/jffs2_config.h +++ b/components/dfs/filesystems/jffs2/jffs2_config.h @@ -1,9 +1,6 @@ #ifndef JFFS2_CONFIG_H #define JFFS2_CONFIG_H -#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 -#include "spinor.h" -#endif #include "mtd_partition.h" #ifdef __cplusplus diff --git a/components/dfs/filesystems/jffs2/porting.c b/components/dfs/filesystems/jffs2/porting.c old mode 100755 new mode 100644 diff --git a/components/dfs/filesystems/jffs2/porting.h b/components/dfs/filesystems/jffs2/porting.h old mode 100755 new mode 100644 diff --git a/components/dfs/filesystems/jffs2/src/LICENCE b/components/dfs/filesystems/jffs2/src/LICENCE old mode 100755 new mode 100644 diff --git a/components/dfs/filesystems/jffs2/src/fs-ecos.c b/components/dfs/filesystems/jffs2/src/fs-ecos.c index 45ba8f00142abb4ac170790231c1b85f17731f25..fcc891d73d1ff316c88c5e04cfab0800c2e6ff18 100755 --- a/components/dfs/filesystems/jffs2/src/fs-ecos.c +++ b/components/dfs/filesystems/jffs2/src/fs-ecos.c @@ -24,9 +24,6 @@ #include "jffs2/compr.h" #include "port/fcntl.h" #include "porting.h" -#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 -#include "spinor.h" -#endif #include "limits.h" #include "los_process_pri.h" #include "capability_type.h" @@ -166,7 +163,7 @@ static int find_entry(jffs2_dirsearch * ds) struct _inode *dir = ds->dir; const unsigned char *name = ds->path; const unsigned char *n = name; - char namelen = 0; + int namelen = 0; struct _inode *d; int accMode = 0; @@ -1418,7 +1415,6 @@ static int jffs2_fo_dirread(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio) out_sem: mutex_unlock(&f->sem); if (fd == NULL) { - fp->f_offset = 2; D2(printk (KERN_DEBUG "reached the end of the directory\n")); return ENOENT; diff --git a/components/dfs/filesystems/jffs2/src/os-ecos.h b/components/dfs/filesystems/jffs2/src/os-ecos.h old mode 100755 new mode 100644 index 04892c5256e4b82eda8fd6e0cdf5fe56b5391d6d..73f121e16f63e01d4e01d6e414751673db37048b --- a/components/dfs/filesystems/jffs2/src/os-ecos.h +++ b/components/dfs/filesystems/jffs2/src/os-ecos.h @@ -24,9 +24,6 @@ #include "errno.h" #include "jffs2_fs_i.h" #include "jffs2_fs_sb.h" -#ifndef LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7 -#include "spinor.h" -#endif #include "fileio.h" #include "sys/uio.h" diff --git a/components/dfs/filesystems/jffs2/vfs_jffs2.c b/components/dfs/filesystems/jffs2/vfs_jffs2.c index b617716f0dd70bd74257e8a59e73a9dd6b750608..506f6e37d3ee0bb587d2712155366a227736862d 100755 --- a/components/dfs/filesystems/jffs2/vfs_jffs2.c +++ b/components/dfs/filesystems/jffs2/vfs_jffs2.c @@ -293,19 +293,19 @@ static loff_t vfs_jffs_seek64(FAR struct file *filep, loff_t offset, int whence) static int vfs_jffs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { - PRINT_ERR("%s NOT SUPPORT\n", __FUNCTION__); + PRINT_DEBUG("%s NOT SUPPORT\n", __FUNCTION__); return -ENOSYS; } static int vfs_jffs_sync(FAR struct file *filep) { - PRINT_ERR("%s NOT SUPPORT\n", __FUNCTION__); + PRINT_DEBUG("%s NOT SUPPORT\n", __FUNCTION__); return -ENOSYS; } static int vfs_jffs_dup(FAR const struct file *oldp, FAR struct file *newp) { - PRINT_ERR("%s NOT SUPPORT\n", __FUNCTION__); + PRINT_DEBUG("%s NOT SUPPORT\n", __FUNCTION__); return -ENOSYS; } @@ -363,45 +363,49 @@ static int vfs_jffs_closedir(FAR struct inode *mountpt, FAR struct fs_dirent_s * static int vfs_jffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir) { -/* reduced value between dir->fd_dir.d_off and jffs2_file->f_offset */ -#define REDUCED_VALUE 3 cyg_file *jffs2_file = NULL; struct CYG_UIO_TAG uio_s; struct CYG_IOVEC_TAG iovec; struct jffs2_dirent jffs2_d; int result; + int i = 0; uint32_t dst_name_size; jffs2_file = (cyg_file *)(dir->u.fs_dir); - /* set jffs2_d */ - (void)memset_s(&jffs2_d, sizeof(struct jffs2_dirent), 0, sizeof(struct jffs2_dirent)); - /* set CYG_UIO_TAG uio_s */ - uio_s.uio_iov = &iovec; - uio_s.uio_iov->iov_base = &jffs2_d; - uio_s.uio_iov->iov_len = sizeof(struct jffs2_dirent);; - uio_s.uio_iovcnt = 1; /* must be 1 */ - uio_s.uio_offset = 0; /* not used... */ - uio_s.uio_resid = uio_s.uio_iov->iov_len; /* seem no use in jffs2; */ - - jffs_mutex_take(&jffs2_lock, (uint32_t)JFFS_WAITING_FOREVER); - result = jffs2_dir_operations.readdir(jffs2_file, &uio_s); - jffs_mutex_release(&jffs2_lock); - - if (result) - return jffs2_result_to_vfs(result); + while (i < MAX_DIRENT_NUM && i < dir->read_cnt) { + /* set jffs2_d */ + (void)memset_s(&jffs2_d, sizeof(struct jffs2_dirent), 0, sizeof(struct jffs2_dirent)); + /* set CYG_UIO_TAG uio_s */ + uio_s.uio_iov = &iovec; + uio_s.uio_iov->iov_base = &jffs2_d; + uio_s.uio_iov->iov_len = sizeof(struct jffs2_dirent);; + uio_s.uio_iovcnt = 1; /* must be 1 */ + uio_s.uio_offset = 0; /* not used... */ + uio_s.uio_resid = uio_s.uio_iov->iov_len; /* seem no use in jffs2; */ + + jffs_mutex_take(&jffs2_lock, (uint32_t)JFFS_WAITING_FOREVER); + result = jffs2_dir_operations.readdir(jffs2_file, &uio_s); + jffs_mutex_release(&jffs2_lock); - dir->fd_dir.d_off = jffs2_file->f_offset - REDUCED_VALUE; - dir->fd_dir.d_type = jffs2_d.d_type; - dir->fd_dir.d_reclen = (uint16_t)sizeof(struct dirent); - dst_name_size = sizeof(dir->fd_dir.d_name); - result = strncpy_s(dir->fd_dir.d_name, dst_name_size, jffs2_d.d_name, dst_name_size - 1); - if (result != EOK) { - return -ENAMETOOLONG; + if (result) { + break; + } + + dir->fd_dir[i].d_type = jffs2_d.d_type; + dst_name_size = sizeof(dir->fd_dir[i].d_name); + result = strncpy_s(dir->fd_dir[i].d_name, dst_name_size, jffs2_d.d_name, dst_name_size - 1); + if (result != EOK) { + return -ENAMETOOLONG; + } + dir->fd_dir[i].d_name[dst_name_size - 1] = '\0'; + dir->fd_position++; + dir->fd_dir[i].d_off = dir->fd_position; + dir->fd_dir[i].d_reclen = (uint16_t)sizeof(struct dirent); + + i++; } - dir->fd_dir.d_name[dst_name_size - 1] = '\0'; - - return OK; + return i; } static int vfs_jffs_rewinddir(FAR struct inode *mountpt, @@ -620,6 +624,7 @@ static int vfs_jffs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) buf->f_frsize = BLOCK_SIZE; buf->f_files = 0; buf->f_ffree = 0; + buf->f_flags = mountpt->mountflags; return 0; } diff --git a/components/dfs/filesystems/jffs2/vfs_jffs2.h b/components/dfs/filesystems/jffs2/vfs_jffs2.h old mode 100755 new mode 100644