| VFS_PAGE_SIZE = n1 + m2 % VFS_PAGE_SIZE, files2[m] = mkfile(m3, md1, m4, content), files2[m, mkfile(n0, md, m4, content[m2 / VFS_PAGE_SIZE, fill(content[m2 / VFS_PAGE_SIZE], zero, m2 % VFS_PAGE_SIZE, n1)] upto m2)] = files0, dirs = dirs1, files = files2, inode = mkinode(m, md, false, m4, 0, m2), n = n0, pageno = 0, pageno0 = 0, pageno1 = m2 / VFS_PAGE_SIZE, m2 / VFS_PAGE_SIZE ∈ content, m ∈ files2, m2 ≤ n0, VFS_PAGE_SIZE ≤ # content[m2 / VFS_PAGE_SIZE] ⊦ ⟨ 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 := ?⟩ ( buf-opt = some(fill(content[m2 / VFS_PAGE_SIZE], zero, m2 % VFS_PAGE_SIZE, n1)) ∧ inode = (m ∈ dirs1 ⊃ mkinode(m, dirs1[m].meta, true, dirs1[m].nlink, dirs1[m].nsubdirs, dirs1[m].size) ;mkinode(m, files0[m].meta, false, files0[m].nlink, 0, files0[m].size) ) ∧ boolvar ∧ err = ESUCCESS ∧ dirs = dirs1 ∧ files = files0), m2 % VFS_PAGE_SIZE = 0, VFS_PAGE_SIZE = 0, buf-opt.some? |
VFS_PAGE_SIZE = n1 + m2 % VFS_PAGE_SIZE, files2[m, mkfile(n0, md, m4, content[m2 / VFS_PAGE_SIZE, fill(content[m2 / VFS_PAGE_SIZE], zero, m2 % VFS_PAGE_SIZE, n1)] upto m2)] = files0, files2[m] = mkfile(m3, md1, m4, content), dirs = dirs1, files = files2, inode = mkinode(m, md, false, m4, 0, m2), n = n0, pageno = 0, pageno0 = 0, pageno1 = m2 / VFS_PAGE_SIZE, m ∈ files2, m2 / VFS_PAGE_SIZE ∈ content, VFS_PAGE_SIZE ≤ # content[m2 / VFS_PAGE_SIZE], m2 ≤ n0 ⊦ ⟨fail#(; ; err); asynced := ?⟩ ( buf-opt = some(fill(content[m2 / VFS_PAGE_SIZE], zero, m2 % VFS_PAGE_SIZE, n1)) ∧ inode = (m ∈ dirs1 ⊃ mkinode(m, dirs1[m].meta, true, dirs1[m].nlink, dirs1[m].nsubdirs, dirs1[m].size) ;mkinode(m, files0[m].meta, false, files0[m].nlink, 0, files0[m].size) ) ∧ boolvar ∧ err = ESUCCESS ∧ dirs = dirs1 ∧ files = files0), ⟨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 := ?⟩ ( buf-opt = some(fill(content[m2 / VFS_PAGE_SIZE], zero, m2 % VFS_PAGE_SIZE, n1)) ∧ inode = (m ∈ dirs1 ⊃ mkinode(m, dirs1[m].meta, true, dirs1[m].nlink, dirs1[m].nsubdirs, dirs1[m].size) ;mkinode(m, files0[m].meta, false, files0[m].nlink, 0, files0[m].size) ) ∧ boolvar ∧ err = ESUCCESS ∧ dirs = dirs1 ∧ files = files0), m2 % VFS_PAGE_SIZE = 0, VFS_PAGE_SIZE = 0, buf-opt.some?