| # buf1 = EB_PAGE_SIZE, # pebs1 = n + m1, # pebs0 = n + m1, pebs1[m1] = mkpeb(buf0, m2, false), buf = buf1, m = 0, m0 = m1, n0 = EB_PAGE_SIZE, n1 = 0, pebs = pebs1[m1, mkpeb(emptypeb, 0, false)], is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), mtd-cons(pebs1), mtd-cons(pebs0), ubi-io-initial(subarray(pebs1, 0, m1)), EB_PAGE_SIZE ≤ PEB_SIZE ⊦ [if m0 < # pebs ∧ ¬ pebs[m0].bad ∧ pebs[m0].fill ≤ m ∧ m + n0 ≤ PEB_SIZE ∧ n1 + n0 ≤ # buf ∧ is-aligned(m, EB_PAGE_SIZE) ∧ is-aligned(n0, EB_PAGE_SIZE) then {fail_or_success#(; ; err); if err = ESUCCESS then {pebs[m0].data := copy(buf, n1, pebs[m0].data, m, n0); pebs[m0].fill := m + n0} else choose n with (n < n0 ∨ n = 0 ∧ n0 = 0) ∧ is-aligned(n, EB_PAGE_SIZE) in if n ≠ 0 then {pebs[m0].data := copy(buf, n1, pebs[m0].data, m, n); pebs[m0].fill := m + n}} else abort] ( mtd-cons(pebs) → ⟪m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n + m1)), n = 0 |
# pebs0 = n + m1, # pebs1 = n + m1, # buf1 = EB_PAGE_SIZE, pebs1[m1] = mkpeb(buf0, m2, false), buf = buf1, m = 0, m0 = m1, n0 = EB_PAGE_SIZE, n1 = 0, pebs = pebs1[m1, mkpeb(emptypeb, 0, false)], m0 < # pebs, is-aligned(m, EB_PAGE_SIZE), is-aligned(n0, EB_PAGE_SIZE), is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), mtd-cons(pebs0), mtd-cons(pebs1), mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), ubi-io-initial(subarray(pebs1, 0, m1)), pebs[m0].fill ≤ m, m + n0 ≤ PEB_SIZE, n1 + n0 ≤ # buf, EB_PAGE_SIZE ≤ PEB_SIZE, m0 < # pebs → m0 < # pebs ∧ (¬ pebs[m0].bad → m0 < # pebs) ⊦ [fail_or_success#(; ; err); if err = ESUCCESS then {pebs[m0].data := copy(buf, n1, pebs[m0].data, m, n0); pebs[m0].fill := m + n0} else choose n with (n < n0 ∨ n = 0 ∧ n0 = 0) ∧ is-aligned(n, EB_PAGE_SIZE) in if n ≠ 0 then {pebs[m0].data := copy(buf, n1, pebs[m0].data, m, n); pebs[m0].fill := m + n}] ( mtd-cons(pebs) → ⟪m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n + m1)), n = 0, pebs[m0].bad
# pebs0 = n + m1, # pebs1 = n + m1, # buf1 = EB_PAGE_SIZE, pebs1[m1] = mkpeb(buf0, m2, false), buf = buf1, m = 0, m0 = m1, n0 = EB_PAGE_SIZE, n1 = 0, pebs = pebs1[m1, mkpeb(emptypeb, 0, false)], is-encoded(echdr((err1 = ESUCCESS ∧ aehdr0.valid? ⊃ aehdr0.ec + 1;0)), buf1), mtd-cons(pebs0), mtd-cons(pebs1), mtd-cons(pebs1[m1, mkpeb(emptypeb, 0, false)]), ubi-io-initial(subarray(pebs1, 0, m1)), EB_PAGE_SIZE ≤ PEB_SIZE, m0 < # pebs → m0 < # pebs ∧ (¬ pebs[m0].bad → m0 < # pebs) ⊦ [abort] ( mtd-cons(pebs) → ⟪m1 := m1 + 1⟫ ( m1 ≤ # pebs0 ∧ # pebs0 = # pebs ∧ (err = ESUCCESS → ubi-io-initial(subarray(pebs, 0, m1))) ∧ (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # pebs0 < n + m1)), n = 0, m0 < # pebs ∧ ¬ pebs[m0].bad ∧ pebs[m0].fill ≤ m ∧ m + n0 ≤ PEB_SIZE ∧ n1 + n0 ≤ # buf ∧ is-aligned(m, EB_PAGE_SIZE) ∧ is-aligned(n0, EB_PAGE_SIZE)