[DFS] update JFFS2 with RT-Thread 3.0.x.
This commit is contained in:
parent
f6a9508785
commit
8e4307382f
|
@ -157,6 +157,11 @@ if RT_USING_DFS
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
config RT_USING_DFS_JFFS2
|
||||||
|
bool "Enable JFFS2 file system"
|
||||||
|
select RT_USING_MTD_NOR
|
||||||
|
default n
|
||||||
|
|
||||||
config RT_USING_DFS_NFS
|
config RT_USING_DFS_NFS
|
||||||
bool "Using NFS v3 client file system"
|
bool "Using NFS v3 client file system"
|
||||||
select RT_USING_LWIP
|
select RT_USING_LWIP
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# endif
|
# endif
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
//# include <stdlib.h> //remove by prife @ 2012/1/30
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_ERRNO_H
|
#ifdef NO_ERRNO_H
|
||||||
# ifdef _WIN32_WCE
|
# ifdef _WIN32_WCE
|
||||||
|
|
|
@ -12,11 +12,16 @@
|
||||||
#undef __ECOS__
|
#undef __ECOS__
|
||||||
#define __ECOS__
|
#define __ECOS__
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#define malloc rt_malloc
|
|
||||||
#define free rt_free
|
#ifndef RT_USING_LIBC
|
||||||
#define printf rt_kprintf
|
#define malloc rt_malloc
|
||||||
|
#define free rt_free
|
||||||
|
#define printf rt_kprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
//#define Z_PREFIX //by prife
|
//#define Z_PREFIX //by prife
|
||||||
//#include <pkgconf/compress_zlib.h> //prife no such file.
|
//#include <pkgconf/compress_zlib.h> //prife no such file.
|
||||||
|
|
||||||
#if CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC != 0
|
#if CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC != 0
|
||||||
#define MY_ZCALLOC
|
#define MY_ZCALLOC
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -313,13 +313,13 @@ struct CYG_FILEOPS_TAG
|
||||||
|
|
||||||
struct CYG_FILE_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_ucount; /* use count */
|
||||||
cyg_uint16 f_type; /* descriptor type */
|
cyg_uint16 f_type; /* descriptor type */
|
||||||
cyg_uint32 f_syncmode; /* synchronization protocol */
|
cyg_uint32 f_syncmode; /* synchronization protocol */
|
||||||
struct CYG_FILEOPS_TAG *f_ops; /* file operations */
|
struct CYG_FILEOPS_TAG *f_ops; /* file operations */
|
||||||
off_t f_offset; /* current offset */
|
off_t f_offset; /* current offset */
|
||||||
CYG_ADDRWORD f_data; /* file or socket */
|
CYG_ADDRWORD f_data; /* file or socket */
|
||||||
CYG_ADDRWORD f_xops; /* extra type specific ops */
|
CYG_ADDRWORD f_xops; /* extra type specific ops */
|
||||||
cyg_mtab_entry *f_mte; /* mount table entry */
|
cyg_mtab_entry *f_mte; /* mount table entry */
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -74,6 +74,8 @@
|
||||||
|
|
||||||
/* These can go once we've made sure we've caught all uses without
|
/* These can go once we've made sure we've caught all uses without
|
||||||
byteswapping */
|
byteswapping */
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#if defined(__GNUC__) || (__CC_ARM)
|
#if defined(__GNUC__) || (__CC_ARM)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t v32;
|
uint32_t v32;
|
||||||
|
|
|
@ -86,94 +86,9 @@ extern "C" {
|
||||||
|
|
||||||
typedef int Cyg_ErrNo;
|
typedef int Cyg_ErrNo;
|
||||||
|
|
||||||
|
#include <rtthread.h>
|
||||||
|
|
||||||
/* CONSTANT DEFINITIONS */
|
#define ENOERR RT_EOK
|
||||||
|
|
||||||
/* 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 */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
|
@ -1,34 +1,12 @@
|
||||||
#ifndef CYGONCE_ISO_FCNTL_H
|
#ifndef CYGONCE_ISO_FCNTL_H
|
||||||
#define 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() */
|
/* File access modes used for open() and fnctl() */
|
||||||
#define JFFS2_O_RDONLY (1<<0) /* Open for reading only */
|
#define JFFS2_O_RDONLY (O_RDONLY) /* Open for reading only */
|
||||||
#define JFFS2_O_WRONLY (1<<1) /* Open for writing only */
|
#define JFFS2_O_WRONLY (O_WRONLY) /* Open for writing only */
|
||||||
#define JFFS2_O_RDWR (O_RDONLY|O_WRONLY) /* Open for reading and writing */
|
#define JFFS2_O_RDWR (O_RDONLY|O_WRONLY) /* Open for reading and writing */
|
||||||
|
|
||||||
/* File access mode mask */
|
/* File access mode mask */
|
||||||
|
@ -36,45 +14,18 @@
|
||||||
|
|
||||||
/* open() mode flags */
|
/* open() mode flags */
|
||||||
|
|
||||||
#define JFFS2_O_CREAT (1<<3) /* Create file it it does not exist */
|
#define JFFS2_O_CREAT (O_CREAT) /* Create file it it does not exist */
|
||||||
#define JFFS2_O_EXCL (1<<4) /* Exclusive use */
|
#define JFFS2_O_EXCL (O_EXCL) /* Exclusive use */
|
||||||
#define JFFS2_O_NOCTTY (1<<5) /* Do not assign a controlling terminal */
|
#define JFFS2_O_NOCTTY (O_NOCTTY) /* Do not assign a controlling terminal */
|
||||||
#define JFFS2_O_TRUNC (1<<6) /* Truncate */
|
#define JFFS2_O_TRUNC (O_TRUNC) /* Truncate */
|
||||||
|
|
||||||
/* File status flags used for open() and fcntl() */
|
/* File status flags used for open() and fcntl() */
|
||||||
#define JFFS2_O_APPEND (1<<7) /* Set append mode */
|
#define JFFS2_O_APPEND (O_APPEND) /* Set append mode */
|
||||||
#define JFFS2_O_DSYNC (1<<8) /* Synchronized I/O data integrity writes */
|
#define JFFS2_O_DSYNC (O_DSYNC) /* Synchronized I/O data integrity writes */
|
||||||
#define JFFS2_O_NONBLOCK (1<<9) /* No delay */
|
#define JFFS2_O_NONBLOCK (O_NONBLOCK)/* No delay */
|
||||||
#define JFFS2_O_RSYNC (1<<10) /* Synchronized read I/O */
|
#define JFFS2_O_RSYNC (O_RSYNC) /* Synchronized read I/O */
|
||||||
#define JFFS2_O_SYNC (1<<11) /* Synchronized I/O file integrity writes */
|
#define JFFS2_O_SYNC (O_SYNC) /* 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 */
|
|
||||||
|
|
||||||
/* 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 */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
/* EOF fcntl.h */
|
/* EOF fcntl.h */
|
||||||
|
|
|
@ -271,51 +271,6 @@ typedef void *cyg_io_handle_t;
|
||||||
#define __stat_mode_LNK (1<<8)
|
#define __stat_mode_LNK (1<<8)
|
||||||
#define __stat_mode_SOCK (1<<9)
|
#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)
|
#if defined(MSVC)
|
||||||
/* for time_t */
|
/* for time_t */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -333,22 +288,6 @@ typedef long time_t;
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#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 */
|
#endif /* CYGONCE_ISO_SYS_TYPES_H multiple inclusion protection */
|
||||||
|
|
||||||
/* EOF sys/types.h */
|
/* EOF sys/types.h */
|
||||||
|
|
|
@ -2,12 +2,5 @@
|
||||||
#define __LINUX_FS_H__
|
#define __LINUX_FS_H__
|
||||||
|
|
||||||
#include <linux/stat.h>
|
#include <linux/stat.h>
|
||||||
/*
|
|
||||||
* File types
|
|
||||||
*/
|
|
||||||
#define DT_UNKNOWN 0
|
|
||||||
#define DT_DIR 4
|
|
||||||
#define DT_REG 8
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __LINUX_FS_H__ */
|
#endif /* __LINUX_FS_H__ */
|
||||||
|
|
|
@ -3,17 +3,7 @@
|
||||||
|
|
||||||
#include "cyg/infra/cyg_type.h"
|
#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 loff_t off_t
|
||||||
|
|
||||||
|
|
||||||
#define kvec iovec
|
#define kvec iovec
|
||||||
#endif /* __LINUX_TYPES_H__ */
|
#endif /* __LINUX_TYPES_H__ */
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "nodelist.h"
|
#include "nodelist.h"
|
||||||
#include <rtdevice.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,
|
const size_t size,
|
||||||
size_t * return_size,
|
size_t * return_size,
|
||||||
unsigned char *buffer)
|
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,
|
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)
|
size_t * return_size, unsigned char *buffer)
|
||||||
{
|
{
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
|
|
|
@ -188,7 +188,7 @@ read_direntry(struct jffs2_sb_info *c,
|
||||||
int already = read - sizeof(*rd);
|
int already = read - sizeof(*rd);
|
||||||
|
|
||||||
err = jffs2_flash_read(c, (ref_offset(ref)) + read,
|
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))
|
if (unlikely(read != rd->nsize - already) && likely(!err))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ read_dnode(struct jffs2_sb_info *c,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
err = jffs2_flash_read(c, ref_offset(ref) + sizeof(*rd), je32_to_cpu(rd->csize),
|
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))
|
if (unlikely(read != je32_to_cpu(rd->csize)) && likely(!err))
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in New Issue