Changeset 254

Show
Ignore:
Timestamp:
07/29/06 12:37:52 (2 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) +