| files0 -- of[fd].ino = files -- of[fd].ino, (files0[of[fd].ino].content.stream to files0[of[fd].ino].size).buf = splice(buf, 0, (files[of[fd].ino].content.stream to files[of[fd].ino].size).buf, of[fd].pos, n1), files0[of[fd].ino].meta = files[of[fd].ino].meta, err1 = ESUCCESS, fs = abs-files(files), of0 = of[fd, of[fd].pos:= (of[fd].pos + n1)], ofh = abs-of(of), root.dir?, dom of < ino, abs(root, ROOT_INO)(dirs), afs-cons(dirs, files), fids-cons(root, abs-files(files), abs-of(of)), of-cons(of, dirs, files), fd ∈ of, of[fd].ino ∈ files, of[fd].ino ∈ files0, n0 ≤ # buf, n1 ≤ n0, psynced → asynced, of[fd].mode = MODE_W ∨ of[fd].mode = MODE_RW ⊦ pre-write(fd, buf, n0, err1, user, root, fs, ofh) ∧ ⟨err0 := err1; if err0 = ESUCCESS then let fh = ofh[fd] in let f = fs[fh.fid] in choose n with n ≤ n0 in {n0 := n; f.content := splice(buf, 0, f.content, fh.pos, n0); fs[fh.fid] := f; ofh[fd].pos := fh.pos + n0} else n0 := ?; psynced := ?⟩ (ofh = abs-of(of0) ∧ fs = abs-files(files0) ∧ (psynced → asynced0) ∧ n1 = n0 ∧ err1 = err0) |
files0 -- of[fd].ino = files -- of[fd].ino, (files0[of[fd].ino].content.stream to files0[of[fd].ino].size).buf = splice(buf, 0, (files[of[fd].ino].content.stream to files[of[fd].ino].size).buf, of[fd].pos, n1), files0[of[fd].ino].meta = files[of[fd].ino].meta, fs = abs-files(files), ofh = abs-of(of), root.dir?, dom of < ino, abs(root, ROOT_INO)(dirs), afs-cons(dirs, files), fids-cons(root, abs-files(files), abs-of(of)), of-cons(of, dirs, files), of[fd].ino ∈ files0, of[fd].ino ∈ files, fd ∈ of, n1 ≤ n0, n0 ≤ # buf, n1 ≤ # buf, psynced → asynced, of[fd].mode = MODE_W ∨ of[fd].mode = MODE_RW ⊦ fd ∈ ofh ∧ (ofh[fd].mode = MODE_W ∨ ofh[fd].mode = MODE_RW) ∧ ⟨err0 := ESUCCESS; if err0 = ESUCCESS then let fh = ofh[fd] in let f = fs[fh.fid] in choose n with n ≤ n0 in {n0 := n; f.content := splice(buf, 0, f.content, fh.pos, n0); fs[fh.fid] := f; ofh[fd].pos := fh.pos + n0} else n0 := ?; psynced := ?⟩ (ofh = abs-of(of[fd, of[fd].pos:= (of[fd].pos + n0)]) ∧ fs = abs-files(files0) ∧ (psynced → asynced0) ∧ n1 = n0 ∧ ESUCCESS = err0)
Used simplifier rules: let: ⊦ n ≤ n0 ∧ n0 ≤ n1 → n ≤ n1; (forward) from specification nat%⊦ pre-write(fd, buf, n, ESUCCESS, user, root, fs, ofh) ↔ fd ∈ ofh ∧ (ofh[fd].mode = MODE_W ∨ ofh[fd].mode = MODE_RW); (s)