aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Barksdale <amatus.amongus@gmail.com>2012-06-11 19:11:45 -0500
committerDavid Barksdale <amatus.amongus@gmail.com>2012-06-11 19:11:45 -0500
commitc1ee0acca8c8302ae18f0ca3abd802ddc8d84dd2 (patch)
tree82365dd8401d76e4d874948634cfd4a6e52bd664 /src
parent6dc5fa531db1a9e65a36c9260d6d1a7cad20f1be (diff)
Some cleanup on the readfile function.
Diffstat (limited to 'src')
-rw-r--r--src/clojure/foofs/filesystem.clj9
-rw-r--r--src/clojure/foofs/memorybackend.clj2
2 files changed, 2 insertions, 9 deletions
diff --git a/src/clojure/foofs/filesystem.clj b/src/clojure/foofs/filesystem.clj
index a6579de..fde7921 100644
--- a/src/clojure/foofs/filesystem.clj
+++ b/src/clojure/foofs/filesystem.clj
@@ -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!))
diff --git a/src/clojure/foofs/memorybackend.clj b/src/clojure/foofs/memorybackend.clj
index 759c782..656f1b8 100644
--- a/src/clojure/foofs/memorybackend.clj
+++ b/src/clojure/foofs/memorybackend.clj
@@ -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