see if a notify event matches
*/
static BOOL notify_match(struct notify_context *notify, struct notify_entry *e,
- const char *path, uint32_t action)
+ const char *path, uint32_t filter)
{
- size_t len = strlen(e->path);
+ size_t len;
- /* TODO: check action */
+ if (!(filter & e->filter)) {
+ return False;
+ }
+
+ len = strlen(e->path);
if (strncmp(path, e->path, len) != 0) {
return False;
trigger a notify message for anyone waiting on a matching event
*/
void notify_trigger(struct notify_context *notify,
- uint32_t action, const char *path)
+ uint32_t action, uint32_t filter, const char *path)
{
NTSTATUS status;
int i;
/* this needs to be changed to a log(n) search */
for (i=0;i<notify->array->num_entries;i++) {
- if (notify_match(notify, ¬ify->array->entries[i], path, action)) {
+ if (notify_match(notify, ¬ify->array->entries[i], path, filter)) {
notify_send(notify, ¬ify->array->entries[i],
path + strlen(notify->array->entries[i].path) + 1,
action);
return status;
}
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_ADDED,
+ FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+ name->full_name);
return NT_STATUS_OK;
}
return status;
}
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_ADDED,
+ FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+ name->full_name);
return NT_STATUS_OK;
}
return pvfs_map_errno(pvfs, errno);
}
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_REMOVED, name->full_name);
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_REMOVED,
+ FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+ name->full_name);
return NT_STATUS_OK;
}
f->handle->have_opendb_entry = True;
create_action = NTCREATEX_ACTION_CREATED;
+
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_REMOVED,
+ FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_DIR_NAME,
+ name->full_name);
} else {
create_action = NTCREATEX_ACTION_EXISTED;
}
if (unlink(path) != 0) {
DEBUG(0,("pvfs_close: failed to delete '%s' - %s\n",
path, strerror(errno)));
+ } else {
+ notify_trigger(h->pvfs->notify_context,
+ NOTIFY_ACTION_REMOVED,
+ FILE_NOTIFY_CHANGE_FILE_NAME,
+ path);
}
}
/* success - keep the file handle */
talloc_steal(pvfs, f);
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_ADDED, name->full_name);
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_ADDED,
+ FILE_NOTIFY_CHANGE_FILE_NAME,
+ name->full_name);
return NT_STATUS_OK;
rd->readx.out.remaining = 0xFFFF;
rd->readx.out.compaction_mode = 0;
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_MODIFIED,
+ FILE_NOTIFY_CHANGE_LAST_ACCESS,
+ f->handle->name->full_name);
+
return NT_STATUS_OK;
}
}
if (NT_STATUS_IS_OK(status)) {
- notify_trigger(pvfs->notify_context, NOTIFY_ACTION_REMOVED,
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_REMOVED,
+ FILE_NOTIFY_CHANGE_FILE_NAME,
name->full_name);
}
wr->writex.out.nwritten = ret;
wr->writex.out.remaining = 0; /* should fill this in? */
+
+ notify_trigger(pvfs->notify_context,
+ NOTIFY_ACTION_MODIFIED,
+ FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE,
+ f->handle->name->full_name);
return NT_STATUS_OK;
}