[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha2-1003-g438032e

Stefan Metzmacher metze at samba.org
Mon Feb 25 07:05:21 GMT 2008


The branch, v4-0-test has been updated
       via  438032e12f3040fbb58488ca537e4d8da39b6124 (commit)
       via  7572afdc2635bdf9afbe1eda3c7498d0b5201db3 (commit)
       via  83e6c99f78990b6b1df520bdee14b9f931ad0420 (commit)
       via  e01554e1617dc3c08a4ed6b4e016fd627f529ef9 (commit)
       via  8301189e94be850494482e8c064b2400a5d11157 (commit)
       via  43ec7fa2d898ce306557ea9092b6412bcc2f97ec (commit)
      from  04eb1be0c67317067ee0ca70c731fef958cd513c (commit)

http://gitweb.samba.org/?samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 438032e12f3040fbb58488ca537e4d8da39b6124
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 09:41:41 2008 +0100

    pvfs_unlink: move stream logic into pvfs_unlink_one()
    
    metze

commit 7572afdc2635bdf9afbe1eda3c7498d0b5201db3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 09:37:22 2008 +0100

    pvfs_unlink: splitup the logic into generic and file specific functions
    
    metze

commit 83e6c99f78990b6b1df520bdee14b9f931ad0420
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 09:30:51 2008 +0100

    pvfs_unlink: add a fast path for the non wildcard case
    
    metze

commit e01554e1617dc3c08a4ed6b4e016fd627f529ef9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 09:28:51 2008 +0100

    pvfs_unlink: move !name->stream_exists into the caller
    
    metze

commit 8301189e94be850494482e8c064b2400a5d11157
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Feb 22 09:23:53 2008 +0100

    pvfs_unlink: pass down union smb_unlink completely to sub functions
    
    metze

commit 43ec7fa2d898ce306557ea9092b6412bcc2f97ec
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Feb 21 20:12:46 2008 +0100

    pvfs_unlink: pass down a struct pvfs_filename to pvfs_unlink_one()
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source/ntvfs/posix/pvfs_unlink.c |  103 +++++++++++++++++---------------------
 1 files changed, 46 insertions(+), 57 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/ntvfs/posix/pvfs_unlink.c b/source/ntvfs/posix/pvfs_unlink.c
index d6e60b5..bda4014 100644
--- a/source/ntvfs/posix/pvfs_unlink.c
+++ b/source/ntvfs/posix/pvfs_unlink.c
@@ -25,92 +25,70 @@
 
 
 /*
-  unlink a stream
- */
-static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs, 
-				   struct ntvfs_request *req,
-				   struct pvfs_filename *name, 
-				   uint16_t attrib)
+  unlink a file
+*/
+static NTSTATUS pvfs_unlink_file(struct pvfs_state *pvfs,
+				 struct pvfs_filename *name)
 {
 	NTSTATUS status;
 
-	if (!name->stream_exists) {
-		return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+	if (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) {
+		return NT_STATUS_FILE_IS_A_DIRECTORY;
 	}
 
-	/* make sure its matches the given attributes */
-	status = pvfs_match_attrib(pvfs, name, attrib, 0);
-	if (!NT_STATUS_IS_OK(status)) {
-		return status;
+	if (name->st.st_nlink == 1) {
+		status = pvfs_xattr_unlink_hook(pvfs, name->full_name);
+		if (!NT_STATUS_IS_OK(status)) {
+			return status;
+		}
 	}
 
-	status = pvfs_can_delete(pvfs, req, name, NULL);
-	if (!NT_STATUS_IS_OK(status)) {
-		return status;
+	/* finally try the actual unlink */
+	if (unlink(name->full_name) == -1) {
+		status = pvfs_map_errno(pvfs, errno);
 	}
 
-	return pvfs_stream_delete(pvfs, name, -1);
-}
+	if (NT_STATUS_IS_OK(status)) {
+		notify_trigger(pvfs->notify_context, 
+			       NOTIFY_ACTION_REMOVED, 
+			       FILE_NOTIFY_CHANGE_FILE_NAME,
+			       name->full_name);
+	}
 
+	return status;
+}
 
 /*
   unlink one file
 */
-static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, 
+static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs,
 				struct ntvfs_request *req,
-				const char *unix_path, 
-				const char *fname, uint32_t attrib)
+				union smb_unlink *unl,
+				struct pvfs_filename *name)
 {
-	struct pvfs_filename *name;
 	NTSTATUS status;
 
-	/* get a pvfs_filename object */
-	status = pvfs_resolve_partial(pvfs, req, 
-				      unix_path, fname, &name);
-	if (!NT_STATUS_IS_OK(status)) {
-		return status;
-	}
-
 	/* make sure its matches the given attributes */
-	status = pvfs_match_attrib(pvfs, name, attrib, 0);
+	status = pvfs_match_attrib(pvfs, name,
+				   unl->unlink.in.attrib, 0);
 	if (!NT_STATUS_IS_OK(status)) {
-		talloc_free(name);
 		return status;
 	}
 
 	status = pvfs_can_delete(pvfs, req, name, NULL);
 	if (!NT_STATUS_IS_OK(status)) {
-		talloc_free(name);
 		return status;
 	}
 
-	if (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) {
-		talloc_free(name);
-		return NT_STATUS_FILE_IS_A_DIRECTORY;
-	}
-
-	if (name->st.st_nlink == 1) {
-		status = pvfs_xattr_unlink_hook(pvfs, name->full_name);
-		if (!NT_STATUS_IS_OK(status)) {
-			return status;
+	if (name->stream_name) {
+		if (!name->stream_exists) {
+			return NT_STATUS_OBJECT_NAME_NOT_FOUND;
 		}
-	}
 
-	/* finally try the actual unlink */
-	if (unlink(name->full_name) == -1) {
-		status = pvfs_map_errno(pvfs, errno);
+		return pvfs_stream_delete(pvfs, name, -1);
 	}
 
-	if (NT_STATUS_IS_OK(status)) {
-		notify_trigger(pvfs->notify_context, 
-			       NOTIFY_ACTION_REMOVED, 
-			       FILE_NOTIFY_CHANGE_FILE_NAME,
-			       name->full_name);
-	}
-
-	talloc_free(name);
-
-	return status;
+	return pvfs_unlink_file(pvfs, name);
 }
 
 /*
@@ -145,8 +123,8 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs,
 		return NT_STATUS_FILE_IS_A_DIRECTORY;
 	}
 
-	if (name->stream_name) {
-		return pvfs_unlink_stream(pvfs, req, name, unl->unlink.in.attrib);
+	if (!name->has_wildcard) {
+		return pvfs_unlink_one(pvfs, req, unl, name);
 	}
 
 	/* get list of matching files */
@@ -156,6 +134,7 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs,
 	}
 
 	status = NT_STATUS_NO_SUCH_FILE;
+	talloc_free(name);
 
 	ofs = 0;
 
@@ -166,10 +145,20 @@ NTSTATUS pvfs_unlink(struct ntvfs_module_context *ntvfs,
 			return NT_STATUS_OBJECT_NAME_INVALID;
 		}
 
-		status = pvfs_unlink_one(pvfs, req, pvfs_list_unix_path(dir), fname, unl->unlink.in.attrib);
+		/* get a pvfs_filename object */
+		status = pvfs_resolve_partial(pvfs, req,
+					      pvfs_list_unix_path(dir),
+					      fname, &name);
+		if (!NT_STATUS_IS_OK(status)) {
+			return status;
+		}
+
+		status = pvfs_unlink_one(pvfs, req, unl, name);
 		if (NT_STATUS_IS_OK(status)) {
 			total_deleted++;
 		}
+
+		talloc_free(name);
 	}
 
 	if (total_deleted > 0) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list