2 * reactos Cache Manager (Cc*) misc of libcaptive
3 * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <glib/gmessages.h>
23 #include "reactos/ddk/status.h"
24 #include "reactos/ddk/iotypes.h"
25 #include "sharedcachemap.h"
30 * @FileObject: Initialized open #FileObject to map.
31 * %NULL value is forbidden.
32 * @BytesToWrite: Amount of data to be asked whether it will be accepted.
33 * Value %0 is permitted.
34 * @Wait: Whether disk waiting would be permitted during the forthcoming write call.
35 * @Retrying: Use %TRUE iff calling this function for the second and further times for one request.
37 * Asks cache manager if it would currently accept write request to @FileObject
38 * of @BytesToWrite bytes with @Wait condition.
39 * libcaptive will always accept any writes. This function is a NOP.
41 * Returns: libcaptive always returns %TRUE.
43 BOOLEAN CcCanIWrite(IN PFILE_OBJECT FileObject,IN ULONG BytesToWrite,IN BOOLEAN Wait,IN BOOLEAN Retrying)
47 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"enter: CcCanIWrite: FileObject=0x%lX,BytesToWrite=0x%lX,Wait=%d,Retrying=%d",
48 (long)FileObject,BytesToWrite,Wait,Retrying);
50 g_return_val_if_fail(FileObject!=NULL,FALSE);
51 g_return_val_if_fail(Wait==TRUE || Wait==FALSE,FALSE); /* Prevent 'Wait' upgrade to 'Flags'. */
52 g_return_val_if_fail(Retrying==TRUE || Retrying==FALSE,FALSE);
55 g_assert(FileObject->SectionObjectPointer!=NULL);
56 /* 'FileObject->SectionObjectPointer->SharedCacheMap' may be NULL */
60 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"leave: CcCanIWrite: r=%d",r);
67 * CcSetReadAheadGranularity:
68 * @FileObject: Initialized open #FileObject to map.
69 * %NULL value is forbidden.
70 * @Granularity: Suggested size of the cache element.
71 * Value must be larger or requal to %PAGE_SIZE and it must be even power of two.
73 * libcaptive does not implement any caching and therefore this function
76 VOID CcSetReadAheadGranularity(IN PFILE_OBJECT FileObject,IN ULONG Granularity)
78 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"enter: CcSetReadAheadGranularity: FileObject=0x%lX,Granularity=0x%lX",
79 (long)FileObject,Granularity);
81 g_return_if_fail(FileObject!=NULL);
82 g_return_if_fail(Granularity>=PAGE_SIZE);
83 g_return_if_fail((Granularity&(Granularity-1))==0); /* Power of two */
85 /* NOP; no caching by libcaptive */
88 captive_FileObject_to_SharedCacheMap(FileObject);
90 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"leave: CcSetReadAheadGranularity");
95 * CcSetAdditionalCacheAttributes:
96 * @FileObject: Initialized open #FileObject to map.
97 * %NULL value is forbidden.
98 * @DisableReadAhead: Read-ahead should not be done by Cache Manager.
99 * @DisableWriteBehind: Write-behind should not be done by Cache Manager.
101 * libcaptive does not implement any caching and therefore this function
104 VOID CcSetAdditionalCacheAttributes(IN PFILE_OBJECT FileObject,IN BOOLEAN DisableReadAhead,IN BOOLEAN DisableWriteBehind)
106 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"enter: CcSetAdditionalCacheAttributes: FileObject=0x%lX,DisableReadAhead=%d,DisableWriteBehind=%d",
107 (long)FileObject,DisableReadAhead,DisableWriteBehind);
109 g_return_if_fail(FileObject!=NULL);
111 /* NOP; no caching by libcaptive */
113 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"leave: CcSetAdditionalCacheAttributes");
117 VOID FsRtlIncrementCcFastReadNoWait(VOID)
119 /* FIXME: {{%fs:[0]}+0x4E0}:LONG++ */
123 NTSTATUS CcWaitForCurrentLazyWriterActivity(VOID)
127 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"enter: CcWaitForCurrentLazyWriterActivity");
131 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"leave: CcWaitForCurrentLazyWriterActivity: r=0x%lX",(long)r);