| ⟨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}; asynced := ?⟩ ( inode = p_inode ∧ buf-opt = buf-opt0 ∧ pageno0 = pageno2 ∧ pageno = pageno4 ∧ (boolvar ↔ boolvar0) ∧ err = err0 ∧ dirs = dirs0 ∧ files = files0 ∧ (asynced ↔ asynced1)), files1[m] = mkfile(m0, md0, m1, content), dirs = dirs1, files = files1, inode = mkinode(m, md, false, m1, 0, m2), n = n0, pageno = 0, pageno0 = 0, pageno1 = m2 / VFS_PAGE_SIZE, m ∈ files1, buf-opt.some? → # buf-opt.buf = VFS_PAGE_SIZE ⊦ ⟨afs_truncate#(n0, m2 / VFS_PAGE_SIZE; buf-opt, inode, boolvar, err, dirs1, files1, boolvar2)⟩ (buf-opt = buf-opt0 ∧ inode = p_inode ∧ (boolvar ↔ boolvar0) ∧ err = err0 ∧ dirs1 = dirs0 ∧ files1 = files0), VFS_PAGE_SIZE = 0 |
⟨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; asynced := ?⟩ ( inode = p_inode ∧ buf-opt = buf-opt0 ∧ pageno0 = pageno2 ∧ pageno = pageno4 ∧ (boolvar ↔ boolvar0) ∧ err = err0 ∧ dirs = dirs0 ∧ files = files0 ∧ (asynced ↔ asynced1)), files1[m] = mkfile(m0, md0, m1, content0), content = files[inode.ino].content, dirs = dirs1, files = files1, ino = inode.ino, inode = mkinode(m, md, false, m1, 0, m2), n = n0, pageno = 0, pageno0 = 0, pageno1 = m2 / VFS_PAGE_SIZE, m ∈ files1, buf-opt.some? → # buf-opt.buf = VFS_PAGE_SIZE ⊦ ⟨afs_truncate#(n0, m2 / VFS_PAGE_SIZE; buf-opt, inode, boolvar, err, dirs1, files1, boolvar2)⟩ (buf-opt = buf-opt0 ∧ inode = p_inode ∧ (boolvar ↔ boolvar0) ∧ err = err0 ∧ dirs1 = dirs0 ∧ files1 = files0), VFS_PAGE_SIZE = 0