#define MAX_OBJECTS 10000
-const char * mkyaffsimage_c_version = "$Id: mkyaffsimage.c,v 1.4 2002-10-02 00:10:17 charles Exp $";
+const char * mkyaffsimage_c_version = "$Id: mkyaffsimage.c,v 1.6 2002-12-13 00:13:06 charles Exp $";
// External functions for ECC on data
void nand_calculate_ecc (const u_char *dat, u_char *ecc_code);
static int error;
-int obj_compare(const void *a, const void * b)
+static int obj_compare(const void *a, const void * b)
{
objItem *oa, *ob;
}
-void add_obj_to_list(dev_t dev, ino_t ino, int obj)
+static void add_obj_to_list(dev_t dev, ino_t ino, int obj)
{
if(n_obj < MAX_OBJECTS)
{
}
-int find_obj_in_list(dev_t dev, ino_t ino)
+static int find_obj_in_list(dev_t dev, ino_t ino)
{
objItem *i = NULL;
objItem test;
-
+
test.dev = dev;
test.ino = ino;
}
-void yaffs_CalcECC(const __u8 *data, yaffs_Spare *spare)
+static void yaffs_CalcECC(const __u8 *data, yaffs_Spare *spare)
{
nand_calculate_ecc (data , spare->ecc1);
nand_calculate_ecc (&data[256] , spare->ecc2);
}
-void yaffs_CalcTagsECC(yaffs_Tags *tags)
+static void yaffs_CalcTagsECC(yaffs_Tags *tags)
{
// Todo don't do anything yet. Need to calculate ecc
unsigned char *b = ((yaffs_TagsUnion *)tags)->asBytes;
{
yaffs_TagsUnion *tu = (yaffs_TagsUnion *)tagsPtr;
- yaffs_CalcTagsECC(tagsPtr);
+ //yaffs_CalcTagsECC(tagsPtr);
sparePtr->tagByte0 = tu->asBytes[0];
sparePtr->tagByte1 = tu->asBytes[1];
-int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes)
+static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes)
{
yaffs_Tags t;
yaffs_Spare s;
-
+
error = write(outFile,data,512);
if(error < 0) return error;
-
+
memset(&t,0xff,sizeof (yaffs_Tags));
memset(&s,0xff,sizeof (yaffs_Spare));
}
-int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
+static int write_object_header(int objId, yaffs_ObjectType t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
{
__u8 bytes[512];
strncpy(oh->name,name,YAFFS_MAX_NAME_LENGTH);
- // NCB added 10/9/2001
- oh->sum = yaffs_CalcNameSum(oh->name);
if(t != YAFFS_OBJECT_TYPE_HARDLINK)
{
}
-int process_directory(int parent, const char *path)
+static int process_directory(int parent, const char *path)
{
DIR *dir;
struct dirent *entry;
- nDirectories++;
+ nDirectories++;
dir = opendir(path);
char symname[500];
- memset(symname,0,500);
+ memset(symname,0, sizeof(symname));
- readlink(full_name,symname,499);
+ readlink(full_name,symname,sizeof(symname) -1);
printf("symlink to \"%s\"\n",symname);
error = write_object_header(newObj, YAFFS_OBJECT_TYPE_SYMLINK, &stats, parent, entry->d_name, -1, symname);
{
printf("usage: mkyaffsimage dir image_file\n");
printf(" dir the directory tree to be converted\n");
- printf(" image_file the ouput file to hold the image\n");
+ printf(" image_file the output file to hold the image\n");
exit(1);
}