2 * Object-private include file for reactos Cache Manager (Cc*) SharedCacheMap structure 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
20 #ifndef _CAPTIVE_CC_SHARED_CACHE_MAP_PRIV_H
21 #define _CAPTIVE_CC_SHARED_CACHE_MAP_PRIV_H 1
24 #include <glib/gmacros.h>
25 #include <glib-object.h>
26 #include "reactos/ddk/cctypes.h"
27 #include "privatebcbmap.h"
32 typedef struct _CaptiveSharedCacheMapObject_page CaptiveSharedCacheMapObject_page;
34 struct _CaptiveSharedCacheMapObject_page {
37 gint64 lsn_oldest,lsn_newest;
40 struct _CaptiveSharedCacheMapObject {
41 GObject parent_instance;
44 FILE_OBJECT *FileObject;
45 SECTION_OBJECT_POINTERS *SectionObjectPointers;
46 /* ValidDataLength<=FileSize<=AllocationSize */
47 /* 'AllocationSize' sets the mmap(2)ed area of buffers of this SharedCacheMap.
48 * We must reallocate this area if 'AllocationSize' changes and in such case
49 * there must exist no map-Bcb or pin-Bcbs for it.
50 * We would cope with 'buffer' change with existing Bcbs but W32 client could not.
52 guint64 AllocationSize; /* ==CC_FILE_SIZES.AllocationSize.QuadPart */
53 /* We generally check against CAPTIVE_ROUND_UP64(FileSize,PAGE_SIZE)
54 * as the offsets are usually PAGE_SIZE aligned due to pin-Bcb expectations.
56 guint64 FileSize; /* ==CC_FILE_SIZES.FileSize.QuadPart */
57 /* We use 'FileSize' instead of 'ValidDataLength' as I assume W32
58 * automatically increases 'ValidDataLength' during Cache Manager write operations.
59 * We do not increase it and therefore it is mostly useless for us.
61 guint64 ValidDataLength; /* ==CC_FILE_SIZES.ValidDataLength.QuadPart */
62 CACHE_MANAGER_CALLBACKS CallBacks;
63 VOID *LazyWriterContext;
65 CaptivePrivateBcbMapObject *map; /* 'map' will g_object_ref(CaptiveSharedCacheMapObject). */
66 GHashTable *pin_hash; /* map: (guint64 *) -> (CaptivePrivateBcbPinObject *) */
67 gboolean LogHandle_set;
68 gboolean FlushToLsnRoutine_set;
70 gpointer buffer; /* FileOffset 0 based */
71 CaptiveSharedCacheMapObject_page *pages; /* FileOffset 0 based, item corresponds to 'buffer' PAGE_SIZE */
73 struct _CaptiveSharedCacheMapObjectClass {
74 GObjectClass parent_class;
76 void (*FileSizes_changed)(CaptiveSharedCacheMapObject *captive_shared_cache_map_object,
77 guint64 AllocationSize,guint64 FileSize,guint64 ValidDataLength);
78 void (*purge)(CaptiveSharedCacheMapObject *captive_shared_cache_map_object);
84 #endif /* _CAPTIVE_CC_SHARED_CACHE_MAP_PRIV_H */