Permalink
Browse files

readlink support in mirrorfs example

  • Loading branch information...
1 parent e68635a commit 1471528670d694b9551ab7dc0306721d6a457a77 @sidorares sidorares committed Sep 26, 2012
Showing with 19 additions and 0 deletions.
  1. +19 −0 example/mirrorFS.js
View
@@ -89,6 +89,24 @@ function readdir(path, cb) {
//---------------------------------------------------------------------------
/*
+ * Handler for the readlink() system call.
+ * path: the path to the file
+ * cb: a callback of the form cb(err, name), where err is the Posix return code
+ * and name is symlink target (when err === 0).
+ */
+function readlink(path, cb) {
+ var path = pth.join(srcRoot, path);
+ return fs.readlink(path, function readlinkCb(err, name) {
+ if (err)
+ return cb(-excToErrno(err));
+ return cb(0, name);
+ });
+}
+
+
+//---------------------------------------------------------------------------
+
+/*
* Converts numerical open() flags to node.js fs.open() 'flags' string.
*/
function convertOpenFlags(openFlags) {
@@ -300,6 +318,7 @@ var destroy = function (cb) {
var handlers = {
getattr: getattr,
readdir: readdir,
+ readlink: readlink,
open: open,
read: read,
write: write,

0 comments on commit 1471528

Please sign in to comment.