From 087046078841616093c6e6babe66eba1bd0ce0d6 Mon Sep 17 00:00:00 2001 From: charles Date: Sun, 10 Oct 2004 17:54:59 +0000 Subject: [PATCH] *** empty log message *** --- direct/yaffscfg.h | 6 ++--- direct/ydirectenv.h | 10 ++++++-- wince/ywinceenv.h | 7 ++++-- yaffs_guts.c | 56 ++++++++++++++------------------------------- yaffs_guts.h | 6 ++--- yportenv.h | 10 +++++++- 6 files changed, 45 insertions(+), 50 deletions(-) diff --git a/direct/yaffscfg.h b/direct/yaffscfg.h index b8a53b3..5031fdd 100644 --- a/direct/yaffscfg.h +++ b/direct/yaffscfg.h @@ -8,15 +8,14 @@ #define __YAFFSCFG_H__ - -#include "yaffs_guts.h" +#include "devextras.h" #define YAFFSFS_N_HANDLES 200 typedef struct { const char *prefix; - yaffs_Device *dev; + struct yaffs_DeviceStruct *dev; } yaffsfs_DeviceConfiguration; @@ -29,3 +28,4 @@ void yaffsfs_SetError(int err); #endif + diff --git a/direct/ydirectenv.h b/direct/ydirectenv.h index 08f4b57..2478ebc 100644 --- a/direct/ydirectenv.h +++ b/direct/ydirectenv.h @@ -14,7 +14,7 @@ * * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. * - * $Id: ydirectenv.h,v 1.1 2004-09-19 09:21:38 charles Exp $ + * $Id: ydirectenv.h,v 1.2 2004-10-10 17:54:59 charles Exp $ * */ @@ -23,6 +23,8 @@ // Direct interface +#include "devextras.h" + #include "stdlib.h" #include "stdio.h" #include "string.h" @@ -46,7 +48,9 @@ #include "yaffscfg.h" -#define CURRENT_TIME yaffsfs_CurrentTime() +#define Y_CURRENT_TIME yaffsfs_CurrentTime() +#define Y_TIME_CONVERT(x) (x) + #define YAFFS_ROOT_MODE 0666 #define YAFFS_LOSTNFOUND_MODE 0666 @@ -54,3 +58,5 @@ #define yaffs_strcmp(a,b) strcmp(a,b) #endif + + diff --git a/wince/ywinceenv.h b/wince/ywinceenv.h index 33fee72..5366ddf 100644 --- a/wince/ywinceenv.h +++ b/wince/ywinceenv.h @@ -14,7 +14,7 @@ * * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. * - * $Id: ywinceenv.h,v 1.1 2004-09-19 09:21:38 charles Exp $ + * $Id: ywinceenv.h,v 1.2 2004-10-10 17:54:59 charles Exp $ * */ @@ -58,7 +58,9 @@ extern unsigned yfsd_U32FileTimeNow(void); -#define CURRENT_TIME yfsd_U32FileTimeNow() +#define Y_CURRENT_TIME yfsd_U32FileTimeNow() +#define Y_TIME_CONVERT(x) (x) + #define YAFFS_ROOT_MODE FILE_ATTRIBUTE_ARCHIVE #define YAFFS_LOSTNFOUND_MODE FILE_ATTRIBUTE_HIDDEN @@ -70,3 +72,4 @@ extern unsigned yfsd_U32FileTimeNow(void); #define YBUG() T(YAFFS_TRACE_BUG,(TSTR("==>> yaffs bug: %s %d" TENDSTR),TEXT(__FILE__),__LINE__)) #endif + diff --git a/yaffs_guts.c b/yaffs_guts.c index 4757ff6..91fb73c 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -14,7 +14,7 @@ */ //yaffs_guts.c -const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.35 2004-09-21 03:03:12 charles Exp $"; +const char *yaffs_guts_c_version="$Id: yaffs_guts.c,v 1.36 2004-10-10 17:54:59 charles Exp $"; #include "yportenv.h" @@ -1638,12 +1638,8 @@ yaffs_Object *yaffs_CreateNewObject(yaffs_Device *dev,int number,yaffs_ObjectTyp #else -//#if defined(CONFIG_KERNEL_2_5) -#if defined(__KERNEL__) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) - theObject->st_atime = theObject->st_mtime = theObject->st_ctime = CURRENT_TIME.tv_sec; -#else - theObject->st_atime = theObject->st_mtime = theObject->st_ctime = CURRENT_TIME; -#endif + theObject->st_atime = theObject->st_mtime = theObject->st_ctime = Y_CURRENT_TIME; + #endif switch(type) { @@ -1747,12 +1743,8 @@ yaffs_Object *yaffs_MknodObject( yaffs_ObjectType type, in->win_ctime[1] = in->win_mtime[1] = in->win_atime[1]; #else -//#if defined(CONFIG_KERNEL_2_5) -#if defined(__KERNEL__) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) - in->st_atime = in->st_mtime = in->st_ctime = CURRENT_TIME.tv_sec; -#else - in->st_atime = in->st_mtime = in->st_ctime = CURRENT_TIME; -#endif + + in->st_atime = in->st_mtime = in->st_ctime = Y_CURRENT_TIME; in->st_rdev = rdev; in->st_uid = uid; in->st_gid = gid; @@ -3727,12 +3719,7 @@ int yaffs_FlushFile(yaffs_Object *in, int updateTime) #ifdef CONFIG_YAFFS_WINCE yfsd_WinFileTimeNow(in->win_mtime); #else -//#if defined(CONFIG_KERNEL_2_5) -#if defined(__KERNEL__) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) - in->st_mtime = CURRENT_TIME.tv_sec; -#else - in->st_mtime = CURRENT_TIME; -#endif + in->st_mtime = Y_CURRENT_TIME; #endif } @@ -4586,17 +4573,10 @@ int yaffs_SetAttributes(yaffs_Object *obj, struct iattr *attr) if(valid & ATTR_UID) obj->st_uid = attr->ia_uid; if(valid & ATTR_GID) obj->st_gid = attr->ia_gid; -//#if defined(CONFIG_KERNEL_2_5) -#if defined(__KERNEL__) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) + if(valid & ATTR_ATIME) obj->st_atime = Y_TIME_CONVERT(attr->ia_atime); + if(valid & ATTR_CTIME) obj->st_ctime = Y_TIME_CONVERT(attr->ia_ctime); + if(valid & ATTR_MTIME) obj->st_mtime = Y_TIME_CONVERT(attr->ia_mtime); - if(valid & ATTR_ATIME) obj->st_atime = attr->ia_atime.tv_sec; - if(valid & ATTR_CTIME) obj->st_ctime = attr->ia_ctime.tv_sec; - if(valid & ATTR_MTIME) obj->st_mtime = attr->ia_mtime.tv_sec; -#else - if(valid & ATTR_ATIME) obj->st_atime = attr->ia_atime; - if(valid & ATTR_CTIME) obj->st_ctime = attr->ia_ctime; - if(valid & ATTR_MTIME) obj->st_mtime = attr->ia_mtime; -#endif if(valid & ATTR_SIZE) yaffs_ResizeFile(obj,attr->ia_size); @@ -4605,6 +4585,7 @@ int yaffs_SetAttributes(yaffs_Object *obj, struct iattr *attr) return YAFFS_OK; } + int yaffs_GetAttributes(yaffs_Object *obj, struct iattr *attr) { unsigned int valid = 0; @@ -4613,16 +4594,11 @@ int yaffs_GetAttributes(yaffs_Object *obj, struct iattr *attr) attr->ia_uid = obj->st_uid; valid |= ATTR_UID; attr->ia_gid = obj->st_gid; valid |= ATTR_GID; -//#if defined(CONFIG_KERNEL_2_5) -#if defined(__KERNEL__) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) - attr->ia_atime.tv_sec = obj->st_atime; valid |= ATTR_ATIME; - attr->ia_ctime.tv_sec = obj->st_ctime; valid |= ATTR_CTIME; - attr->ia_mtime.tv_sec = obj->st_mtime; valid |= ATTR_MTIME; -#else - attr->ia_atime = obj->st_atime; valid |= ATTR_ATIME; - attr->ia_ctime = obj->st_ctime; valid |= ATTR_CTIME; - attr->ia_mtime = obj->st_mtime; valid |= ATTR_MTIME; -#endif + + Y_TIME_CONVERT(attr->ia_atime) = obj->st_atime; valid |= ATTR_ATIME; + Y_TIME_CONVERT(attr->ia_ctime) = obj->st_ctime; valid |= ATTR_CTIME; + Y_TIME_CONVERT(attr->ia_mtime) = obj->st_mtime; valid |= ATTR_MTIME; + attr->ia_size = yaffs_GetFileSize(obj); valid |= ATTR_SIZE; attr->ia_valid = valid; @@ -5006,3 +4982,5 @@ void yaffs_GutsTest(yaffs_Device *dev) + + diff --git a/yaffs_guts.h b/yaffs_guts.h index 769dcc5..4aafe1d 100644 --- a/yaffs_guts.h +++ b/yaffs_guts.h @@ -14,14 +14,13 @@ * * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. * - * $Id: yaffs_guts.h,v 1.16 2003-01-31 03:30:33 charles Exp $ + * $Id: yaffs_guts.h,v 1.17 2004-10-10 17:54:59 charles Exp $ */ #ifndef __YAFFS_GUTS_H__ #define __YAFFS_GUTS_H__ -#include "devextras.h" - +#include "yportenv.h" #define YAFFS_OK 1 #define YAFFS_FAIL 0 @@ -586,3 +585,4 @@ void yaffs_GutsTest(yaffs_Device *dev); #endif + diff --git a/yportenv.h b/yportenv.h index 0c64037..dade8e4 100644 --- a/yportenv.h +++ b/yportenv.h @@ -15,7 +15,7 @@ * * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. * - * $Id: yportenv.h,v 1.12 2004-10-04 23:24:21 charles Exp $ + * $Id: yportenv.h,v 1.13 2004-10-10 17:54:59 charles Exp $ * */ @@ -49,6 +49,13 @@ #define YAFFS_ROOT_MODE 0666 #define YAFFS_LOSTNFOUND_MODE 0666 +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) +#define Y_CURRENT_TIME CURRENT_TIME.tv_sec +#define Y_TIME_CONVERT(x) (x).tv_sec +#else +#define Y_CURRENT_TIME CURRENT_TIME +#define Y_TIME_CONVERT(x) (x) +#endif #define yaffs_SumCompare(x,y) ((x) == (y)) #define yaffs_strcmp(a,b) strcmp(a,b) @@ -124,3 +131,4 @@ extern unsigned yaffs_traceMask; #endif #endif + -- 2.30.2