[Yaffs] fix for mkyaffsimage compile error

Top Page
Attachments:
Message as email
+ (text/plain)
+ yaffs_userland_02_fixup_rh9.patch (text/plain)
Delete this message
Reply to this message
Author: Frank Rowand
Date:  
To: yaffs
Subject: [Yaffs] fix for mkyaffsimage compile error
When I compile mkyaffsimage on RedHat 9.0, I get errors that look
like the errors reported in the email thread "Compile error when using
yaffs/direct" started by Daniel Gustafsson, Fri, 8 Oct 2004 15:28:35.

The problem is caused by some #define statements in
/usr/include/bits/stat.h:

    # define st_atime st_atim.tv_sec        /* Backward compatibility.  */
    # define st_mtime st_mtim.tv_sec
    # define st_ctime st_ctim.tv_sec


The attached patch is one way to fix the problem for mkyaffsimage. It
renames the st_*time fields to st_tim.

If this is an acceptable way to fix the problem, then I can update
the patch to include the in-kernel files and the files in the direct
directory since they reference these same fields.

-Frank
--
Frank Rowand <>
MontaVista Software, Inc
Index: yaffs/yaffs_guts.h
===================================================================
--- yaffs.orig/yaffs_guts.h
+++ yaffs/yaffs_guts.h
@@ -200,9 +200,12 @@
 #else
     __u32 st_uid;   // user ID of owner
     __u32 st_gid;    // group ID of owner 
-    __u32 st_atime; // time of last access
-    __u32 st_mtime; // time of last modification
-    __u32 st_ctime; // time of last change
+/*
+ * /usr/include/bits/stat.h defines st_atime, st_mtime, st_ctime
+ */
+    __u32 st_atim; // time of last access
+    __u32 st_mtim; // time of last modification
+    __u32 st_ctim; // time of last change
 #endif


     // File size  applies to files only
@@ -349,9 +352,12 @@
 #else
     __u32 st_uid;       // user ID of owner
     __u32 st_gid;        // group ID of owner 
-    __u32 st_atime;     // time of last access
-    __u32 st_mtime;     // time of last modification
-    __u32 st_ctime;     // time of last change
+/*
+ * /usr/include/bits/stat.h defines st_atime, st_mtime, st_ctime
+ */
+    __u32 st_atim;         // time of last access
+    __u32 st_mtim;         // time of last modification
+    __u32 st_ctim;         // time of last change
 #endif


     __u32 st_rdev;         // device stuff for block and char devices
Index: yaffs/utils/mkyaffsimage.c
===================================================================
--- yaffs.orig/utils/mkyaffsimage.c
+++ yaffs/utils/mkyaffsimage.c
@@ -293,9 +293,9 @@
     // Regular POSIX.
     oh->st_uid = SWAP32(oh->st_uid);
     oh->st_gid = SWAP32(oh->st_gid);
-    oh->st_atime = SWAP32(oh->st_atime);
-    oh->st_mtime = SWAP32(oh->st_mtime);
-    oh->st_ctime = SWAP32(oh->st_ctime);
+    oh->st_atim = SWAP32(oh->st_atim);
+    oh->st_mtim = SWAP32(oh->st_mtim);
+    oh->st_ctim = SWAP32(oh->st_ctim);
 #endif


     oh->fileSize = SWAP32(oh->fileSize); // Aiee. An int... signed, at that!
@@ -354,9 +354,9 @@
         oh->st_uid = s->st_uid;
 // NCB 12/9/02        oh->st_gid = s->st_uid;
         oh->st_gid = s->st_gid;
-        oh->st_atime = s->st_atime;
-        oh->st_mtime = s->st_mtime;
-        oh->st_ctime = s->st_ctime;
+        oh->st_atim = s->st_atime;
+        oh->st_mtim = s->st_mtime;
+        oh->st_ctim = s->st_ctime;
         oh->st_rdev  = s->st_rdev;
     }