[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Fri Mar 16 07:29:03 MDT 2012
The branch, master has been updated
via 8503eec s3-notify: Lift "/." handling up one level
via 640a7d0 s3-notify: Simplify if-expressions
via 1909af4 s3-dbwrap: Move "lock_order" initialization to db_open_xx
from af68fe7 build: Fix build issue on OpenBSD 5.x
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8503eecabb9cbd47db6167f7394dc2257714ebd9
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 15 13:02:15 2012 +0100
s3-notify: Lift "/." handling up one level
This slightly simplifies the code
Autobuild-User: Volker Lendecke <vl at samba.org>
Autobuild-Date: Fri Mar 16 14:28:44 CET 2012 on sn-devel-104
commit 640a7d0db71e038223a2f5afed70c5df5db509ac
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 15 12:22:50 2012 +0100
s3-notify: Simplify if-expressions
commit 1909af434eef5473c236aa46e531818e392b80b3
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 15 11:10:35 2012 +0100
s3-dbwrap: Move "lock_order" initialization to db_open_xx
-----------------------------------------------------------------------
Summary of changes:
source3/lib/dbwrap/dbwrap_ctdb.c | 1 +
source3/lib/dbwrap/dbwrap_open.c | 6 +---
source3/lib/dbwrap/dbwrap_tdb.c | 4 ++-
source3/lib/dbwrap/dbwrap_tdb.h | 3 +-
source3/smbd/notify.c | 9 +++++++
source3/smbd/notify_internal.c | 44 +++++++++++--------------------------
6 files changed, 30 insertions(+), 37 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index d50f75e..41adfd8 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1505,6 +1505,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
db_path = ctdbd_dbpath(conn, db_ctdb, db_ctdb->db_id);
result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
+ result->lock_order = lock_order;
/* only pass through specific flags */
tdb_flags &= TDB_SEQNUM;
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index 7315296..06ae7c6 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -123,10 +123,8 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
if (result == NULL) {
result = db_open_tdb(mem_ctx, name, hash_size,
- tdb_flags, open_flags, mode);
- }
- if (result != NULL) {
- result->lock_order = lock_order;
+ tdb_flags, open_flags, mode,
+ lock_order);
}
return result;
}
diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c
index 454073a..46d6cdb 100644
--- a/source3/lib/dbwrap/dbwrap_tdb.c
+++ b/source3/lib/dbwrap/dbwrap_tdb.c
@@ -343,7 +343,8 @@ static int db_tdb_transaction_cancel(struct db_context *db)
struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
const char *name,
int hash_size, int tdb_flags,
- int open_flags, mode_t mode)
+ int open_flags, mode_t mode,
+ enum dbwrap_lock_order lock_order)
{
struct db_context *result = NULL;
struct db_tdb_ctx *db_tdb;
@@ -361,6 +362,7 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
DEBUG(0, ("talloc failed\n"));
goto fail;
}
+ result->lock_order = lock_order;
db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, tdb_flags,
open_flags, mode, lp_ctx);
diff --git a/source3/lib/dbwrap/dbwrap_tdb.h b/source3/lib/dbwrap/dbwrap_tdb.h
index 86673d0..1f7a223 100644
--- a/source3/lib/dbwrap/dbwrap_tdb.h
+++ b/source3/lib/dbwrap/dbwrap_tdb.h
@@ -27,7 +27,8 @@ struct db_context;
struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
const char *name,
int hash_size, int tdb_flags,
- int open_flags, mode_t mode);
+ int open_flags, mode_t mode,
+ enum dbwrap_lock_order lock_order);
#endif /* __DBWRAP_TDB_H__ */
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c
index 37d585b..534ed84 100644
--- a/source3/smbd/notify.c
+++ b/source3/smbd/notify.c
@@ -178,6 +178,7 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
bool recursive)
{
char *fullpath;
+ size_t len;
struct notify_entry e;
NTSTATUS status;
@@ -202,6 +203,14 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32 filter,
return NT_STATUS_NO_MEMORY;
}
+ /*
+ * 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';
+ }
+
ZERO_STRUCT(e);
e.path = fullpath;
e.dir_fd = fsp->fh->fd;
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index d442367..906f767 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -511,9 +511,7 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
{
struct notify_entry e = *e0;
NTSTATUS status;
- char *tmp_path = NULL;
struct notify_list *listel;
- size_t len;
int depth;
/* see if change notify is enabled at all */
@@ -521,17 +519,6 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
return NT_STATUS_NOT_IMPLEMENTED;
}
- /* cope with /. on the end of the path */
- len = strlen(e.path);
- if (len > 1 && e.path[len-1] == '.' && e.path[len-2] == '/') {
- tmp_path = talloc_strndup(notify, e.path, len-2);
- if (tmp_path == NULL) {
- status = NT_STATUS_NO_MEMORY;
- goto done;
- }
- e.path = tmp_path;
- }
-
depth = count_chars(e.path, '/');
listel = talloc_zero(notify, struct notify_list);
@@ -586,8 +573,6 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
}
status = NT_STATUS_OK;
done:
- talloc_free(tmp_path);
-
return status;
}
@@ -958,6 +943,7 @@ void notify_trigger(struct notify_context *notify,
int p_len = p - path;
int min_i, max_i, i;
struct notify_depth *d = ¬ify->array->depth[depth];
+ uint32_t d_max_mask;
next_p = strchr(p+1, '/');
/* see if there are any entries at this depth */
@@ -966,14 +952,11 @@ void notify_trigger(struct notify_context *notify,
/* try to skip based on the maximum mask. If next_p is
NULL then we know it will be a 'this directory'
match, otherwise it must be a subdir match */
- if (next_p != NULL) {
- if (0 == (filter & d->max_mask_subdir)) {
- continue;
- }
- } else {
- if (0 == (filter & d->max_mask)) {
- continue;
- }
+
+ d_max_mask = next_p ? d->max_mask_subdir : d->max_mask;
+
+ if ((filter & d_max_mask) == 0) {
+ continue;
}
/* we know there is an entry here worth looking
@@ -1009,17 +992,16 @@ void notify_trigger(struct notify_context *notify,
/* we now know that the entries start at min_i */
for (i=min_i;i<d->num_entries;i++) {
struct notify_entry *e = &d->entries[i];
+ uint32_t e_filter;
if (p_len != e->path_len ||
strncmp(path, e->path, p_len) != 0) break;
- if (next_p != NULL) {
- if (0 == (filter & e->subdir_filter)) {
- continue;
- }
- } else {
- if (0 == (filter & e->filter)) {
- continue;
- }
+
+ e_filter = next_p ? e->subdir_filter : e->filter;
+
+ if ((filter & e_filter) == 0) {
+ continue;
}
+
status = notify_send(notify, e, path + e->path_len + 1,
action);
--
Samba Shared Repository
More information about the samba-cvs
mailing list