| of[fd] = mkfile(m, mode, m0), buf = buf0, n = n0, ofh = abs-of(of), mode ≠ MODE_R, mode ≠ MODE_RW, 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, n0 ≤ # buf0, psynced → asynced ⊦ ⟨posix_read#(fd, user, root, abs-files(files); buf0, n0, err0, ofh)⟩ (ofh = abs-of(of) ∧ (psynced → asynced) ∧ buf = buf0 ∧ n = n0 ∧ EBADFD = err0) |
of[fd] = mkfile(m, mode, m0), buf = buf0, buf1 = buf0, fs = abs-files(files), n = n0, 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, n0 ≤ # buf0, psynced → asynced ⊦ ⟨if n0 ≤ # buf then {choose err with pre-read(fd, n0, err, user, root, fs, ofh) in err0 := err; if err0 = ESUCCESS then let fh = ofh[fd] in let f = fs[fh.fid] in choose n with n ≤ n0 ∧ fh.pos + n ≤ # f.content in {n0 := n; buf := copy(f.content, fh.pos, buf, 0, n0); ofh[fd].pos := fh.pos + n0} ifnone n0 := 0 else n0 := ?} else abort⟩ (ofh = abs-of(of) ∧ (psynced → asynced) ∧ buf1 = buf ∧ n = n0 ∧ EBADFD = err0), mode = MODE_R, mode = MODE_RW
Used simplifier rules: posix_read#(FD, USER, ROOT, FS; BUF, N, ERR, OFH) {if N ≤ # BUF then {choose E with pre-read(FD, N, E, USER, ROOT, FS, OFH) in ERR := E; if ERR = ESUCCESS then let FH = OFH[FD] in let FDATA = FS[FH.fid] in choose N0 with N0 ≤ N ∧ FH.pos + N0 ≤ # FDATA.content in {N := N0; BUF := copy(FDATA.content, FH.pos, BUF, 0, N); OFH[FD].pos := FH.pos + N} ifnone N := 0 else N := ?} else abort };