CcSetBcbOwnerPointer(): +gtk-doc documentation
authorshort <>
Fri, 28 Mar 2003 20:07:29 +0000 (20:07 +0000)
committershort <>
Fri, 28 Mar 2003 20:07:29 +0000 (20:07 +0000)
+CcRemapBcb()

src/libcaptive/cc/map.c

index 331ad79..d13502e 100644 (file)
@@ -1561,6 +1561,18 @@ VOID CcSetAdditionalCacheAttributes(IN PFILE_OBJECT FileObject,IN BOOLEAN Disabl
 }
 
 
+/**
+ * CcSetBcbOwnerPointer:
+ * @Bcb: Initialized #PUBLIC_BCB structure.
+ * %NULL value is forbidden.
+ * @Owner: Thread-specific pointer (FIXME: Is it KeGetCurrentThread()?).
+ * %NULL value is forbidden (FIXME: is it W32 compliant?).
+ *
+ * Set thread-specific pointer for a pinned @Bcb.
+ *
+ * libcaptive implements this function as no-operation as it does not yet
+ * support any threading.
+ */
 VOID CcSetBcbOwnerPointer(IN PVOID Bcb,IN PVOID Owner)
 {
        g_return_if_fail(Bcb!=NULL);
@@ -1568,3 +1580,54 @@ VOID CcSetBcbOwnerPointer(IN PVOID Bcb,IN PVOID Owner)
 
        /* FIXME:thread; NOP if no threads present */
 }
+
+
+/**
+ * CcRemapBcb:
+ * @Bcb: Initialized #PUBLIC_BCB structure.
+ * %NULL value is forbidden.
+ *
+ * Create a copy of @Bcb for the exactly same file contents as is @Bcb.
+ * The returned copy has the same attributes as the result of CcMapData()
+ * notwithstanding the current state of input @Bcb, therefore it is only
+ * for read/only access etc.
+ *
+ * FIXME: libcaptive calls CcMapData() internally which will just return
+ * input @Bcb point increasing its #ref_count value. It should be some different
+ * #PUBLIC_BCB structure according to W32 doc.
+ *
+ * Returns: Copy of @Bcb.
+ */
+PVOID CcRemapBcb(IN PVOID Bcb)
+{
+PVOID r;
+PVOID Buffer_unused;
+BOOLEAN errbool;
+PUBLIC_BCB *PublicBcb;
+struct private_bcb *privbcb;
+
+       g_return_val_if_fail(validate_Bcb(Bcb),NULL);
+
+       private_bcb_hash_init();
+
+       PublicBcb=(PUBLIC_BCB *)Bcb;
+       privbcb=g_hash_table_lookup(private_bcb_hash,PublicBcb);
+       g_return_val_if_fail(privbcb!=NULL,NULL);
+
+       g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,
+                       "%s: privbcb->FileObject=%p,privbcb->MappedFileOffset=0x%llX,privbcb->MappedLength=0x%lX,privbcb->ref_count=%d",G_STRLOC,
+                       privbcb->FileObject,(guint64)privbcb->MappedFileOffset.QuadPart,(gulong)privbcb->MappedLength,(int)privbcb->ref_count);
+
+       errbool=CcMapData(
+                       privbcb->FileObject,    /* FileObject */
+                       &privbcb->MappedFileOffset,     /* FileOffset */
+                       privbcb->MappedLength,  /* Length */
+                       MAP_WAIT,       /* Flags; && !MAP_NO_READ */
+                       &r,     /* Bcb */
+                       &Buffer_unused); /* Buffer */
+       g_return_val_if_fail(errbool==TRUE,NULL);
+       g_return_val_if_fail(r!=NULL,NULL);
+       g_return_val_if_fail(Buffer_unused!=NULL,NULL);
+
+       return r;
+}