Commit 4b528257 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Move the storage_simples "getobj" helper method from oc to stv.

parent 6ed66f50
...@@ -34,7 +34,6 @@ typedef void objupdatemeta_f(struct worker *, struct objcore *); ...@@ -34,7 +34,6 @@ typedef void objupdatemeta_f(struct worker *, struct objcore *);
typedef void objfree_f(struct worker *, struct objcore *); typedef void objfree_f(struct worker *, struct objcore *);
/* This method is only used by SML (...to get to persistent) */ /* This method is only used by SML (...to get to persistent) */
typedef struct object *sml_getobj_f(struct worker *, struct objcore *);
typedef int objiterator_f(struct worker *, struct objcore *, typedef int objiterator_f(struct worker *, struct objcore *,
void *priv, objiterate_f *func); void *priv, objiterate_f *func);
...@@ -54,8 +53,6 @@ struct obj_methods { ...@@ -54,8 +53,6 @@ struct obj_methods {
objfree_f *objfree; objfree_f *objfree;
objupdatemeta_f *objupdatemeta; objupdatemeta_f *objupdatemeta;
sml_getobj_f *sml_getobj;
objiterator_f *objiterator; objiterator_f *objiterator;
objgetspace_f *objgetspace; objgetspace_f *objgetspace;
objextend_f *objextend; objextend_f *objextend;
......
...@@ -59,8 +59,6 @@ struct storage { ...@@ -59,8 +59,6 @@ struct storage {
typedef void storage_init_f(struct stevedore *, int ac, char * const *av); typedef void storage_init_f(struct stevedore *, int ac, char * const *av);
typedef void storage_open_f(struct stevedore *); typedef void storage_open_f(struct stevedore *);
typedef struct storage *storage_alloc_f(const struct stevedore *, size_t size);
typedef void storage_free_f(struct storage *);
typedef int storage_allocobj_f(struct worker *, const struct stevedore *, typedef int storage_allocobj_f(struct worker *, const struct stevedore *,
struct objcore *, unsigned ltot, int really); struct objcore *, unsigned ltot, int really);
typedef void storage_close_f(const struct stevedore *); typedef void storage_close_f(const struct stevedore *);
...@@ -70,6 +68,10 @@ typedef int storage_baninfo_f(const struct stevedore *, enum baninfo event, ...@@ -70,6 +68,10 @@ typedef int storage_baninfo_f(const struct stevedore *, enum baninfo event,
typedef void storage_banexport_f(const struct stevedore *, const uint8_t *bans, typedef void storage_banexport_f(const struct stevedore *, const uint8_t *bans,
unsigned len); unsigned len);
typedef struct object *storage_getobj_f(struct worker *, struct objcore *);
typedef struct storage *storage_alloc_f(const struct stevedore *, size_t size);
typedef void storage_free_f(struct storage *);
/* Prototypes for VCL variable responders */ /* Prototypes for VCL variable responders */
#define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *); #define VRTSTVTYPE(ct) typedef ct storage_var_##ct(const struct stevedore *);
#include "tbl/vrt_stv_var.h" #include "tbl/vrt_stv_var.h"
...@@ -86,6 +88,7 @@ struct stevedore { ...@@ -86,6 +88,7 @@ struct stevedore {
storage_open_f *open; /* called by cache process */ storage_open_f *open; /* called by cache process */
storage_alloc_f *sml_alloc; /* --//-- only if SML */ storage_alloc_f *sml_alloc; /* --//-- only if SML */
storage_free_f *sml_free; /* --//-- only if SML */ storage_free_f *sml_free; /* --//-- only if SML */
storage_getobj_f *sml_getobj; /* --//-- only if SML */
storage_close_f *close; /* --//-- */ storage_close_f *close; /* --//-- */
storage_allocobj_f *allocobj; /* --//-- */ storage_allocobj_f *allocobj; /* --//-- */
storage_signal_close_f *signal_close; /* --//-- */ storage_signal_close_f *signal_close; /* --//-- */
......
...@@ -593,13 +593,15 @@ const struct stevedore smp_stevedore = { ...@@ -593,13 +593,15 @@ const struct stevedore smp_stevedore = {
.init = smp_mgt_init, .init = smp_mgt_init,
.open = smp_open, .open = smp_open,
.close = smp_close, .close = smp_close,
.sml_alloc = smp_alloc,
.allocobj = smp_allocobj, .allocobj = smp_allocobj,
.sml_free = NULL,
.signal_close = smp_signal_close, .signal_close = smp_signal_close,
.baninfo = smp_baninfo, .baninfo = smp_baninfo,
.banexport = smp_banexport, .banexport = smp_banexport,
.methods = &smp_oc_realmethods, .methods = &smp_oc_realmethods,
.sml_alloc = smp_alloc,
.sml_free = NULL,
.sml_getobj = smp_sml_getobj,
}; };
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
...@@ -686,7 +688,6 @@ SMP_Init(void) ...@@ -686,7 +688,6 @@ SMP_Init(void)
lck_smp = Lck_CreateClass("smp"); lck_smp = Lck_CreateClass("smp");
CLI_AddFuncs(debug_cmds); CLI_AddFuncs(debug_cmds);
smp_oc_realmethods = SML_methods; smp_oc_realmethods = SML_methods;
smp_oc_realmethods.sml_getobj = smp_oc_methods.sml_getobj;
smp_oc_realmethods.objupdatemeta = smp_oc_methods.objupdatemeta; smp_oc_realmethods.objupdatemeta = smp_oc_methods.objupdatemeta;
smp_oc_realmethods.objfree = smp_oc_methods.objfree; smp_oc_realmethods.objfree = smp_oc_methods.objfree;
smp_oc_realmethods.objtouch = NULL; smp_oc_realmethods.objtouch = NULL;
......
...@@ -308,6 +308,7 @@ void smp_close_seg(struct smp_sc *sc, struct smp_seg *sg); ...@@ -308,6 +308,7 @@ void smp_close_seg(struct smp_sc *sc, struct smp_seg *sg);
void smp_init_oc(struct objcore *oc, struct smp_seg *sg, unsigned objidx); void smp_init_oc(struct objcore *oc, struct smp_seg *sg, unsigned objidx);
void smp_save_segs(struct smp_sc *sc); void smp_save_segs(struct smp_sc *sc);
extern const struct obj_methods smp_oc_methods; extern const struct obj_methods smp_oc_methods;
storage_getobj_f smp_sml_getobj;
/* storage_persistent_subr.c */ /* storage_persistent_subr.c */
......
...@@ -388,8 +388,8 @@ smp_loaded_st(const struct smp_sc *sc, const struct smp_seg *sg, ...@@ -388,8 +388,8 @@ smp_loaded_st(const struct smp_sc *sc, const struct smp_seg *sg,
* objcore methods for persistent objects * objcore methods for persistent objects
*/ */
static struct object * struct object *
smp_oc_sml_getobj(struct worker *wrk, struct objcore *oc) smp_sml_getobj(struct worker *wrk, struct objcore *oc)
{ {
struct object *o; struct object *o;
struct smp_seg *sg; struct smp_seg *sg;
...@@ -402,9 +402,6 @@ smp_oc_sml_getobj(struct worker *wrk, struct objcore *oc) ...@@ -402,9 +402,6 @@ smp_oc_sml_getobj(struct worker *wrk, struct objcore *oc)
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
AN(oc->stobj->stevedore); AN(oc->stobj->stevedore);
/* Some calls are direct, but they should match anyway */
assert(oc->stobj->stevedore->methods->sml_getobj == smp_oc_sml_getobj);
CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC); CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC);
so = smp_find_so(sg, oc->stobj->priv2); so = smp_find_so(sg, oc->stobj->priv2);
...@@ -513,7 +510,6 @@ smp_oc_objfree(struct worker *wrk, struct objcore *oc) ...@@ -513,7 +510,6 @@ smp_oc_objfree(struct worker *wrk, struct objcore *oc)
} }
const struct obj_methods smp_oc_methods = { const struct obj_methods smp_oc_methods = {
.sml_getobj = smp_oc_sml_getobj,
.objupdatemeta = smp_oc_objupdatemeta, .objupdatemeta = smp_oc_objupdatemeta,
.objfree = smp_oc_objfree, .objfree = smp_oc_objfree,
}; };
......
...@@ -156,14 +156,15 @@ SML_allocobj(struct worker *wrk, const struct stevedore *stv, ...@@ -156,14 +156,15 @@ SML_allocobj(struct worker *wrk, const struct stevedore *stv,
static struct object * static struct object *
sml_getobj(struct worker *wrk, struct objcore *oc) sml_getobj(struct worker *wrk, struct objcore *oc)
{ {
const struct obj_methods *m; const struct stevedore *stv;
struct object *o; struct object *o;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
m = oc->stobj->stevedore->methods; stv = oc->stobj->stevedore;
if (m->sml_getobj != NULL) CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC);
return (m->sml_getobj(wrk, oc)); if (stv->sml_getobj != NULL)
return (stv->sml_getobj(wrk, oc));
if (oc->stobj->priv == NULL) if (oc->stobj->priv == NULL)
return (NULL); return (NULL);
CAST_OBJ_NOTNULL(o, oc->stobj->priv, OBJECT_MAGIC); CAST_OBJ_NOTNULL(o, oc->stobj->priv, OBJECT_MAGIC);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment