| files[ino1] = mkfile(m0, md0, # links(ino1, dirs), content0), buf-opt = none, err = ESUCCESS, fs = abs-files(files), ino = 0, ino0 = 0, inode = mkinode(ino1, md0, false, # links(ino1, dirs), 0, m0), root.dir?, dom of < ino3, abs(root, ROOT_INO)(dirs), afs-cons(dirs, files), fids-cons(root, abs-files(files), abs-of(of)), ispath(path, ROOT_INO, ino1, dirs, files), of-cons(of, dirs, files), pw(user, md0), px-parent(user, path, ROOT_INO, dirs, files), ino1 ∈ files, ROOT_INO ∈ dirs, ¬ root[path].dir?, ¬ ino1 ∈ dirs, psynced → asynced0 ⊦ [afs_truncate_internal#(n, m0 / VFS_PAGE_SIZE; inode, buf-opt, ino0, ino, isdir, err, dirs, files; asynced)] ( of-cons(of, dirs, files) ∧ afs-cons(dirs, files) → ⟨posix_truncate#(path, n, user, root, abs-of(of); err1, fs; psynced)⟩ (fs = abs-files(files) ∧ abs(root, ROOT_INO)(dirs) ∧ (psynced → asynced) ∧ err = err1)) |
files[ino2] = mkfile(m0, md0, # links(ino2, dirs), content0), buf-opt = none, err = ESUCCESS, fs = abs-files(files), ino = 0, ino0 = ino, ino1 = ino4, ino4 = 0, inode = mkinode(ino2, md0, false, # links(ino2, dirs), 0, m0), pageno = m0 / VFS_PAGE_SIZE, root.dir?, dom of < ino3, abs(root, ROOT_INO)(dirs), afs-cons(dirs, files), fids-cons(root, abs-files(files), abs-of(of)), ispath(path, ROOT_INO, ino2, dirs, files), of-cons(of, dirs, files), pw(user, md0), px-parent(user, path, ROOT_INO, dirs, files), ROOT_INO ∈ dirs, ino2 ∈ files, psynced → asynced0 ⊦ [ let ino = inode.ino, content = files[inode.ino].content, buf = ? in {ino1 := inode.size % VFS_PAGE_SIZE, ino0 := min(n, inode.size); isdir := inode.size ≤ n ∧ ino1 ≠ 0 ∧ (pageno ∈ content ∨ buf-opt.some?); if isdir then {if buf-opt.some? then buf := buf-opt.buf else buf := files[ino].content[pageno]; buf := fill(buf, zero, ino1, VFS_PAGE_SIZE - ino1); content[pageno] := buf; buf-opt := some(buf)}; files[ino].content := content upto ino0; 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 := ?] ( of-cons(of, dirs, files) ∧ afs-cons(dirs, files) → ⟨posix_truncate#(path, n, user, root, abs-of(of); err1, fs; psynced)⟩ (fs = abs-files(files) ∧ abs(root, ROOT_INO)(dirs) ∧ (psynced → asynced) ∧ err = err1)), VFS_PAGE_SIZE = 0, root[path].dir?, ino2 ∈ dirs
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 := ? };