notify: Move path construction to notify_trigger
authorVolker Lendecke <vl@samba.org>
Thu, 2 Jan 2014 16:54:53 +0000 (17:54 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 16 Dec 2014 20:22:26 +0000 (21:22 +0100)
notify_msg won't need to construct the path anymore, it will be able to
put the parts into iovecs

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 16 21:22:26 CET 2014 on sn-devel-104

source3/smbd/notify.c
source3/smbd/notify_internal.c
source3/smbd/proto.h

index ac1a55ce842a1779bd3f6bbb194a13fe8edd4493..5ac8c0c791da7f5333fc3b4b17485241ecd5778c 100644 (file)
@@ -442,21 +442,12 @@ void notify_fname(connection_struct *conn, uint32 action, uint32 filter,
                  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,
index 9c0b1901f8c9e71609af4e3eb16283ab382933f5..e612f163da9edd34929f73aad01f72cb2b54daff 100644 (file)
@@ -616,7 +616,8 @@ static bool notify_pull_remote_blob(TALLOC_CTX *mem_ctx,
 }
 
 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;
@@ -625,22 +626,33 @@ void notify_trigger(struct notify_context *notify,
        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;
@@ -708,6 +720,7 @@ void notify_trigger(struct notify_context *notify,
 done:
        TALLOC_FREE(remote_blob);
        TALLOC_FREE(idx_state.vnns);
+       TALLOC_FREE(to_free);
 }
 
 static void notify_trigger_local(struct notify_context *notify,
index 44ea6f0c7543e68e755b19329f17399e3e584ec1..121682c9659b02fa65e8d11ebab8f1e0c2bec518 100644 (file)
@@ -554,7 +554,8 @@ NTSTATUS notify_add(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,