r5555 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Thu Nov 18 16:12:08 CET 2010


Author: phk
Date: 2010-11-18 16:12:08 +0100 (Thu, 18 Nov 2010)
New Revision: 5555

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_hash.c
   trunk/varnish-cache/bin/varnishd/hash_slinger.h
   trunk/varnish-cache/bin/varnishd/stevedore.c
   trunk/varnish-cache/bin/varnishd/stevedore.h
Log:
Move the oc default methods and HSH_Object() into stevedore.c where
it belongs (more)



Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2010-11-18 09:42:18 UTC (rev 5554)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2010-11-18 15:12:08 UTC (rev 5555)
@@ -634,7 +634,7 @@
 	}
 
 	if (sp->wrk->cacheable)
-		HSH_Object(sp);
+		STV_Object(sp);
 
 	if (sp->wrk->do_esi)
 		ESI_Parse(sp);

Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-11-18 09:42:18 UTC (rev 5554)
+++ trunk/varnish-cache/bin/varnishd/cache_hash.c	2010-11-18 15:12:08 UTC (rev 5555)
@@ -71,42 +71,6 @@
 
 static const struct hash_slinger *hash;
 
-/*---------------------------------------------------------------------
- * Default objcore methods
- */
-
-static struct object * __match_proto__(getobj_f)
-default_oc_getobj(struct worker *wrk, struct objcore *oc)
-{
-	struct object *o;
-
-	(void)wrk;
-	if (oc->priv == NULL)
-		return (NULL);
-	CAST_OBJ_NOTNULL(o, oc->priv, OBJECT_MAGIC);
-	return (o);
-}
-
-static void
-default_oc_freeobj(struct objcore *oc)
-{
-	struct object *o;
-
-	CAST_OBJ_NOTNULL(o, oc->priv, OBJECT_MAGIC);
-	oc->priv = NULL;
-
-	HSH_Freestore(o);
-	if (o->objstore != NULL)
-		STV_free(o->objstore);
-	else
-		FREE_OBJ(o);
-}
-
-struct objcore_methods default_oc_methods = {
-	.getobj = default_oc_getobj,
-	.freeobj = default_oc_freeobj,
-};
-
 /*---------------------------------------------------------------------*/
 double
 HSH_Grace(double g)
@@ -116,22 +80,6 @@
 	return (g);
 }
 
-/*
- * XXX: this should vector through stevedore.c instead of calling the
- * XXX: member function directly.
- */
-
-void
-HSH_Object(const struct sess *sp)
-{
-	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
-	CHECK_OBJ_NOTNULL(sp->obj->objstore, STORAGE_MAGIC);
-	CHECK_OBJ_NOTNULL(sp->obj->objstore->stevedore, STEVEDORE_MAGIC);
-	AssertObjBusy(sp->obj);
-	if (sp->obj->objstore->stevedore->object != NULL)
-		sp->obj->objstore->stevedore->object(sp);
-}
-
 /* Precreate an objhead and object for later use */
 void
 HSH_Prealloc(const struct sess *sp)

Modified: trunk/varnish-cache/bin/varnishd/hash_slinger.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/hash_slinger.h	2010-11-18 09:42:18 UTC (rev 5554)
+++ trunk/varnish-cache/bin/varnishd/hash_slinger.h	2010-11-18 15:12:08 UTC (rev 5555)
@@ -50,7 +50,6 @@
 };
 
 /* cache_hash.c */
-void HSH_Object(const struct sess *sp);
 void HSH_Prealloc(const struct sess *sp);
 void HSH_Cleanup(struct worker *w);
 void HSH_Freestore(struct object *o);

Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c	2010-11-18 09:42:18 UTC (rev 5554)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c	2010-11-18 15:12:08 UTC (rev 5555)
@@ -43,6 +43,7 @@
 
 #include "cache.h"
 #include "stevedore.h"
+#include "hash_slinger.h"
 #include "cli_priv.h"
 
 #define TRANSIENT_NAME	"Transient"
@@ -194,6 +195,53 @@
 	return (o);
 }
 
+/*---------------------------------------------------------------------
+ * Default objcore methods
+ */
+
+static struct object * __match_proto__(getobj_f)
+default_oc_getobj(struct worker *wrk, struct objcore *oc)
+{
+	struct object *o;
+
+	(void)wrk;
+	if (oc->priv == NULL)
+		return (NULL);
+	CAST_OBJ_NOTNULL(o, oc->priv, OBJECT_MAGIC);
+	return (o);
+}
+
+static void
+default_oc_freeobj(struct objcore *oc)
+{
+	struct object *o;
+
+	CAST_OBJ_NOTNULL(o, oc->priv, OBJECT_MAGIC);
+	oc->priv = NULL;
+
+	HSH_Freestore(o);
+	if (o->objstore != NULL)
+		STV_free(o->objstore);
+	else
+		FREE_OBJ(o);
+}
+
+struct objcore_methods default_oc_methods = {
+	.getobj = default_oc_getobj,
+	.freeobj = default_oc_freeobj,
+};
+
+void
+STV_Object(const struct sess *sp)
+{
+	CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
+	CHECK_OBJ_NOTNULL(sp->obj->objstore, STORAGE_MAGIC);
+	CHECK_OBJ_NOTNULL(sp->obj->objstore->stevedore, STEVEDORE_MAGIC);
+	AssertObjBusy(sp->obj);
+	if (sp->obj->objstore->stevedore->object != NULL)
+		sp->obj->objstore->stevedore->object(sp);
+}
+
 /*********************************************************************/
 
 struct storage *

Modified: trunk/varnish-cache/bin/varnishd/stevedore.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.h	2010-11-18 09:42:18 UTC (rev 5554)
+++ trunk/varnish-cache/bin/varnishd/stevedore.h	2010-11-18 15:12:08 UTC (rev 5555)
@@ -77,6 +77,7 @@
 struct lru *STV_lru(const struct storage *st);
 void STV_Config(const char *spec);
 void STV_Config_Transient(void);
+void STV_Object(const struct sess *sp);
 
 struct lru *LRU_Alloc(void);
 




More information about the varnish-commit mailing list