char *path; /* Path of this directory (think dirname) */
char *fullname; /* Full name of this directory (i.e. path+name) */
char *hostname; /* Full path to this file on the host filesystem */
+ uint32_t ino; /* Inode number of this file in JFFS2 */
struct stat sb; /* Stores directory permissions and whatnot */
char *link; /* Target a symlink points to. */
struct filesystem_entry *parent; /* Parent directory */
struct filesystem_entry *files; /* Only relevant to directories */
};
-
static int out_fd = -1;
static int in_fd = -1;
static char default_rootdir[] = ".";
rd.totlen = cpu_to_je32(sizeof(rd) + strlen(name));
rd.hdr_crc = cpu_to_je32(crc32(0, &rd,
sizeof(struct jffs2_unknown_node) - 4));
- rd.pino = cpu_to_je32((e->parent) ? e->parent->sb.st_ino : 1);
+ rd.pino = cpu_to_je32((e->parent) ? e->parent->ino : 1);
rd.version = cpu_to_je32(version++);
- rd.ino = cpu_to_je32(statbuf->st_ino);
+ rd.ino = cpu_to_je32(e->ino);
rd.mctime = cpu_to_je32(statbuf->st_mtime);
rd.nsize = strlen(name);
rd.type = IFTODT(statbuf->st_mode);
perror_msg_and_die("%s: open file", e->hostname);
}
- statbuf->st_ino = ++ino;
+ e->ino = ++ino;
mkfs_debug_msg("writing file '%s' ino=%lu parent_ino=%lu",
- e->name, (unsigned long) statbuf->st_ino,
- (unsigned long) e->parent->sb.st_ino);
+ e->name, (unsigned long) e->ino,
+ (unsigned long) e->parent->ino);
write_dirent(e);
buf = xmalloc(page_size);
ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
- ri.ino = cpu_to_je32(statbuf->st_ino);
+ ri.ino = cpu_to_je32(e->ino);
ri.mode = cpu_to_jemode(statbuf->st_mode);
ri.uid = cpu_to_je16(statbuf->st_uid);
ri.gid = cpu_to_je16(statbuf->st_gid);
struct jffs2_raw_inode ri;
statbuf = &(e->sb);
- statbuf->st_ino = ++ino;
+ e->ino = ++ino;
mkfs_debug_msg("writing symlink '%s' ino=%lu parent_ino=%lu",
- e->name, (unsigned long) statbuf->st_ino,
- (unsigned long) e->parent->sb.st_ino);
+ e->name, (unsigned long) e->ino,
+ (unsigned long) e->parent->ino);
write_dirent(e);
len = strlen(e->link);
ri.hdr_crc = cpu_to_je32(crc32(0,
&ri, sizeof(struct jffs2_unknown_node) - 4));
- ri.ino = cpu_to_je32(statbuf->st_ino);
+ ri.ino = cpu_to_je32(e->ino);
ri.mode = cpu_to_jemode(statbuf->st_mode);
ri.uid = cpu_to_je16(statbuf->st_uid);
ri.gid = cpu_to_je16(statbuf->st_gid);
struct jffs2_raw_inode ri;
statbuf = &(e->sb);
- statbuf->st_ino = ++ino;
+ e->ino = ++ino;
if (S_ISDIR(statbuf->st_mode)) {
mkfs_debug_msg("writing dir '%s' ino=%lu parent_ino=%lu",
- e->name, (unsigned long) statbuf->st_ino,
- (unsigned long) (e->parent) ? e->parent->sb. st_ino : 1);
+ e->name, (unsigned long) e->ino,
+ (unsigned long) (e->parent) ? e->parent->ino : 1);
}
write_dirent(e);
ri.hdr_crc = cpu_to_je32(crc32(0,
&ri, sizeof(struct jffs2_unknown_node) - 4));
- ri.ino = cpu_to_je32(statbuf->st_ino);
+ ri.ino = cpu_to_je32(e->ino);
ri.mode = cpu_to_jemode(statbuf->st_mode);
ri.uid = cpu_to_je16(statbuf->st_uid);
ri.gid = cpu_to_je16(statbuf->st_gid);
struct jffs2_raw_inode ri;
statbuf = &(e->sb);
- statbuf->st_ino = ++ino;
+ e->ino = ++ino;
write_dirent(e);
kdev = cpu_to_je16((major(statbuf->st_rdev) << 8) +
ri.hdr_crc = cpu_to_je32(crc32(0,
&ri, sizeof(struct jffs2_unknown_node) - 4));
- ri.ino = cpu_to_je32(statbuf->st_ino);
+ ri.ino = cpu_to_je32(e->ino);
ri.mode = cpu_to_jemode(statbuf->st_mode);
ri.uid = cpu_to_je16(statbuf->st_uid);
ri.gid = cpu_to_je16(statbuf->st_gid);
ref.nodetype = cpu_to_je16(JFFS2_NODETYPE_XREF);
ref.totlen = cpu_to_je32(sizeof(ref));
ref.hdr_crc = cpu_to_je32(crc32(0, &ref, sizeof(struct jffs2_unknown_node) - 4));
- ref.ino = cpu_to_je32(e->sb.st_ino);
+ ref.ino = cpu_to_je32(e->ino);
ref.xid = cpu_to_je32(xe->xid);
ref.xseqno = cpu_to_je32(highest_xseqno += 2);
ref.node_crc = cpu_to_je32(crc32(0, &ref, sizeof(ref) - 4));
if (ino == 0)
ino = 1;
- root->sb.st_ino = 1;
+ root->ino = 1;
recursive_populate_directory(root);
if (pad_fs_size == -1) {