The branch, master has been updated via 698f651 notifyd: Move BlockSignals calls to server.c via fa96452 smbd: Re-register notify requests via fef0c3d smbd: Restart notifyd via cf7fea2 smbd: Store notify filters in fsp->notify via 0136141 smbd: Log which notifyd was found via 5371d2b smbd: Remember notifyd's serverid via 7404fef notify_msg: Deregister handler upon talloc_free via 16a1418 smbd: Remove "listel" from notify_msg via 99b9f57 smbd: Protect notify_callback from stray pointers via 3caa8a1 smbd: Pass "sconn" via notify to notify_callback() via d446e40 smbd: There's only one notify_callback via 2779cae smbd: Make notify_callback() public via 60fe61b smbd: "path" is no longer needed in notify_list via 229c910 smbd: Add "path" to notify_remove via ed26f4b smbd: Avoid a talloc_asprintf via ea47abc smbd: Add fsp_fullbasepath via 2c7bfdc smbd: Factor out notify_init via 8e27c19 smbd: sconn->sys_notify_ctx is not used via 2bd3451 smbd: Don't stop sending to children when one send fails from 99b8aca s3: torture: Regression test case to specify exactly how UNIX extensions should act on files with streams.
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 698f6517866f567e999baf5b63ec7e6f5e9452a8 Author: Volker Lendecke <v...@samba.org> Date: Tue Jul 19 14:36:07 2016 +0200 notifyd: Move BlockSignals calls to server.c notifyd_send() is called as part of smbd initialization both in normal daemon mode after a fork, but also in interactive mode. In interactive mode, notifyd should not modify the global signal state with BlockSignals(). This patch moves the signal blocking to the place where we know that notifyd is a child daemon. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Wed Jul 20 09:04:00 CEST 2016 on sn-devel-144 commit fa96452f9cde535f3cfe31afe8c54199a940f027 Author: Volker Lendecke <v...@samba.org> Date: Tue Jun 21 16:23:19 2016 +0200 smbd: Re-register notify requests When notifyd is restarted, the parent will broadcast that fact to all workers. They will then re-register their notify requests. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit fef0c3d271847313f118160e57a853f899858888 Author: Volker Lendecke <v...@samba.org> Date: Fri Jun 24 16:29:28 2016 +0200 smbd: Restart notifyd Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit cf7fea2312c159764402f1bcb966f97904fb2132 Author: Volker Lendecke <v...@samba.org> Date: Fri Jun 24 16:27:34 2016 +0200 smbd: Store notify filters in fsp->notify When notifyd crashes, it will be restarted. We need to restore the filters with notifyd Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 01361418abd9b33cd0719188a88952566d99ff68 Author: Volker Lendecke <v...@samba.org> Date: Thu Jun 23 14:24:32 2016 +0200 smbd: Log which notifyd was found Just a debugging aid Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 5371d2b86077a0624e3ee58d4f554d64ce5cfbe9 Author: Volker Lendecke <v...@samba.org> Date: Tue Jun 21 14:13:06 2016 +0200 smbd: Remember notifyd's serverid Similarly to cleanupd, this is necessary to restart notifyd Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 7404feffd7130ce389be3a1f65a7ae8c7cc2d156 Author: Volker Lendecke <v...@samba.org> Date: Tue Jun 21 13:04:25 2016 +0200 notify_msg: Deregister handler upon talloc_free So far, we haven't TALLOC_FREE'ed the notify context. This will change. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 16a1418f3aa08b1fd5c971481592bfddc250abf0 Author: Volker Lendecke <v...@samba.org> Date: Tue Jun 14 15:03:35 2016 +0200 smbd: Remove "listel" from notify_msg We have all information that was kept in "notify_list" in other parts of smbd as well. The only possible downside of this patch is that we possibly have a lot more fsp's than fsp's with notifies, so notify_callback() might be a bit slower in this situation. If this turns out to be a problem, I'd rather put some more smarts into the notifyd protocol to enable a better indexed notify_callback(). For now, this avoids data to be kept in two places. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 99b9f5729a32f1b60bac150abe267da4daa1e7e2 Author: Volker Lendecke <v...@samba.org> Date: Tue Jun 14 15:00:29 2016 +0200 smbd: Protect notify_callback from stray pointers This protection right now lives in notify_msg.c with the notify_list, but that will go. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3caa8a1bf1e55d09399c4d54c69b638955ed3b36 Author: Volker Lendecke <v...@samba.org> Date: Tue Jun 14 14:54:32 2016 +0200 smbd: Pass "sconn" via notify to notify_callback() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit d446e406db3745ef2b217f31f2f8abd0254e7f03 Author: Volker Lendecke <v...@samba.org> Date: Tue Jun 14 11:55:13 2016 +0200 smbd: There's only one notify_callback We do not have different callbacks per notify, put the callback function into the notify context Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2779cae82311c5a9352b757580abfe336e2a551b Author: Volker Lendecke <v...@samba.org> Date: Tue Jun 14 06:54:11 2016 +0200 smbd: Make notify_callback() public Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 60fe61b3525cce154c4822148d523d0d79d9f5cc Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 13 18:08:58 2016 +0200 smbd: "path" is no longer needed in notify_list Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 229c9108d91e353c60eb47d33b3c55e7689db605 Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 13 18:06:08 2016 +0200 smbd: Add "path" to notify_remove Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ed26f4b22ab33f7124a4393ee2f7cdb993b5adec Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 13 16:22:31 2016 +0200 smbd: Avoid a talloc_asprintf Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ea47abcf3c9e750fa6315ec1de0c18f9fb4faaeb Author: Volker Lendecke <v...@samba.org> Date: Mon Jun 13 16:12:54 2016 +0200 smbd: Add fsp_fullbasepath Okay, this is similar to full_path_tos, but with variable arrays now and much simpler :-) Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2c7bfdc6445a82823f3876eafe22cd7ec8ae95a2 Author: Volker Lendecke <v...@samba.org> Date: Thu Jun 23 12:53:47 2016 +0200 smbd: Factor out notify_init Before this patch, failure of notify_init was ignored. Also, no proper error handling of a messaging_register failure was done. Fix those, also adding some debug messages. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8e27c19d13a7d2c2cfc5881c95850a2d65d0aee3 Author: Volker Lendecke <v...@samba.org> Date: Wed Jun 15 10:21:48 2016 +0200 smbd: sconn->sys_notify_ctx is not used Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 2bd34516d4ee0eb44cdcb3c97ccbc062ba5339cf Author: Volker Lendecke <v...@samba.org> Date: Tue Jun 21 16:10:14 2016 +0200 smbd: Don't stop sending to children when one send fails Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: librpc/idl/messaging.idl | 1 + source3/smbd/files.c | 29 ++++++++-- source3/smbd/globals.h | 1 - source3/smbd/notify.c | 117 ++++++++++++++++++++++++++++++++--------- source3/smbd/notify_msg.c | 106 +++++++++++++++++-------------------- source3/smbd/notifyd/notifyd.c | 4 -- source3/smbd/proto.h | 24 ++++++--- source3/smbd/server.c | 35 ++++++++++-- source3/smbd/service.c | 54 +++++++++++++++---- source3/utils/status.c | 3 +- 10 files changed, 262 insertions(+), 112 deletions(-) Changeset truncated at 500 lines: diff --git a/librpc/idl/messaging.idl b/librpc/idl/messaging.idl index 6232322..a54d13c 100644 --- a/librpc/idl/messaging.idl +++ b/librpc/idl/messaging.idl @@ -105,6 +105,7 @@ interface messaging MSG_SMB_NOTIFY_GET_DB = 0x031C, MSG_SMB_NOTIFY_DB = 0x031D, MSG_SMB_NOTIFY_REC_CHANGES = 0x031E, + MSG_SMB_NOTIFY_STARTED = 0x031F, /* winbind messages */ MSG_WINBIND_FINISHED = 0x0401, diff --git a/source3/smbd/files.c b/source3/smbd/files.c index a3cce13..1ef1bc9 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -518,9 +518,21 @@ void file_free(struct smb_request *req, files_struct *fsp) uint64_t fnum = fsp->fnum; if (fsp->notify) { - struct notify_context *notify_ctx = - fsp->conn->sconn->notify_ctx; - notify_remove(notify_ctx, fsp); + size_t len = fsp_fullbasepath(fsp, NULL, 0); + char fullpath[len+1]; + + fsp_fullbasepath(fsp, fullpath, sizeof(fullpath)); + + /* + * Avoid /. at the end of the path name. notify can't + * deal with it. + */ + if (len > 1 && fullpath[len-1] == '.' && + fullpath[len-2] == '/') { + fullpath[len-2] = '\0'; + } + + notify_remove(fsp->conn->sconn->notify_ctx, fsp, fullpath); TALLOC_FREE(fsp->notify); } @@ -780,3 +792,14 @@ uint32_t fsp_lease_type(struct files_struct *fsp) } return map_oplock_to_lease_type(fsp->oplock_type); } + +size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen) +{ + int len; + + len = snprintf(buf, buflen, "%s/%s", fsp->conn->connectpath, + fsp->fsp_name->base_name); + SMB_ASSERT(len>0); + + return len; +} diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 0266533..8ba564d 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -860,7 +860,6 @@ struct smbd_server_connection { const char *remote_hostname; struct tevent_context *ev_ctx; struct messaging_context *msg_ctx; - struct sys_notify_context *sys_notify_ctx; struct notify_context *notify_ctx; bool using_smb2; int trans_num; diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index d7382db..f64185d 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -33,6 +33,12 @@ struct notify_change_event { struct notify_change_buf { /* + * Filters for reinitializing after notifyd has been restarted + */ + uint32_t filter; + uint32_t subdir_filter; + + /* * If no requests are pending, changes are queued here. Simple array, * we only append. */ @@ -240,20 +246,41 @@ void change_notify_reply(struct smb_request *req, notify_buf->num_changes = 0; } -static void notify_callback(void *private_data, struct timespec when, - const struct notify_event *e) +struct notify_fsp_state { + struct files_struct *notified_fsp; + struct timespec when; + const struct notify_event *e; +}; + +static struct files_struct *notify_fsp_cb(struct files_struct *fsp, + void *private_data) { - files_struct *fsp = (files_struct *)private_data; - DEBUG(10, ("notify_callback called for %s\n", fsp_str_dbg(fsp))); - notify_fsp(fsp, when, e->action, e->path); + struct notify_fsp_state *state = private_data; + + if (fsp == state->notified_fsp) { + DBG_DEBUG("notify_callback called for %s\n", fsp_str_dbg(fsp)); + notify_fsp(fsp, state->when, state->e->action, state->e->path); + return fsp; + } + + return NULL; +} + +void notify_callback(struct smbd_server_connection *sconn, + void *private_data, struct timespec when, + const struct notify_event *e) +{ + struct notify_fsp_state state = { + .notified_fsp = private_data, .when = when, .e = e + }; + files_forall(sconn, notify_fsp_cb, &state); } NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter, bool recursive) { - char *fullpath; - size_t len; - uint32_t subdir_filter; + size_t len = fsp_fullbasepath(fsp, NULL, 0); + char fullpath[len+1]; NTSTATUS status = NT_STATUS_NOT_IMPLEMENTED; if (fsp->notify != NULL) { @@ -266,33 +293,25 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter, DEBUG(0, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } + fsp->notify->filter = filter; + fsp->notify->subdir_filter = recursive ? filter : 0; - /* Do notify operations on the base_name. */ - fullpath = talloc_asprintf( - talloc_tos(), "%s/%s", fsp->conn->connectpath, - fsp->fsp_name->base_name); - if (fullpath == NULL) { - DEBUG(0, ("talloc_asprintf failed\n")); - TALLOC_FREE(fsp->notify); - return NT_STATUS_NO_MEMORY; - } + fsp_fullbasepath(fsp, fullpath, sizeof(fullpath)); /* * Avoid /. at the end of the path name. notify can't deal with it. */ - len = strlen(fullpath); if (len > 1 && fullpath[len-1] == '.' && fullpath[len-2] == '/') { fullpath[len-2] = '\0'; } - subdir_filter = recursive ? filter : 0; - - if ((filter != 0) || (subdir_filter != 0)) { + if ((fsp->notify->filter != 0) || + (fsp->notify->subdir_filter != 0)) { status = notify_add(fsp->conn->sconn->notify_ctx, - fullpath, filter, subdir_filter, - notify_callback, fsp); + fullpath, fsp->notify->filter, + fsp->notify->subdir_filter, fsp); } - TALLOC_FREE(fullpath); + return status; } @@ -471,6 +490,56 @@ done: TALLOC_FREE(fid); } +static struct files_struct *smbd_notifyd_reregister(struct files_struct *fsp, + void *private_data) +{ + DBG_DEBUG("reregister %s\n", fsp->fsp_name->base_name); + + if ((fsp->conn->sconn->notify_ctx != NULL) && + (fsp->notify != NULL) && + ((fsp->notify->filter != 0) || + (fsp->notify->subdir_filter != 0))) { + size_t len = fsp_fullbasepath(fsp, NULL, 0); + char fullpath[len+1]; + + NTSTATUS status; + + fsp_fullbasepath(fsp, fullpath, sizeof(fullpath)); + if (len > 1 && fullpath[len-1] == '.' && + fullpath[len-2] == '/') { + fullpath[len-2] = '\0'; + } + + status = notify_add(fsp->conn->sconn->notify_ctx, + fullpath, fsp->notify->filter, + fsp->notify->subdir_filter, fsp); + if (!NT_STATUS_IS_OK(status)) { + DBG_DEBUG("notify_add failed: %s\n", + nt_errstr(status)); + } + } + return NULL; +} + +void smbd_notifyd_restarted(struct messaging_context *msg, + void *private_data, uint32_t msg_type, + struct server_id server_id, DATA_BLOB *data) +{ + struct smbd_server_connection *sconn = talloc_get_type_abort( + private_data, struct smbd_server_connection); + + TALLOC_FREE(sconn->notify_ctx); + + sconn->notify_ctx = notify_init(sconn, sconn->msg_ctx, sconn->ev_ctx, + sconn, notify_callback); + if (sconn->notify_ctx == NULL) { + DBG_DEBUG("notify_init failed\n"); + return; + } + + files_forall(sconn, smbd_notifyd_reregister, sconn->notify_ctx); +} + /**************************************************************************** Delete entries by fnum from the change notify pending queue. *****************************************************************************/ diff --git a/source3/smbd/notify_msg.c b/source3/smbd/notify_msg.c index ea067d0..20b2864 100644 --- a/source3/smbd/notify_msg.c +++ b/source3/smbd/notify_msg.c @@ -30,27 +30,28 @@ #include "lib/util/server_id_db.h" #include "smbd/notifyd/notifyd.h" -struct notify_list { - struct notify_list *next, *prev; - void (*callback)(void *private_data, struct timespec when, - const struct notify_event *ctx); - void *private_data; - char path[1]; -}; - struct notify_context { struct server_id notifyd; struct messaging_context *msg_ctx; - struct notify_list *list; + + struct smbd_server_connection *sconn; + void (*callback)(struct smbd_server_connection *sconn, + void *private_data, struct timespec when, + const struct notify_event *ctx); }; static void notify_handler(struct messaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data); - -struct notify_context *notify_init(TALLOC_CTX *mem_ctx, - struct messaging_context *msg, - struct tevent_context *ev) +static int notify_context_destructor(struct notify_context *ctx); + +struct notify_context *notify_init( + TALLOC_CTX *mem_ctx, struct messaging_context *msg, + struct tevent_context *ev, + struct smbd_server_connection *sconn, + void (*callback)(struct smbd_server_connection *sconn, + void *, struct timespec, + const struct notify_event *)) { struct server_id_db *names_db; struct notify_context *ctx; @@ -61,7 +62,9 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, return NULL; } ctx->msg_ctx = msg; - ctx->list = NULL; + + ctx->sconn = sconn; + ctx->callback = callback; names_db = messaging_names_db(msg); if (!server_id_db_lookup_one(names_db, "notify-daemon", @@ -71,17 +74,37 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, return NULL; } - status = messaging_register(msg, ctx, MSG_PVFS_NOTIFY, notify_handler); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("messaging_register failed: %s\n", - nt_errstr(status))); - TALLOC_FREE(ctx); - return NULL; + { + struct server_id_buf tmp; + DBG_DEBUG("notifyd=%s\n", + server_id_str_buf(ctx->notifyd, &tmp)); } + if (callback != NULL) { + status = messaging_register(msg, ctx, MSG_PVFS_NOTIFY, + notify_handler); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("messaging_register failed: %s\n", + nt_errstr(status))); + TALLOC_FREE(ctx); + return NULL; + } + } + + talloc_set_destructor(ctx, notify_context_destructor); + return ctx; } +static int notify_context_destructor(struct notify_context *ctx) +{ + if (ctx->callback != NULL) { + messaging_deregister(ctx->msg_ctx, MSG_PVFS_NOTIFY, ctx); + } + + return 0; +} + static void notify_handler(struct messaging_context *msg, void *private_data, uint32_t msg_type, struct server_id src, DATA_BLOB *data) @@ -90,7 +113,6 @@ static void notify_handler(struct messaging_context *msg, void *private_data, private_data, struct notify_context); struct notify_event_msg *event_msg; struct notify_event event; - struct notify_list *listel; if (data->length < offsetof(struct notify_event_msg, path) + 1) { DEBUG(1, ("message too short: %u\n", (unsigned)data->length)); @@ -111,22 +133,13 @@ static void notify_handler(struct messaging_context *msg, void *private_data, "path=%s\n", __func__, (unsigned)event.action, event.private_data, event.path)); - for (listel = ctx->list; listel != NULL; listel = listel->next) { - if (listel->private_data == event.private_data) { - listel->callback(listel->private_data, event_msg->when, - &event); - break; - } - } + ctx->callback(ctx->sconn, event.private_data, event_msg->when, &event); } NTSTATUS notify_add(struct notify_context *ctx, const char *path, uint32_t filter, uint32_t subdir_filter, - void (*callback)(void *, struct timespec, - const struct notify_event *), void *private_data) { - struct notify_list *listel; struct notify_rec_change_msg msg = {}; struct iovec iov[2]; size_t pathlen; @@ -142,15 +155,6 @@ NTSTATUS notify_add(struct notify_context *ctx, pathlen = strlen(path)+1; - listel = (struct notify_list *)talloc_size( - ctx, offsetof(struct notify_list, path) + pathlen); - if (listel == NULL) { - return NT_STATUS_NO_MEMORY; - } - listel->callback = callback; - listel->private_data = private_data; - memcpy(listel->path, path, pathlen); - clock_gettime_mono(&msg.instance.creation_time); msg.instance.filter = filter; msg.instance.subdir_filter = subdir_filter; @@ -166,19 +170,17 @@ NTSTATUS notify_add(struct notify_context *ctx, iov, ARRAY_SIZE(iov), NULL, 0); if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(listel); DEBUG(10, ("messaging_send_iov returned %s\n", nt_errstr(status))); return status; } - DLIST_ADD(ctx->list, listel); return NT_STATUS_OK; } -NTSTATUS notify_remove(struct notify_context *ctx, void *private_data) +NTSTATUS notify_remove(struct notify_context *ctx, void *private_data, + char *path) { - struct notify_list *listel; struct notify_rec_change_msg msg = {}; struct iovec iov[2]; NTSTATUS status; @@ -188,29 +190,17 @@ NTSTATUS notify_remove(struct notify_context *ctx, void *private_data) return NT_STATUS_NOT_IMPLEMENTED; } - for (listel = ctx->list; listel != NULL; listel = listel->next) { - if (listel->private_data == private_data) { - DLIST_REMOVE(ctx->list, listel); - break; - } - } - if (listel == NULL) { - DEBUG(10, ("%p not found\n", private_data)); - return NT_STATUS_NOT_FOUND; - } - msg.instance.private_data = private_data; iov[0].iov_base = &msg; iov[0].iov_len = offsetof(struct notify_rec_change_msg, path); - iov[1].iov_base = discard_const_p(char, listel->path); - iov[1].iov_len = strlen(listel->path)+1; + iov[1].iov_base = path; + iov[1].iov_len = strlen(path)+1; status = messaging_send_iov( ctx->msg_ctx, ctx->notifyd, MSG_SMB_NOTIFY_REC_CHANGE, iov, ARRAY_SIZE(iov), NULL, 0); - TALLOC_FREE(listel); return status; } diff --git a/source3/smbd/notifyd/notifyd.c b/source3/smbd/notifyd/notifyd.c index 519109f..69d30f7 100644 --- a/source3/smbd/notifyd/notifyd.c +++ b/source3/smbd/notifyd/notifyd.c @@ -258,10 +258,6 @@ struct tevent_req *notifyd_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, return tevent_req_post(req, ev); } - /* Block those signals that we are not handling */ - BlockSignals(True, SIGHUP); - BlockSignals(True, SIGUSR1); - if (ctdbd_conn == NULL) { /* * No cluster around, skip the database replication diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 86fafe5..26fec95 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -412,6 +412,7 @@ NTSTATUS fsp_set_smb_fname(struct files_struct *fsp, const struct smb_filename *smb_fname_in); const struct GUID *fsp_client_guid(const files_struct *fsp); uint32_t fsp_lease_type(struct files_struct *fsp); +size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen); /* The following definitions come from smbd/ipc.c */ @@ -529,6 +530,9 @@ void change_notify_reply(struct smb_request *req, void (*reply_fn)(struct smb_request *req, NTSTATUS error_code, uint8_t *buf, size_t len)); +void notify_callback(struct smbd_server_connection *sconn, + void *private_data, struct timespec when, + const struct notify_event *e); NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter, bool recursive); NTSTATUS change_notify_add_request(struct smb_request *req, @@ -541,6 +545,9 @@ NTSTATUS change_notify_add_request(struct smb_request *req, void smbd_notify_cancel_deleted(struct messaging_context *msg, void *private_data, uint32_t msg_type, struct server_id server_id, DATA_BLOB *data); +void smbd_notifyd_restarted(struct messaging_context *msg, + void *private_data, uint32_t msg_type, + struct server_id server_id, DATA_BLOB *data); void remove_pending_change_notify_requests_by_mid( struct smbd_server_connection *sconn, uint64_t mid); void remove_pending_change_notify_requests_by_fid(files_struct *fsp, @@ -580,15 +587,18 @@ int fam_watch(TALLOC_CTX *mem_ctx, /* The following definitions come from smbd/notify_internal.c */ -struct notify_context *notify_init(TALLOC_CTX *mem_ctx, - struct messaging_context *messaging_ctx, - struct tevent_context *ev); -NTSTATUS notify_add(struct notify_context *notify, +struct notify_context *notify_init( + TALLOC_CTX *mem_ctx, struct messaging_context *msg, + struct tevent_context *ev, + struct smbd_server_connection *sconn, + void (*callback)(struct smbd_server_connection *sconn, + void *, struct timespec, + const struct notify_event *)); +NTSTATUS notify_add(struct notify_context *ctx, -- Samba Shared Repository