summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2015-06-21 17:51:24 +0200
committerKaleb KEITHLEY <kkeithle@redhat.com>2016-01-31 03:34:04 -0800
commitb8a7b648d8f16999b00768d56f029b955c390eb7 (patch)
tree730f70cf10086e5814c0d38db4673dd0d1ce2c4f /libglusterfs/src
parent0b6aba5ef63882e6a798a23de6f8efbb6bea0ea7 (diff)
syncop: add seek() FOP
Add the new seek() FOP to the syncop framework. gfapi will use this in the future. Change-Id: I0c15153beb27de73d5844b6f692175750fc28f60 BUG: 1220173 Singed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/11481 Smoke: Gluster Build System <jenkins@build.gluster.com> Tested-by: Niels de Vos <ndevos@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/syncop.c37
-rw-r--r--libglusterfs/src/syncop.h7
2 files changed, 43 insertions, 1 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 7c0ec7799e7..3544562e44e 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -2838,6 +2838,42 @@ syncop_ipc (xlator_t *subvol, int32_t op, dict_t *xdata_in, dict_t **xdata_out)
}
int
+syncop_seek_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int op_ret, int op_errno, off_t offset, dict_t *xdata)
+{
+ struct syncargs *args = NULL;
+
+ args = cookie;
+
+ args->op_ret = op_ret;
+ args->op_errno = op_errno;
+ args->offset = offset;
+ if (xdata)
+ args->xdata = dict_ref (xdata);
+
+ __wake (args);
+
+ return 0;
+}
+
+int
+syncop_seek (xlator_t *subvol, fd_t *fd, off_t offset, gf_seek_what_t what,
+ dict_t *xdata_in, off_t *off)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_seek_cbk, subvol->fops->seek, fd,
+ offset, what, xdata_in);
+
+ if (*off)
+ *off = args.offset;
+
+ if (args.op_ret == -1)
+ return -args.op_errno;
+ return args.op_ret;
+}
+
+int
syncop_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct gf_flock *flock,
dict_t *xdata)
@@ -2858,7 +2894,6 @@ syncop_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
-
int
syncop_lk (xlator_t *subvol, fd_t *fd, int cmd, struct gf_flock *flock,
dict_t *xdata_in, dict_t **xdata_out)
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index 8afc68e7f21..1bad3506405 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -169,7 +169,9 @@ struct syncargs {
pthread_mutex_t mutex;
pthread_cond_t cond;
int done;
+
gf_dirent_t entries;
+ off_t offset;
};
struct syncopctx {
@@ -511,4 +513,9 @@ int syncop_xattrop (xlator_t *subvol, loc_t *loc, gf_xattrop_flags_t flags,
int
syncop_fxattrop (xlator_t *subvol, fd_t *fd, gf_xattrop_flags_t flags,
dict_t *dict, dict_t *xdata_in, dict_t **xdata_out);
+
+int
+syncop_seek (xlator_t *subvol, fd_t *fd, off_t offset, gf_seek_what_t what,
+ dict_t *xdata_in, off_t *off);
+
#endif /* _SYNCOP_H */