| boolvar ↔ boolvar2, fs[ri[inodekey(m)]] = inodenode(key, md0, false, m1, 0, m4), buf-opt = buf-opt0, dirs = abs-dirs(fs, ri), files = abs-files(fs, ri), inode = mkinode(m, md, false, m1, 0, m2), pageno = 0, pageno0 = 0, m2 % VFS_PAGE_SIZE ≠ 0, orphans(fs, ri).inodes?, fo.inodes?, afs-cons(abs-dirs(fs, ri), abs-files(fs, ri)), file-node-cons(fs, ri), log-cons(log, fs), orphans-cons(fs, ri, orphans(fs, ri)), replay-cons-strong(fs, ri, orphans(fs, ri), fi, fo, log), ri-inj(ri), ri-inj(fi), ubifs-cons(fs, ri, orphans(fs, ri), fi, fo, log), inodekey(m) ∈ ri, ri[inodekey(m)] ∈ fs, m2 ≤ n, ⌊err0⌋ , ¬ buf-opt0.some?, ¬ datakey(m, m2 / VFS_PAGE_SIZE) ∈ ri, asynced → boolvar0 ⊦ ⟨afs_truncate_internal#(n, m2 / VFS_PAGE_SIZE; inode, buf-opt, pageno0, pageno, boolvar, err, dirs, files; asynced)⟩ ( dirs = abs-dirs(fs, ri) ∧ files = abs-files(fs, ri) ∧ (asynced → boolvar4) ∧ buf-opt0 = buf-opt ∧ mkinode(m, md, false, m1, 0, m2) = inode ∧ (boolvar2 ↔ boolvar) ∧ err0 = err) |
boolvar ↔ boolvar2, fs[ri[inodekey(m)]] = inodenode(key, md0, false, m1, 0, m4), buf-opt = buf-opt0, dirs = abs-dirs(fs, ri), files = abs-files(fs, ri), inode = mkinode(m, md, false, m1, 0, m2), pageno = 0, pageno0 = 0, pageno1 = m2 / VFS_PAGE_SIZE, fo.inodes?, orphans(fs, ri).inodes?, afs-cons(abs-dirs(fs, ri), abs-files(fs, ri)), file-node-cons(fs, ri), log-cons(log, fs), orphans-cons(fs, ri, orphans(fs, ri)), replay-cons-strong(fs, ri, orphans(fs, ri), fi, fo, log), ri-inj(fi), ri-inj(ri), ubifs-cons(fs, ri, orphans(fs, ri), fi, fo, log), ri[inodekey(m)] ∈ fs, inodekey(m) ∈ ri, m2 ≤ n, ⌊err0⌋ , asynced → boolvar0 ⊦ ⟨ let ino = inode.ino, content = files[inode.ino].content, buf = ? in {pageno0 := inode.size % VFS_PAGE_SIZE, pageno := min(n, inode.size); boolvar := inode.size ≤ n ∧ pageno0 ≠ 0 ∧ (pageno1 ∈ content ∨ buf-opt.some?); if boolvar then {if buf-opt.some? then buf := buf-opt.buf else buf := files[ino].content[pageno1]; buf := fill(buf, zero, pageno0, VFS_PAGE_SIZE - pageno0); content[pageno1] := buf; buf-opt := some(buf)}; files[ino].content := content upto pageno; let new_inode = inode in {new_inode.size := n; afs_inode_sync#(new_inode; dirs, files)}; inode := getinode(inode.ino, dirs, files); err := ESUCCESS} or fail#(; ; err); asynced := ?⟩ ( dirs = abs-dirs(fs, ri) ∧ files = abs-files(fs, ri) ∧ (asynced → boolvar4) ∧ buf-opt0 = buf-opt ∧ mkinode(m, md, false, m1, 0, m2) = inode ∧ (boolvar2 ↔ boolvar) ∧ err0 = err), m2 % VFS_PAGE_SIZE = 0, VFS_PAGE_SIZE = 0, buf-opt0.some?, datakey(m, m2 / VFS_PAGE_SIZE) ∈ ri
Used simplifier rules: afs_truncate_internal# (N, PAGENO ; INODE, PBUF-OPT, OFFSET, SIZE, MODIFIED, ERR, DIRS, FILES ; ASYNCED ) { let INO = INODE.ino, CONTENT = FILES[INODE.ino].content, PBUF = ? in {OFFSET := INODE.size % VFS_PAGE_SIZE, SIZE := min(N, INODE.size); MODIFIED := INODE.size ≤ N ∧ OFFSET ≠ 0 ∧ (PAGENO ∈ CONTENT ∨ PBUF-OPT.some?); if MODIFIED then {if PBUF-OPT.some? then PBUF := PBUF-OPT.buf else PBUF := FILES[INO].content[PAGENO]; PBUF := fill(PBUF, zero, OFFSET, VFS_PAGE_SIZE - OFFSET); CONTENT[PAGENO] := PBUF; PBUF-OPT := some(PBUF)}; FILES[INO].content := CONTENT upto SIZE; let NEW_INODE = INODE in {NEW_INODE.size := N; afs_inode_sync#(NEW_INODE; DIRS, FILES)}; INODE := getinode(INODE.ino, DIRS, FILES); ERR := ESUCCESS} or fail#(; ; ERR); ASYNCED := ? };% ⊦ VFS_PAGE_SIZE ≠ 0; (s)