Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
8e430738
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
8e430738
编写于
12月 30, 2017
作者:
B
bernard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[DFS] update JFFS2 with RT-Thread 3.0.x.
上级
f6a95087
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
593 addition
and
822 deletion
+593
-822
components/dfs/Kconfig
components/dfs/Kconfig
+5
-0
components/dfs/filesystems/jffs2/cyg/compress/src/zutil.h
components/dfs/filesystems/jffs2/cyg/compress/src/zutil.h
+1
-1
components/dfs/filesystems/jffs2/cyg/compress/zconf.h
components/dfs/filesystems/jffs2/cyg/compress/zconf.h
+8
-3
components/dfs/filesystems/jffs2/cyg/fileio/fileio.h
components/dfs/filesystems/jffs2/cyg/fileio/fileio.h
+4
-4
components/dfs/filesystems/jffs2/dfs_jffs2.c
components/dfs/filesystems/jffs2/dfs_jffs2.c
+554
-583
components/dfs/filesystems/jffs2/include/linux/jffs2.h
components/dfs/filesystems/jffs2/include/linux/jffs2.h
+2
-0
components/dfs/filesystems/jffs2/include/port/codes.h
components/dfs/filesystems/jffs2/include/port/codes.h
+2
-87
components/dfs/filesystems/jffs2/include/port/fcntl.h
components/dfs/filesystems/jffs2/include/port/fcntl.h
+13
-62
components/dfs/filesystems/jffs2/include/port/sys/stat.h
components/dfs/filesystems/jffs2/include/port/sys/stat.h
+0
-61
components/dfs/filesystems/jffs2/kernel/linux/fs.h
components/dfs/filesystems/jffs2/kernel/linux/fs.h
+0
-7
components/dfs/filesystems/jffs2/kernel/linux/types.h
components/dfs/filesystems/jffs2/kernel/linux/types.h
+0
-10
components/dfs/filesystems/jffs2/src/flashio.c
components/dfs/filesystems/jffs2/src/flashio.c
+2
-2
components/dfs/filesystems/jffs2/src/readinode.c
components/dfs/filesystems/jffs2/src/readinode.c
+2
-2
未找到文件。
components/dfs/Kconfig
浏览文件 @
8e430738
...
...
@@ -157,6 +157,11 @@ if RT_USING_DFS
endif
config RT_USING_DFS_JFFS2
bool "Enable JFFS2 file system"
select RT_USING_MTD_NOR
default n
config RT_USING_DFS_NFS
bool "Using NFS v3 client file system"
select RT_USING_LWIP
...
...
components/dfs/filesystems/jffs2/cyg/compress/src/zutil.h
浏览文件 @
8e430738
...
...
@@ -28,7 +28,7 @@
# include <stddef.h>
# endif
# include <string.h>
//# include <stdlib.h> //remove by prife @ 2012/1/30
# include <stdlib.h>
#endif
#ifdef NO_ERRNO_H
# ifdef _WIN32_WCE
...
...
components/dfs/filesystems/jffs2/cyg/compress/zconf.h
浏览文件 @
8e430738
...
...
@@ -12,11 +12,16 @@
#undef __ECOS__
#define __ECOS__
#include <rtthread.h>
#define malloc rt_malloc
#define free rt_free
#define printf rt_kprintf
#ifndef RT_USING_LIBC
#define malloc rt_malloc
#define free rt_free
#define printf rt_kprintf
#endif
//#define Z_PREFIX //by prife
//#include <pkgconf/compress_zlib.h> //prife no such file.
#if CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC != 0
#define MY_ZCALLOC
#endif
...
...
components/dfs/filesystems/jffs2/cyg/fileio/fileio.h
浏览文件 @
8e430738
...
...
@@ -313,13 +313,13 @@ struct CYG_FILEOPS_TAG
struct
CYG_FILE_TAG
{
cyg_uint32
f_flag
;
/* file state */
cyg_uint32
f_flag
;
/* file state */
cyg_uint16
f_ucount
;
/* use count */
cyg_uint16
f_type
;
/* descriptor type */
cyg_uint16
f_type
;
/* descriptor type */
cyg_uint32
f_syncmode
;
/* synchronization protocol */
struct
CYG_FILEOPS_TAG
*
f_ops
;
/* file operations */
off_t
f_offset
;
/* current offset */
CYG_ADDRWORD
f_data
;
/* file or socket */
off_t
f_offset
;
/* current offset */
CYG_ADDRWORD
f_data
;
/* file or socket */
CYG_ADDRWORD
f_xops
;
/* extra type specific ops */
cyg_mtab_entry
*
f_mte
;
/* mount table entry */
};
...
...
components/dfs/filesystems/jffs2/dfs_jffs2.c
浏览文件 @
8e430738
此差异已折叠。
点击以展开。
components/dfs/filesystems/jffs2/include/linux/jffs2.h
浏览文件 @
8e430738
...
...
@@ -74,6 +74,8 @@
/* These can go once we've made sure we've caught all uses without
byteswapping */
#include <stdint.h>
#if defined(__GNUC__) || (__CC_ARM)
typedef
struct
{
uint32_t
v32
;
...
...
components/dfs/filesystems/jffs2/include/port/codes.h
浏览文件 @
8e430738
...
...
@@ -86,94 +86,9 @@ extern "C" {
typedef
int
Cyg_ErrNo
;
#include <rtthread.h>
/* CONSTANT DEFINITIONS */
/* If adding to this list, you must also update strerror() with its text
* If there is a common error of the same purpose on Unix, try and use its
* name and number. If not, use one above 200 to prevent future conflicts
*
* Do not use negative numbers, so that functions can return positive on
* success and -ESOMETHING on error, and it all works consistently.
*/
#define ENOERR 0
/* No error */
#define EPERM 1
/* Not permitted */
#define ENOENT 2
/* No such entity */
#define ESRCH 3
/* No such process */
#define EINTR 4
/* Operation interrupted */
#define EIO 5
/* I/O error */
#define EBADF 9
/* Bad file handle */
#define EAGAIN 11
/* Try again later */
#define EWOULDBLOCK EAGAIN
#define ENOMEM 12
/* Out of memory */
#define EBUSY 16
/* Resource busy */
#define EXDEV 18
/* Cross-device link */
#define ENODEV 19
/* No such device */
#define ENOTDIR 20
/* Not a directory */
#define EISDIR 21
/* Is a directory */
#define EINVAL 22
/* Invalid argument */
#define ENFILE 23
/* Too many open files in system */
#define EMFILE 24
/* Too many open files */
#define EFBIG 27
/* File too large */
#define ENOSPC 28
/* No space left on device */
#define ESPIPE 29
/* Illegal seek */
#define EROFS 30
/* Read-only file system */
#define EDOM 33
/* Argument to math function outside valid */
/* domain */
#define ERANGE 34
/* Math result cannot be represented */
#define EDEADLK 35
/* Resource deadlock would occur */
#define EDEADLOCK EDEADLK
#define ENOSYS 38
/* Function not implemented */
#define ENAMETOOLONG 60
/* File name too long */
#define ENOTEMPTY 66
/* Directory not empty */
#define ENOTSUP 95
/* Not supported error */
#define EEOF 200
/* End of file reached */
#define ENOSUPP 201
/* Operation not supported */
#define EDEVNOSUPP 202
/* Device does not support this operation */
/* Additional errors used by networking */
#define ENXIO 300
/* Device not configured */
#define EACCES 301
/* Permission denied */
#define EEXIST 302
/* File exists */
#define ENOTTY 303
/* Inappropriate ioctl for device */
#define EPIPE 304
/* Broken pipe */
/* non-blocking and interrupt i/o */
#define EINPROGRESS 310
/* Operation now in progress */
#define EALREADY 311
/* Operation already in progress */
/* ipc/network software -- argument errors */
#define ENOTSOCK 320
/* Socket operation on non-socket */
#define EDESTADDRREQ 321
/* Destination address required */
#define EMSGSIZE 322
/* Message too long */
#define EPROTOTYPE 323
/* Protocol wrong type for socket */
#define ENOPROTOOPT 324
/* Protocol not available */
#define EPROTONOSUPPORT 325
/* Protocol not supported */
#define ESOCKTNOSUPPORT 326
/* Socket type not supported */
#define EOPNOTSUPP 327
/* Operation not supported */
#define EPFNOSUPPORT 328
/* Protocol family not supported */
#define EAFNOSUPPORT 329
/* Address family not supported by */
/* protocol family */
#define EADDRINUSE 330
/* Address already in use */
#define EADDRNOTAVAIL 331
/* Can't assign requested address */
/* ipc/network software -- operational errors */
#define ENETDOWN 350
/* Network is down */
#define ENETUNREACH 351
/* Network is unreachable */
#define ENETRESET 352
/* Network dropped connection on reset */
#define ECONNABORTED 353
/* Software caused connection abort */
#define ECONNRESET 354
/* Connection reset by peer */
#define ENOBUFS 355
/* No buffer space available */
#define EISCONN 356
/* Socket is already connected */
#define ENOTCONN 357
/* Socket is not connected */
#define ESHUTDOWN 358
/* Can't send after socket shutdown */
#define ETOOMANYREFS 359
/* Too many references: can't splice */
#define ETIMEDOUT 360
/* Operation timed out */
#define ECONNREFUSED 361
/* Connection refused */
#define EHOSTDOWN 364
/* Host is down */
#define EHOSTUNREACH 365
/* No route to host */
#define ENOERR RT_EOK
#ifdef __cplusplus
}
/* extern "C" */
...
...
components/dfs/filesystems/jffs2/include/port/fcntl.h
浏览文件 @
8e430738
#ifndef CYGONCE_ISO_FCNTL_H
#define CYGONCE_ISO_FCNTL_H
#if defined(__CC_ARM) || defined(MSVC)
/* File access modes used for open() and fnctl() */
#define O_RDONLY (1<<0)
/* Open for reading only */
#define O_WRONLY (1<<1)
/* Open for writing only */
#define O_RDWR (O_RDONLY|O_WRONLY)
/* Open for reading and writing */
/* File access mode mask */
#define O_ACCMODE (O_RDONLY|O_RDWR|O_WRONLY)
/* open() mode flags */
#define O_CREAT (1<<3)
/* Create file it it does not exist */
#define O_EXCL (1<<4)
/* Exclusive use */
#define O_NOCTTY (1<<5)
/* Do not assign a controlling terminal */
#define O_TRUNC (1<<6)
/* Truncate */
/* File status flags used for open() and fcntl() */
#define O_APPEND (1<<7)
/* Set append mode */
#define O_DSYNC (1<<8)
/* Synchronized I/O data integrity writes */
#define O_NONBLOCK (1<<9)
/* No delay */
#define O_RSYNC (1<<10)
/* Synchronized read I/O */
#define O_SYNC (1<<11)
/* Synchronized I/O file integrity writes */
/*------------------------------------------------------------------------*/
/* for dfs_jffs2.c
*/
/* for dfs_jffs2.c */
/*------------------------------------------------------------------------*/
/* File access modes used for open() and fnctl() */
#define JFFS2_O_RDONLY (
1<<0
)
/* Open for reading only */
#define JFFS2_O_WRONLY (
1<<1
)
/* Open for writing only */
#define JFFS2_O_RDONLY (
O_RDONLY
)
/* Open for reading only */
#define JFFS2_O_WRONLY (
O_WRONLY
)
/* Open for writing only */
#define JFFS2_O_RDWR (O_RDONLY|O_WRONLY)
/* Open for reading and writing */
/* File access mode mask */
...
...
@@ -36,45 +14,18 @@
/* open() mode flags */
#define JFFS2_O_CREAT (1<<3)
/* Create file it it does not exist */
#define JFFS2_O_EXCL (1<<4)
/* Exclusive use */
#define JFFS2_O_NOCTTY (1<<5)
/* Do not assign a controlling terminal */
#define JFFS2_O_TRUNC (1<<6)
/* Truncate */
/* File status flags used for open() and fcntl() */
#define JFFS2_O_APPEND (1<<7)
/* Set append mode */
#define JFFS2_O_DSYNC (1<<8)
/* Synchronized I/O data integrity writes */
#define JFFS2_O_NONBLOCK (1<<9)
/* No delay */
#define JFFS2_O_RSYNC (1<<10)
/* Synchronized read I/O */
#define JFFS2_O_SYNC (1<<11)
/* Synchronized I/O file integrity writes */
#elif defined(__GNUC__)
/*------------------------------------------------------------------------*/
/* for dfs_jffs2.c */
/*------------------------------------------------------------------------*/
/* File access modes used for open() and fnctl() */
#define JFFS2_O_RDONLY (DFS_O_RDONLY)
/* Open for reading only */
#define JFFS2_O_WRONLY (DFS_O_WRONLY)
/* Open for writing only */
#define JFFS2_O_RDWR (DFS_O_RDONLY|DFS_O_WRONLY)
/* Open for reading and writing */
/* File access mode mask */
#define JFFS2_O_ACCMODE (DFS_O_RDONLY|DFS_O_RDWR|DFS_O_WRONLY)
/* open() mode flags */
#define JFFS2_O_CREAT (DFS_O_CREAT)
/* Create file it it does not exist */
#define JFFS2_O_EXCL (DFS_O_EXCL)
/* Exclusive use */
#define JFFS2_O_NOCTTY (DFS_O_NOCTTY)
/* Do not assign a controlling terminal */
#define JFFS2_O_TRUNC (DFS_O_TRUNC)
/* Truncate */
#define JFFS2_O_CREAT (O_CREAT)
/* Create file it it does not exist */
#define JFFS2_O_EXCL (O_EXCL)
/* Exclusive use */
#define JFFS2_O_NOCTTY (O_NOCTTY)
/* Do not assign a controlling terminal */
#define JFFS2_O_TRUNC (O_TRUNC)
/* Truncate */
/* File status flags used for open() and fcntl() */
#define JFFS2_O_APPEND (
DFS_
O_APPEND)
/* Set append mode */
#define JFFS2_O_DSYNC (
DFS_
O_DSYNC)
/* Synchronized I/O data integrity writes */
#define JFFS2_O_NONBLOCK (
DFS_
O_NONBLOCK)
/* No delay */
#define JFFS2_O_RSYNC (
DFS_
O_RSYNC)
/* Synchronized read I/O */
#define JFFS2_O_SYNC (
DFS_
O_SYNC)
/* Synchronized I/O file integrity writes */
#define JFFS2_O_APPEND (O_APPEND)
/* Set append mode */
#define JFFS2_O_DSYNC (O_DSYNC)
/* Synchronized I/O data integrity writes */
#define JFFS2_O_NONBLOCK (O_NONBLOCK)
/* No delay */
#define JFFS2_O_RSYNC (O_RSYNC)
/* Synchronized read I/O */
#define JFFS2_O_SYNC (O_SYNC)
/* Synchronized I/O file integrity writes */
#endif
#endif
/* EOF fcntl.h */
components/dfs/filesystems/jffs2/include/port/sys/stat.h
浏览文件 @
8e430738
...
...
@@ -271,51 +271,6 @@ typedef void *cyg_io_handle_t;
#define __stat_mode_LNK (1<<8)
#define __stat_mode_SOCK (1<<9)
#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE >= 200112L)
#define S_IFDIR (__stat_mode_DIR)
#define S_IFCHR (__stat_mode_CHR)
#define S_IFBLK (__stat_mode_BLK)
#define S_IFREG (__stat_mode_REG)
#define S_IFIFO (__stat_mode_FIFO)
#define S_IFLNK (__stat_mode_LNK)
#define S_IFSOCK (__stat_mode_SOCK)
#define S_IFMT (S_IFDIR|S_IFCHR|S_IFBLK|S_IFREG| \
S_IFIFO|S_IFLNK|S_IFSOCK)
#endif
#define S_ISDIR(__mode) ((__mode) & __stat_mode_DIR )
#define S_ISCHR(__mode) ((__mode) & __stat_mode_CHR )
#define S_ISBLK(__mode) ((__mode) & __stat_mode_BLK )
#define S_ISREG(__mode) ((__mode) & __stat_mode_REG )
#define S_ISFIFO(__mode) ((__mode) & __stat_mode_FIFO )
#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE >= 200112L)
#define S_ISLNK(__mode) ((__mode) & __stat_mode_LNK )
#define S_ISSOCK(__mode) ((__mode) & __stat_mode_SOCK )
#endif
#define S_TYPEISMQ(__buf) ((__buf)->st_mode & __stat_mode_MQ )
#define S_TYPEISSEM(__buf) ((__buf)->st_mode & __stat_mode_SEM )
#define S_TYPEISSHM(__buf) ((__buf)->st_mode & __stat_mode_SHM )
#define S_IRUSR (1<<16)
#define S_IWUSR (1<<17)
#define S_IXUSR (1<<18)
#define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
#define S_IRGRP (1<<19)
#define S_IWGRP (1<<20)
#define S_IXGRP (1<<21)
#define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
#define S_IROTH (1<<22)
#define S_IWOTH (1<<23)
#define S_IXOTH (1<<24)
#define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
#define S_ISUID (1<<25)
#define S_ISGID (1<<26)
#if defined(MSVC)
/* for time_t */
#include <time.h>
...
...
@@ -333,22 +288,6 @@ typedef long time_t;
#include <sys/types.h>
#endif
struct
stat
{
mode_t
st_mode
;
/* File mode */
ino_t
st_ino
;
/* File serial number */
dev_t
st_dev
;
/* ID of device containing file */
nlink_t
st_nlink
;
/* Number of hard links */
uid_t
st_uid
;
/* User ID of the file owner */
gid_t
st_gid
;
/* Group ID of the file's group */
off_t
st_size
;
/* File size (regular files only) */
time_t
st_atime
;
/* Last access time */
time_t
st_mtime
;
/* Last data modification time */
time_t
st_ctime
;
/* Last file status change time */
};
//fcntl.h
#define O_NONBLOCK (1<<9)
/* No delay */
#endif
/* CYGONCE_ISO_SYS_TYPES_H multiple inclusion protection */
/* EOF sys/types.h */
...
...
components/dfs/filesystems/jffs2/kernel/linux/fs.h
浏览文件 @
8e430738
...
...
@@ -2,12 +2,5 @@
#define __LINUX_FS_H__
#include <linux/stat.h>
/*
* File types
*/
#define DT_UNKNOWN 0
#define DT_DIR 4
#define DT_REG 8
#endif
/* __LINUX_FS_H__ */
components/dfs/filesystems/jffs2/kernel/linux/types.h
浏览文件 @
8e430738
...
...
@@ -3,17 +3,7 @@
#include "cyg/infra/cyg_type.h"
#define uint8_t cyg_uint8
#define uint16_t cyg_uint16
#define uint32_t cyg_uint32
#define int8_t cyg_int8
#define int16_t cyg_int16
#define int32_t cyg_int32
#define loff_t off_t
#define kvec iovec
#endif
/* __LINUX_TYPES_H__ */
components/dfs/filesystems/jffs2/src/flashio.c
浏览文件 @
8e430738
...
...
@@ -16,7 +16,7 @@
#include "nodelist.h"
#include <rtdevice.h>
int
jffs2_flash_read
(
struct
jffs2_sb_info
*
c
,
uint32_t
offset
,
int
jffs2_flash_read
(
struct
jffs2_sb_info
*
c
,
cyg_uint32
offset
,
const
size_t
size
,
size_t
*
return_size
,
unsigned
char
*
buffer
)
...
...
@@ -33,7 +33,7 @@ int jffs2_flash_read(struct jffs2_sb_info * c, uint32_t offset,
}
int
jffs2_flash_write
(
struct
jffs2_sb_info
*
c
,
uint32_t
offset
,
const
size_t
size
,
cyg_uint32
offset
,
const
size_t
size
,
size_t
*
return_size
,
unsigned
char
*
buffer
)
{
uint32_t
len
;
...
...
components/dfs/filesystems/jffs2/src/readinode.c
浏览文件 @
8e430738
...
...
@@ -188,7 +188,7 @@ read_direntry(struct jffs2_sb_info *c,
int
already
=
read
-
sizeof
(
*
rd
);
err
=
jffs2_flash_read
(
c
,
(
ref_offset
(
ref
))
+
read
,
rd
->
nsize
-
already
,
&
read
,
&
fd
->
name
[
already
]);
rd
->
nsize
-
already
,
(
size_t
*
)
&
read
,
&
fd
->
name
[
already
]);
if
(
unlikely
(
read
!=
rd
->
nsize
-
already
)
&&
likely
(
!
err
))
return
-
EIO
;
...
...
@@ -278,7 +278,7 @@ read_dnode(struct jffs2_sb_info *c,
return
-
ENOMEM
;
err
=
jffs2_flash_read
(
c
,
ref_offset
(
ref
)
+
sizeof
(
*
rd
),
je32_to_cpu
(
rd
->
csize
),
&
read
,
buf
);
(
size_t
*
)
&
read
,
buf
);
if
(
unlikely
(
read
!=
je32_to_cpu
(
rd
->
csize
))
&&
likely
(
!
err
))
err
=
-
EIO
;
if
(
err
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录