#include <dirent.h>
#include <string.h>
#include <unistd.h>
-
+#include "yaffs_ecc.h"
#include "yaffs_guts.h"
#define MAX_OBJECTS 10000
-const char * mkyaffsimage_c_version = "$Id: mkyaffsimage.c,v 1.7 2003-07-16 03:00:48 charles Exp $";
-
-// External functions for ECC on data
-void nand_calculate_ecc (const u_char *dat, u_char *ecc_code);
-int nand_correct_data (u_char *dat, u_char *read_ecc, u_char *calc_ecc);
+const char * mkyaffsimage_c_version = "$Id: mkyaffsimage.c,v 1.8 2005-10-11 23:39:56 charles Exp $";
typedef struct
static void yaffs_CalcECC(const __u8 *data, yaffs_Spare *spare)
{
- nand_calculate_ecc (data , spare->ecc1);
- nand_calculate_ecc (&data[256] , spare->ecc2);
+ yaffs_ECCCalculate(data , spare->ecc1);
+ yaffs_ECCCalculate(&data[256] , spare->ecc2);
}
static void yaffs_CalcTagsECC(yaffs_Tags *tags)
oh->parentObjectId = SWAP32(oh->parentObjectId); // int
oh->sum__NoLongerUsed = SWAP16(oh->sum__NoLongerUsed); // __u16 - Not used, but done for completeness.
// name = skip. Char array. Not swapped.
- oh->st_mode = SWAP32(oh->st_mode);
+ oh->yst_mode = SWAP32(oh->yst_mode);
#ifdef CONFIG_YAFFS_WINCE // WinCE doesn't implement this, but we need to just in case.
// In fact, WinCE would be *THE* place where this would be an issue!
oh->notForWinCE[0] = SWAP32(oh->notForWinCE[0]);
oh->notForWinCE[4] = SWAP32(oh->notForWinCE[4]);
#else
// 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->yst_uid = SWAP32(oh->yst_uid);
+ oh->yst_gid = SWAP32(oh->yst_gid);
+ oh->yst_atime = SWAP32(oh->yst_atime);
+ oh->yst_mtime = SWAP32(oh->yst_mtime);
+ oh->yst_ctime = SWAP32(oh->yst_ctime);
#endif
oh->fileSize = SWAP32(oh->fileSize); // Aiee. An int... signed, at that!
oh->equivalentObjectId = SWAP32(oh->equivalentObjectId);
// alias - char array.
- oh->st_rdev = SWAP32(oh->st_rdev);
+ oh->yst_rdev = SWAP32(oh->yst_rdev);
#ifdef CONFIG_YAFFS_WINCE
oh->win_ctime[0] = SWAP32(oh->win_ctime[0]);
if(t != YAFFS_OBJECT_TYPE_HARDLINK)
{
- oh->st_mode = s->st_mode;
- 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_rdev = s->st_rdev;
+ oh->yst_mode = s->st_mode;
+ oh->yst_uid = s->st_uid;
+// NCB 12/9/02 oh->yst_gid = s->yst_uid;
+ oh->yst_gid = s->st_gid;
+ oh->yst_atime = s->st_atime;
+ oh->yst_mtime = s->st_mtime;
+ oh->yst_ctime = s->st_ctime;
+ oh->yst_rdev = s->st_rdev;
}
if(t == YAFFS_OBJECT_TYPE_FILE)