Lines Matching refs:sup
77 struct ubifs_sb_node *sup; in create_default_filesystem() local
163 sup = kzalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_KERNEL); in create_default_filesystem()
170 if (!sup || !mst || !idx || !ino || !cs) { in create_default_filesystem()
185 sup->hash_algo = cpu_to_le16(c->auth_hash_algo); in create_default_filesystem()
186 err = ubifs_hmac_wkm(c, sup->hmac_wkm); in create_default_filesystem()
190 sup->hash_algo = cpu_to_le16(0xffff); in create_default_filesystem()
193 sup->ch.node_type = UBIFS_SB_NODE; in create_default_filesystem()
194 sup->key_hash = UBIFS_KEY_HASH_R5; in create_default_filesystem()
195 sup->flags = cpu_to_le32(sup_flags); in create_default_filesystem()
196 sup->min_io_size = cpu_to_le32(c->min_io_size); in create_default_filesystem()
197 sup->leb_size = cpu_to_le32(c->leb_size); in create_default_filesystem()
198 sup->leb_cnt = cpu_to_le32(c->leb_cnt); in create_default_filesystem()
199 sup->max_leb_cnt = cpu_to_le32(c->max_leb_cnt); in create_default_filesystem()
200 sup->max_bud_bytes = cpu_to_le64(tmp64); in create_default_filesystem()
201 sup->log_lebs = cpu_to_le32(log_lebs); in create_default_filesystem()
202 sup->lpt_lebs = cpu_to_le32(lpt_lebs); in create_default_filesystem()
203 sup->orph_lebs = cpu_to_le32(orph_lebs); in create_default_filesystem()
204 sup->jhead_cnt = cpu_to_le32(DEFAULT_JHEADS_CNT); in create_default_filesystem()
205 sup->fanout = cpu_to_le32(DEFAULT_FANOUT); in create_default_filesystem()
206 sup->lsave_cnt = cpu_to_le32(c->lsave_cnt); in create_default_filesystem()
207 sup->fmt_version = cpu_to_le32(ubifs_default_version); in create_default_filesystem()
208 sup->time_gran = cpu_to_le32(DEFAULT_TIME_GRAN); in create_default_filesystem()
210 sup->default_compr = cpu_to_le16(c->mount_opts.compr_type); in create_default_filesystem()
212 sup->default_compr = cpu_to_le16(get_default_compressor(c)); in create_default_filesystem()
214 generate_random_uuid(sup->uuid); in create_default_filesystem()
220 sup->rp_size = cpu_to_le64(tmp64); in create_default_filesystem()
221 sup->ro_compat_version = cpu_to_le32(UBIFS_RO_COMPAT_VERSION); in create_default_filesystem()
322 err = ubifs_write_node_hmac(c, sup, UBIFS_SB_NODE_SZ, 0, 0, in create_default_filesystem()
360 kfree(sup); in create_default_filesystem()
379 static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) in validate_sb() argument
389 if (sup->key_fmt != UBIFS_SIMPLE_KEY_FMT) { in validate_sb()
394 if (le32_to_cpu(sup->min_io_size) != c->min_io_size) { in validate_sb()
396 le32_to_cpu(sup->min_io_size), c->min_io_size); in validate_sb()
400 if (le32_to_cpu(sup->leb_size) != c->leb_size) { in validate_sb()
402 le32_to_cpu(sup->leb_size), c->leb_size); in validate_sb()
489 if (le32_to_cpu(sup->time_gran) > 1000000000 || in validate_sb()
490 le32_to_cpu(sup->time_gran) < 1) { in validate_sb()
509 ubifs_dump_node(c, sup, ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size)); in validate_sb()
523 struct ubifs_sb_node *sup; in ubifs_read_sb_node() local
526 sup = kmalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_NOFS); in ubifs_read_sb_node()
527 if (!sup) in ubifs_read_sb_node()
530 err = ubifs_read_node(c, sup, UBIFS_SB_NODE, UBIFS_SB_NODE_SZ, in ubifs_read_sb_node()
533 kfree(sup); in ubifs_read_sb_node()
537 return sup; in ubifs_read_sb_node()
541 const struct ubifs_sb_node *sup) in authenticate_sb_node() argument
543 unsigned int sup_flags = le32_to_cpu(sup->flags); in authenticate_sb_node()
568 hash_algo = le16_to_cpu(sup->hash_algo); in authenticate_sb_node()
587 if (ubifs_hmac_zero(c, sup->hmac)) { in authenticate_sb_node()
588 err = ubifs_sb_verify_signature(c, sup); in authenticate_sb_node()
593 if (ubifs_check_hmac(c, hmac_wkm, sup->hmac_wkm)) { in authenticate_sb_node()
597 err = ubifs_node_verify_hmac(c, sup, sizeof(*sup), in authenticate_sb_node()
615 int ubifs_write_sb_node(struct ubifs_info *c, struct ubifs_sb_node *sup) in ubifs_write_sb_node() argument
620 err = ubifs_prepare_node_hmac(c, sup, UBIFS_SB_NODE_SZ, in ubifs_write_sb_node()
625 return ubifs_leb_change(c, UBIFS_SB_LNUM, sup, len); in ubifs_write_sb_node()
639 struct ubifs_sb_node *sup; in ubifs_read_superblock() local
647 sup = ubifs_read_sb_node(c); in ubifs_read_superblock()
648 if (IS_ERR(sup)) in ubifs_read_superblock()
649 return PTR_ERR(sup); in ubifs_read_superblock()
651 c->sup_node = sup; in ubifs_read_superblock()
653 c->fmt_version = le32_to_cpu(sup->fmt_version); in ubifs_read_superblock()
654 c->ro_compat_version = le32_to_cpu(sup->ro_compat_version); in ubifs_read_superblock()
691 switch (sup->key_hash) { in ubifs_read_superblock()
703 c->key_fmt = sup->key_fmt; in ubifs_read_superblock()
715 c->leb_cnt = le32_to_cpu(sup->leb_cnt); in ubifs_read_superblock()
716 c->max_leb_cnt = le32_to_cpu(sup->max_leb_cnt); in ubifs_read_superblock()
717 c->max_bud_bytes = le64_to_cpu(sup->max_bud_bytes); in ubifs_read_superblock()
718 c->log_lebs = le32_to_cpu(sup->log_lebs); in ubifs_read_superblock()
719 c->lpt_lebs = le32_to_cpu(sup->lpt_lebs); in ubifs_read_superblock()
720 c->orph_lebs = le32_to_cpu(sup->orph_lebs); in ubifs_read_superblock()
721 c->jhead_cnt = le32_to_cpu(sup->jhead_cnt) + NONDATA_JHEADS_CNT; in ubifs_read_superblock()
722 c->fanout = le32_to_cpu(sup->fanout); in ubifs_read_superblock()
723 c->lsave_cnt = le32_to_cpu(sup->lsave_cnt); in ubifs_read_superblock()
724 c->rp_size = le64_to_cpu(sup->rp_size); in ubifs_read_superblock()
725 c->rp_uid = make_kuid(&init_user_ns, le32_to_cpu(sup->rp_uid)); in ubifs_read_superblock()
726 c->rp_gid = make_kgid(&init_user_ns, le32_to_cpu(sup->rp_gid)); in ubifs_read_superblock()
727 sup_flags = le32_to_cpu(sup->flags); in ubifs_read_superblock()
729 c->default_compr = le16_to_cpu(sup->default_compr); in ubifs_read_superblock()
731 c->vfs_sb->s_time_gran = le32_to_cpu(sup->time_gran); in ubifs_read_superblock()
732 memcpy(&c->uuid, &sup->uuid, 16); in ubifs_read_superblock()
738 err = authenticate_sb_node(c, sup); in ubifs_read_superblock()
761 sup->leb_cnt = cpu_to_le32(c->leb_cnt); in ubifs_read_superblock()
779 err = validate_sb(c, sup); in ubifs_read_superblock()
909 struct ubifs_sb_node *sup = c->sup_node; in ubifs_fixup_free_space() local
922 sup->flags &= cpu_to_le32(~UBIFS_FLG_SPACE_FIXUP); in ubifs_fixup_free_space()
933 struct ubifs_sb_node *sup = c->sup_node; in ubifs_enable_encryption() local
949 sup->flags |= cpu_to_le32(UBIFS_FLG_ENCRYPTION); in ubifs_enable_encryption()
951 err = ubifs_write_sb_node(c, sup); in ubifs_enable_encryption()