Call also MmBuildMdlForNonPagedPool() after each MmCreateMdl().
authorshort <>
Fri, 11 Jul 2003 06:55:43 +0000 (06:55 +0000)
committershort <>
Fri, 11 Jul 2003 06:55:43 +0000 (06:55 +0000)
 - no effect seen on ntfs.sys of NT-5.1sp1
CcPurgeCacheSection(): Return TRUE on empty purge.
 - required by LOCK_VOLUME on ntfs.sys of NT-5.1sp1
+CcWaitForCurrentLazyWriterActivity()

src/libcaptive/cc/map.c

index 9ca726e..e613f99 100644 (file)
@@ -608,6 +608,7 @@ NTSTATUS err;
        memset(address,0,PAGE_SIZE);    /* pre-clear the buffer */
        Mdl=MmCreateMdl(NULL,address,PAGE_SIZE);        /* FIXME: Deprecated in favor of IoAllocateMdl() */
        g_assert(Mdl!=NULL);
+       MmBuildMdlForNonPagedPool(Mdl);
        KeInitializeEvent(&Event,NotificationEvent,FALSE);
        IoStatus.Information=0; /* preventive pre-clear for buggy filesystems */
        err=IoPageRead(FileObject,Mdl,FileOffset,&Event,&IoStatus);
@@ -836,11 +837,11 @@ gpointer pageaddr;
                        g_assert(pagepos->shmid==-1);
                        if (-1==(pagepos->shmid=shmget(IPC_PRIVATE,PAGE_SIZE,IPC_CREAT|IPC_CREAT|0600)))
                                g_error("Failed shmget(2), you may be out of maximum system IPC shared pages");
-                       g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: created shmid %d out of mmap() for offset %llu to new pagepos %p to address %p",
+                       g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: created shmid %d out of mmap() for offset %llu to existing pagepos %p to address %p",
                                        G_STRLOC,pagepos->shmid,(unsigned long long)offset,pagepos,pageaddr);
                        }
                else {  /* already >=2 mappings, already IPC shared mem */
-                       g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: shared-mmap of offset %llu by pagepos %p shmid %d to address %p",
+                       g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: already shared shmid of offset %llu by existing pagepos %p shmid %d to address %p",
                                        G_STRLOC,(unsigned long long)offset,pagepos,pagepos->shmid,pageaddr);
                        g_assert(pagepos->shmid!=-1);
                        g_assert(pagepos->privbcb_list!=NULL);
@@ -1208,6 +1209,7 @@ REACTOS_COMMON_FCB_HEADER *CommonFcb=(REACTOS_COMMON_FCB_HEADER *)privbcb->FileO
 
        Mdl=MmCreateMdl(NULL,base_sectoraligned,length_sectoraligned);
        g_assert(Mdl!=NULL);
+       MmBuildMdlForNonPagedPool(Mdl);
 
        KeInitializeEvent(&Event,NotificationEvent,FALSE);
 
@@ -1518,7 +1520,7 @@ struct CcSetFileSizes_param CcSetFileSizes_param;
  * @SectionObjectPointer: Pointer specifying file to purge;
  * %NULL value is forbidden.
  * libcaptive interprets only #SharedCacheMap field as #PUBLIC_BCB pointer.
- * Field #SharedCacheMap value %NULL is permitted; libcaptive does a NOP with %FALSE return code in such case.
+ * Field #SharedCacheMap value %NULL is permitted; libcaptive does a NOP with %TRUE return code in such case.
  * @FileOffset: Starting offset of the ranger to purge.
  * %NULL pointer is permitted and it means to purge the whole whole.
  * FIXME: Non %NULL pointer is NOT IMPLEMENTED YET by libcaptive.
@@ -1528,6 +1530,9 @@ struct CcSetFileSizes_param CcSetFileSizes_param;
  * Drop any caching for shrunken file which is not being deleted.
  * libcaptive will no longer consider such #BCB as dirty.
  *
+ * Undocumented: It is required during %FSCTL_LOCK_VOLUME by ntfs.sys of NT-5.1sp1
+ * to return %TRUE value if #SharedCacheMap value is %NULL.
+ *
  * Returns: %TRUE if the range was purged successfuly.
  */
 BOOLEAN CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
@@ -1538,7 +1543,7 @@ struct private_bcb *privbcb;
 
        g_return_val_if_fail(SectionObjectPointer!=NULL,FALSE);
        if (SectionObjectPointer->SharedCacheMap==NULL)
-               return FALSE;   /* failed - nothing to purge */
+               return TRUE;    /* nothing to purge; never return FALSE for ntfs.sys of NT-5.1sp1! */
        g_return_val_if_fail(FileOffset==NULL,FALSE);   /* NOT IMPLEMENTED YET */
 
        PublicBcb=SectionObjectPointer->SharedCacheMap;
@@ -2212,3 +2217,9 @@ VOID FsRtlIncrementCcFastReadNoWait(VOID)
 {
        /* FIXME: {{%fs:[0]}+0x4E0}:LONG++ */
 }
+
+
+NTSTATUS CcWaitForCurrentLazyWriterActivity(VOID)
+{
+       return STATUS_SUCCESS;
+}