3 * Fill a data buffer with info to look like an on-disk inode
12 void lafs_inode_fillblock(struct lafs_ino *ino, char *buf)
14 struct la_inode *lino = (void*)buf;
16 lino->data_blocks = __cpu_to_le32(ino->cblocks);
17 lino->index_blocks = __cpu_to_le32(ino->ciblocks);
18 lino->generation = __cpu_to_le16(ino->generation);
19 lino->metadata_size = __cpu_to_le16(ino->metadata_size);
20 lino->depth = ino->depth;
21 lino->trunc_gen = ino->trunc_gen;
22 lino->filetype = ino->type;
23 lino->flags = ino->flags;
25 trace(1, "FILL inode (type=%d)\n", ino->type);
29 struct fs_metadata *sfs = &lino->metadata[0].fs;
30 struct fs_md *mfs = &ino->md.fs;
31 sfs->update_time = __cpu_to_le64(mfs->update_time);
32 sfs->blocks_used = __cpu_to_le64(mfs->cblocks_used);
33 sfs->blocks_allowed = __cpu_to_le64(mfs->blocks_allowed);
34 sfs->creation_age = __cpu_to_le64(mfs->creation_age);
35 sfs->inodes_used = __cpu_to_le32(mfs->inodes_used);
36 sfs->snapshot_usage_table = __cpu_to_le16(mfs->usagetable);
37 sfs->quota_inodes[0] = __cpu_to_le32(mfs->quota_inums[0]);
38 sfs->quota_inodes[1] = __cpu_to_le32(mfs->quota_inums[1]);
39 sfs->quota_inodes[2] = __cpu_to_le32(mfs->quota_inums[2]);
40 /* FIXME do something with name */
45 struct inodemap_metadata *sim = &lino->metadata[0].inodemap;
46 struct inodemap_md *mim = &ino->md.inodemap;
47 sim->size = __cpu_to_le32(mim->size);
52 struct su_metadata *s = &lino->metadata[0].segmentusage;
53 struct su_md *m = &ino->md.segmentusage;
54 s->table_size = __cpu_to_le32(m->table_size);
59 struct quota_metadata *s = &lino->metadata[0].quota;
60 struct quota_md *m = &ino->md.quota;
61 s->gracetime = __cpu_to_le32(m->gracetime);
62 s->graceunits = __cpu_to_le32(m->graceunits);
68 default: /* external-file */
70 struct file_metadata *sfl = & lino->metadata[0].file;
71 struct file_md *mfl = & ino->md.file;
72 struct dir_metadata *sdr = & lino->metadata[0].dir;
73 struct special_metadata *ssp = & lino->metadata[0].special;
75 if (ino->type < TypeBase) abort();
76 sfl->flags = __cpu_to_le16(mfl->flags);
77 sfl->mode = __cpu_to_le16(mfl->mode);
78 sfl->userid = __cpu_to_le32(mfl->uid);
79 sfl->groupid = __cpu_to_le32(mfl->gid);
80 sfl->treeid = __cpu_to_le32(mfl->treeid);
81 sfl->creationtime = __cpu_to_le64(mfl->creationtime);
82 sfl->modifytime = __cpu_to_le64(mfl->modifytime);
83 sfl->ctime = __cpu_to_le64(mfl->ctime);
84 sfl->accesstime = __cpu_to_le64(mfl->i_accesstime);
85 /* FIXME should we zero the accesstime file at this point? */
86 sfl->size = __cpu_to_le64(mfl->size);
87 sfl->parent = __cpu_to_le32(mfl->parent);
88 sfl->linkcount = __cpu_to_le32(mfl->linkcount);
91 if (ino->type == TypeDir)
92 sdr->hash_seed = __cpu_to_le32(mfl->seed);
93 if (ino->type == TypeSpecial) {
94 ssp->major = __cpu_to_le32(mfl->major);
95 ssp->minor = __cpu_to_le32(mfl->minor);