From 9091aec724545b0a301f863e4f19f756fb7f7f49 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 22 Mar 2012 12:17:14 +0100 Subject: s3: Add sync cli_notify --- source3/libsmb/clifile.c | 35 +++++++++++++++++++++++++++++++++++ source3/libsmb/proto.h | 4 ++++ 2 files changed, 39 insertions(+) (limited to 'source3') diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index a25eb4636e..48a0636fec 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -5069,6 +5069,41 @@ NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } +NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size, + uint32_t completion_filter, bool recursive, + TALLOC_CTX *mem_ctx, uint32_t *pnum_changes, + struct notify_change **pchanges) +{ + TALLOC_CTX *frame = talloc_stackframe(); + struct tevent_context *ev; + struct tevent_req *req; + NTSTATUS status = NT_STATUS_NO_MEMORY; + + if (cli_has_async_calls(cli)) { + /* + * Can't use sync call while an async call is in flight + */ + status = NT_STATUS_INVALID_PARAMETER; + goto fail; + } + ev = tevent_context_init(frame); + if (ev == NULL) { + goto fail; + } + req = cli_notify_send(ev, ev, cli, fnum, buffer_size, + completion_filter, recursive); + if (req == NULL) { + goto fail; + } + if (!tevent_req_poll_ntstatus(req, ev, &status)) { + goto fail; + } + status = cli_notify_recv(req, mem_ctx, pnum_changes, pchanges); + fail: + TALLOC_FREE(frame); + return status; +} + struct cli_qpathinfo_state { uint8_t *param; uint8_t *data; diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index 9e03ec4798..336c95f07c 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -593,6 +593,10 @@ struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx, NTSTATUS cli_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, uint32_t *pnum_changes, struct notify_change **pchanges); +NTSTATUS cli_notify(struct cli_state *cli, uint16_t fnum, uint32_t buffer_size, + uint32_t completion_filter, bool recursive, + TALLOC_CTX *mem_ctx, uint32_t *pnum_changes, + struct notify_change **pchanges); struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx, struct event_context *ev, -- cgit