Rewritten Cache Manager to better match its W32 original behaviour
[captive.git] / src / libcaptive / cc / sharedcachemap-priv.h
1 /* $Id$
2  * Object-private include file for reactos Cache Manager (Cc*) SharedCacheMap structure of libcaptive
3  * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
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
8  * 
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.
13  * 
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
17  */
18
19
20 #ifndef _CAPTIVE_CC_SHARED_CACHE_MAP_PRIV_H
21 #define _CAPTIVE_CC_SHARED_CACHE_MAP_PRIV_H 1
22
23
24 #include <glib/gmacros.h>
25 #include <glib-object.h>
26 #include "reactos/ddk/cctypes.h"
27 #include "privatebcbmap.h"
28
29
30 G_BEGIN_DECLS
31
32 typedef struct _CaptiveSharedCacheMapObject_page CaptiveSharedCacheMapObject_page;
33
34 struct _CaptiveSharedCacheMapObject_page {
35         gboolean data_valid;
36         gboolean dirty;
37         gint64 lsn_oldest,lsn_newest;
38         };
39
40 struct _CaptiveSharedCacheMapObject {
41         GObject parent_instance;
42
43         gint w32_ref_count;
44         FILE_OBJECT *FileObject;
45         SECTION_OBJECT_POINTERS *SectionObjectPointers;
46         /* ValidDataLength<=FileSize<=AllocationSize */
47         guint64 AllocationSize; /* ==CC_FILE_SIZES.AllocationSize.QuadPart */
48         guint64 FileSize;       /* ==CC_FILE_SIZES.FileSize.QuadPart */
49         guint64 ValidDataLength;        /* ==CC_FILE_SIZES.ValidDataLength.QuadPart */
50         CACHE_MANAGER_CALLBACKS CallBacks;
51         VOID *LazyWriterContext;
52         gboolean PinAccess;
53         CaptivePrivateBcbMapObject *map;
54         GHashTable *pin_hash;   /* map: (guint64 *) -> (CaptivePrivateBcbPinObject *) */
55         gboolean LogHandle_set;
56         gboolean FlushToLsnRoutine_set;
57
58         gpointer buffer;        /* FileOffset 0 based */
59         CaptiveSharedCacheMapObject_page *pages;        /* FileOffset 0 based, item corresponds to 'buffer' PAGE_SIZE */
60         };
61 struct _CaptiveSharedCacheMapObjectClass {
62         GObjectClass parent_class;
63
64         void (*FileSizes_changed)(CaptiveSharedCacheMapObject *captive_shared_cache_map_object,
65                         guint64 AllocationSize,guint64 FileSize,guint64 ValidDataLength);
66         void (*purge)(CaptiveSharedCacheMapObject *captive_shared_cache_map_object);
67         };
68
69 G_END_DECLS
70
71
72 #endif /* _CAPTIVE_CC_SHARED_CACHE_MAP_PRIV_H */