source: trunk/mod_cacher/xc_cache.h @ 1281

Last change on this file since 1281 was 1281, checked in by moo, 10 months ago

remove php 4 support completely

  • Property svn:eol-style set to native
File size: 4.5 KB
Line 
1#ifndef XC_CACHE_H_684B099102B4651FB10058EF6F7E80CE
2#define XC_CACHE_H_684B099102B4651FB10058EF6F7E80CE
3
4#if _MSC_VER > 1000
5#pragma once
6#endif /* _MSC_VER > 1000 */
7
8#include "xcache.h"
9#include "xcache/xc_compatibility.h"
10
11typedef ulong xc_hash_value_t;
12typedef struct _xc_hash_t xc_hash_t;
13typedef struct _xc_cached_t xc_cached_t;
14typedef struct _xc_entry_t xc_entry_t;
15typedef struct _xc_entry_data_php_t xc_entry_data_php_t;
16
17struct _xc_lock_t;
18struct _xc_shm_t;
19/* {{{ xc_op_array_info_detail_t */
20typedef struct {
21    zend_uint index;
22    zend_uint info;
23} xc_op_array_info_detail_t;
24/* }}} */
25/* {{{ xc_op_array_info_t */
26typedef struct {
27#ifdef ZEND_ENGINE_2_4
28    zend_uint literalinfo_cnt;
29    xc_op_array_info_detail_t *literalinfos;
30#else
31    zend_uint oplineinfo_cnt;
32    xc_op_array_info_detail_t *oplineinfos;
33#endif
34} xc_op_array_info_t;
35/* }}} */
36/* {{{ xc_classinfo_t */
37typedef struct {
38#ifdef IS_UNICODE
39    zend_uchar          type;
40#endif
41    const24_zstr        key;
42    zend_uint           key_size;
43    ulong               h;
44    zend_uint           methodinfo_cnt;
45    xc_op_array_info_t *methodinfos;
46    zend_class_entry   *class_entry;
47#ifndef ZEND_COMPILE_DELAYED_BINDING
48    int                 oplineno;
49#endif
50} xc_classinfo_t;
51/* }}} */
52#ifdef HAVE_XCACHE_CONSTANT
53/* {{{ xc_constinfo_t */
54typedef struct {
55#ifdef IS_UNICODE
56    zend_uchar    type;
57#endif
58    const24_zstr  key;
59    zend_uint     key_size;
60    ulong         h;
61    zend_constant constant;
62} xc_constinfo_t;
63/* }}} */
64#endif
65/* {{{ xc_funcinfo_t */
66typedef struct {
67#ifdef IS_UNICODE
68    zend_uchar     type;
69#endif
70    const24_zstr   key;
71    zend_uint      key_size;
72    ulong          h;
73    xc_op_array_info_t op_array_info;
74    zend_function func;
75} xc_funcinfo_t;
76/* }}} */
77#ifdef ZEND_ENGINE_2_1
78/* {{{ xc_autoglobal_t */
79typedef struct {
80#ifdef IS_UNICODE
81    zend_uchar   type;
82#endif
83    const24_zstr key;
84    zend_uint    key_len;
85    ulong        h;
86} xc_autoglobal_t;
87/* }}} */
88#endif
89
90typedef struct {
91    char digest[16];
92} xc_md5sum_t;
93struct _xc_compilererror_t;
94/* {{{ xc_entry_data_php_t */
95struct _xc_entry_data_php_t {
96    xc_entry_data_php_t *next;
97    xc_hash_value_t      hvalue;
98
99    xc_md5sum_t md5;        /* md5sum of the source */
100    zend_ulong  refcount;   /* count of entries referencing to this data */
101
102    zend_ulong hits;        /* hits of this php */
103    size_t     size;
104
105    xc_op_array_info_t op_array_info;
106    zend_op_array *op_array;
107
108#ifdef HAVE_XCACHE_CONSTANT
109    zend_uint constinfo_cnt;
110    xc_constinfo_t *constinfos;
111#endif
112
113    zend_uint funcinfo_cnt;
114    xc_funcinfo_t *funcinfos;
115
116    zend_uint classinfo_cnt;
117    xc_classinfo_t *classinfos;
118#ifndef ZEND_COMPILE_DELAYED_BINDING
119    zend_bool have_early_binding;
120#endif
121
122#ifdef ZEND_ENGINE_2_1
123    zend_uint autoglobal_cnt;
124    xc_autoglobal_t *autoglobals;
125#endif
126
127#ifdef XCACHE_ERROR_CACHING
128    zend_uint compilererror_cnt;
129    struct _xc_compilererror_t *compilererrors;
130#endif
131
132    zend_bool  have_references;
133};
134/* }}} */
135typedef zvalue_value xc_entry_name_t;
136/* {{{ xc_entry_t */
137struct _xc_entry_t {
138    xc_entry_t *next;
139
140    size_t     size;
141    time_t     ctime;           /* creation ctime of this entry */
142    time_t     atime;           /*   access atime of this entry */
143    time_t     dtime;           /*  deletion time of this entry */
144    zend_ulong hits;
145    zend_ulong ttl;
146
147    xc_entry_name_t name;
148};
149
150typedef struct {
151    xc_entry_t entry;
152    xc_entry_data_php_t *php;
153
154    zend_ulong refcount;    /* count of php instances holding this entry */
155    time_t file_mtime;
156    size_t file_size;
157    size_t file_device;
158    size_t file_inode;
159
160    size_t filepath_len;
161    ZEND_24(NOTHING, const) char *filepath;
162    size_t dirpath_len;
163    char  *dirpath;
164#ifdef IS_UNICODE
165    int    ufilepath_len;
166    UChar *ufilepath;
167    int    udirpath_len;
168    UChar *udirpath;
169#endif
170} xc_entry_php_t;
171
172typedef struct {
173    xc_entry_t entry;
174#ifdef IS_UNICODE
175    zend_uchar name_type;
176#endif
177    zval      *value;
178    zend_bool  have_references;
179} xc_entry_var_t;
180/* }}} */
181typedef struct xc_entry_hash_t { /* {{{ */
182    xc_hash_value_t cacheid;
183    xc_hash_value_t entryslotid;
184} xc_entry_hash_t;
185/* }}} */
186
187zend_bool xc_is_rw(const void *p);
188zend_bool xc_is_ro(const void *p);
189zend_bool xc_is_shm(const void *p);
190/* {{{ xc_gc_op_array_t */
191typedef struct {
192    zend_uint num_args;
193    zend_arg_info *arg_info;
194#ifdef ZEND_ENGINE_2_4
195    zend_literal *literals;
196#endif
197    zend_op *opcodes;
198} xc_gc_op_array_t;
199/* }}} */
200void xc_gc_add_op_array(xc_gc_op_array_t *gc_op_array TSRMLS_DC);
201void xc_fix_op_array_info(const xc_entry_php_t *xce, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copy, const xc_op_array_info_t *op_array_info TSRMLS_DC);
202
203#endif /* XC_CACHE_H_684B099102B4651FB10058EF6F7E80CE */
Note: See TracBrowser for help on using the repository browser.