[master] 5da2d31 Move struct object and its methods to storage.h

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 15 21:31:32 CEST 2014


commit 5da2d3192731ee86d9efb42daa46fe690700443a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 15 19:14:48 2014 +0000

    Move struct object and its methods to storage.h

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 86f3c34..3add9ef 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -395,18 +395,6 @@ struct storeobj {
 	uintptr_t		priv2;
 };
 
-typedef struct object *getobj_f(struct dstat *ds, struct objcore *oc);
-typedef void updatemeta_f(struct objcore *oc, struct dstat *);
-typedef void freeobj_f(struct dstat *ds, struct objcore *oc);
-typedef struct lru *getlru_f(const struct objcore *oc);
-
-struct storeobj_methods {
-	getobj_f	*getobj;
-	updatemeta_f	*updatemeta;
-	freeobj_f	*freeobj;
-	getlru_f	*getlru;
-};
-
 /* Object core structure ---------------------------------------------
  * Objects have sideways references in the binary heap and the LRU list
  * and we want to avoid paging in a lot of objects just to move them up
@@ -531,8 +519,6 @@ struct busyobj {
 
 /* Object structure --------------------------------------------------*/
 
-VTAILQ_HEAD(storagehead, storage);
-
 enum obj_attr {
 #define OBJ_ATTR(U, l)	OA_##U,
 #include "tbl/obj_attr.h"
@@ -545,25 +531,6 @@ enum obj_flags {
 #undef OBJ_FLAG
 };
 
-struct object {
-	unsigned		magic;
-#define OBJECT_MAGIC		0x32851d42
-	struct storage		*objstore;
-
-	char			oa_vxid[4];
-	uint8_t			*oa_vary;
-	uint8_t			*oa_http;
-	uint8_t			oa_flags[1];
-	char			oa_gzipbits[24];
-	char			oa_lastmodified[8];
-
-	// struct stevedore	*stevedore;
-	struct storagehead	list;
-	ssize_t			len;
-
-	struct storage		*esidata;
-};
-
 /*--------------------------------------------------------------------*/
 
 struct req {
diff --git a/bin/varnishd/storage/storage.h b/bin/varnishd/storage/storage.h
index 56c72b8..e9a12be 100644
--- a/bin/varnishd/storage/storage.h
+++ b/bin/varnishd/storage/storage.h
@@ -34,6 +34,7 @@
 struct stv_objsecrets;
 struct stevedore;
 struct sess;
+struct dstat;
 struct busyobj;
 struct objcore;
 struct worker;
@@ -55,6 +56,43 @@ struct storage {
 	unsigned		space;
 };
 
+/* Object ------------------------------------------------------------*/
+
+VTAILQ_HEAD(storagehead, storage);
+
+struct object {
+	unsigned		magic;
+#define OBJECT_MAGIC		0x32851d42
+	struct storage		*objstore;
+
+	char			oa_vxid[4];
+	uint8_t			*oa_vary;
+	uint8_t			*oa_http;
+	uint8_t			oa_flags[1];
+	char			oa_gzipbits[24];
+	char			oa_lastmodified[8];
+
+	struct storagehead	list;
+	ssize_t			len;
+
+	struct storage		*esidata;
+};
+
+/* -------------------------------------------------------------------*/
+
+typedef struct object *getobj_f(struct dstat *ds, struct objcore *oc);
+typedef void updatemeta_f(struct objcore *oc, struct dstat *);
+typedef void freeobj_f(struct dstat *ds, struct objcore *oc);
+typedef struct lru *getlru_f(const struct objcore *oc);
+
+struct storeobj_methods {
+	getobj_f	*getobj;
+	updatemeta_f	*updatemeta;
+	freeobj_f	*freeobj;
+	getlru_f	*getlru;
+};
+
+/* Prototypes --------------------------------------------------------*/
 
 typedef void storage_init_f(struct stevedore *, int ac, char * const *av);
 typedef void storage_open_f(const struct stevedore *);



More information about the varnish-commit mailing list