Changeset 148 for trunk/xc_shm.h


Ignore:
Timestamp:
2006-09-09T02:56:44+02:00 (8 years ago)
Author:
moo
Message:

reconstruct shm/allocator

File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/xc_shm.h

    r137 r148  
    22typedef size_t xc_shmsize_t; 
    33 
    4 int xc_shm_can_readonly(xc_shm_t *shm); 
    5 int xc_shm_is_readwrite(xc_shm_t *shm, const void *p); 
    6 int xc_shm_is_readonly(xc_shm_t *shm, const void *p); 
    7 void *xc_shm_to_readwrite(xc_shm_t *shm, void *p); 
    8 void *xc_shm_to_readonly(xc_shm_t *shm, void *p); 
     4#include "mem.h" 
    95 
    10 void *xc_shm_ptr(xc_shm_t *shm); 
     6/* shm */ 
     7#define XC_SHM_CAN_READONLY(func) int   func(xc_shm_t *shm) 
     8#define XC_SHM_IS_READWRITE(func) int   func(xc_shm_t *shm, const void *p) 
     9#define XC_SHM_IS_READONLY(func)  int   func(xc_shm_t *shm, const void *p) 
     10#define XC_SHM_TO_READWRITE(func) void *func(xc_shm_t *shm, void *p) 
     11#define XC_SHM_TO_READONLY(func)  void *func(xc_shm_t *shm, void *p) 
    1112 
    12 xc_shm_t *xc_shm_init(const char *path, xc_shmsize_t size, zend_bool readonly_protection); 
     13#define XC_SHM_INIT(func)         xc_shm_t *func(xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2) 
     14#define XC_SHM_DESTROY(func)      void func(xc_shm_t *shm) 
     15 
     16#define XC_SHM_MEMINIT(func)      xc_mem_t *func(xc_shm_t *shm, xc_memsize_t size) 
     17#define XC_SHM_MEMDESTROY(func)   void func(xc_mem_t *mem) 
     18 
     19#define XC_SHM_HANDLERS(name)    { \ 
     20    NULL                           \ 
     21    , xc_##name##_can_readonly     \ 
     22    , xc_##name##_is_readwrite     \ 
     23    , xc_##name##_is_readonly      \ 
     24    , xc_##name##_to_readwrite     \ 
     25    , xc_##name##_to_readonly      \ 
     26\ 
     27    , xc_##name##_init             \ 
     28    , xc_##name##_destroy          \ 
     29\ 
     30    , xc_##name##_meminit          \ 
     31    , xc_##name##_memdestroy       \ 
     32} 
     33 
     34typedef struct { 
     35    const xc_mem_handlers_t *memhandlers; 
     36    XC_SHM_CAN_READONLY((*can_readonly)); 
     37    XC_SHM_IS_READWRITE((*is_readwrite)); 
     38    XC_SHM_IS_READONLY((*is_readonly)); 
     39    XC_SHM_TO_READWRITE((*to_readwrite)); 
     40    XC_SHM_TO_READONLY((*to_readonly)); 
     41    XC_SHM_INIT((*init)); 
     42    XC_SHM_DESTROY((*destroy)); 
     43 
     44    XC_SHM_MEMINIT((*meminit)); 
     45    XC_SHM_MEMDESTROY((*memdestroy)); 
     46} xc_shm_handlers_t; 
     47 
     48 
     49#ifndef XC_SHM_IMPL 
     50struct _xc_shm_t { 
     51    const xc_shm_handlers_t *handlers; 
     52}; 
     53#endif 
     54 
     55void xc_shm_init_modules(); 
     56int xc_shm_scheme_register(const char *name, const xc_shm_handlers_t *handlers); 
     57const xc_shm_handlers_t *xc_shm_scheme_find(const char *name); 
     58 
     59xc_shm_t *xc_shm_init(const char *type, xc_shmsize_t size, int readonly_protection, const void *arg1, const void *arg2); 
    1360void xc_shm_destroy(xc_shm_t *shm); 
Note: See TracChangeset for help on using the changeset viewer.