]> granicus.if.org Git - apache/commitdiff
Introduce an socache iterator 'userctx' for the user to track the
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 26 Jun 2010 00:26:01 +0000 (00:26 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 26 Jun 2010 00:26:01 +0000 (00:26 +0000)
context of their own callback.

Breaks API, but we probably wanted an mmn reset between .6 and .7
betas for unintentional/unnoticed ABI breaks.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@958157 13f79535-47bb-0310-9956-ffa450edef68

include/ap_mmn.h
include/ap_socache.h
modules/cache/mod_socache_dbm.c
modules/cache/mod_socache_dc.c
modules/cache/mod_socache_memcache.c
modules/cache/mod_socache_shmcb.c

index 89cca6cc108269480ae0de5459193173c3efbf4f..8f0a0adc09ff87f4d73e7259300d6cc871e63a18 100644 (file)
  * 20100609.0 (2.3.6-dev)  Dropped ap_args_to_table due to missing constraints.
  * 20100609.1 (2.3.7-dev)  Introduce ap_log_cserror()
  * 20100609.2 (2.3.7-dev)  Add deferred write pool to core_output_filter_ctx
+ * 20100625.0 (2.3.7-dev)  Add 'userctx' to socache iterator callback prototype
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20100609
+#define MODULE_MAGIC_NUMBER_MAJOR 20100625
 #endif
 #define MODULE_MAGIC_NUMBER_MINOR 2                     /* 0...n */
 
index ff909971493e4992598b2478daa711ba0a1d4382..e00c316f6d79a4968f3b2f3b4c980eaa645fef3f 100644 (file)
@@ -61,25 +61,27 @@ struct ap_socache_hints {
 
 /**
  * Iterator callback prototype for the ap_socache_provider_t->iterate() method
- * @param instance The cache instance (passed through)
- * @param s Associated server structure (passed through)
+ * @param instance The cache instance
+ * @param s Associated server context (for logging)
+ * @param userctx User defined pointer passed from the iterator call
  * @param id Unique ID for the object (binary blob)
  * with a trailing null char for convenience
  * @param idlen Length of id blob
  * @param data Output buffer to place retrieved data (binary blob)
  * with a trailing null char for convenience
  * @param datalen Length of data buffer
- * @param pool Pool for temporary allocations (passed through)
+ * @param pool Pool for temporary allocations
  * @return APR status value; return APR_SUCCESS or the iteration will halt;
  * this value is returned to the ap_socache_provider_t->iterate() caller
  */
-typedef apr_status_t (*ap_socache_iterator_t)(ap_socache_instance_t *instance,
-                                              server_rec *s,
-                                              const unsigned char *id,
-                                              unsigned int idlen,
-                                              const unsigned char *data,
-                                              unsigned int datalen,
-                                              apr_pool_t *pool);
+typedef apr_status_t (ap_socache_iterator_t)(ap_socache_instance_t *instance,
+                                             server_rec *s,
+                                             void *userctx,
+                                             const unsigned char *id,
+                                             unsigned int idlen,
+                                             const unsigned char *data,
+                                             unsigned int datalen,
+                                             apr_pool_t *pool);
 
 /** A socache provider structure.  socache providers are registered
  * with the ap_provider.h interface using the AP_SOCACHE_PROVIDER_*
@@ -193,15 +195,16 @@ typedef struct ap_socache_provider_t {
     /**
      * Dump all cached objects through an iterator callback.
      * @param instance The cache instance
-     * @param s Associated server structure (for logging purposes)
-     * @param iterator The user provided callback which will receive
+     * @param s Associated server context (for processing and logging)
+     * @param userctx User defined pointer passed through to the iterator
+     * @param iterator The user provided callback function which will receive
      * individual calls for each unexpired id/data pair
      * @param pool Pool for temporary allocations.
      * @return APR status value; APR_NOTFOUND if the object was not
      * found
      */
     apr_status_t (*iterate)(ap_socache_instance_t *instance, server_rec *s,
-                            ap_socache_iterator_t *iterator,
+                            void *userctx, ap_socache_iterator_t *iterator,
                             apr_pool_t *pool);
 
 } ap_socache_provider_t;
index 0fc302988002713d0592c3f22175becdd6431c6f..728e1f1097a689cde393ee3bc33b71e2e60132a5 100644 (file)
@@ -503,7 +503,7 @@ static void socache_dbm_status(ap_socache_instance_t *ctx, request_rec *r,
 }
 
 static apr_status_t socache_dbm_iterate(ap_socache_instance_t *ctx,
-                                        server_rec *s,
+                                        server_rec *s, void *userctx,
                                         ap_socache_iterator_t *iterator,
                                         apr_pool_t *pool)
 {
@@ -539,7 +539,8 @@ static apr_status_t socache_dbm_iterate(ap_socache_instance_t *ctx,
                 expired = TRUE;
         }
         if (!expired) {
-            rv = (*iterator)(ctx, s, (unsigned char *)dbmkey.dptr, dbmkey.dsize,
+            rv = (*iterator)(ctx, s, userctx,
+                             (unsigned char *)dbmkey.dptr, dbmkey.dsize,
                              (unsigned char *)dbmval.dptr + sizeof(apr_time_t),
                              dbmval.dsize - sizeof(apr_time_t), pool);
             ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s,
index 674a6a7bcf23611bb6a5150a7fedcfe5930e75fb..74b879cb2298479b3ae48b6c0cdd9d078a7913b9 100644 (file)
@@ -155,7 +155,7 @@ static void socache_dc_status(ap_socache_instance_t *ctx, request_rec *r, int fl
 }
 
 static apr_status_t socache_dc_iterate(ap_socache_instance_t *instance,
-                                       server_rec *s,
+                                       server_rec *s, void *userctx,
                                        ap_socache_iterator_t *iterator,
                                        apr_pool_t *pool)
 {
index 0d4858189cc66e25646b37855070bee9720b4bac..9a3f26eeec456d08e4fd87dadc57de882215ceff 100644 (file)
@@ -288,7 +288,7 @@ static void socache_mc_status(ap_socache_instance_t *ctx, request_rec *r, int fl
 }
 
 static apr_status_t socache_mc_iterate(ap_socache_instance_t *instance,
-                                       server_rec *s,
+                                       server_rec *s, void *userctx,
                                        ap_socache_iterator_t *iterator,
                                        apr_pool_t *pool)
 {
index 952b810f1903afde1008cf403edf4642910fa635..bba1e9a47748e1006770ec75ae16f5ce68343c0d 100644 (file)
@@ -259,6 +259,7 @@ static int shmcb_subcache_remove(server_rec *, SHMCBHeader *, SHMCBSubcache *,
 /* Returns result of the (iterator)() call, zero is success (continue) */
 static apr_status_t shmcb_subcache_iterate(ap_socache_instance_t *instance,
                                            server_rec *s,
+                                           void *userctx,
                                            SHMCBHeader *header,
                                            SHMCBSubcache *subcache,
                                            ap_socache_iterator_t *iterator,
@@ -634,7 +635,7 @@ static void socache_shmcb_status(ap_socache_instance_t *ctx,
 }
 
 static apr_status_t socache_shmcb_iterate(ap_socache_instance_t *instance,
-                                          server_rec *s,
+                                          server_rec *s, void *userctx,
                                           ap_socache_iterator_t *iterator,
                                           apr_pool_t *pool)
 {
@@ -651,8 +652,8 @@ static apr_status_t socache_shmcb_iterate(ap_socache_instance_t *instance,
     /* Iterate over the subcaches */
     for (loop = 0; loop < header->subcache_num && rv == APR_SUCCESS; loop++) {
         SHMCBSubcache *subcache = SHMCB_SUBCACHE(header, loop);
-        rv = shmcb_subcache_iterate(instance, s, header, subcache, iterator,
-                                    &buf, &buflen, pool, now);
+        rv = shmcb_subcache_iterate(instance, s, userctx, header, subcache,
+                                    iterator, &buf, &buflen, pool, now);
     }
     return rv;
 }
@@ -911,6 +912,7 @@ static int shmcb_subcache_remove(server_rec *s, SHMCBHeader *header,
 
 static apr_status_t shmcb_subcache_iterate(ap_socache_instance_t *instance,
                                            server_rec *s,
+                                           void *userctx,
                                            SHMCBHeader *header,
                                            SHMCBSubcache *subcache,
                                            ap_socache_iterator_t *iterator,
@@ -970,7 +972,7 @@ static apr_status_t shmcb_subcache_iterate(ap_socache_instance_t *instance,
                                          data_offset, dest_len);
                 dest[dest_len] = '\0';
 
-                rv = (*iterator)(instance, s, id, idx->id_len,
+                rv = (*iterator)(instance, s, userctx, id, idx->id_len,
                                  dest, dest_len, pool);
                 ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s,
                              "shmcb entry iterated");