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)
45 g_return_val_if_fail(FileObject!=NULL,FALSE);
46 g_return_val_if_fail(Wait==TRUE || Wait==FALSE,FALSE); /* Prevent 'Wait' upgrade to 'Flags'. */
47 g_return_val_if_fail(Retrying==TRUE || Retrying==FALSE,FALSE);
49 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: FileObject=%p,BytesToWrite=0x%lX,Wait=%d,Retrying=%d",G_STRLOC,
50 FileObject,(gulong)BytesToWrite,(gint)Wait,(gint)Retrying);
53 captive_FileObject_to_SharedCacheMap(FileObject);
60 * CcSetReadAheadGranularity:
61 * @FileObject: Initialized open #FileObject to map.
62 * %NULL value is forbidden.
63 * @Granularity: Suggested size of the cache element.
64 * Value must be larger or requal to %PAGE_SIZE and it must be even power of two.
66 * libcaptive does not implement any caching and therefore this function
69 VOID CcSetReadAheadGranularity(IN PFILE_OBJECT FileObject,IN ULONG Granularity)
71 g_return_if_fail(FileObject!=NULL);
72 g_return_if_fail(Granularity>=PAGE_SIZE);
73 g_return_if_fail((Granularity&(Granularity-1))==0); /* Power of two */
75 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: FileObject=%p,Granularity=0x%lX",G_STRLOC,
76 FileObject,(gulong)Granularity);
78 /* NOP; no caching by libcaptive */
81 captive_FileObject_to_SharedCacheMap(FileObject);
86 * CcSetAdditionalCacheAttributes:
87 * @FileObject: Initialized open #FileObject to map.
88 * %NULL value is forbidden.
89 * @DisableReadAhead: Read-ahead should not be done by Cache Manager.
90 * @DisableWriteBehind: Write-behind should not be done by Cache Manager.
92 * libcaptive does not implement any caching and therefore this function
95 VOID CcSetAdditionalCacheAttributes(IN PFILE_OBJECT FileObject,IN BOOLEAN DisableReadAhead,IN BOOLEAN DisableWriteBehind)
97 g_return_if_fail(FileObject!=NULL);
99 g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: FileObject=%p,DisableReadAhead=%s,DisableWriteBehind=%s",G_STRLOC,
100 FileObject,(DisableReadAhead ? "TRUE" : "FALSE"),(DisableWriteBehind ? "TRUE" : "FALSE"));
102 /* NOP; no caching by libcaptive */
106 VOID FsRtlIncrementCcFastReadNoWait(VOID)
108 /* FIXME: {{%fs:[0]}+0x4E0}:LONG++ */
112 NTSTATUS CcWaitForCurrentLazyWriterActivity(VOID)
114 return STATUS_SUCCESS;