From: Jim Jagielski Date: Thu, 1 Jan 2009 20:17:56 +0000 (+0000) Subject: Transition mod_slotmem to ap_slotmem... just monkeying X-Git-Tag: 2.3.1~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11719367b3711847c794765afb75c5ddd62c0267;p=apache Transition mod_slotmem to ap_slotmem... just monkeying with the locations, etc. now... adding getter/setter will be over the weekend and post-2.3.1 but I figured at least do this beforehand... I love trunk :) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@730597 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 8509ae5e68..a34acc2c1c 100644 --- a/CHANGES +++ b/CHANGES @@ -2,7 +2,7 @@ Changes with Apache 2.3.1 [ When backported to 2.2.x, remove entry from this file ] - *) mod_slotmem: Add in new slot-based memory access API module, including + *) ap_slotmem: Add in new slot-based memory access API impl., including 2 providers (mod_sharedmem and mod_plainmem) [Jim Jagielski, Jean-Frederic Clere, Brian Akins ] diff --git a/modules/mem/mod_slotmem.h b/include/ap_slotmem.h similarity index 91% rename from modules/mem/mod_slotmem.h rename to include/ap_slotmem.h index 3b1ac338c1..2abdefaa05 100644 --- a/modules/mem/mod_slotmem.h +++ b/include/ap_slotmem.h @@ -48,23 +48,10 @@ #include /* for getpid() */ #endif -#define SLOTMEM_STORAGE "slotmem" +#define AP_SLOTMEM_STORAGE "slotmem" typedef struct ap_slotmem_t ap_slotmem_t; -struct ap_slotmem_t { - char *name; /* per segment name */ - void *shm; /* ptr to memory segment (apr_shm_t *) */ - void *base; /* data set start */ - apr_size_t size; /* size of each memory slot */ - int num; /* number of mem slots */ - apr_pool_t *gpool; /* per segment global pool */ - apr_global_mutex_t *smutex; /* mutex */ - void *context; /* general purpose storage */ - struct ap_slotmem_t *next; /* location of next allocated segment */ -}; - - /** * callback function used for slotmem. * @param mem is the memory associated with a worker. diff --git a/modules/mem/Makefile.in b/modules/mem/Makefile.in index e32210f185..7c5c149d85 100644 --- a/modules/mem/Makefile.in +++ b/modules/mem/Makefile.in @@ -1,2 +1,3 @@ - +# a modules Makefile has no explicit targets -- they will be defined by +# whatever modules are enabled. just grab special.mk to deal with this. include $(top_srcdir)/build/special.mk diff --git a/modules/mem/config.m4 b/modules/mem/config.m4 index aa1e99d5c5..5f5014ce20 100644 --- a/modules/mem/config.m4 +++ b/modules/mem/config.m4 @@ -3,19 +3,9 @@ dnl modules enabled in this directory by default dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) APACHE_MODPATH_INIT(mem) -if test "$enable_slotmem" = "shared"; then - slotmem_mods_enable=shared -elif test "$enable_slotmem" = "yes"; then - slotmem_mods_enable=yes -else - slotmem_mods_enable=no -fi -slotmem_objs="mod_slotmem.lo" - -APACHE_MODULE(slotmem, slot-based memory API using providers, $slotmem_objs, , most) - -# Ensure that other modules can pick up mod_slotmem.h -APR_ADDTO(INCLUDES, [-I\$(top_srcdir)/$modpath_current]) +sharedmem_objs="mod_sharedmem.lo" +APACHE_MODULE(sharedmem, memslot provider that uses shared memory, $sharedmem_objs, , most) +APACHE_MODULE(plainmem, memslot provider that uses plain memory, , , no) APACHE_MODPATH_FINISH diff --git a/modules/mem/providers/mod_plainmem.c b/modules/mem/mod_plainmem.c similarity index 89% rename from modules/mem/providers/mod_plainmem.c rename to modules/mem/mod_plainmem.c index ae23804394..968f7991fd 100644 --- a/modules/mem/providers/mod_plainmem.c +++ b/modules/mem/mod_plainmem.c @@ -18,7 +18,18 @@ * This one uses plain memory. */ -#include "mod_slotmem.h" +#include "ap_slotmem.h" + +struct ap_slotmem_t { + char *name; /* per segment name */ + void *base; /* data set start */ + apr_size_t size; /* size of each memory slot */ + int num; /* number of mem slots */ + apr_pool_t *gpool; /* per segment global pool */ + apr_global_mutex_t *smutex; /* mutex */ + struct ap_slotmem_t *next; /* location of next allocated segment */ +}; + /* global pool and list of slotmem we are handling */ static struct ap_slotmem_t *globallistmem = NULL; @@ -156,7 +167,7 @@ static int pre_config(apr_pool_t *p, apr_pool_t *plog, static void ap_plainmem_register_hook(apr_pool_t *p) { /* XXX: static const char * const prePos[] = { "mod_slotmem.c", NULL }; */ - ap_register_provider(p, SLOTMEM_STORAGE, "plain", "0", &storage); + ap_register_provider(p, AP_SLOTMEM_STORAGE, "plain", "0", &storage); ap_hook_pre_config(pre_config, NULL, NULL, APR_HOOK_MIDDLE); } diff --git a/modules/mem/providers/mod_sharedmem.c b/modules/mem/mod_sharedmem.c similarity index 95% rename from modules/mem/providers/mod_sharedmem.c rename to modules/mem/mod_sharedmem.c index 26015e2391..9f6c34857f 100644 --- a/modules/mem/providers/mod_sharedmem.c +++ b/modules/mem/mod_sharedmem.c @@ -18,7 +18,19 @@ * This one uses shared memory. */ -#include "mod_slotmem.h" +#include "ap_slotmem.h" + +struct ap_slotmem_t { + char *name; /* per segment name */ + void *shm; /* ptr to memory segment (apr_shm_t *) */ + void *base; /* data set start */ + apr_size_t size; /* size of each memory slot */ + int num; /* number of mem slots */ + apr_pool_t *gpool; /* per segment global pool */ + apr_global_mutex_t *smutex; /* mutex */ + struct ap_slotmem_t *next; /* location of next allocated segment */ +}; + /* The description of the slots to reuse the slotmem */ struct sharedslotdesc { @@ -473,7 +485,7 @@ static void child_init(apr_pool_t *p, server_rec *s) static void ap_sharedmem_register_hook(apr_pool_t *p) { const ap_slotmem_storage_method *storage = sharedmem_getstorage(); - ap_register_provider(p, SLOTMEM_STORAGE, "shared", "0", storage); + ap_register_provider(p, AP_SLOTMEM_STORAGE, "shared", "0", storage); ap_hook_post_config(post_config, NULL, NULL, APR_HOOK_LAST); ap_hook_pre_config(pre_config, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_child_init(child_init, NULL, NULL, APR_HOOK_MIDDLE); diff --git a/modules/mem/providers/Makefile.in b/modules/mem/providers/Makefile.in deleted file mode 100644 index 7c5c149d85..0000000000 --- a/modules/mem/providers/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ -# a modules Makefile has no explicit targets -- they will be defined by -# whatever modules are enabled. just grab special.mk to deal with this. -include $(top_srcdir)/build/special.mk diff --git a/modules/mem/providers/config2.m4 b/modules/mem/providers/config2.m4 deleted file mode 100644 index bdfd3d866a..0000000000 --- a/modules/mem/providers/config2.m4 +++ /dev/null @@ -1,11 +0,0 @@ -dnl modules enabled in this directory by default - -dnl APACHE_MODULE(name, helptext[, objects[, structname[, default[, config]]]]) - -APACHE_MODPATH_INIT(mem/providers) - -sharedmem_objs="mod_sharedmem.lo" -APACHE_MODULE(sharedmem, memslot provider that uses shared memory, $sharedmem_objs, , $slotmem_mods_enable) -APACHE_MODULE(plainmem, memslot provider that uses plain memory, , , no) - -APACHE_MODPATH_FINISH diff --git a/server/Makefile.in b/server/Makefile.in index 4a3b6099a7..2da92b1c6b 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -14,7 +14,7 @@ LTLIBRARY_SOURCES = \ mpm_common.c util_charset.c util_cookies.c util_debug.c util_xml.c \ util_expr.c util_filter.c util_pcre.c exports.c \ scoreboard.c error_bucket.c protocol.c core.c request.c provider.c \ - eoc_bucket.c eor_bucket.c core_filters.c + eoc_bucket.c eor_bucket.c core_filters.c slotmem.c TARGETS = delete-exports $(LTLIBRARY_NAME) $(CORE_IMPLIB_FILE) export_vars.h httpd.exp diff --git a/modules/mem/mod_slotmem.c b/server/slotmem.c similarity index 95% rename from modules/mem/mod_slotmem.c rename to server/slotmem.c index 7810e7e884..9af25a7699 100644 --- a/modules/mem/mod_slotmem.c +++ b/server/slotmem.c @@ -19,16 +19,16 @@ * front-end to the actual memory providers. */ -#include "mod_slotmem.h" +#include "ap_slotmem.h" AP_DECLARE(apr_array_header_t *) ap_slotmem_methods(apr_pool_t *pool) { - return (ap_list_provider_names(pool, SLOTMEM_STORAGE, "0")); + return (ap_list_provider_names(pool, AP_SLOTMEM_STORAGE, "0")); } AP_DECLARE(ap_slotmem_storage_method *) ap_slotmem_method(const char *provider) { - return (ap_lookup_provider(SLOTMEM_STORAGE, provider, "0")); + return (ap_lookup_provider(AP_SLOTMEM_STORAGE, provider, "0")); } AP_DECLARE(apr_status_t) ap_slotmem_do(ap_slotmem_storage_method *sm,