Windows: Add AFSFileCleanupResultCB
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 30 Dec 2011 06:10:08 +0000 (01:10 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 31 Dec 2011 21:43:42 +0000 (13:43 -0800)
Add AFSFileCleanupResultCB which includes the parent directory
data version number.  This is necessary because object deletion occurs
during the Cleanup processing and the redirector needs to know the
resulting data version of the affected directory.

Change-Id: Iac07ddaaa3e3373f1690c85d247313e070450169
Reviewed-on: http://gerrit.openafs.org/6453
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsrdr/common/AFSUserStructs.h
src/WINNT/afsrdr/user/RDRFunction.c

index 24ebd08..7aa09a8 100644 (file)
@@ -981,6 +981,14 @@ typedef struct _AFS_FILE_CLEANUP_CB
 
 } AFSFileCleanupCB;
 
+typedef struct _AFS_FILE_CLEANUP_RESULT_CB
+{
+
+    LARGE_INTEGER   ParentDataVersion;
+
+} AFSFileCleanupResultCB;
+
+
 //
 // Trace configuration cb
 //
index c304802..02e8084 100644 (file)
@@ -1642,7 +1642,8 @@ RDR_CleanupFileEntry( IN cm_user_t *userp,
                       IN DWORD ResultBufferLength,
                       IN OUT AFSCommResult **ResultCB)
 {
-    size_t size = sizeof(AFSCommResult);
+    AFSFileCleanupResultCB *pResultCB = NULL;
+    size_t size = sizeof(AFSCommResult) + ResultBufferLength - 1;
     cm_fid_t            Fid;
     cm_fid_t            parentFid;
     afs_uint32          code = 0;
@@ -1967,14 +1968,21 @@ RDR_CleanupFileEntry( IN cm_user_t *userp,
             code = cm_Unlink(dscp, NULL, FileName, userp, &req);
     }
 
+    if ( ResultBufferLength >=  sizeof( AFSFileCleanupResultCB))
+    {
+        (*ResultCB)->ResultBufferLength = sizeof( AFSFileCleanupResultCB);
+        pResultCB = (AFSFileCleanupResultCB *)&(*ResultCB)->ResultData;
+        pResultCB->ParentDataVersion.QuadPart = dscp ? dscp->dataVersion : 0;
+    } else {
+        (*ResultCB)->ResultBufferLength = 0;
+    }
+
     if (code == 0) {
         (*ResultCB)->ResultStatus = 0;
-        (*ResultCB)->ResultBufferLength = 0;
         osi_Log0(afsd_logp, "RDR_CleanupFileEntry SUCCESS");
     } else {
         smb_MapNTError(cm_MapRPCError(code, &req), &status, TRUE);
         (*ResultCB)->ResultStatus = status;
-        (*ResultCB)->ResultBufferLength = 0;
         osi_Log2(afsd_logp, "RDR_CleanupFileEntry FAILURE code=0x%x status=0x%x",
                   code, status);
     }