svn commit: samba r3126 - in branches/SAMBA_4_0/source/ntvfs: common posix

tridge at samba.org tridge at samba.org
Fri Oct 22 01:15:00 GMT 2004


Author: tridge
Date: 2004-10-22 01:14:49 +0000 (Fri, 22 Oct 2004)
New Revision: 3126

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/ntvfs&rev=3126&nolog=1

Log:
in the brlock code I had used a void* for the brl context as I didn't
want to expose the brl context structure outside the brlock.c
code. Instead, I now use "struct brl_context *" and rely on C being
happy to pass around pointers to unknown structures as long as they
are not dereferenced. I will be interested to see how the build farm
likes this.


Modified:
   branches/SAMBA_4_0/source/ntvfs/common/brlock.c
   branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/common/brlock.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/common/brlock.c	2004-10-21 21:57:30 UTC (rev 3125)
+++ branches/SAMBA_4_0/source/ntvfs/common/brlock.c	2004-10-22 01:14:49 UTC (rev 3126)
@@ -71,8 +71,8 @@
   talloc_free(). We need the messaging_ctx to allow for
   pending lock notifications.
 */
-void *brl_init(TALLOC_CTX *mem_ctx, servid_t server, uint16_t tid, 
-	       void *messaging_ctx)
+struct brl_context *brl_init(TALLOC_CTX *mem_ctx, servid_t server, uint16_t tid, 
+			     void *messaging_ctx)
 {
 	char *path;
 	struct brl_context *brl;
@@ -97,7 +97,7 @@
 	brl->messaging_ctx = messaging_ctx;
 	ZERO_STRUCT(brl->last_lock_failure);
 
-	return (void *)brl;
+	return brl;
 }
 
 
@@ -219,7 +219,7 @@
   someone else closing an overlapping lock range) a messaging
   notification is sent, identified by the notify_ptr
 */
-NTSTATUS brl_lock(void *brl_ctx,
+NTSTATUS brl_lock(struct brl_context *brl,
 		  DATA_BLOB *file_key, 
 		  uint16_t smbpid,
 		  uint16_t fnum, 
@@ -227,7 +227,6 @@
 		  enum brl_type lock_type,
 		  void *notify_ptr)
 {
-	struct brl_context *brl = brl_ctx;
 	TDB_DATA kbuf, dbuf;
 	int count, i;
 	struct lock_struct lock, *locks;
@@ -248,7 +247,7 @@
 	   preventing the real lock gets removed */
 	if (lock_type >= PENDING_READ_LOCK) {
 		enum brl_type rw = (lock_type==PENDING_READ_LOCK? READ_LOCK : WRITE_LOCK);
-		status = brl_lock(brl_ctx, file_key, smbpid, fnum, start, size, rw, NULL);
+		status = brl_lock(brl, file_key, smbpid, fnum, start, size, rw, NULL);
 		if (NT_STATUS_IS_OK(status)) {
 			tdb_chainunlock(brl->w->tdb, kbuf);
 			return NT_STATUS_OK;
@@ -368,13 +367,12 @@
 /*
  Unlock a range of bytes.
 */
-NTSTATUS brl_unlock(void *brl_ctx,
+NTSTATUS brl_unlock(struct brl_context *brl,
 		    DATA_BLOB *file_key, 
 		    uint16_t smbpid,
 		    uint16_t fnum,
 		    uint64_t start, uint64_t size)
 {
-	struct brl_context *brl = brl_ctx;
 	TDB_DATA kbuf, dbuf;
 	int count, i;
 	struct lock_struct *locks;
@@ -456,11 +454,10 @@
   given up trying to establish a lock or when they have succeeded in
   getting it. In either case they no longer need to be notified.
 */
-NTSTATUS brl_remove_pending(void *brl_ctx,
+NTSTATUS brl_remove_pending(struct brl_context *brl,
 			    DATA_BLOB *file_key, 
 			    void *notify_ptr)
 {
-	struct brl_context *brl = brl_ctx;
 	TDB_DATA kbuf, dbuf;
 	int count, i;
 	struct lock_struct *locks;
@@ -526,14 +523,13 @@
 /*
   Test if we are allowed to perform IO on a region of an open file
 */
-NTSTATUS brl_locktest(void *brl_ctx,
+NTSTATUS brl_locktest(struct brl_context *brl,
 		      DATA_BLOB *file_key, 
 		      uint16_t fnum,
 		      uint16 smbpid, 
 		      uint64_t start, uint64_t size, 
 		      enum brl_type lock_type)
 {
-	struct brl_context *brl = brl_ctx;
 	TDB_DATA kbuf, dbuf;
 	int count, i;
 	struct lock_struct lock, *locks;
@@ -573,10 +569,9 @@
 /*
  Remove any locks associated with a open file.
 */
-NTSTATUS brl_close(void *brl_ctx,
+NTSTATUS brl_close(struct brl_context *brl,
 		   DATA_BLOB *file_key, int fnum)
 {
-	struct brl_context *brl = brl_ctx;
 	TDB_DATA kbuf, dbuf;
 	int count, i, dcount=0;
 	struct lock_struct *locks;

Modified: branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h	2004-10-21 21:57:30 UTC (rev 3125)
+++ branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.h	2004-10-22 01:14:49 UTC (rev 3126)
@@ -36,7 +36,7 @@
 
 	struct pvfs_mangle_context *mangle_ctx;
 
-	void *brl_context;
+	struct brl_context *brl_context;
 
 	/* an id tree mapping open search ID to a pvfs_search_state structure */
 	void *idtree_search;



More information about the samba-cvs mailing list