X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs%2F.git;a=blobdiff_plain;f=yaffs_guts.c;h=91fb73c598fda9e44ed5052abc06a0ff8de1b38d;hp=4757ff6802ceed1571b8fad2c556522010a454b7;hb=087046078841616093c6e6babe66eba1bd0ce0d6;hpb=0446bf9a8d4cb2703587b7c99bd01270cfcd7d96 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) + +