summaryrefslogtreecommitdiffstats
path: root/booster/src/booster.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-05-05 16:04:37 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-05-05 17:51:08 +0530
commitbddbe5f7a4437fc4c295b7830fa2916011ab799a (patch)
treedfbf5eb896fdbab81758036aa8227e42f6d152f0 /booster/src/booster.c
parentad8e8fa72f287da034027bf26fc1fbfb1437d47e (diff)
booster: Add getxattr,lgetxattr API
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'booster/src/booster.c')
-rw-r--r--booster/src/booster.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index 4e263d438a2..bd1161c3b57 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -188,7 +188,10 @@ static int (*real_statfs) (const char *path, struct statfs *buf);
static int (*real_statfs64) (const char *path, struct statfs64 *buf);
static int (*real_statvfs) (const char *path, struct statvfs *buf);
static int (*real_statvfs64) (const char *path, struct statvfs64 *buf);
-
+static ssize_t (*real_getxattr) (const char *path, const char *name,
+ void *value, size_t size);
+static ssize_t (*real_lgetxattr) (const char *path, const char *name,
+ void *value, size_t size);
#define RESOLVE(sym) do { \
if (!real_##sym) \
@@ -1971,6 +1974,47 @@ out:
return ret;
}
+ssize_t
+getxattr (const char *path, const char *name, void *value, size_t size)
+{
+ int ret = -1;
+
+ ret = glusterfs_getxattr (path, name, value, size);
+ if (((ret == -1) && (ret != ENODEV)) || (ret > 0))
+ return ret;
+
+ if (real_getxattr == NULL) {
+ ret = -1;
+ errno = ENOSYS;
+ goto out;
+ }
+
+ ret = real_getxattr (path, name, value, size);
+out:
+ return ret;
+}
+
+
+ssize_t
+lgetxattr (const char *path, const char *name, void *value, size_t size)
+{
+ int ret = -1;
+
+ ret = glusterfs_lgetxattr (path, name, value, size);
+ if (((ret == -1) && (ret != ENODEV)) || (ret > 0))
+ return ret;
+
+ if (real_lgetxattr == NULL) {
+ ret = -1;
+ errno = ENOSYS;
+ goto out;
+ }
+
+ ret = real_lgetxattr (path, name, value, size);
+out:
+ return ret;
+}
+
pid_t
fork (void)
{
@@ -2057,6 +2101,8 @@ _init (void)
RESOLVE (statfs64);
RESOLVE (statvfs);
RESOLVE (statvfs64);
+ RESOLVE (getxattr);
+ RESOLVE (lgetxattr);
/* This must be called after resolving real functions
* above so that the socket based IO calls in libglusterfsclient