Changeset 254

Show
Ignore:
Timestamp:
07/29/06 12:37:52 (4 years ago)
Author:
bart
Message:

Do a big cleanup in struct naming

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ChangeLog

    r253 r254  
    44          faster and provides a much better distribution. 
    55        * Don't compile the user cache code one no feature is being compiled. 
     6        * A big cleanup in struct naming 
    67 
    782006-07-29  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
  • eaccelerator/trunk/cache.c

    r253 r254  
    2929#include "eaccelerator_version.h" 
    3030 
    31 #if defined(HAVE_EACCELERATOR) && (defined(WITH_EACCELERATOR_CONTENT_CACHING) || defined(WITH_EACCELERATOR_SESSIONS) || defined(WITH_EACCELERATOR_SHM)) 
     31#ifdef HAVE_EACCELERATOR 
    3232 
    3333#include "zend.h" 
     
    4444 
    4545/* variables needed from eaccelerator.c */ 
    46 extern long eaccelerator_shm_max; 
     46extern long ea_shm_max; 
    4747extern eaccelerator_mm *eaccelerator_mm_instance; 
    4848extern int binary_eaccelerator_version; 
    4949extern int binary_php_version; 
    5050extern int binary_zend_version; 
     51 
     52#if defined(WITH_EACCELERATOR_CONTENT_CACHING) || defined(WITH_EACCELERATOR_SESSIONS) || defined(WITH_EACCELERATOR_SHM) 
    5153 
    5254static char *build_key(const char *key, int key_len, int *xlen TSRMLS_DC) 
     
    9193    int xlen; 
    9294    char *xkey; 
    93     mm_lock_entry *x; 
    94     mm_lock_entry **p; 
     95    ea_lock_entry *x; 
     96    ea_lock_entry **p; 
    9597    int ok = 0; 
    9698 
     
    100102    xkey = build_key(key, key_len, &xlen TSRMLS_CC); 
    101103    EACCELERATOR_UNPROTECT(); 
    102     x = eaccelerator_malloc(offsetof(mm_lock_entry, key) + xlen + 1); 
     104    x = eaccelerator_malloc(offsetof(ea_lock_entry, key) + xlen + 1); 
    103105    if (x == NULL) { 
    104106        EACCELERATOR_PROTECT(); 
     
    161163    int xlen; 
    162164    char *xkey; 
    163     mm_lock_entry **p; 
     165    ea_lock_entry **p; 
    164166 
    165167    if (eaccelerator_mm_instance == NULL) 
     
    177179            if ((*p)->pid == getpid()) { 
    178180#endif 
    179                 mm_lock_entry *x = (*p); 
     181                ea_lock_entry *x = (*p); 
    180182                *p = (*p)->next; 
    181183                eaccelerator_free_nolock(x); 
     
    201203 
    202204/* put a key in the cache (shm or disk) */ 
    203 int eaccelerator_put(const char *key, int key_len, zval * val, time_t ttl, 
    204                       eaccelerator_cache_place where TSRMLS_DC) 
    205 
    206     mm_user_cache_entry *p, *q; 
     205int eaccelerator_put(const char *key, int key_len, zval * val, time_t ttl, ea_cache_place where TSRMLS_DC) 
     206
     207    ea_user_cache_entry *p, *q; 
    207208    unsigned int slot, hv; 
    208209    long size; 
     
    218219    zend_hash_init(&EAG(strings), 0, NULL, NULL, 0); 
    219220    EACCELERATOR_ALIGN(EAG(mem)); 
    220     EAG(mem) += offsetof(mm_user_cache_entry, key) + xlen + 1; 
     221    EAG(mem) += offsetof(ea_user_cache_entry, key) + xlen + 1; 
    221222    calc_zval(val TSRMLS_CC); 
    222223    zend_hash_destroy(&EAG(strings)); 
     
    225226 
    226227    EAG(mem) = NULL; 
    227     if (eaccelerator_mm_instance != NULL && (where == eaccelerator_shm_and_disk ||  
    228                 where == eaccelerator_shm || where == eaccelerator_shm_only)) { 
     228    if (eaccelerator_mm_instance != NULL && (where == ea_shm_and_disk || where == ea_shm || where == ea_shm_only)) { 
    229229        EACCELERATOR_UNPROTECT(); 
    230         if (eaccelerator_shm_max == 0 || size <= eaccelerator_shm_max) { 
     230        if (ea_shm_max == 0 || size <= ea_shm_max) { 
    231231            EAG(mem) = eaccelerator_malloc(size); 
    232232            if (EAG(mem) == NULL) { 
     
    238238        } 
    239239    } 
    240     if (EAG(mem) == NULL && (where == eaccelerator_shm_and_disk ||  
    241                 where == eaccelerator_shm || where == eaccelerator_disk_only)) { 
     240    if (EAG(mem) == NULL && (where == ea_shm_and_disk || where == ea_shm || where == ea_disk_only)) { 
    242241        use_shm = 0; 
    243242        EAG(mem) = emalloc(size); 
     
    246245        zend_hash_init(&EAG(strings), 0, NULL, NULL, 0); 
    247246        EACCELERATOR_ALIGN(EAG(mem)); 
    248         q = (mm_user_cache_entry *) EAG(mem); 
     247        q = (ea_user_cache_entry *) EAG(mem); 
    249248        q->size = size; 
    250         EAG(mem) += offsetof(mm_user_cache_entry, key) + xlen + 1; 
     249        EAG(mem) += offsetof(ea_user_cache_entry, key) + xlen + 1; 
    251250        q->hv = zend_get_hash_value(xkey, xlen); 
    252251        memcpy(q->key, xkey, xlen + 1); 
     
    262261         * storing to file  
    263262         */ 
    264         if ((where == eaccelerator_shm_and_disk || ((where == eaccelerator_shm) && !use_shm) ||  
    265                     where == eaccelerator_disk_only) && eaccelerator_md5(s, "/eaccelerator-user-", q->key TSRMLS_CC)) { 
     263        if ((where == ea_shm_and_disk || ((where == ea_shm) && !use_shm) || where == ea_disk_only) &&  
     264                       eaccelerator_md5(s, "/eaccelerator-user-", q->key TSRMLS_CC)) { 
    266265            int f; 
    267266            unlink(s); 
    268267            f = open(s, O_CREAT | O_WRONLY | O_EXCL | O_BINARY, S_IRUSR | S_IWUSR); 
    269268            if (f > 0) { 
    270                 mm_file_header hdr; 
     269                ea_file_header hdr; 
    271270                EACCELERATOR_FLOCK(f, LOCK_EX); 
    272271                strncpy(hdr.magic, EA_MAGIC, 8); 
     
    294293        } 
    295294 
    296         if ((where == eaccelerator_shm_and_disk || where == eaccelerator_shm || where == eaccelerator_shm_only) && use_shm) { 
     295        if ((where == ea_shm_and_disk || where == ea_shm || where == ea_shm_only) && use_shm) { 
    297296            /* 
    298297             * storing to shared memory  
     
    327326 
    328327/* get a key from the cache */ 
    329 int eaccelerator_get(const char *key, int key_len, zval * return_value, 
    330                   eaccelerator_cache_place where TSRMLS_DC) 
     328int eaccelerator_get(const char *key, int key_len, zval * return_value, ea_cache_place where TSRMLS_DC) 
    331329{ 
    332330    unsigned int hv, slot; 
     
    339337    slot = hv & EA_USER_HASH_MAX; 
    340338 
    341     if (eaccelerator_mm_instance != NULL && (where == eaccelerator_shm_and_disk  
    342                 || where == eaccelerator_shm || where == eaccelerator_shm_only)) { 
    343         mm_user_cache_entry *p, *q; 
    344         mm_user_cache_entry *x = NULL; 
     339    if (eaccelerator_mm_instance != NULL && (where == ea_shm_and_disk || where == ea_shm || where == ea_shm_only)) { 
     340        ea_user_cache_entry *p, *q; 
     341        ea_user_cache_entry *x = NULL; 
    345342        EACCELERATOR_UNPROTECT(); 
    346343        EACCELERATOR_LOCK_RW(); 
     
    380377     * key is not found in shared memory try to load it from file  
    381378     */ 
    382     if ((where == eaccelerator_shm_and_disk || where == eaccelerator_shm ||  
    383             where == eaccelerator_disk_only) &&  
     379    if ((where == ea_shm_and_disk || where == ea_shm || where == ea_disk_only) &&  
    384380            eaccelerator_md5(s, "/eaccelerator-user-", xkey TSRMLS_CC)) { 
    385381        time_t t = time(0); 
     
    389385 
    390386        if ((f = open(s, O_RDONLY | O_BINARY)) > 0) { 
    391             mm_file_header hdr; 
     387            ea_file_header hdr; 
    392388 
    393389            EACCELERATOR_FLOCK(f, LOCK_SH); 
     
    406402                 * try to put it into shared memory  
    407403                 */ 
    408                 mm_user_cache_entry *p = NULL; 
    409                 if (eaccelerator_mm_instance != NULL && (where == eaccelerator_shm_and_disk || where == eaccelerator_shm)) { 
    410                     if (eaccelerator_shm_max == 0 || hdr.size <= eaccelerator_shm_max) { 
     404                ea_user_cache_entry *p = NULL; 
     405                if (eaccelerator_mm_instance != NULL && (where == ea_shm_and_disk || where == ea_shm)) { 
     406                    if (ea_shm_max == 0 || hdr.size <= ea_shm_max) { 
    411407                        EACCELERATOR_UNPROTECT(); 
    412408                        p = eaccelerator_malloc(hdr.size); 
     
    453449                        if (use_shm) { 
    454450                            /* put it into shared memory */ 
    455                             mm_user_cache_entry *q, *prev; 
     451                            ea_user_cache_entry *q, *prev; 
    456452 
    457453                            p->hv = hv; 
     
    509505 
    510506/* remove a key from the cache */ 
    511 int eaccelerator_rm(const char *key, int key_len, 
    512                  eaccelerator_cache_place where TSRMLS_DC) 
     507int eaccelerator_rm(const char *key, int key_len, ea_cache_place where TSRMLS_DC) 
    513508{ 
    514509    unsigned int hv, slot; 
    515     mm_user_cache_entry *p, *q; 
     510    ea_user_cache_entry *p, *q; 
    516511    char s[MAXPATHLEN]; 
    517512    int xlen; 
     
    522517     * removing file  
    523518     */ 
    524     if ((where == eaccelerator_shm_and_disk || where == eaccelerator_shm ||  
    525                 where == eaccelerator_disk_only) && eaccelerator_md5(s, "/eaccelerator-user-", xkey TSRMLS_CC)) { 
     519    if ((where == ea_shm_and_disk || where == ea_shm || where == ea_disk_only) &&  
     520               eaccelerator_md5(s, "/eaccelerator-user-", xkey TSRMLS_CC)) { 
    526521        unlink(s); 
    527522    } 
     
    530525     * removing from shared memory  
    531526     */ 
    532     if (eaccelerator_mm_instance != NULL && (where == eaccelerator_shm_and_disk ||  
    533                 where == eaccelerator_shm || where == eaccelerator_shm_only)) { 
     527    if (eaccelerator_mm_instance != NULL && (where == ea_shm_and_disk ||  
     528                where == ea_shm || where == ea_shm_only)) { 
    534529        hv = zend_get_hash_value(xkey, xlen); 
    535530        slot = hv & EA_USER_HASH_MAX; 
     
    561556    return 1; 
    562557} 
     558#endif 
    563559 
    564560/* do garbage collection on the keys */ 
     
    575571    EACCELERATOR_LOCK_RW(); 
    576572    for (i = 0; i < EA_USER_HASH_SIZE; i++) { 
    577         mm_user_cache_entry **p = &eaccelerator_mm_instance->user_hash[i]; 
     573        ea_user_cache_entry **p = &eaccelerator_mm_instance->user_hash[i]; 
    578574        while (*p != NULL) { 
    579575            if ((*p)->ttl != 0 && (*p)->ttl < t) { 
    580                 mm_user_cache_entry *r = *p; 
     576                ea_user_cache_entry *r = *p; 
    581577                *p = (*p)->next; 
    582578                eaccelerator_mm_instance->user_hash_cnt--; 
     
    593589} 
    594590 
     591#ifdef WITH_EACCELERATOR_INFO 
    595592/* get list of all keys stored in memory that matches hostname or namespace */ 
    596593int eaccelerator_list_keys(zval *return_value TSRMLS_DC)  
     
    599596    zval *list; 
    600597    char *xkey = ""; 
    601     mm_user_cache_entry *p; 
     598    ea_user_cache_entry *p; 
    602599    time_t t = time(0); 
    603600 
     
    654651    return 1; 
    655652} 
     653#endif /* WITH_EACCELERATOR_INFO */ 
    656654 
    657655#endif /* HAVE_EACCELERATOR */ 
  • eaccelerator/trunk/cache.h

    r182 r254  
    3535#include "zend_extensions.h" 
    3636 
    37 int eaccelerator_put (const char *key, int key_len, zval * val, time_t ttl, 
    38                                           eaccelerator_cache_place where TSRMLS_DC); 
    39 int eaccelerator_get (const char *key, int key_len, zval * return_value, 
    40                                           eaccelerator_cache_place where TSRMLS_DC); 
    41 int eaccelerator_rm (const char *key, int key_len, 
    42                                          eaccelerator_cache_place where TSRMLS_DC); 
     37#if defined(WITH_EACCELERATOR_CONTENT_CACHING) || defined(WITH_EACCELERATOR_SESSIONS) || defined(WITH_EACCELERATOR_SHM) 
     38int eaccelerator_put (const char *key, int key_len, zval * val, time_t ttl, ea_cache_place where TSRMLS_DC); 
     39int eaccelerator_get (const char *key, int key_len, zval * return_value, ea_cache_place where TSRMLS_DC); 
     40int eaccelerator_rm (const char *key, int key_len, ea_cache_place where TSRMLS_DC); 
     41#endif 
    4342size_t eaccelerator_gc (TSRMLS_D); 
    4443 
     44 
     45#ifdef WITH_EACCELERATOR_INFO 
    4546int eaccelerator_list_keys(zval *return_value TSRMLS_DC); 
     47#endif 
    4648 
    4749#endif                                                  /* INCLUDED_CACHE_H */ 
  • eaccelerator/trunk/content.c

    r228 r254  
    3737#define EACCELERATOR_COMPRESS_MIN 128 
    3838 
    39 eaccelerator_cache_place eaccelerator_content_cache_place = eaccelerator_shm_and_disk; 
     39ea_cache_place eaccelerator_content_cache_place = ea_shm_and_disk; 
    4040 
    4141static int (*eaccelerator_old_header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC); 
    4242 
    43 PHP_INI_MH (eaccelerator_OnUpdateContentCachePlace) 
     43PHP_INI_MH(eaccelerator_OnUpdateContentCachePlace) 
    4444{ 
    45         if (strncasecmp ("shm_and_disk", new_value,  
    46                 sizeof ("shm_and_disk")) == 0) 
    47         { 
    48                 eaccelerator_content_cache_place = eaccelerator_shm_and_disk; 
    49         } 
    50         else if (strncasecmp ("shm", new_value,  
    51                 sizeof ("shm")) == 0) 
    52         { 
    53                 eaccelerator_content_cache_place = eaccelerator_shm; 
    54         } 
    55         else if (strncasecmp ("shm_only", new_value,  
    56                 sizeof ("shm_only")) == 0) 
    57         { 
    58                 eaccelerator_content_cache_place = eaccelerator_shm_only; 
    59         } 
    60         else if (strncasecmp ("disk_only", new_value,  
    61                 sizeof ("disk_only")) == 0) 
    62         { 
    63                 eaccelerator_content_cache_place = eaccelerator_disk_only; 
    64         } 
    65         else if (strncasecmp ("none", new_value,  
    66                 sizeof ("none")) == 0) 
    67         { 
    68                 eaccelerator_content_cache_place = eaccelerator_none; 
     45        if (strncasecmp("shm_and_disk", new_value, sizeof("shm_and_disk")) == 0) { 
     46                eaccelerator_content_cache_place = ea_shm_and_disk; 
     47        } else if (strncasecmp("shm", new_value, sizeof("shm")) == 0) { 
     48                eaccelerator_content_cache_place = ea_shm; 
     49        } else if (strncasecmp("shm_only", new_value, sizeof("shm_only")) == 0) { 
     50                eaccelerator_content_cache_place = ea_shm_only; 
     51        } else if (strncasecmp("disk_only", new_value, sizeof("disk_only")) == 0) { 
     52                eaccelerator_content_cache_place = ea_disk_only; 
     53        } else if (strncasecmp("none", new_value, sizeof("none")) == 0) { 
     54                eaccelerator_content_cache_place = ea_none; 
    6955        } 
    7056        return SUCCESS; 
     
    10894 
    10995void eaccelerator_content_cache_startup() { 
    110   if (eaccelerator_content_cache_place != eaccelerator_none) { 
     96  if (eaccelerator_content_cache_place != ea_none) { 
    11197    eaccelerator_old_header_handler = sapi_module.header_handler; 
    11298    sapi_module.header_handler = eaccelerator_header_handler; 
     
    115101 
    116102void eaccelerator_content_cache_shutdown() { 
    117   if (eaccelerator_content_cache_place != eaccelerator_none) { 
     103  if (eaccelerator_content_cache_place != ea_none) { 
    118104    sapi_module.header_handler = eaccelerator_old_header_handler; 
    119105  } 
     
    397383    RETURN_FALSE; 
    398384  } 
    399   if (eaccelerator_content_cache_place == eaccelerator_none) { 
     385  if (eaccelerator_content_cache_place == ea_none) { 
    400386    RETURN_FALSE; 
    401387  } 
     
    512498    return; 
    513499  } 
    514   if (eaccelerator_content_cache_place == eaccelerator_none) { 
     500  if (eaccelerator_content_cache_place == ea_none) { 
    515501    RETURN_NULL(); 
    516502  } 
     
    541527    return; 
    542528  } 
    543   if (eaccelerator_content_cache_place == eaccelerator_none) { 
     529  if (eaccelerator_content_cache_place == ea_none) { 
    544530    eval_name = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); 
    545531    zend_eval_string(code, NULL, eval_name TSRMLS_CC); 
     
    593579    return; 
    594580  } 
    595   if ((eaccelerator_content_cache_place != eaccelerator_none) && 
     581  if ((eaccelerator_content_cache_place != ea_none) && 
    596582      eaccelerator_get(key, key_len, return_value, eaccelerator_content_cache_place TSRMLS_CC)) { 
    597583    /*  Return value is cached. Return it. */ 
     
    601587    eval_name = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC); 
    602588    if (zend_eval_string(code, return_value, eval_name TSRMLS_CC) == SUCCESS && 
    603         eaccelerator_content_cache_place != eaccelerator_none) { 
     589        eaccelerator_content_cache_place != ea_none) { 
    604590 
    605591#ifndef ZEND_ENGINE_2_1 
  • eaccelerator/trunk/ea_dasm.c

    r229 r254  
    197197 * } 
    198198 */ 
    199 static zval *get_op_array(eaccelerator_op_array *op_array TSRMLS_DC)  
     199static zval *get_op_array(ea_op_array *op_array TSRMLS_DC)  
    200200{ 
    201201    zval *return_value; 
     
    505505 
    506506/* {{{ get_cache_entry: get the cache_entry for the given file */ 
    507 static mm_cache_entry *get_cache_entry(const char *file) { 
     507static ea_cache_entry *get_cache_entry(const char *file) { 
    508508    unsigned int slot; 
    509     mm_cache_entry *p; 
    510     mm_cache_entry *result = NULL; 
     509    ea_cache_entry *p; 
     510    ea_cache_entry *result = NULL; 
    511511     
    512512        if (file != NULL) { 
     
    548548    const char *file; 
    549549    int file_len; 
    550         mm_cache_entry *p; 
    551     mm_fc_entry *fc; 
     550        ea_cache_entry *p; 
     551    ea_fc_entry *fc; 
    552552    zval *functions; 
    553553    zval *classes; 
     
    575575    array_init(functions); 
    576576        while (fc != NULL) { 
    577         add_assoc_zval(functions, fc->htabkey, get_op_array((eaccelerator_op_array *)fc->fc TSRMLS_CC)); 
     577        add_assoc_zval(functions, fc->htabkey, get_op_array((ea_op_array *)fc->fc TSRMLS_CC)); 
    578578                fc = fc->next; 
    579579        } 
     
    586586        if (fc != NULL) { 
    587587                while (fc != NULL) { 
    588                         eaccelerator_class_entry *c = (eaccelerator_class_entry *) fc->fc; 
     588                        ea_class_entry *c = (ea_class_entry *) fc->fc; 
    589589            if (c->type == ZEND_USER_CLASS) { /* get methods */ 
    590590                zval *methods; 
     
    595595                q = c->function_table.pListHead; 
    596596                while (q) { 
    597                     eaccelerator_op_array *func = (eaccelerator_op_array *) q->pData; 
     597                    ea_op_array *func = (ea_op_array *) q->pData; 
    598598                    if (func->type == ZEND_USER_FUNCTION) { 
    599599                        add_assoc_zval(methods, func->function_name, get_op_array(func TSRMLS_CC)); 
  • eaccelerator/trunk/ea_info.c

    r237 r254  
    142142 
    143143        if ((f = open(file, O_RDONLY | O_BINARY)) > 0) { 
    144                 mm_file_header hdr; 
     144                ea_file_header hdr; 
    145145                EACCELERATOR_FLOCK (f, LOCK_SH); 
    146146                if (read(f, &hdr, sizeof(hdr)) != sizeof(hdr)  
     
    293293{ 
    294294        unsigned int i; 
    295         mm_cache_entry *p; 
     295        ea_cache_entry *p; 
    296296 
    297297    if (!isAdminAllowed(TSRMLS_C)) { 
     
    305305                p = eaccelerator_mm_instance->hash[i]; 
    306306                while (p != NULL) { 
    307                         mm_cache_entry *r = p; 
     307                        ea_cache_entry *r = p; 
    308308                        p = p->next; 
    309309                        eaccelerator_mm_instance->hash_cnt--; 
     
    320320        } 
    321321        for (i = 0; i < EA_USER_HASH_SIZE; i++) { 
    322                 mm_user_cache_entry *p = eaccelerator_mm_instance->user_hash[i]; 
     322                ea_user_cache_entry *p = eaccelerator_mm_instance->user_hash[i]; 
    323323                while (p != NULL) { 
    324                         mm_user_cache_entry *r = p; 
     324                        ea_user_cache_entry *r = p; 
    325325                        p = p->next; 
    326326                        eaccelerator_mm_instance->user_hash_cnt--; 
     
    348348 
    349349        if (eaccelerator_mm_instance != NULL) { 
    350                 mm_cache_entry *p, *q; 
     350                ea_cache_entry *p, *q; 
    351351                EACCELERATOR_UNPROTECT(); 
    352352                EACCELERATOR_LOCK_RW(); 
     
    406406PHP_FUNCTION(eaccelerator_cached_scripts) 
    407407{ 
    408     mm_cache_entry *p; 
     408    ea_cache_entry *p; 
    409409    int i; 
    410410 
     
    439439PHP_FUNCTION(eaccelerator_removed_scripts) 
    440440{ 
    441     mm_cache_entry *p; 
     441    ea_cache_entry *p; 
    442442    zval *script; 
    443443 
  • eaccelerator/trunk/ea_restore.c

    r251 r254  
    158158} 
    159159 
    160 void fixup_op_array(eaccelerator_op_array * from TSRMLS_DC) 
     160void fixup_op_array(ea_op_array * from TSRMLS_DC) 
    161161{ 
    162162        zend_op *opline; 
     
    242242} 
    243243 
    244 void fixup_class_entry(eaccelerator_class_entry * from TSRMLS_DC) 
     244void fixup_class_entry(ea_class_entry * from TSRMLS_DC) 
    245245{ 
    246246        FIXUP(from->name); 
     
    393393} 
    394394 
    395 zend_op_array *restore_op_array(zend_op_array * to, 
    396                                                                 eaccelerator_op_array * from TSRMLS_DC) 
     395zend_op_array *restore_op_array(zend_op_array * to, ea_op_array * from TSRMLS_DC) 
    397396{ 
    398397    union { 
     
    618617} 
    619618 
    620 static zend_op_array *restore_op_array_ptr(eaccelerator_op_array * 
    621                                                                                    from TSRMLS_DC) 
     619static zend_op_array *restore_op_array_ptr(ea_op_array *from TSRMLS_DC) 
    622620{ 
    623621        return restore_op_array(NULL, from TSRMLS_CC); 
     
    735733#endif 
    736734 
    737 zend_class_entry *restore_class_entry(zend_class_entry * to, 
    738                                                                           eaccelerator_class_entry * from TSRMLS_DC) 
     735zend_class_entry *restore_class_entry(zend_class_entry * to, ea_class_entry * from TSRMLS_DC) 
    739736{ 
    740737        zend_class_entry *old; 
     
    844841        } 
    845842 
    846         restore_hash(&to->function_table, &from->function_table, 
    847                                  (restore_bucket_t) restore_op_array_ptr TSRMLS_CC); 
     843        restore_hash(&to->function_table, &from->function_table, (restore_bucket_t)restore_op_array_ptr TSRMLS_CC); 
    848844        to->function_table.pDestructor = ZEND_FUNCTION_DTOR; 
    849845 
     
    861857} 
    862858 
    863 void restore_function(mm_fc_entry * p TSRMLS_DC) 
     859void restore_function(ea_fc_entry * p TSRMLS_DC) 
    864860{ 
    865861        zend_op_array op_array; 
     
    868864                return; 
    869865        } 
    870         if (restore_op_array(&op_array, (eaccelerator_op_array *) p->fc TSRMLS_CC) != NULL) { 
     866        if (restore_op_array(&op_array, (ea_op_array *) p->fc TSRMLS_CC) != NULL) { 
    871867                if (zend_hash_add(CG(function_table), p->htabkey, p->htablen, &op_array, sizeof(zend_op_array), NULL) == FAILURE) { 
    872868                        CG(in_compilation) = 1; 
     
    885881 * Class handling. 
    886882 */ 
    887 void restore_class(mm_fc_entry * p TSRMLS_DC) 
     883void restore_class(ea_fc_entry * p TSRMLS_DC) 
    888884{ 
    889885#ifdef ZEND_ENGINE_2 
     
    897893        } 
    898894#ifdef ZEND_ENGINE_2 
    899         ce = restore_class_entry(NULL, (eaccelerator_class_entry *) p->fc TSRMLS_CC); 
     895        ce = restore_class_entry(NULL, (ea_class_entry *) p->fc TSRMLS_CC); 
    900896        if (ce != NULL) 
    901897#else 
    902         if (restore_class_entry(&ce, (eaccelerator_class_entry *) p->fc TSRMLS_CC) != NULL) 
     898        if (restore_class_entry(&ce, (ea_class_entry *) p->fc TSRMLS_CC) != NULL) 
    903899#endif 
    904900        { 
  • eaccelerator/trunk/ea_restore.h

    r183 r254  
    3030 
    3131#define FIXUP(x) if((x)!=NULL) {(x) = (void*)(((char*)(x)) + ((long)(EAG(mem))));} 
    32 void fixup_op_array(eaccelerator_op_array *from TSRMLS_DC); 
    33 void fixup_class_entry(eaccelerator_class_entry *from TSRMLS_DC); 
     32void fixup_op_array(ea_op_array *from TSRMLS_DC); 
     33void fixup_class_entry(ea_class_entry *from TSRMLS_DC); 
    3434void fixup_zval(zval *z TSRMLS_DC); 
    3535 
    3636void restore_zval(zval *zv TSRMLS_DC); 
    37 void restore_class(mm_fc_entry *p TSRMLS_DC); 
    38 void restore_function(mm_fc_entry *p TSRMLS_DC); 
    39 zend_op_array* restore_op_array(zend_op_array *to, eaccelerator_op_array *from TSRMLS_DC); 
    40 zend_class_entry *restore_class_entry(zend_class_entry *to, eaccelerator_class_entry *from TSRMLS_DC); 
     37void restore_class(ea_fc_entry *p TSRMLS_DC); 
     38void restore_function(ea_fc_entry *p TSRMLS_DC); 
     39zend_op_array* restore_op_array(zend_op_array *to, ea_op_array *from TSRMLS_DC); 
     40zend_class_entry *restore_class_entry(zend_class_entry *to, ea_class_entry *from TSRMLS_DC); 
    4141void restore_class_parent(char *parent, int len, zend_class_entry *to TSRMLS_DC); 
    4242#ifdef ZEND_ENGINE_2 
  • eaccelerator/trunk/ea_store.c

    r248 r254  
    146146        } else if (from->type == ZEND_USER_FUNCTION) { 
    147147                EACCELERATOR_ALIGN(EAG(mem)); 
    148                 EAG(mem) += sizeof(eaccelerator_op_array); 
     148                EAG(mem) += sizeof(ea_op_array); 
    149149        } else { 
    150150                DBG(ea_debug_error, ("[%d] EACCELERATOR can't cache function \"%s\"\n", getpid(), from->function_name)); 
     
    241241        } 
    242242        EACCELERATOR_ALIGN(EAG(mem)); 
    243         EAG(mem) += sizeof(eaccelerator_class_entry); 
     243        EAG(mem) += sizeof(ea_class_entry); 
    244244 
    245245        if (from->name != NULL) 
     
    284284 
    285285        zend_hash_init(&EAG(strings), 0, NULL, NULL, 0); 
    286         EAG(mem) += offsetof(mm_cache_entry, realfilename) + len + 1; 
     286        EAG(mem) += offsetof(ea_cache_entry, realfilename) + len + 1; 
    287287        zend_hash_add(&EAG(strings), key, len + 1, &key, sizeof(char *), NULL); 
    288288        b = c; 
    289289        while (b != NULL) { 
    290290                EACCELERATOR_ALIGN(EAG(mem)); 
    291                 EAG(mem) += offsetof(mm_fc_entry, htabkey) + b->nKeyLength; 
     291                EAG(mem) += offsetof(ea_fc_entry, htabkey) + b->nKeyLength; 
    292292                x = b->arKey; 
    293293                zend_hash_add(&EAG(strings), b->arKey, b->nKeyLength, &x, sizeof(char *), NULL); 
     
    297297        while (b != NULL) { 
    298298                EACCELERATOR_ALIGN(EAG(mem)); 
    299                 EAG(mem) += offsetof(mm_fc_entry, htabkey) + b->nKeyLength; 
     299                EAG(mem) += offsetof(ea_fc_entry, htabkey) + b->nKeyLength; 
    300300                x = b->arKey; 
    301301                zend_hash_add(&EAG(strings), b->arKey, b->nKeyLength, &x, sizeof(char *), NULL); 
     
    473473} 
    474474 
    475 eaccelerator_op_array *store_op_array(zend_op_array * from TSRMLS_DC) 
    476 { 
    477         eaccelerator_op_array *to; 
     475ea_op_array *store_op_array(zend_op_array * from TSRMLS_DC) 
     476{ 
     477        ea_op_array *to; 
    478478        zend_op *opline; 
    479479        zend_op *end; 
     
    496496        if (from->type == ZEND_INTERNAL_FUNCTION) { 
    497497                EACCELERATOR_ALIGN(EAG(mem)); 
    498                 to = (eaccelerator_op_array *) EAG(mem); 
    499                 EAG(mem) += offsetof(eaccelerator_op_array, opcodes); 
     498                to = (ea_op_array *) EAG(mem); 
     499                EAG(mem) += offsetof(ea_op_array, opcodes); 
    500500        } else if (from->type == ZEND_USER_FUNCTION) { 
    501501                EACCELERATOR_ALIGN(EAG(mem)); 
    502                 to = (eaccelerator_op_array *) EAG(mem); 
    503                 EAG(mem) += sizeof(eaccelerator_op_array); 
     502                to = (ea_op_array *) EAG(mem); 
     503                EAG(mem) += sizeof(ea_op_array); 
    504504        } else { 
    505505                return NULL; 
     
    785785#endif 
    786786 
    787 eaccelerator_class_entry *store_class_entry(zend_class_entry * from TSRMLS_DC) 
    788 { 
    789         eaccelerator_class_entry *to; 
     787ea_class_entry *store_class_entry(zend_class_entry * from TSRMLS_DC) 
     788{ 
     789        ea_class_entry *to; 
    790790        unsigned int i; 
    791791 
    792792        EACCELERATOR_ALIGN(EAG(mem)); 
    793         to = (eaccelerator_class_entry *) EAG(mem); 
    794         EAG(mem) += sizeof(eaccelerator_class_entry); 
     793        to = (ea_class_entry *) EAG(mem); 
     794        EAG(mem) += sizeof(ea_class_entry); 
    795795        to->type = from->type; 
    796796        to->name = NULL; 
  • eaccelerator/trunk/ea_store.h

    r183 r254  
    3535 
    3636void store_zval(zval *z TSRMLS_DC); 
    37 eaccelerator_op_array *store_op_array(zend_op_array *from TSRMLS_DC); 
    38 eaccelerator_class_entry *store_class_entry_ptr(zend_class_entry **from TSRMLS_DC); 
    39 eaccelerator_class_entry *store_class_entry(zend_class_entry *from TSRMLS_DC); 
     37ea_op_array *store_op_array(zend_op_array *from TSRMLS_DC); 
     38ea_class_entry *store_class_entry_ptr(zend_class_entry **from TSRMLS_DC); 
     39ea_class_entry *store_class_entry(zend_class_entry *from TSRMLS_DC); 
    4040 
    4141#endif /* EA_STORE_H */ 
  • eaccelerator/trunk/eaccelerator.c

    r253 r254  
    8080 
    8181/* Globals (common for each process/thread) */ 
    82 static long eaccelerator_shm_size = 0; 
    83 long eaccelerator_shm_max = 0; 
    84 static long eaccelerator_shm_ttl = 0; 
    85 static long eaccelerator_shm_prune_period = 0; 
     82static long ea_shm_size = 0; 
     83long ea_shm_max = 0; 
     84static long ea_shm_ttl = 0; 
     85static long ea_shm_prune_period = 0; 
    8686extern long eaccelerator_debug; 
    8787static zend_bool eaccelerator_check_mtime = 1; 
     
    122122 
    123123/* Find a script entry with the given hash key */ 
    124 static mm_cache_entry* hash_find_mm(const char  *key, 
     124static ea_cache_entry* hash_find_mm(const char  *key, 
    125125                                    struct stat *buf, 
    126126                                    int         *nreloads, 
    127127                                    time_t      ttl) { 
    128128  unsigned int hv, slot; 
    129   mm_cache_entry *p, *q; 
     129  ea_cache_entry *p, *q; 
    130130 
    131131#ifdef EACCELERATOR_USE_INODE 
     
    193193 
    194194/* Add a new entry to the hashtable */ 
    195 static void hash_add_mm(mm_cache_entry *x) { 
    196   mm_cache_entry *p,*q; 
     195static void hash_add_mm(ea_cache_entry *x) { 
     196  ea_cache_entry *p,*q; 
    197197  unsigned int slot; 
    198198#ifdef EACCELERATOR_USE_INODE 
     
    247247  char   mm_path[MAXPATHLEN]; 
    248248 
    249 /*  if (getppid() != 1) return SUCCESS; */ /*???*/ 
    250249#ifdef ZEND_WIN32 
    251250    snprintf(mm_path, MAXPATHLEN, "%s.%s", EACCELERATOR_MM_FILE, sapi_module.name); 
    252251#else 
    253     snprintf(mm_path, MAXPATHLEN, "%s.%s%d", EACCELERATOR_MM_FILE, sapi_module.name, getpid()); 
     252    snprintf(mm_path, MAXPATHLEN, "%s.%s%d", EACCELERATOR_MM_FILE, sapi_module.name, owner); 
    254253#endif 
    255254/*  snprintf(mm_path, MAXPATHLEN, "%s.%s%d", EACCELERATOR_MM_FILE, sapi_module.name, geteuid());*/ 
    256   if ((eaccelerator_mm_instance = (eaccelerator_mm*)mm_attach(eaccelerator_shm_size*1024*1024, mm_path)) != NULL) { 
     255  if ((eaccelerator_mm_instance = (eaccelerator_mm*)mm_attach(ea_shm_size*1024*1024, mm_path)) != NULL) { 
    257256#ifdef ZTS 
    258257    ea_mutex = tsrm_mutex_alloc(); 
     
    260259    return SUCCESS; 
    261260  } 
    262   mm = mm_create(eaccelerator_shm_size*1024*1024, mm_path); 
     261  mm = mm_create(ea_shm_size*1024*1024, mm_path); 
    263262  if (!mm) { 
    264263    return FAILURE; 
    265264  } 
    266265#ifdef ZEND_WIN32 
    267   DBG(ea_debug_printf, (EA_DEBUG, "init_mm [%d]\n", getpid())); 
    268 #else 
    269   DBG(ea_debug_printf, (EA_DEBUG, "init_mm [%d,%d]\n", getpid(), getppid())); 
     266  DBG(ea_debug_printf, (EA_DEBUG, "init_mm [%d]\n", owner)); 
     267#else 
     268  DBG(ea_debug_printf, (EA_DEBUG, "init_mm [%d,%d]\n", owner, getppid())); 
    270269#endif 
    271270#ifdef ZTS 
     
    444443  eaccelerator_mm_instance->last_prune = t; 
    445444  for (i = 0; i < EA_HASH_SIZE; i++) { 
    446     mm_cache_entry **p = &eaccelerator_mm_instance->hash[i]; 
     445    ea_cache_entry **p = &eaccelerator_mm_instance->hash[i]; 
    447446    while (*p != NULL) { 
    448447      struct stat buf; 
     
    455454          (*p)->mtime != buf.st_mtime || 
    456455          (*p)->filesize != buf.st_size) { 
    457         mm_cache_entry *r = *p; 
     456        ea_cache_entry *r = *p; 
    458457        *p = (*p)->next; 
    459458        eaccelerator_mm_instance->hash_cnt--; 
     
    478477    } 
    479478  } 
    480   if (eaccelerator_shm_prune_period > 0) { 
     479  if (ea_shm_prune_period > 0) { 
    481480    t = time(0); 
    482     if (t - eaccelerator_mm_instance->last_prune > eaccelerator_shm_prune_period) { 
     481    if (t - eaccelerator_mm_instance->last_prune > ea_shm_prune_period) { 
    483482      eaccelerator_prune(t); 
    484483      p = eaccelerator_malloc(size); 
     
    565564} 
    566565 
    567 void eaccelerator_fixup (mm_cache_entry * p TSRMLS_DC) 
     566void eaccelerator_fixup (ea_cache_entry * p TSRMLS_DC) 
    568567{ 
    569   mm_fc_entry *q; 
     568  ea_fc_entry *q; 
    570569 
    571570  EAG (mem) = (char *) ((long) p - (long) p->next); 
     
    579578  while (q != NULL) { 
    580579    FIXUP (q->fc); 
    581     fixup_op_array ((eaccelerator_op_array *) q->fc TSRMLS_CC); 
     580    fixup_op_array ((ea_op_array *) q->fc TSRMLS_CC); 
    582581    FIXUP (q->next); 
    583582    q = q->next; 
     
    586585  while (q != NULL) { 
    587586    FIXUP (q->fc); 
    588     fixup_class_entry ((eaccelerator_class_entry *) q->fc TSRMLS_CC); 
     587    fixup_class_entry ((ea_class_entry *) q->fc TSRMLS_CC); 
    589588    FIXUP (q->next); 
    590589    q = q->next; 
     
    597596 
    598597/* Retrieve a cache entry from the cache directory */ 
    599 static mm_cache_entry* hash_find_file(const char  *key, 
     598static ea_cache_entry* hash_find_file(const char  *key, 
    600599                                      struct stat *buf TSRMLS_DC) { 
    601600  int f; 
    602601  char s[MAXPATHLEN]; 
    603   mm_file_header hdr; 
    604   mm_cache_entry *p; 
     602  ea_file_header hdr; 
     603  ea_cache_entry *p; 
    605604  int use_shm = 1; 
    606605 
     
    686685      p->use_cnt  = 1; 
    687686      p->removed  = 0; 
    688       if (eaccelerator_shm_ttl > 0) { 
    689         p->ttl = time(0) + eaccelerator_shm_ttl; 
     687      if (ea_shm_ttl > 0) { 
     688        p->ttl = time(0) + ea_shm_ttl; 
    690689      } else { 
    691690        p->ttl = 0; 
     
    702701 
    703702/* Add a cache entry to the cache directory */ 
    704 static int hash_add_file(mm_cache_entry *p TSRMLS_DC) { 
     703static int hash_add_file(ea_cache_entry *p TSRMLS_DC) { 
    705704  int f; 
    706705  int ret = 0; 
    707706  char s[MAXPATHLEN]; 
    708   mm_file_header hdr; 
     707  ea_file_header hdr; 
    709708 
    710709#ifdef EACCELERATOR_USE_INODE 
     
    742741/* Create a cache entry from the given op_array, functions and classes of a 
    743742   script */ 
    744 static mm_cache_entry *eaccelerator_store_int (char *key, int len,  
     743static ea_cache_entry *eaccelerator_store_int (char *key, int len,  
    745744        zend_op_array * op_array, Bucket * f, Bucket * c TSRMLS_DC) 
    746745{ 
    747   mm_cache_entry *p; 
    748   mm_fc_entry *fc; 
    749   mm_fc_entry *q; 
     746  ea_cache_entry *p; 
     747  ea_fc_entry *fc; 
     748  ea_fc_entry *q; 
    750749  char *x; 
    751750 
     
    756755  EAG (compress) = 1; 
    757756  zend_hash_init (&EAG (strings), 0, NULL, NULL, 0); 
    758   p = (mm_cache_entry *) EAG (mem); 
    759   EAG (mem) += offsetof (mm_cache_entry, realfilename) + len + 1; 
     757  p = (ea_cache_entry *) EAG (mem); 
     758  EAG (mem) += offsetof (ea_cache_entry, realfilename) + len + 1; 
    760759 
    761760  p->nhits = 0; 
     
    776775 
    777776    EACCELERATOR_ALIGN (EAG (mem)); 
    778     fc = (mm_fc_entry *) EAG (mem); 
    779     EAG (mem) += offsetof (mm_fc_entry, htabkey) + c->nKeyLength; 
     777    fc = (ea_fc_entry *) EAG (mem); 
     778    EAG (mem) += offsetof (ea_fc_entry, htabkey) + c->nKeyLength; 
    780779    memcpy (fc->htabkey, c->arKey, c->nKeyLength); 
    781780    fc->htablen = c->nKeyLength; 
     
    805804 
    806805      EACCELERATOR_ALIGN (EAG (mem)); 
    807       fc = (mm_fc_entry *) EAG (mem); 
    808       EAG (mem) += offsetof (mm_fc_entry, htabkey) + f->nKeyLength; 
     806      fc = (ea_fc_entry *) EAG (mem); 
     807      EAG (mem) += offsetof (ea_fc_entry, htabkey) + f->nKeyLength; 
    809808      memcpy (fc->htabkey, f->arKey, f->nKeyLength); 
    810809      fc->htablen = f->nKeyLength; 
     
    845844                         zend_op_array* op_array, 
    846845                         Bucket* f, Bucket *c TSRMLS_DC) { 
    847   mm_cache_entry *p; 
     846  ea_cache_entry *p; 
    848847  int len = strlen(key); 
    849848  int use_shm = 1; 
     
    882881#endif 
    883882    if (use_shm) { 
    884       if (eaccelerator_shm_ttl > 0) { 
    885         p->ttl = time(0) + eaccelerator_shm_ttl; 
     883      if (ea_shm_ttl > 0) { 
     884        p->ttl = time(0) + ea_shm_ttl; 
    886885      } else { 
    887886        p->ttl = 0; 
     
    905904static zend_op_array* eaccelerator_restore(char *realname, struct stat *buf, 
    906905                                      int *nreloads, time_t compile_time TSRMLS_DC) { 
    907   mm_cache_entry *p; 
     906  ea_cache_entry *p; 
    908907  zend_op_array *op_array = NULL; 
    909908 
    910909  *nreloads = 1; 
    911910  EACCELERATOR_UNPROTECT(); 
    912   p = hash_find_mm(realname, buf, nreloads, ((eaccelerator_shm_ttl > 0)?(compile_time + eaccelerator_shm_ttl):0)); 
     911  p = hash_find_mm(realname, buf, nreloads, ((ea_shm_ttl > 0)?(compile_time + ea_shm_ttl):0)); 
    913912  if (p == NULL && !eaccelerator_scripts_shm_only) { 
    914913    p = hash_find_file(realname, buf TSRMLS_CC); 
     
    919918    op_array = restore_op_array(NULL, p->op_array TSRMLS_CC); 
    920919    if (op_array != NULL) { 
    921       mm_fc_entry *e; 
    922       mm_used_entry *used = emalloc(sizeof(mm_used_entry)); 
     920      ea_fc_entry *e; 
     921      ea_used_entry *used = emalloc(sizeof(ea_used_entry)); 
    923922      used->entry  = p; 
    924       used->next   = (mm_used_entry*)EAG(used_entries); 
     923      used->next   = (ea_used_entry*)EAG(used_entries); 
    925924      EAG(used_entries) = (void*)used; 
    926925      EAG(mem) = op_array->filename; 
     
    10181017/* Check if the file is ok to cache */ 
    10191018static int eaccelerator_ok_to_cache(char *realname TSRMLS_DC) { 
    1020   mm_cond_entry *p; 
     1019  ea_cond_entry *p; 
    10211020  int ok; 
    10221021  if (EAG(cond_list) == NULL) { 
     
    15901589 */ 
    15911590PHP_INI_MH(eaccelerator_filter) { 
    1592   mm_cond_entry *p, *q; 
     1591  ea_cond_entry *p, *q; 
    15931592  char *s = new_value; 
    15941593  char *ss; 
     
    16171616      ; 
    16181617    if ((s > ss) && *ss) { 
    1619       p = (mm_cond_entry *)malloc(sizeof(mm_cond_entry)); 
     1618      p = (ea_cond_entry *)malloc(sizeof(ea_cond_entry)); 
    16201619      if (p == NULL) 
    16211620        break; 
     
    16571656STD_PHP_INI_ENTRY("eaccelerator.compress",       "1", PHP_INI_ALL, OnUpdateBool, compression_enabled, zend_eaccelerator_globals, eaccelerator_globals) 
    16581657STD_PHP_INI_ENTRY("eaccelerator.compress_level", "9", PHP_INI_ALL, OnUpdateLong, compress_level, zend_eaccelerator_globals, eaccelerator_globals)                   
    1659 ZEND_INI_ENTRY1("eaccelerator.shm_size",        "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &eaccelerator_shm_size) 
    1660 ZEND_INI_ENTRY1("eaccelerator.shm_max",         "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &eaccelerator_shm_max) 
    1661 ZEND_INI_ENTRY1("eaccelerator.shm_ttl",         "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &eaccelerator_shm_ttl) 
    1662 ZEND_INI_ENTRY1("eaccelerator.shm_prune_period", "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &eaccelerator_shm_prune_period) 
     1658ZEND_INI_ENTRY1("eaccelerator.shm_size",        "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &ea_shm_size) 
     1659ZEND_INI_ENTRY1("eaccelerator.shm_max",         "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &ea_shm_max) 
     1660ZEND_INI_ENTRY1("eaccelerator.shm_ttl",         "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &ea_shm_ttl) 
     1661ZEND_INI_ENTRY1("eaccelerator.shm_prune_period", "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &ea_shm_prune_period) 
    16631662ZEND_INI_ENTRY1("eaccelerator.debug",           "1", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &eaccelerator_debug) 
    16641663STD_PHP_INI_ENTRY("eaccelerator.log_file",      "", PHP_INI_SYSTEM, OnUpdateString, eaccelerator_log_file, zend_eaccelerator_globals, eaccelerator_globals) 
     
    16831682 
    16841683static void eaccelerator_clean_request(TSRMLS_D) { 
    1685   mm_used_entry  *p = (mm_used_entry*)EAG(used_entries); 
     1684  ea_used_entry  *p = (ea_used_entry*)EAG(used_entries); 
    16861685  if (eaccelerator_mm_instance != NULL) { 
    16871686    EACCELERATOR_UNPROTECT(); 
     
    16981697            p->entry = NULL; 
    16991698          } else { 
    1700             mm_cache_entry *q = eaccelerator_mm_instance->removed; 
     1699            ea_cache_entry *q = eaccelerator_mm_instance->removed; 
    17011700            while (q != NULL && q->next != p->entry) { 
    17021701              q = q->next; 
     
    17171716        THREAD_T thread = tsrm_thread_id(); 
    17181717#endif 
    1719         mm_lock_entry** p = &eaccelerator_mm_instance->locks; 
     1718        ea_lock_entry** p = &eaccelerator_mm_instance->locks; 
    17201719        while ((*p) != NULL) { 
    17211720#ifdef ZTS 
     
    17241723          if ((*p)->pid == pid) { 
    17251724#endif 
    1726             mm_lock_entry* x = *p; 
     1725            ea_lock_entry* x = *p; 
    17271726            *p = (*p)->next; 
    17281727            eaccelerator_free_nolock(x); 
     
    17351734    } 
    17361735    EACCELERATOR_PROTECT(); 
    1737     p = (mm_used_entry*)EAG(used_entries); 
     1736    p = (ea_used_entry*)EAG(used_entries); 
    17381737    while (p != NULL) { 
    1739       mm_used_entry* r = p; 
     1738      ea_used_entry* r = p; 
    17401739      p = p->next; 
    17411740      if (r->entry != NULL && r->entry->use_cnt < 0) { 
     
    18561855static void eaccelerator_globals_dtor(zend_eaccelerator_globals *eaccelerator_globals) 
    18571856{ 
    1858   mm_cond_entry *p, *q; 
     1857  ea_cond_entry *p, *q; 
    18591858 
    18601859  for (p = eaccelerator_globals->cond_list; p != NULL; p = q) { 
     
    19271926  REGISTER_INI_ENTRIES(); 
    19281927  REGISTER_STRING_CONSTANT("EACCELERATOR_VERSION", EACCELERATOR_VERSION, CONST_CS | CONST_PERSISTENT); 
    1929   REGISTER_LONG_CONSTANT("EACCELERATOR_SHM_AND_DISK", eaccelerator_shm_and_disk, CONST_CS | CONST_PERSISTENT); 
    1930   REGISTER_LONG_CONSTANT("EACCELERATOR_SHM", eaccelerator_shm, CONST_CS | CONST_PERSISTENT); 
    1931   REGISTER_LONG_CONSTANT("EACCELERATOR_SHM_ONLY", eaccelerator_shm_only, CONST_CS | CONST_PERSISTENT); 
    1932   REGISTER_LONG_CONSTANT("EACCELERATOR_DISK_ONLY", eaccelerator_disk_only, CONST_CS | CONST_PERSISTENT); 
    1933   REGISTER_LONG_CONSTANT("EACCELERATOR_NONE", eaccelerator_none, CONST_CS | CONST_PERSISTENT); 
     1928  REGISTER_LONG_CONSTANT("EACCELERATOR_SHM_AND_DISK", ea_shm_and_disk, CONST_CS | CONST_PERSISTENT); 
     1929  REGISTER_LONG_CONSTANT("EACCELERATOR_SHM", ea_shm, CONST_CS | CONST_PERSISTENT); 
     1930  REGISTER_LONG_CONSTANT("EACCELERATOR_SHM_ONLY", ea_shm_only, CONST_CS | CONST_PERSISTENT); 
     1931  REGISTER_LONG_CONSTANT("EACCELERATOR_DISK_ONLY", ea_disk_only, CONST_CS | CONST_PERSISTENT); 
     1932  REGISTER_LONG_CONSTANT("EACCELERATOR_NONE", ea_none, CONST_CS | CONST_PERSISTENT); 
    19341933  binary_eaccelerator_version = encode_version(EACCELERATOR_VERSION); 
    19351934  binary_php_version = encode_version(PHP_VERSION); 
  • eaccelerator/trunk/eaccelerator.h

    r253 r254  
    5252/* fixes compile errors on php5.1 */ 
    5353#ifdef STR_EMPTY_ALLOC 
    54 #define empty_string STR_EMPTY_ALLOC() 
     54#      define empty_string STR_EMPTY_ALLOC() 
    5555#endif 
    5656 
     
    226226        zend_uint line_end; 
    227227#endif 
    228 } eaccelerator_op_array; 
     228} ea_op_array; 
    229229 
    230230typedef struct _eaccelerator_class_entry { 
     
    249249        zend_uint line_end; 
    250250#endif 
    251 } eaccelerator_class_entry; 
     251} ea_class_entry; 
    252252 
    253253/* 
    254254 * To cache functions and classes. 
    255255 */ 
    256 typedef struct _mm_fc_entry { 
     256typedef struct _ea_fc_entry { 
    257257        void *fc; 
    258         struct _mm_fc_entry *next; 
     258        struct _ea_fc_entry *next; 
    259259        int htablen; 
    260260        char htabkey[1];                        /* must be last element */ 
    261 } mm_fc_entry; 
     261} ea_fc_entry; 
    262262 
    263263 
     
    267267 * into the list of mm_fc_entry. 
    268268 */ 
    269 typedef struct _mm_cache_entry { 
    270         struct _mm_cache_entry *next; 
     269typedef struct _ea_cache_entry { 
     270        struct _ea_cache_entry *next; 
    271271#ifdef EACCELERATOR_USE_INODE 
    272272        dev_t st_dev;                           /* file's device                     */ 
     
    282282        int nreloads;                           /* count of reloads                  */ 
    283283        int use_cnt;                            /* how many processes uses the entry */ 
    284         eaccelerator_op_array *op_array;      /* script's global scope code        */ 
    285         mm_fc_entry *f_head;          /* list of nested functions          */ 
    286         mm_fc_entry *c_head;          /* list of nested classes            */ 
     284        ea_op_array *op_array;        /* script's global scope code        */ 
     285        ea_fc_entry *f_head;          /* list of nested functions          */ 
     286        ea_fc_entry *c_head;          /* list of nested classes            */ 
    287287        zend_bool removed;                      /* the entry is scheduled to remove  */ 
    288288        char realfilename[1];           /* real file name (must be last el.) */ 
    289 } mm_cache_entry; 
     289} ea_cache_entry; 
    290290 
    291291/* 
    292292 * bucket for user's cache 
    293293 */ 
    294 typedef struct _mm_user_cache_entry { 
    295         struct _mm_user_cache_entry *next; 
     294typedef struct _ea_user_cache_entry { 
     295        struct _ea_user_cache_entry *next; 
    296296        unsigned int hv;                        /* hash value                  */ 
    297297        long ttl;                                       /* expiration time             */ 
     
    300300        zval value;                                     /* value                       */ 
    301301        char key[1];                            /* key value (must be last el) */ 
    302 } mm_user_cache_entry; 
     302} ea_user_cache_entry; 
    303303 
    304304/* 
    305305 * Linked list of mm_cache_entry which are used by process/thread 
    306306 */ 
    307 typedef struct _mm_used_entry { 
    308         struct _mm_used_entry *next; 
    309         mm_cache_entry *entry; 
    310 } mm_used_entry; 
     307typedef struct _ea_used_entry { 
     308        struct _ea_used_entry *next; 
     309        ea_cache_entry *entry; 
     310} ea_used_entry; 
    311311 
    312312/* 
    313313 * Linked list of locks 
    314314 */ 
    315 typedef struct _mm_lock_entry { 
    316         struct _mm_lock_entry *next; 
     315typedef struct _ea_lock_entry { 
     316        struct _ea_lock_entry *next; 
    317317        pid_t pid; 
    318318#ifdef ZTS 
     
    320320#endif 
    321321        char key[1]; 
    322 } mm_lock_entry; 
    323  
    324 typedef struct _mm_file_header { 
     322} ea_lock_entry; 
     323 
     324typedef struct _ea_file_header { 
    325325        char magic[8];                          /* "EACCELERATOR" */ 
    326326        int eaccelerator_version; 
     
    330330        time_t mtime; 
    331331        unsigned int crc32; 
    332 } mm_file_header; 
     332} ea_file_header; 
    333333 
    334334typedef struct { 
     
    342342        unsigned int rem_cnt; 
    343343        time_t last_prune; 
    344         mm_cache_entry *removed; 
    345         mm_lock_entry *locks; 
    346  
    347         mm_cache_entry *hash[EA_HASH_SIZE]; 
    348         mm_user_cache_entry *user_hash[EA_USER_HASH_SIZE]; 
     344        ea_cache_entry *removed; 
     345        ea_lock_entry *locks; 
     346 
     347        ea_cache_entry *hash[EA_HASH_SIZE]; 
     348        ea_user_cache_entry *user_hash[EA_USER_HASH_SIZE]; 
    349349} eaccelerator_mm; 
    350350 
     
    352352 * Where to cache 
    353353 */ 
    354 typedef enum _eaccelerator_cache_place { 
    355         eaccelerator_shm_and_disk,    /* in shm and in disk */ 
    356         eaccelerator_shm,                     /* in shm, but if it is not possible then on disk */ 
    357         eaccelerator_shm_only,                /* in shm only  */ 
    358         eaccelerator_disk_only,               /* on disk only */ 
    359         eaccelerator_none                     /* don't cache  */ 
    360 } eaccelerator_cache_place; 
     354typedef enum _ea_cache_place { 
     355        ea_shm_and_disk,      /* in shm and in disk */ 
     356        ea_shm,                               /* in shm, but if it is not possible then on disk */ 
     357        ea_shm_only,          /* in shm only  */ 
     358        ea_disk_only,         /* on disk only */ 
     359        ea_none                               /* don't cache  */ 
     360} ea_cache_place; 
    361361 
    362362typedef union align_union { 
     
    415415 * conditional filter 
    416416 */ 
    417 typedef struct _mm_cond_entry { 
     417typedef struct _ea_cond_entry { 
    418418        char *str; 
    419419        int len; 
    420420        zend_bool not; 
    421         struct _mm_cond_entry *next; 
    422 } mm_cond_entry; 
     421        struct _ea_cond_entry *next; 
     422} ea_cond_entry; 
    423423 
    424424/* 
     
    445445HashTable restored; 
    446446zend_class_entry *class_entry; 
    447 mm_cond_entry *cond_list; 
     447ea_cond_entry *cond_list; 
    448448zend_uint refcount_helper; 
    449449char hostname[32]; 
  • eaccelerator/trunk/session.c

    r228 r254  
    4343#endif 
    4444 
    45 eaccelerator_cache_place eaccelerator_sessions_cache_place = 
    46         eaccelerator_shm_and_disk; 
     45ea_cache_place eaccelerator_sessions_cache_place = ea_shm_and_disk; 
    4746int eaccelerator_sessions_registered = 0; 
    4847extern eaccelerator_mm *eaccelerator_mm_instance; 
     
    5150PHP_INI_MH(eaccelerator_OnUpdateSessionCachePlace) 
    5251{ 
    53         if (strncasecmp("shm_and_disk", new_value, sizeof ("shm_and_disk")) == 0) { 
    54                 eaccelerator_sessions_cache_place = eaccelerator_shm_and_disk; 
     52        if (strncasecmp("shm_and_disk", new_value, sizeof("shm_and_disk")) == 0) { 
     53                eaccelerator_sessions_cache_place = ea_shm_and_disk; 
    5554        } else if (strncasecmp("shm", new_value, sizeof ("shm")) == 0) { 
    56                 eaccelerator_sessions_cache_place = eaccelerator_shm; 
     55                eaccelerator_sessions_cache_place = ea_shm; 
    5756        } else if (strncasecmp("shm_only", new_value, sizeof ("shm_only")) == 0) { 
    58                 eaccelerator_sessions_cache_place = eaccelerator_shm_only; 
     57                eaccelerator_sessions_cache_place = ea_shm_only; 
    5958        } else if (strncasecmp("disk_only", new_value, sizeof ("disk_only")) == 0) { 
    60                 eaccelerator_sessions_cache_place = eaccelerator_disk_only; 
     59                eaccelerator_sessions_cache_place = ea_disk_only; 
    6160        } else if (strncasecmp("none", new_value, sizeof ("none")) == 0) { 
    62                 eaccelerator_sessions_cache_place = eaccelerator_none; 
     61                eaccelerator_sessions_cache_place = ea_none; 
    6362        } 
    6463        return SUCCESS; 
     
    381380int eaccelerator_session_registered() 
    382381{ 
    383         return !(eaccelerator_sessions_cache_place != eaccelerator_none && 
    384                          eaccelerator_sessions_registered == 0); 
     382        return !(eaccelerator_sessions_cache_place != ea_none && eaccelerator_sessions_registered == 0); 
    385383} 
    386384 
     
    401399        zval param; 
    402400        zval *params[1]; 
    403 /* 
    404   if (php_session_register_module(&ps_mod_eaccelerator) != 0) { 
    405     return 0; 
    406   } 
    407 */ 
    408         if (eaccelerator_sessions_cache_place == eaccelerator_none) { 
     401 
     402        if (eaccelerator_sessions_cache_place == ea_none) { 
    409403                return 0; 
    410404        } 
  • eaccelerator/trunk/shm.c

    r249 r254  
    4141 
    4242/* where to cache the keys */ 
    43 eaccelerator_cache_place eaccelerator_keys_cache_place = 
    44         eaccelerator_shm_and_disk; 
     43ea_cache_place eaccelerator_keys_cache_place = ea_shm_and_disk; 
    4544 
    4645/* set the eaccelerator_keys_cache_place */ 
    47 PHP_INI_MH (eaccelerator_OnUpdateKeysCachePlace) 
     46PHP_INI_MH(eaccelerator_OnUpdateKeysCachePlace) 
    4847{ 
    49         if (strncasecmp ("shm_and_disk", new_value, sizeof ("shm_and_disk")) == 0) 
    50                 eaccelerator_keys_cache_place = eaccelerator_shm_and_disk; 
     48        if (strncasecmp("shm_and_disk", new_value, sizeof("shm_and_disk")) == 0) 
     49                eaccelerator_keys_cache_place = ea_shm_and_disk; 
    5150 
    52         else if (strncasecmp ("shm", new_value, sizeof ("shm")) == 0) 
    53                 eaccelerator_keys_cache_place = eaccelerator_shm; 
     51        else if (strncasecmp("shm", new_value, sizeof("shm")) == 0) 
     52                eaccelerator_keys_cache_place = ea_shm; 
    5453 
    55         else if (strncasecmp ("shm_only", new_value, sizeof ("shm_only")) == 0) 
    56                 eaccelerator_keys_cache_place = eaccelerator_shm_only; 
     54        else if (strncasecmp("shm_only", new_value, sizeof ("shm_only")) == 0) 
     55                eaccelerator_keys_cache_place = ea_shm_only; 
    5756 
    58         else if (strncasecmp ("disk_only", new_value, sizeof ("disk_only")) == 0) 
    59                 eaccelerator_keys_cache_place = eaccelerator_disk_only; 
     57        else if (strncasecmp("disk_only", new_value, sizeof("disk_only")) == 0) 
     58                eaccelerator_keys_cache_place = ea_disk_only; 
    6059 
    61         else if (strncasecmp ("none", new_value, sizeof ("none")) == 0) 
    62                 eaccelerator_keys_cache_place = eaccelerator_none; 
     60        else if (strncasecmp("none", new_value, sizeof("none")) == 0) 
     61                eaccelerator_keys_cache_place = ea_none; 
    6362 
    6463        return SUCCESS;