Subversion Repositories QNX 8.QNX8 IFS tool

Rev

Rev 30 | Rev 33 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30 Rev 31
Line 2447... Line 2447...
2447
         continue; // skip all entries that don't have a separate data block and those who were written already
2447
         continue; // skip all entries that don't have a separate data block and those who were written already
2448
      fsentries[fsentry_index].u.file.offset = (uint32_t) (ifs.data.size - ifs.offsets.imageheader); // save file data blob offset in file structure
2448
      fsentries[fsentry_index].u.file.offset = (uint32_t) (ifs.data.size - ifs.offsets.imageheader); // save file data blob offset in file structure
2449
      Buffer_AppendIFSFileData (&ifs.data, &fsentries[fsentry_index]); // write file data
2449
      Buffer_AppendIFSFileData (&ifs.data, &fsentries[fsentry_index]); // write file data
2450
      fsentries[fsentry_index].UNSAVED_was_data_written = true; // and remember this file's data was written
2450
      fsentries[fsentry_index].UNSAVED_was_data_written = true; // and remember this file's data was written
2451
   }
2451
   }
2452
   for (fsentry_index = 1; fsentry_index < fsentry_count; fsentry_index++) // other files (non-ELF, e.g. scripts and data files) last
2452
   // other files (non-ELF, e.g. scripts and data files) last, in decreasing size order
-
 
2453
   for (;;)
2453
   {
2454
   {
-
 
2455
      // look for the biggest one that can fit
-
 
2456
      largest_index = 0;
-
 
2457
      largest_size = 0;
-
 
2458
      for (fsentry_index = 1; fsentry_index < fsentry_count; fsentry_index++)
-
 
2459
      {
2454
      if (!S_ISREG (fsentries[fsentry_index].header.mode) || fsentries[fsentry_index].UNSAVED_was_data_written) // filter out anything that's not a file, and anything that's been already written
2460
         if (!S_ISREG (fsentries[fsentry_index].header.mode) || fsentries[fsentry_index].UNSAVED_was_data_written)
2455
         continue; // skip all entries that don't have a separate data block and those who were written already
2461
            continue; // skip all entries that don't have a separate data block, those who were written already and those that wouldn't fit
-
 
2462
         if (fsentries[fsentry_index].u.file.size > largest_size)
-
 
2463
         {
-
 
2464
            largest_size = fsentries[fsentry_index].u.file.size;
-
 
2465
            largest_index = fsentry_index;
-
 
2466
         }
-
 
2467
      }
-
 
2468
      if (largest_size == 0)
-
 
2469
         break; // found none ? if so, stop searching
-
 
2470
      fsentry_index = largest_index;
-
 
2471
 
2456
      fsentries[fsentry_index].u.file.offset = (uint32_t) (ifs.data.size - ifs.offsets.imageheader); // save file data blob offset in file structure
2472
      fsentries[fsentry_index].u.file.offset = (uint32_t) (ifs.data.size - ifs.offsets.imageheader); // save file data blob offset in file structure
2457
      Buffer_AppendIFSFileData (&ifs.data, &fsentries[fsentry_index]); // write file data
2473
      Buffer_AppendIFSFileData (&ifs.data, &fsentries[fsentry_index]); // write file data
2458
      fsentries[fsentry_index].UNSAVED_was_data_written = true; // and remember this file's data was written
2474
      fsentries[fsentry_index].UNSAVED_was_data_written = true; // and remember this file's data was written
2459
   }
2475
   }
2460
   ASSERT_WITH_ERRNO (Buffer_PadWithZeroesTo (&ifs.data, ROUND_TO_UPPER_MULTIPLE (ifs.data.size, image_align))); // pad as necessary
2476
   ASSERT_WITH_ERRNO (Buffer_PadWithZeroesTo (&ifs.data, ROUND_TO_UPPER_MULTIPLE (ifs.data.size, image_align))); // pad as necessary