diff options
author | Shehjar Tikoo <shehjart@zresearch.com> | 2009-05-05 16:03:09 +0530 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-05-05 17:46:54 +0530 |
commit | e749da85ec67dfa62af5702d199b8f1bcc53d1d7 (patch) | |
tree | 4682743a30964fd93546af615b4f51974c0cb23e /booster/src | |
parent | 1504e1d50c7efcf20fe55fc7db526bb1d364244a (diff) |
booster: Add readlink API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster/src')
-rw-r--r-- | booster/src/booster.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c index f2ae494c..cdd55486 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -165,6 +165,7 @@ static int (*real_mknod) (const char *path, mode_t mode, dev_t dev); static int (*real_mkfifo) (const char *path, mode_t mode); static int (*real_unlink) (const char *path); static int (*real_symlink) (const char *oldpath, const char *newpath); +static int (*real_readlink) (const char *path, char *buf, size_t bufsize); #define RESOLVE(sym) do { \ if (!real_##sym) \ @@ -1446,6 +1447,24 @@ symlink (const char *oldpath, const char *newpath) return ret; } +int +readlink (const char *path, char *buf, size_t bufsize) +{ + int ret = -1; + + ret = glusterfs_readlink (path, buf, bufsize); + if (((ret == -1) && (errno != ENODEV)) || (ret > 0)) + return ret; + + if (real_readlink == NULL) { + errno = ENOSYS; + ret = -1; + } else + ret = real_readlink (path, buf, bufsize); + + return ret; +} + pid_t fork (void) { @@ -1511,6 +1530,7 @@ _init (void) RESOLVE (mkfifo); RESOLVE (unlink); RESOLVE (symlink); + RESOLVE (readlink); /* This must be called after resolving real functions * above so that the socket based IO calls in libglusterfsclient |