const char *path)
{
struct notify_context *notify_ctx = conn->sconn->notify_ctx;
- char *fullpath, *to_free;
- char tmpbuf[PATH_MAX];
- ssize_t len;
if (path[0] == '.' && path[1] == '/') {
path += 2;
}
- len = full_path_tos(conn->connectpath, path, tmpbuf, sizeof(tmpbuf),
- &fullpath, &to_free);
- if (len == -1) {
- DEBUG(0, ("full_path_tos failed\n"));
- return;
- }
- notify_trigger(notify_ctx, action, filter, fullpath);
- TALLOC_FREE(to_free);
+
+ notify_trigger(notify_ctx, action, filter, conn->connectpath, path);
}
static void notify_fsp(files_struct *fsp, struct timespec when,
}
void notify_trigger(struct notify_context *notify,
- uint32_t action, uint32_t filter, const char *path)
+ uint32_t action, uint32_t filter,
+ const char *dir, const char *name)
{
struct ctdbd_connection *ctdbd_conn;
struct notify_trigger_index_state idx_state;
uint32_t last_vnn;
uint8_t *remote_blob = NULL;
size_t remote_blob_len = 0;
+ char *path, *to_free;
+ char tmpbuf[PATH_MAX];
+ ssize_t len;
DEBUG(10, ("notify_trigger called action=0x%x, filter=0x%x, "
- "path=%s\n", (unsigned)action, (unsigned)filter, path));
+ "dir=%s, name=%s\n", (unsigned)action, (unsigned)filter,
+ dir, name));
/* see if change notify is enabled at all */
if (notify == NULL) {
return;
}
- if (path[0] != '/') {
+ if (dir[0] != '/') {
/*
* The rest of this routine assumes an absolute path.
*/
return;
}
+ len = full_path_tos(dir, name, tmpbuf, sizeof(tmpbuf),
+ &path, &to_free);
+ if (len == -1) {
+ DEBUG(1, ("full_path_tos failed\n"));
+ return;
+ }
+
idx_state.mem_ctx = talloc_tos();
idx_state.vnns = NULL;
idx_state.found_my_vnn = false;
done:
TALLOC_FREE(remote_blob);
TALLOC_FREE(idx_state.vnns);
+ TALLOC_FREE(to_free);
}
static void notify_trigger_local(struct notify_context *notify,
void *private_data);
NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
void notify_trigger(struct notify_context *notify,
- uint32_t action, uint32_t filter, const char *path);
+ uint32_t action, uint32_t filter,
+ const char *dir, const char *path);
void notify_walk_idx(struct notify_context *notify,
void (*fn)(const char *path,
uint32_t *vnns, size_t num_vnns,