Lines Matching full:c

5  * Copyright (C) 2006-2008 Nokia Corporation.
54 static int get_default_compressor(struct ubifs_info *c) in get_default_compressor() argument
56 if (ubifs_compr_present(c, UBIFS_COMPR_LZO)) in get_default_compressor()
59 if (ubifs_compr_present(c, UBIFS_COMPR_ZLIB)) in get_default_compressor()
67 * @c: UBIFS file-system description object
72 static int create_default_filesystem(struct ubifs_info *c) in create_default_filesystem() argument
91 /* Some functions called from here depend on the @c->key_len filed */ in create_default_filesystem()
92 c->key_len = UBIFS_SK_LEN; in create_default_filesystem()
98 if (c->leb_cnt < 0x7FFFFFFF / DEFAULT_JNL_PERCENT) in create_default_filesystem()
100 jnl_lebs = c->leb_cnt * DEFAULT_JNL_PERCENT / 100; in create_default_filesystem()
102 jnl_lebs = (c->leb_cnt / 100) * DEFAULT_JNL_PERCENT; in create_default_filesystem()
106 if (jnl_lebs * c->leb_size > DEFAULT_MAX_JNL) in create_default_filesystem()
107 jnl_lebs = DEFAULT_MAX_JNL / c->leb_size; in create_default_filesystem()
115 tmp = 2 * (c->ref_node_alsz * jnl_lebs) + c->leb_size - 1; in create_default_filesystem()
116 log_lebs = tmp / c->leb_size; in create_default_filesystem()
119 if (c->leb_cnt - min_leb_cnt > 8) { in create_default_filesystem()
136 if (c->leb_cnt - min_leb_cnt > 1) in create_default_filesystem()
144 main_lebs = c->leb_cnt - UBIFS_SB_LEBS - UBIFS_MST_LEBS - log_lebs; in create_default_filesystem()
148 c->lsave_cnt = DEFAULT_LSAVE_CNT; in create_default_filesystem()
149 c->max_leb_cnt = c->leb_cnt; in create_default_filesystem()
150 err = ubifs_create_dflt_lpt(c, &main_lebs, lpt_first, &lpt_lebs, in create_default_filesystem()
158 main_first = c->leb_cnt - main_lebs; in create_default_filesystem()
160 sup = kzalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_KERNEL); in create_default_filesystem()
161 mst = kzalloc(c->mst_node_alsz, GFP_KERNEL); in create_default_filesystem()
162 idx_node_size = ubifs_idx_node_sz(c, 1); in create_default_filesystem()
163 idx = kzalloc(ALIGN(idx_node_size, c->min_io_size), GFP_KERNEL); in create_default_filesystem()
164 ino = kzalloc(ALIGN(UBIFS_INO_NODE_SZ, c->min_io_size), GFP_KERNEL); in create_default_filesystem()
165 cs = kzalloc(ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size), GFP_KERNEL); in create_default_filesystem()
174 tmp64 = (long long)max_buds * c->leb_size; in create_default_filesystem()
180 if (ubifs_authenticated(c)) { in create_default_filesystem()
182 sup->hash_algo = cpu_to_le16(c->auth_hash_algo); in create_default_filesystem()
183 err = ubifs_hmac_wkm(c, sup->hmac_wkm); in create_default_filesystem()
193 sup->min_io_size = cpu_to_le32(c->min_io_size); in create_default_filesystem()
194 sup->leb_size = cpu_to_le32(c->leb_size); in create_default_filesystem()
195 sup->leb_cnt = cpu_to_le32(c->leb_cnt); in create_default_filesystem()
196 sup->max_leb_cnt = cpu_to_le32(c->max_leb_cnt); in create_default_filesystem()
203 sup->lsave_cnt = cpu_to_le32(c->lsave_cnt); in create_default_filesystem()
206 if (c->mount_opts.override_compr) in create_default_filesystem()
207 sup->default_compr = cpu_to_le16(c->mount_opts.compr_type); in create_default_filesystem()
209 sup->default_compr = cpu_to_le16(get_default_compressor(c)); in create_default_filesystem()
213 main_bytes = (long long)main_lebs * c->leb_size; in create_default_filesystem()
230 tmp = ubifs_idx_node_sz(c, 1); in create_default_filesystem()
234 mst->ihead_offs = cpu_to_le32(ALIGN(tmp, c->min_io_size)); in create_default_filesystem()
236 mst->lpt_lnum = cpu_to_le32(c->lpt_lnum); in create_default_filesystem()
237 mst->lpt_offs = cpu_to_le32(c->lpt_offs); in create_default_filesystem()
238 mst->nhead_lnum = cpu_to_le32(c->nhead_lnum); in create_default_filesystem()
239 mst->nhead_offs = cpu_to_le32(c->nhead_offs); in create_default_filesystem()
240 mst->ltab_lnum = cpu_to_le32(c->ltab_lnum); in create_default_filesystem()
241 mst->ltab_offs = cpu_to_le32(c->ltab_offs); in create_default_filesystem()
242 mst->lsave_lnum = cpu_to_le32(c->lsave_lnum); in create_default_filesystem()
243 mst->lsave_offs = cpu_to_le32(c->lsave_offs); in create_default_filesystem()
247 mst->leb_cnt = cpu_to_le32(c->leb_cnt); in create_default_filesystem()
248 ubifs_copy_hash(c, hash_lpt, mst->hash_lpt); in create_default_filesystem()
252 tmp64 -= ALIGN(ubifs_idx_node_sz(c, 1), c->min_io_size); in create_default_filesystem()
253 tmp64 -= ALIGN(UBIFS_INO_NODE_SZ, c->min_io_size); in create_default_filesystem()
256 tmp64 = ALIGN(ubifs_idx_node_sz(c, 1), c->min_io_size); in create_default_filesystem()
257 ino_waste = ALIGN(UBIFS_INO_NODE_SZ, c->min_io_size) - in create_default_filesystem()
260 tmp64 -= ALIGN(ubifs_idx_node_sz(c, 1), 8); in create_default_filesystem()
264 tmp64 = ((long long)(c->main_lebs - 1) * c->dark_wm); in create_default_filesystem()
273 c->key_fmt = UBIFS_SIMPLE_KEY_FMT; in create_default_filesystem()
274 c->key_hash = key_r5_hash; in create_default_filesystem()
278 ino_key_init(c, &key, UBIFS_ROOT_INO); in create_default_filesystem()
279 br = ubifs_idx_branch(c, idx, 0); in create_default_filesystem()
280 key_write_idx(c, &key, &br->key); in create_default_filesystem()
289 ino_key_init_flash(c, &ino->key, UBIFS_ROOT_INO); in create_default_filesystem()
291 ino->creat_sqnum = cpu_to_le64(++c->max_sqnum); in create_default_filesystem()
319 err = ubifs_write_node_hmac(c, sup, UBIFS_SB_NODE_SZ, 0, 0, in create_default_filesystem()
324 err = ubifs_write_node(c, ino, UBIFS_INO_NODE_SZ, in create_default_filesystem()
329 ubifs_node_calc_hash(c, ino, hash); in create_default_filesystem()
330 ubifs_copy_hash(c, hash, ubifs_branch_hash(c, br)); in create_default_filesystem()
332 err = ubifs_write_node(c, idx, idx_node_size, main_first + DEFAULT_IDX_LEB, 0); in create_default_filesystem()
336 ubifs_node_calc_hash(c, idx, hash); in create_default_filesystem()
337 ubifs_copy_hash(c, hash, mst->hash_root_idx); in create_default_filesystem()
339 err = ubifs_write_node_hmac(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM, 0, in create_default_filesystem()
344 err = ubifs_write_node_hmac(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM + 1, in create_default_filesystem()
349 err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, 0); in create_default_filesystem()
353 ubifs_msg(c, "default file-system created"); in create_default_filesystem()
368 * @c: UBIFS file-system description object
372 * from the superblock and stored in @c, the function validates fields in @c
376 static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) in validate_sb() argument
381 if (!c->key_hash) { in validate_sb()
391 if (le32_to_cpu(sup->min_io_size) != c->min_io_size) { in validate_sb()
392 ubifs_err(c, "min. I/O unit mismatch: %d in superblock, %d real", in validate_sb()
393 le32_to_cpu(sup->min_io_size), c->min_io_size); in validate_sb()
397 if (le32_to_cpu(sup->leb_size) != c->leb_size) { in validate_sb()
398 ubifs_err(c, "LEB size mismatch: %d in superblock, %d real", in validate_sb()
399 le32_to_cpu(sup->leb_size), c->leb_size); in validate_sb()
403 if (c->log_lebs < UBIFS_MIN_LOG_LEBS || in validate_sb()
404 c->lpt_lebs < UBIFS_MIN_LPT_LEBS || in validate_sb()
405 c->orph_lebs < UBIFS_MIN_ORPH_LEBS || in validate_sb()
406 c->main_lebs < UBIFS_MIN_MAIN_LEBS) { in validate_sb()
416 min_leb_cnt = UBIFS_SB_LEBS + UBIFS_MST_LEBS + c->log_lebs; in validate_sb()
417 min_leb_cnt += c->lpt_lebs + c->orph_lebs + c->jhead_cnt + 6; in validate_sb()
419 if (c->leb_cnt < min_leb_cnt || c->leb_cnt > c->vi.size) { in validate_sb()
420 ubifs_err(c, "bad LEB count: %d in superblock, %d on UBI volume, %d minimum required", in validate_sb()
421 c->leb_cnt, c->vi.size, min_leb_cnt); in validate_sb()
425 if (c->max_leb_cnt < c->leb_cnt) { in validate_sb()
426 ubifs_err(c, "max. LEB count %d less than LEB count %d", in validate_sb()
427 c->max_leb_cnt, c->leb_cnt); in validate_sb()
431 if (c->main_lebs < UBIFS_MIN_MAIN_LEBS) { in validate_sb()
432 ubifs_err(c, "too few main LEBs count %d, must be at least %d", in validate_sb()
433 c->main_lebs, UBIFS_MIN_MAIN_LEBS); in validate_sb()
437 max_bytes = (long long)c->leb_size * UBIFS_MIN_BUD_LEBS; in validate_sb()
438 if (c->max_bud_bytes < max_bytes) { in validate_sb()
439 ubifs_err(c, "too small journal (%lld bytes), must be at least %lld bytes", in validate_sb()
440 c->max_bud_bytes, max_bytes); in validate_sb()
444 max_bytes = (long long)c->leb_size * c->main_lebs; in validate_sb()
445 if (c->max_bud_bytes > max_bytes) { in validate_sb()
446 ubifs_err(c, "too large journal size (%lld bytes), only %lld bytes available in the main area", in validate_sb()
447 c->max_bud_bytes, max_bytes); in validate_sb()
451 if (c->jhead_cnt < NONDATA_JHEADS_CNT + 1 || in validate_sb()
452 c->jhead_cnt > NONDATA_JHEADS_CNT + UBIFS_MAX_JHEADS) { in validate_sb()
457 if (c->fanout < UBIFS_MIN_FANOUT || in validate_sb()
458 ubifs_idx_node_sz(c, c->fanout) > c->leb_size) { in validate_sb()
463 if (c->lsave_cnt < 0 || (c->lsave_cnt > DEFAULT_LSAVE_CNT && in validate_sb()
464 c->lsave_cnt > c->max_leb_cnt - UBIFS_SB_LEBS - UBIFS_MST_LEBS - in validate_sb()
465 c->log_lebs - c->lpt_lebs - c->orph_lebs)) { in validate_sb()
470 if (UBIFS_SB_LEBS + UBIFS_MST_LEBS + c->log_lebs + c->lpt_lebs + in validate_sb()
471 c->orph_lebs + c->main_lebs != c->leb_cnt) { in validate_sb()
476 if (c->default_compr >= UBIFS_COMPR_TYPES_CNT) { in validate_sb()
481 if (c->rp_size < 0 || max_bytes < c->rp_size) { in validate_sb()
492 if (!c->double_hash && c->fmt_version >= 5) { in validate_sb()
497 if (c->encrypted && c->fmt_version < 5) { in validate_sb()
505 ubifs_err(c, "bad superblock, error %d", err); in validate_sb()
506 ubifs_dump_node(c, sup); in validate_sb()
512 * @c: UBIFS file-system description object
518 static struct ubifs_sb_node *ubifs_read_sb_node(struct ubifs_info *c) in ubifs_read_sb_node() argument
523 sup = kmalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_NOFS); in ubifs_read_sb_node()
527 err = ubifs_read_node(c, sup, UBIFS_SB_NODE, UBIFS_SB_NODE_SZ, in ubifs_read_sb_node()
537 static int authenticate_sb_node(struct ubifs_info *c, in authenticate_sb_node() argument
546 if (c->authenticated && !authenticated) { in authenticate_sb_node()
547 ubifs_err(c, "authenticated FS forced, but found FS without authentication"); in authenticate_sb_node()
551 if (!c->authenticated && authenticated) { in authenticate_sb_node()
552 ubifs_err(c, "authenticated FS found, but no key given"); in authenticate_sb_node()
556 ubifs_msg(c, "Mounting in %sauthenticated mode", in authenticate_sb_node()
557 c->authenticated ? "" : "un"); in authenticate_sb_node()
559 if (!c->authenticated) in authenticate_sb_node()
567 ubifs_err(c, "superblock uses unknown hash algo %d", in authenticate_sb_node()
572 if (strcmp(hash_algo_name[hash_algo], c->auth_hash_name)) { in authenticate_sb_node()
573 ubifs_err(c, "This filesystem uses %s for hashing," in authenticate_sb_node()
575 c->auth_hash_name); in authenticate_sb_node()
584 if (ubifs_hmac_zero(c, sup->hmac)) { in authenticate_sb_node()
585 err = ubifs_sb_verify_signature(c, sup); in authenticate_sb_node()
587 err = ubifs_hmac_wkm(c, hmac_wkm); in authenticate_sb_node()
590 if (ubifs_check_hmac(c, hmac_wkm, sup->hmac_wkm)) { in authenticate_sb_node()
591 ubifs_err(c, "provided key does not fit"); in authenticate_sb_node()
594 err = ubifs_node_verify_hmac(c, sup, sizeof(*sup), in authenticate_sb_node()
600 ubifs_err(c, "Failed to authenticate superblock: %d", err); in authenticate_sb_node()
607 * @c: UBIFS file-system description object
612 int ubifs_write_sb_node(struct ubifs_info *c, struct ubifs_sb_node *sup) in ubifs_write_sb_node() argument
614 int len = ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size); in ubifs_write_sb_node()
617 err = ubifs_prepare_node_hmac(c, sup, UBIFS_SB_NODE_SZ, in ubifs_write_sb_node()
622 return ubifs_leb_change(c, UBIFS_SB_LNUM, sup, len); in ubifs_write_sb_node()
627 * @c: UBIFS file-system description object
633 int ubifs_read_superblock(struct ubifs_info *c) in ubifs_read_superblock() argument
638 if (c->empty) { in ubifs_read_superblock()
639 err = create_default_filesystem(c); in ubifs_read_superblock()
644 sup = ubifs_read_sb_node(c); in ubifs_read_superblock()
648 c->sup_node = sup; in ubifs_read_superblock()
650 c->fmt_version = le32_to_cpu(sup->fmt_version); in ubifs_read_superblock()
651 c->ro_compat_version = le32_to_cpu(sup->ro_compat_version); in ubifs_read_superblock()
657 if (c->fmt_version > UBIFS_FORMAT_VERSION) { in ubifs_read_superblock()
658 ubifs_assert(c, !c->ro_media || c->ro_mount); in ubifs_read_superblock()
659 if (!c->ro_mount || in ubifs_read_superblock()
660 c->ro_compat_version > UBIFS_RO_COMPAT_VERSION) { in ubifs_read_superblock()
661 …ubifs_err(c, "on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d… in ubifs_read_superblock()
662 c->fmt_version, c->ro_compat_version, in ubifs_read_superblock()
665 if (c->ro_compat_version <= UBIFS_RO_COMPAT_VERSION) { in ubifs_read_superblock()
666 ubifs_msg(c, "only R/O mounting is possible"); in ubifs_read_superblock()
678 c->rw_incompat = 1; in ubifs_read_superblock()
681 if (c->fmt_version < 3) { in ubifs_read_superblock()
682 ubifs_err(c, "on-flash format version %d is not supported", in ubifs_read_superblock()
683 c->fmt_version); in ubifs_read_superblock()
690 c->key_hash = key_r5_hash; in ubifs_read_superblock()
691 c->key_hash_type = UBIFS_KEY_HASH_R5; in ubifs_read_superblock()
695 c->key_hash = key_test_hash; in ubifs_read_superblock()
696 c->key_hash_type = UBIFS_KEY_HASH_TEST; in ubifs_read_superblock()
700 c->key_fmt = sup->key_fmt; in ubifs_read_superblock()
702 switch (c->key_fmt) { in ubifs_read_superblock()
704 c->key_len = UBIFS_SK_LEN; in ubifs_read_superblock()
707 ubifs_err(c, "unsupported key format"); in ubifs_read_superblock()
712 c->leb_cnt = le32_to_cpu(sup->leb_cnt); in ubifs_read_superblock()
713 c->max_leb_cnt = le32_to_cpu(sup->max_leb_cnt); in ubifs_read_superblock()
714 c->max_bud_bytes = le64_to_cpu(sup->max_bud_bytes); in ubifs_read_superblock()
715 c->log_lebs = le32_to_cpu(sup->log_lebs); in ubifs_read_superblock()
716 c->lpt_lebs = le32_to_cpu(sup->lpt_lebs); in ubifs_read_superblock()
717 c->orph_lebs = le32_to_cpu(sup->orph_lebs); in ubifs_read_superblock()
718 c->jhead_cnt = le32_to_cpu(sup->jhead_cnt) + NONDATA_JHEADS_CNT; in ubifs_read_superblock()
719 c->fanout = le32_to_cpu(sup->fanout); in ubifs_read_superblock()
720 c->lsave_cnt = le32_to_cpu(sup->lsave_cnt); in ubifs_read_superblock()
721 c->rp_size = le64_to_cpu(sup->rp_size); in ubifs_read_superblock()
722 c->rp_uid = make_kuid(&init_user_ns, le32_to_cpu(sup->rp_uid)); in ubifs_read_superblock()
723 c->rp_gid = make_kgid(&init_user_ns, le32_to_cpu(sup->rp_gid)); in ubifs_read_superblock()
725 if (!c->mount_opts.override_compr) in ubifs_read_superblock()
726 c->default_compr = le16_to_cpu(sup->default_compr); in ubifs_read_superblock()
728 c->vfs_sb->s_time_gran = le32_to_cpu(sup->time_gran); in ubifs_read_superblock()
729 memcpy(&c->uuid, &sup->uuid, 16); in ubifs_read_superblock()
730 c->big_lpt = !!(sup_flags & UBIFS_FLG_BIGLPT); in ubifs_read_superblock()
731 c->space_fixup = !!(sup_flags & UBIFS_FLG_SPACE_FIXUP); in ubifs_read_superblock()
732 c->double_hash = !!(sup_flags & UBIFS_FLG_DOUBLE_HASH); in ubifs_read_superblock()
733 c->encrypted = !!(sup_flags & UBIFS_FLG_ENCRYPTION); in ubifs_read_superblock()
735 err = authenticate_sb_node(c, sup); in ubifs_read_superblock()
740 ubifs_err(c, "Unknown feature flags found: %#x", in ubifs_read_superblock()
746 if (!IS_ENABLED(CONFIG_FS_ENCRYPTION) && c->encrypted) { in ubifs_read_superblock()
747 ubifs_err(c, "file system contains encrypted files but UBIFS" in ubifs_read_superblock()
754 if (c->leb_cnt < c->vi.size && c->leb_cnt < c->max_leb_cnt) { in ubifs_read_superblock()
755 int old_leb_cnt = c->leb_cnt; in ubifs_read_superblock()
757 c->leb_cnt = min_t(int, c->max_leb_cnt, c->vi.size); in ubifs_read_superblock()
758 sup->leb_cnt = cpu_to_le32(c->leb_cnt); in ubifs_read_superblock()
760 c->superblock_need_write = 1; in ubifs_read_superblock()
763 old_leb_cnt, c->leb_cnt); in ubifs_read_superblock()
766 c->log_bytes = (long long)c->log_lebs * c->leb_size; in ubifs_read_superblock()
767 c->log_last = UBIFS_LOG_LNUM + c->log_lebs - 1; in ubifs_read_superblock()
768 c->lpt_first = UBIFS_LOG_LNUM + c->log_lebs; in ubifs_read_superblock()
769 c->lpt_last = c->lpt_first + c->lpt_lebs - 1; in ubifs_read_superblock()
770 c->orph_first = c->lpt_last + 1; in ubifs_read_superblock()
771 c->orph_last = c->orph_first + c->orph_lebs - 1; in ubifs_read_superblock()
772 c->main_lebs = c->leb_cnt - UBIFS_SB_LEBS - UBIFS_MST_LEBS; in ubifs_read_superblock()
773 c->main_lebs -= c->log_lebs + c->lpt_lebs + c->orph_lebs; in ubifs_read_superblock()
774 c->main_first = c->leb_cnt - c->main_lebs; in ubifs_read_superblock()
776 err = validate_sb(c, sup); in ubifs_read_superblock()
783 * @c: UBIFS file-system description object
792 static int fixup_leb(struct ubifs_info *c, int lnum, int len) in fixup_leb() argument
796 ubifs_assert(c, len >= 0); in fixup_leb()
797 ubifs_assert(c, len % c->min_io_size == 0); in fixup_leb()
798 ubifs_assert(c, len < c->leb_size); in fixup_leb()
802 return ubifs_leb_unmap(c, lnum); in fixup_leb()
806 err = ubifs_leb_read(c, lnum, c->sbuf, 0, len, 1); in fixup_leb()
810 return ubifs_leb_change(c, lnum, c->sbuf, len); in fixup_leb()
815 * @c: UBIFS file-system description object
820 static int fixup_free_space(struct ubifs_info *c) in fixup_free_space() argument
825 ubifs_get_lprops(c); in fixup_free_space()
829 err = fixup_leb(c, lnum, c->mst_offs + c->mst_node_alsz); in fixup_free_space()
835 lnum = ubifs_next_log_lnum(c, c->lhead_lnum); in fixup_free_space()
836 while (lnum != c->ltail_lnum) { in fixup_free_space()
837 err = fixup_leb(c, lnum, 0); in fixup_free_space()
840 lnum = ubifs_next_log_lnum(c, lnum); in fixup_free_space()
847 err = fixup_leb(c, c->lhead_lnum, in fixup_free_space()
848 ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size)); in fixup_free_space()
853 for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) { in fixup_free_space()
854 int free = c->ltab[lnum - c->lpt_first].free; in fixup_free_space()
857 err = fixup_leb(c, lnum, c->leb_size - free); in fixup_free_space()
864 for (lnum = c->orph_first; lnum <= c->orph_last; lnum++) { in fixup_free_space()
865 err = fixup_leb(c, lnum, 0); in fixup_free_space()
871 for (lnum = c->main_first; lnum < c->leb_cnt; lnum++) { in fixup_free_space()
872 lprops = ubifs_lpt_lookup(c, lnum); in fixup_free_space()
879 err = fixup_leb(c, lnum, c->leb_size - lprops->free); in fixup_free_space()
886 ubifs_release_lprops(c); in fixup_free_space()
892 * @c: UBIFS file-system description object
903 int ubifs_fixup_free_space(struct ubifs_info *c) in ubifs_fixup_free_space() argument
906 struct ubifs_sb_node *sup = c->sup_node; in ubifs_fixup_free_space()
908 ubifs_assert(c, c->space_fixup); in ubifs_fixup_free_space()
909 ubifs_assert(c, !c->ro_mount); in ubifs_fixup_free_space()
911 ubifs_msg(c, "start fixing up free space"); in ubifs_fixup_free_space()
913 err = fixup_free_space(c); in ubifs_fixup_free_space()
918 c->space_fixup = 0; in ubifs_fixup_free_space()
921 c->superblock_need_write = 1; in ubifs_fixup_free_space()
923 ubifs_msg(c, "free space fixup complete"); in ubifs_fixup_free_space()
927 int ubifs_enable_encryption(struct ubifs_info *c) in ubifs_enable_encryption() argument
930 struct ubifs_sb_node *sup = c->sup_node; in ubifs_enable_encryption()
935 if (c->encrypted) in ubifs_enable_encryption()
938 if (c->ro_mount || c->ro_media) in ubifs_enable_encryption()
941 if (c->fmt_version < 5) { in ubifs_enable_encryption()
942 ubifs_err(c, "on-flash format version 5 is needed for encryption"); in ubifs_enable_encryption()
948 err = ubifs_write_sb_node(c, sup); in ubifs_enable_encryption()
950 c->encrypted = 1; in ubifs_enable_encryption()