diff options
author | Raghavendra G <raghavendra@gluster.com> | 2009-11-18 01:16:57 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-11-18 21:14:28 -0800 |
commit | 6b65a11e4e1e351a85cddd86f18b320addec49fb (patch) | |
tree | 8909b1bd8179c2e57d044729c01c3f2d2db6e440 /booster | |
parent | 1e401ee2a94091154d114c11b55853bda3f49e29 (diff) |
booster: implement creat64.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 369 (Samba does not work with booster.)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=369
Diffstat (limited to 'booster')
-rw-r--r-- | booster/src/booster.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c index 43c84890b04..2e0d8de9d53 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -104,6 +104,7 @@ write (int fd, const void *buf, size_t count); static int (*real_open) (const char *pathname, int flags, ...); static int (*real_open64) (const char *pathname, int flags, ...); static int (*real_creat) (const char *pathname, mode_t mode); +static int (*real_creat64) (const char *pathname, mode_t mode); /* read, readv, pread, pread64 */ static ssize_t (*real_read) (int fd, void *buf, size_t count); @@ -607,6 +608,8 @@ out: int __REDIRECT (booster_false_creat, (const char *pathname, mode_t mode), creat) __nonnull ((1)); +int __REDIRECT (booster_false_creat64, (const char *pathname, mode_t mode), + creat64) __nonnull ((1)); int booster_false_creat (const char *pathname, mode_t mode) @@ -651,6 +654,49 @@ out: } +int +booster_false_creat64 (const char *pathname, mode_t mode) +{ + int ret = -1; + if (!pathname) { + errno = EINVAL; + goto out; + } + + gf_log ("booster", GF_LOG_TRACE, "Create: %s", pathname); + ret = vmp_creat (pathname, mode); + + if ((ret == -1) && (errno != ENODEV)) { + gf_log ("booster", GF_LOG_ERROR, "VMP create failed: %s", + strerror (errno)); + goto out; + } + + if (ret > 0) { + gf_log ("booster", GF_LOG_TRACE, "File created"); + goto out; + } + + if (real_creat64 == NULL) { + errno = ENOSYS; + ret = -1; + goto out; + } + + ret = real_creat64 (pathname, mode); + + if (ret != -1) { + do_open (ret, pathname, GF_O_WRONLY | GF_O_TRUNC, mode, + BOOSTER_CREAT); + } else + gf_log ("booster", GF_LOG_ERROR, "real create failed: %s", + strerror (errno)); + +out: + return ret; +} + + /* pread */ ssize_t @@ -2907,6 +2953,7 @@ booster_lib_init (void) RESOLVE (open); RESOLVE (open64); RESOLVE (creat); + RESOLVE (creat64); RESOLVE (read); RESOLVE (readv); |