From b45f14c03824da8ee425c94bce7595da73f4e8e8 Mon Sep 17 00:00:00 2001 From: "goprife@gmail.com" Date: Tue, 18 Dec 2012 06:42:27 +0000 Subject: [PATCH] 1) add JFFS2_NAME_MAX to jffs2_config.h 2)fix micro conflict in include/port/fcntl.h git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2492 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- .../filesystems/jffs2/include/port/fcntl.h | 80 ++++++++++++------- .../dfs/filesystems/jffs2/jffs2_config.h | 5 +- components/dfs/filesystems/jffs2/porting.h | 5 +- .../dfs/filesystems/jffs2/src/fs-ecos.c | 4 +- .../dfs/filesystems/jffs2/src/os-ecos.h | 4 +- 5 files changed, 60 insertions(+), 38 deletions(-) diff --git a/components/dfs/filesystems/jffs2/include/port/fcntl.h b/components/dfs/filesystems/jffs2/include/port/fcntl.h index bd50c7b9a3..438b72541b 100644 --- a/components/dfs/filesystems/jffs2/include/port/fcntl.h +++ b/components/dfs/filesystems/jffs2/include/port/fcntl.h @@ -1,5 +1,55 @@ #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 */ +/*------------------------------------------------------------------------*/ +/* 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_RDWR (O_RDONLY|O_WRONLY) /* Open for reading and writing */ + +/* File access mode mask */ +#define JFFS2_O_ACCMODE (O_RDONLY|O_RDWR|O_WRONLY) + +/* 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 */ /*------------------------------------------------------------------------*/ @@ -25,34 +75,6 @@ #define JFFS2_O_RSYNC (DFS_O_RSYNC) /* Synchronized read I/O */ #define JFFS2_O_SYNC (DFS_O_SYNC) /* Synchronized I/O file integrity writes */ - -/*------------------------------------------------------------------------*/ -/* for dfs_jffs2.c */ -/*------------------------------------------------------------------------*/ -#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 */ - -#endif /* CYGONCE_ISO_FCNTL_H multiple inclusion protection */ #endif - +#endif /* EOF fcntl.h */ diff --git a/components/dfs/filesystems/jffs2/jffs2_config.h b/components/dfs/filesystems/jffs2/jffs2_config.h index 0a3e4e3c91..8ef01ed22a 100644 --- a/components/dfs/filesystems/jffs2/jffs2_config.h +++ b/components/dfs/filesystems/jffs2/jffs2_config.h @@ -3,7 +3,10 @@ #define __ECOS /* must be defined */ -#define FILE_PATH_MAX 128 /* the longest file path */ +#define FILE_PATH_MAX 128 /* the longest file path */ +#define CONFIG_JFFS2_ENTRY_NAME_MAX 8 +#define JFFS2_NAME_MAX CONFIG_JFFS2_ENTRY_NAME_MAX +#define JFFS2_PATH_MAX FILE_PATH_MAX #define DEVICE_PART_MAX 1 /* the max partions on a nand deivce*/ diff --git a/components/dfs/filesystems/jffs2/porting.h b/components/dfs/filesystems/jffs2/porting.h index 86676782fe..2671f46dde 100644 --- a/components/dfs/filesystems/jffs2/porting.h +++ b/components/dfs/filesystems/jffs2/porting.h @@ -26,9 +26,6 @@ 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 { @@ -39,7 +36,7 @@ struct jffs2_dirent // d_type is not part of POSIX so // should be used with caution. #endif - char d_name[NAME_MAX+1]; + char d_name[JFFS2_NAME_MAX+1]; }; extern cyg_fileops jffs2_fileops; diff --git a/components/dfs/filesystems/jffs2/src/fs-ecos.c b/components/dfs/filesystems/jffs2/src/fs-ecos.c index cadef8557d..5f3b5d607c 100644 --- a/components/dfs/filesystems/jffs2/src/fs-ecos.c +++ b/components/dfs/filesystems/jffs2/src/fs-ecos.c @@ -392,11 +392,11 @@ static int jffs2_pathconf(struct _inode *node, struct cyg_pathconf_info *info) break; case _PC_NAME_MAX: - info->value = NAME_MAX; + info->value = JFFS2_NAME_MAX; break; case _PC_PATH_MAX: - info->value = PATH_MAX; + info->value = JFFS2_PATH_MAX; break; case _PC_PIPE_BUF: diff --git a/components/dfs/filesystems/jffs2/src/os-ecos.h b/components/dfs/filesystems/jffs2/src/os-ecos.h index cd066e1b7d..b6d2a0e8c8 100644 --- a/components/dfs/filesystems/jffs2/src/os-ecos.h +++ b/components/dfs/filesystems/jffs2/src/os-ecos.h @@ -53,7 +53,7 @@ struct dirent // d_type is not part of POSIX so // should be used with caution. #endif - char d_name[NAME_MAX+1]; + char d_name[JFFS2_NAME_MAX+1]; }; @@ -260,6 +260,6 @@ static inline void jffs2_erase_pending_trigger(struct jffs2_sb_info *c) #define BUG_ON(x) do { if (unlikely(x)) BUG(); } while(0) #endif -#define __init +#define __init #endif /* __JFFS2_OS_ECOS_H__ */ -- GitLab