pvfs_unlink: splitup the logic into generic and file specific functions
authorStefan Metzmacher <metze@samba.org>
Fri, 22 Feb 2008 08:37:22 +0000 (09:37 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 25 Feb 2008 07:03:43 +0000 (08:03 +0100)
metze

source/ntvfs/posix/pvfs_unlink.c

index 72649e646d2a317547d39b08686871772c3154b9..0763a4e48c4cf4cf925779a28194e04a2329e5e0 100644 (file)
@@ -51,27 +51,13 @@ static NTSTATUS pvfs_unlink_stream(struct pvfs_state *pvfs,
 
 
 /*
-  unlink one file
+  unlink a file
 */
-static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs, 
-                               struct ntvfs_request *req,
-                               union smb_unlink *unl,
-                               struct pvfs_filename *name)
+static NTSTATUS pvfs_unlink_file(struct pvfs_state *pvfs,
+                                struct pvfs_filename *name)
 {
        NTSTATUS status;
 
-       /* make sure its matches the given attributes */
-       status = pvfs_match_attrib(pvfs, name,
-                                  unl->unlink.in.attrib, 0);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       status = pvfs_can_delete(pvfs, req, name, NULL);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
        if (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) {
                return NT_STATUS_FILE_IS_A_DIRECTORY;
        }
@@ -98,6 +84,31 @@ static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs,
        return status;
 }
 
+/*
+  unlink one file
+*/
+static NTSTATUS pvfs_unlink_one(struct pvfs_state *pvfs,
+                               struct ntvfs_request *req,
+                               union smb_unlink *unl,
+                               struct pvfs_filename *name)
+{
+       NTSTATUS status;
+
+       /* make sure its matches the given attributes */
+       status = pvfs_match_attrib(pvfs, name,
+                                  unl->unlink.in.attrib, 0);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       status = pvfs_can_delete(pvfs, req, name, NULL);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       return pvfs_unlink_file(pvfs, name);
+}
+
 /*
   delete a file - the dirtype specifies the file types to include in the search. 
   The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)