Lines Matching refs:offset
103 unsigned int offset; /* pointer to compressed data in archive */
324 unsigned int offset = sizeof(struct cramfs_super) + image_length;
327 offset += opt_pad;
360 super->root.offset = offset >> 2;
362 return offset;
365 static void set_data_offset(struct entry *entry, char *base, unsigned long offset)
369 assert ((offset & 3) == 0);
371 if (offset >= (1 << (2 + CRAMFS_OFFSET_WIDTH))) {
375 inode->offset = (offset >> 2);
385 static unsigned int write_directory_structure(struct entry *entry, char *base, unsigned int offset)
393 struct cramfs_inode *inode = (struct cramfs_inode *) (base + offset);
396 entry->dir_offset = offset;
408 inode->offset = 0;
410 write over inode->offset later. */
412 offset += sizeof(struct cramfs_inode);
414 memcpy(base + offset, entry->name, len);
417 *(base + offset + len) = '\0';
421 offset += len;
463 set_data_offset(entry, base, offset);
467 return offset;
491 * output. The first block does not need an offset pointer,
499 static unsigned int do_compress(char *base, unsigned int offset, char const *name, char *uncompressed, unsigned int size)
502 unsigned long original_offset = offset;
505 unsigned long curr = offset + 4 * blocks;
528 *(unsigned int *) (base + offset) = curr;
529 offset += 4;
550 static unsigned int write_data(struct entry *entry, char *base, unsigned int offset)
555 set_data_offset(entry, base, entry->same->offset);
556 entry->offset=entry->same->offset;
558 set_data_offset(entry, base, offset);
559 entry->offset=offset;
560 offset = do_compress(base, offset, entry->name, entry->uncompressed, entry->size);
564 offset = write_data(entry->child, base, offset);
567 return offset;
570 static unsigned int write_file(char *file, char *base, unsigned int offset)
581 memcpy(base + offset, buf, image_length);
586 *(base + offset + image_length) = '\0';
589 return (offset + image_length);
599 #define MAXFSLEN ((((1 << CRAMFS_OFFSET_WIDTH) - 1) << 2) /* offset */ \
618 ssize_t offset, written;
736 offset = opt_pad;
740 offset += sizeof(struct cramfs_super);
745 offset = write_file(opt_image, rom_image, offset);
748 offset = write_directory_structure(root_entry->child, rom_image, offset);
749 printf("Directory data: %d bytes\n", offset);
751 offset = write_data(root_entry, rom_image, offset);
755 offset = ((offset - 1) | (blksize - 1)) + 1;
756 printf("Everything: %d kilobytes\n", offset >> 10);
759 write_superblock(root_entry, rom_image+opt_pad, offset);
763 crc = crc32(crc, (rom_image+opt_pad), (offset-opt_pad));
768 if (fslen_ub < offset) {
770 fslen_ub, offset);
774 written = write(fd, rom_image, offset);
779 if (offset != written) {
780 fprintf(stderr, "ROM image write failed (%d %d)\n", written, offset);