+ """
+ If the path specified is a symlink, return the target
+ """
+ return self._get_file(path).readlink()
+
+class TreeKey(object):
+ def getattr(self):
+ return -errno.EINVAL
+ def readdir(self, offset):
+ return -errno.EINVAL
+ def read(self, length, offset):
+ return -errno.EINVAL
+ def readlink(self):
+ return -errno.EINVAL
+
+class NoEntry(TreeKey):
+ def getattr(self):
+ return -errno.ENOENT
+ def readdir(self, offset):
+ return -errno.ENOENT
+ def read(self, length, offset):
+ return -errno.ENOENT
+ def readlink(self):
+ return -errno.ENOENT
+
+class TreeEntry(TreeKey):
+ default_mode = 0444
+
+ def __new__(cls, contents, mode=None):
+ return super(TreeEntry, cls).__new__(cls, contents)
+
+ def __init__(self, contents, mode=None):
+ if mode is None:
+ self.mode = self.default_mode