summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-10-01 06:59:09 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-01 07:24:08 -0700
commit46c23afc98e3f0c8063c4baada7baa3dd3134727 (patch)
treeff2ba16fcafffa99f75805d1e6fe00a3ce211cff /libglusterfsclient
parenta2013f6bc70832c7cbcc1cabbb4d74725c0adac7 (diff)
libglusterfsclient: Use setattr for utime
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 146 (Add setattr FOP) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=146
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index ce5a9cade8d..32a271112a3 100755
--- a/libglusterfsclient/src/libglusterfsclient.c
+++ b/libglusterfsclient/src/libglusterfsclient.c
@@ -6474,13 +6474,24 @@ glusterfs_glh_utime (glusterfs_handle_t handle, const char *path,
int32_t op_ret = -1;
loc_t loc = {0, };
libglusterfs_client_ctx_t *ctx = handle;
- struct timespec ts[2] = {{0,},{0,}};
char *name = NULL;
+ struct stat stbuf = {0,};
+ int32_t valid = 0;
GF_VALIDATE_OR_GOTO (LIBGF_XL_NAME, ctx, out);
GF_VALIDATE_ABSOLUTE_PATH_OR_GOTO (LIBGF_XL_NAME, path, out);
gf_log (LIBGF_XL_NAME, GF_LOG_DEBUG, "path %s", path);
+ if (buf) {
+ stbuf.st_atime = buf->actime;
+ ST_ATIM_NSEC_SET (&stbuf, 0);
+
+ stbuf.st_mtime = buf->modtime;
+ ST_MTIM_NSEC_SET (&stbuf, 0);
+ }
+
+ valid |= (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME);
+
loc.path = libgf_resolve_path_light ((char *)path);
if (!loc.path) {
gf_log (LIBGF_XL_NAME, GF_LOG_ERROR, "Path compaction failed");
@@ -6505,13 +6516,7 @@ glusterfs_glh_utime (glusterfs_handle_t handle, const char *path,
goto out;
}
- ts[0].tv_sec = buf->actime;
- ts[0].tv_nsec = 0;
-
- ts[1].tv_sec = buf->modtime;
- ts[1].tv_nsec = 0;
-
- op_ret = libgf_client_utimens (ctx, &loc, ts);
+ op_ret = libgf_client_setattr (ctx, &loc, &stbuf, valid);
out:
if (name)
FREE (name);