From 4311e7f01dc244baa1a1b8fc50f74a823dbd38c4 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Tue, 5 May 2009 16:02:31 +0530 Subject: booster: Add utime API Signed-off-by: Anand V. Avati --- booster/src/booster.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'booster') diff --git a/booster/src/booster.c b/booster/src/booster.c index 80bac3a2f..7bb2b64e2 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -39,6 +39,7 @@ #include #include #include +#include #ifndef GF_UNIT_KB #define GF_UNIT_KB 1024 @@ -159,6 +160,7 @@ static int (*real_ftruncate) (int fd, off_t length); static int (*real_link) (const char *oldpath, const char *newname); static int (*real_rename) (const char *oldpath, const char *newpath); static int (*real_utimes) (const char *path, const struct timeval times[2]); +static int (*real_utime) (const char *path, const struct utimbuf *buf); #define RESOLVE(sym) do { \ if (!real_##sym) \ @@ -1349,6 +1351,25 @@ utimes (const char *path, const struct timeval times[2]) return ret; } +int +utime (const char *path, const struct utimbuf *buf) +{ + int ret = -1; + + ret = glusterfs_utime (path, buf); + + if (((ret == -1) && (errno != ENODEV)) || (ret == 0)) + return ret; + + if (real_utime == NULL) { + errno = ENOSYS; + ret = -1; + } else + ret = real_utime (path, buf); + + return ret; +} + pid_t fork (void) { @@ -1409,6 +1430,7 @@ _init (void) RESOLVE (link); RESOLVE (rename); RESOLVE (utimes); + RESOLVE (utime); /* This must be called after resolving real functions * above so that the socket based IO calls in libglusterfsclient -- cgit