Skip to content

Commit

Permalink
Some cleanup on the readfile function.
Browse files Browse the repository at this point in the history
  • Loading branch information
amatus committed Jun 12, 2012
1 parent 6dc5fa5 commit c1ee0ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions src/clojure/foofs/filesystem.clj
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,7 @@
(continuation! {:handle 0
:flags 0})))))
(readfile [_ {:keys [nodeid arg]} continuation!]
(let [offset (:offset arg)
size (:size arg)]
(.readfile
backend nodeid offset size
(fn [buffer]
(if (nil? buffer)
(continuation! errno-noent)
(continuation! buffer))))))
(.readfile backend nodeid (:offset arg) (:size arg) continuation!))
(writefile [_ {:keys [nodeid arg]} continuation!]
(.writefile
backend nodeid (:offset arg) (:size arg) (:data arg) continuation!))
Expand Down
2 changes: 1 addition & 1 deletion src/clojure/foofs/memorybackend.clj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
(readfile [_ nodeid offset size continuation!]
(let [file (get-in (deref state-agent) [:file-table nodeid])]
(if (nil? file)
(continuation! nil)
(continuation! errno-noent)
(continuation! (take size (drop offset file))))))
(writefile [_ nodeid offset size data continuation!]
(send
Expand Down

0 comments on commit c1ee0ac

Please sign in to comment.