summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2018-03-15 13:08:55 +0100
committerRalph Boehme <slow@samba.org>2018-07-27 13:07:14 +0200
commit47d77432e4e0c61ba93390a5e33641a401154b54 (patch)
treeecd8d0807fdf07574d09c636b152f4f856131b62 /examples
parent8a6013f612f3a5ae8dccfab8aa07baf09450b59a (diff)
downloadsamba-47d77432e4e0c61ba93390a5e33641a401154b54.tar.gz
s3: vfs: add SMB_VFS_GET_DOS_ATTRIBUTES_SEND/RECV
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/VFS/skel_opaque.c48
-rw-r--r--examples/VFS/skel_transparent.c82
2 files changed, 130 insertions, 0 deletions
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 971303436b0..054de50197e 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -707,6 +707,52 @@ static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
return NT_STATUS_NOT_IMPLEMENTED;
}
+struct skel_get_dos_attributes_state {
+ struct vfs_aio_state aio_state;
+ uint32_t dosmode;
+};
+
+static struct tevent_req *skel_get_dos_attributes_send(
+ TALLOC_CTX *mem_ctx,
+ const struct smb_vfs_ev_glue *evg,
+ struct vfs_handle_struct *handle,
+ files_struct *dir_fsp,
+ struct smb_filename *smb_fname)
+{
+ struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
+ struct tevent_req *req = NULL;
+ struct skel_get_dos_attributes_state *state = NULL;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct skel_get_dos_attributes_state);
+ if (req == NULL) {
+ return NULL;
+ }
+
+ tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
+ return tevent_req_post(req, ev);
+}
+
+static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
+ struct vfs_aio_state *aio_state,
+ uint32_t *dosmode)
+{
+ struct skel_get_dos_attributes_state *state =
+ tevent_req_data(req,
+ struct skel_get_dos_attributes_state);
+ NTSTATUS status;
+
+ if (tevent_req_is_nterror(req, &status)) {
+ tevent_req_received(req);
+ return status;
+ }
+
+ *aio_state = state->aio_state;
+ *dosmode = state->dosmode;
+ tevent_req_received(req);
+ return NT_STATUS_OK;
+}
+
static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode)
@@ -1069,6 +1115,8 @@ static struct vfs_fn_pointers skel_opaque_fns = {
/* DOS attributes. */
.get_dos_attributes_fn = skel_get_dos_attributes,
+ .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
+ .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
.fget_dos_attributes_fn = skel_fget_dos_attributes,
.set_dos_attributes_fn = skel_set_dos_attributes,
.fset_dos_attributes_fn = skel_fset_dos_attributes,
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 503c14edcc0..cff52fa185e 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -886,6 +886,86 @@ static NTSTATUS skel_get_dos_attributes(struct vfs_handle_struct *handle,
dosmode);
}
+struct skel_get_dos_attributes_state {
+ struct vfs_aio_state aio_state;
+ uint32_t dosmode;
+};
+
+static void skel_get_dos_attributes_done(struct tevent_req *subreq);
+
+static struct tevent_req *skel_get_dos_attributes_send(
+ TALLOC_CTX *mem_ctx,
+ const struct smb_vfs_ev_glue *evg,
+ struct vfs_handle_struct *handle,
+ files_struct *dir_fsp,
+ struct smb_filename *smb_fname)
+{
+ struct tevent_context *ev = smb_vfs_ev_glue_ev_ctx(evg);
+ struct tevent_req *req = NULL;
+ struct skel_get_dos_attributes_state *state = NULL;
+ struct tevent_req *subreq = NULL;
+
+ req = tevent_req_create(mem_ctx, &state,
+ struct skel_get_dos_attributes_state);
+ if (req == NULL) {
+ return NULL;
+ }
+
+ subreq = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_SEND(mem_ctx,
+ evg,
+ handle,
+ dir_fsp,
+ smb_fname);
+ if (tevent_req_nomem(subreq, req)) {
+ return tevent_req_post(req, ev);
+ }
+ tevent_req_set_callback(subreq, skel_get_dos_attributes_done, req);
+
+ return req;
+}
+
+static void skel_get_dos_attributes_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req =
+ tevent_req_callback_data(subreq,
+ struct tevent_req);
+ struct skel_get_dos_attributes_state *state =
+ tevent_req_data(req,
+ struct skel_get_dos_attributes_state);
+ NTSTATUS status;
+
+ status = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_RECV(subreq,
+ &state->aio_state,
+ &state->dosmode);
+ TALLOC_FREE(subreq);
+ if (tevent_req_nterror(req, status)) {
+ return;
+ }
+
+ tevent_req_done(req);
+ return;
+}
+
+static NTSTATUS skel_get_dos_attributes_recv(struct tevent_req *req,
+ struct vfs_aio_state *aio_state,
+ uint32_t *dosmode)
+{
+ struct skel_get_dos_attributes_state *state =
+ tevent_req_data(req,
+ struct skel_get_dos_attributes_state);
+ NTSTATUS status;
+
+ if (tevent_req_is_nterror(req, &status)) {
+ tevent_req_received(req);
+ return status;
+ }
+
+ *aio_state = state->aio_state;
+ *dosmode = state->dosmode;
+ tevent_req_received(req);
+ return NT_STATUS_OK;
+}
+
static NTSTATUS skel_fget_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t *dosmode)
@@ -1298,6 +1378,8 @@ static struct vfs_fn_pointers skel_transparent_fns = {
/* DOS attributes. */
.get_dos_attributes_fn = skel_get_dos_attributes,
+ .get_dos_attributes_send_fn = skel_get_dos_attributes_send,
+ .get_dos_attributes_recv_fn = skel_get_dos_attributes_recv,
.fget_dos_attributes_fn = skel_fget_dos_attributes,
.set_dos_attributes_fn = skel_set_dos_attributes,
.fset_dos_attributes_fn = skel_fset_dos_attributes,