Lines Matching refs:sup
86 struct ubifs_sb_node *sup; in create_default_filesystem() local
172 sup = kzalloc(tmp, GFP_KERNEL); in create_default_filesystem()
173 if (!sup) in create_default_filesystem()
181 sup->ch.node_type = UBIFS_SB_NODE; in create_default_filesystem()
182 sup->key_hash = UBIFS_KEY_HASH_R5; in create_default_filesystem()
183 sup->flags = cpu_to_le32(sup_flags); in create_default_filesystem()
184 sup->min_io_size = cpu_to_le32(c->min_io_size); in create_default_filesystem()
185 sup->leb_size = cpu_to_le32(c->leb_size); in create_default_filesystem()
186 sup->leb_cnt = cpu_to_le32(c->leb_cnt); in create_default_filesystem()
187 sup->max_leb_cnt = cpu_to_le32(c->max_leb_cnt); in create_default_filesystem()
188 sup->max_bud_bytes = cpu_to_le64(tmp64); in create_default_filesystem()
189 sup->log_lebs = cpu_to_le32(log_lebs); in create_default_filesystem()
190 sup->lpt_lebs = cpu_to_le32(lpt_lebs); in create_default_filesystem()
191 sup->orph_lebs = cpu_to_le32(orph_lebs); in create_default_filesystem()
192 sup->jhead_cnt = cpu_to_le32(DEFAULT_JHEADS_CNT); in create_default_filesystem()
193 sup->fanout = cpu_to_le32(DEFAULT_FANOUT); in create_default_filesystem()
194 sup->lsave_cnt = cpu_to_le32(c->lsave_cnt); in create_default_filesystem()
195 sup->fmt_version = cpu_to_le32(UBIFS_FORMAT_VERSION); in create_default_filesystem()
196 sup->time_gran = cpu_to_le32(DEFAULT_TIME_GRAN); in create_default_filesystem()
198 sup->default_compr = cpu_to_le16(c->mount_opts.compr_type); in create_default_filesystem()
200 sup->default_compr = cpu_to_le16(get_default_compressor(c)); in create_default_filesystem()
202 generate_random_uuid(sup->uuid); in create_default_filesystem()
208 sup->rp_size = cpu_to_le64(tmp64); in create_default_filesystem()
209 sup->ro_compat_version = cpu_to_le32(UBIFS_RO_COMPAT_VERSION); in create_default_filesystem()
211 err = ubifs_write_node(c, sup, UBIFS_SB_NODE_SZ, 0, 0); in create_default_filesystem()
212 kfree(sup); in create_default_filesystem()
370 static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) in validate_sb() argument
380 if (sup->key_fmt != UBIFS_SIMPLE_KEY_FMT) { in validate_sb()
385 if (le32_to_cpu(sup->min_io_size) != c->min_io_size) { in validate_sb()
387 le32_to_cpu(sup->min_io_size), c->min_io_size); in validate_sb()
391 if (le32_to_cpu(sup->leb_size) != c->leb_size) { in validate_sb()
393 le32_to_cpu(sup->leb_size), c->leb_size); in validate_sb()
480 if (le32_to_cpu(sup->time_gran) > 1000000000 || in validate_sb()
481 le32_to_cpu(sup->time_gran) < 1) { in validate_sb()
500 ubifs_dump_node(c, sup); in validate_sb()
514 struct ubifs_sb_node *sup; in ubifs_read_sb_node() local
517 sup = kmalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_NOFS); in ubifs_read_sb_node()
518 if (!sup) in ubifs_read_sb_node()
521 err = ubifs_read_node(c, sup, UBIFS_SB_NODE, UBIFS_SB_NODE_SZ, in ubifs_read_sb_node()
524 kfree(sup); in ubifs_read_sb_node()
528 return sup; in ubifs_read_sb_node()
538 int ubifs_write_sb_node(struct ubifs_info *c, struct ubifs_sb_node *sup) in ubifs_write_sb_node() argument
542 ubifs_prepare_node(c, sup, UBIFS_SB_NODE_SZ, 1); in ubifs_write_sb_node()
543 return ubifs_leb_change(c, UBIFS_SB_LNUM, sup, len); in ubifs_write_sb_node()
557 struct ubifs_sb_node *sup; in ubifs_read_superblock() local
565 sup = ubifs_read_sb_node(c); in ubifs_read_superblock()
566 if (IS_ERR(sup)) in ubifs_read_superblock()
567 return PTR_ERR(sup); in ubifs_read_superblock()
569 c->fmt_version = le32_to_cpu(sup->fmt_version); in ubifs_read_superblock()
570 c->ro_compat_version = le32_to_cpu(sup->ro_compat_version); in ubifs_read_superblock()
607 switch (sup->key_hash) { in ubifs_read_superblock()
619 c->key_fmt = sup->key_fmt; in ubifs_read_superblock()
631 c->leb_cnt = le32_to_cpu(sup->leb_cnt); in ubifs_read_superblock()
632 c->max_leb_cnt = le32_to_cpu(sup->max_leb_cnt); in ubifs_read_superblock()
633 c->max_bud_bytes = le64_to_cpu(sup->max_bud_bytes); in ubifs_read_superblock()
634 c->log_lebs = le32_to_cpu(sup->log_lebs); in ubifs_read_superblock()
635 c->lpt_lebs = le32_to_cpu(sup->lpt_lebs); in ubifs_read_superblock()
636 c->orph_lebs = le32_to_cpu(sup->orph_lebs); in ubifs_read_superblock()
637 c->jhead_cnt = le32_to_cpu(sup->jhead_cnt) + NONDATA_JHEADS_CNT; in ubifs_read_superblock()
638 c->fanout = le32_to_cpu(sup->fanout); in ubifs_read_superblock()
639 c->lsave_cnt = le32_to_cpu(sup->lsave_cnt); in ubifs_read_superblock()
640 c->rp_size = le64_to_cpu(sup->rp_size); in ubifs_read_superblock()
641 c->rp_uid = make_kuid(&init_user_ns, le32_to_cpu(sup->rp_uid)); in ubifs_read_superblock()
642 c->rp_gid = make_kgid(&init_user_ns, le32_to_cpu(sup->rp_gid)); in ubifs_read_superblock()
643 sup_flags = le32_to_cpu(sup->flags); in ubifs_read_superblock()
645 c->default_compr = le16_to_cpu(sup->default_compr); in ubifs_read_superblock()
647 c->vfs_sb->s_time_gran = le32_to_cpu(sup->time_gran); in ubifs_read_superblock()
648 memcpy(&c->uuid, &sup->uuid, 16); in ubifs_read_superblock()
680 sup->leb_cnt = cpu_to_le32(c->leb_cnt); in ubifs_read_superblock()
681 err = ubifs_write_sb_node(c, sup); in ubifs_read_superblock()
698 err = validate_sb(c, sup); in ubifs_read_superblock()
700 kfree(sup); in ubifs_read_superblock()
829 struct ubifs_sb_node *sup; in ubifs_fixup_free_space() local
840 sup = ubifs_read_sb_node(c); in ubifs_fixup_free_space()
841 if (IS_ERR(sup)) in ubifs_fixup_free_space()
842 return PTR_ERR(sup); in ubifs_fixup_free_space()
846 sup->flags &= cpu_to_le32(~UBIFS_FLG_SPACE_FIXUP); in ubifs_fixup_free_space()
848 err = ubifs_write_sb_node(c, sup); in ubifs_fixup_free_space()
849 kfree(sup); in ubifs_fixup_free_space()
860 struct ubifs_sb_node *sup; in ubifs_enable_encryption() local
873 sup = ubifs_read_sb_node(c); in ubifs_enable_encryption()
874 if (IS_ERR(sup)) in ubifs_enable_encryption()
875 return PTR_ERR(sup); in ubifs_enable_encryption()
877 sup->flags |= cpu_to_le32(UBIFS_FLG_ENCRYPTION); in ubifs_enable_encryption()
879 err = ubifs_write_sb_node(c, sup); in ubifs_enable_encryption()
882 kfree(sup); in ubifs_enable_encryption()