Commit 1a190195 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Rename VSM "classes" to "categories"

parent 90361196
...@@ -83,14 +83,14 @@ vsm_lock_f *vsc_unlock = vsc_dummy_lock; ...@@ -83,14 +83,14 @@ vsm_lock_f *vsc_unlock = vsc_dummy_lock;
static const size_t vsc_overhead = PRNDUP(sizeof(struct vsc_head)); static const size_t vsc_overhead = PRNDUP(sizeof(struct vsc_head));
static struct vsc_seg * static struct vsc_seg *
vrt_vsc_mksegv(struct vsmw_cluster *vc, const char *class, vrt_vsc_mksegv(struct vsmw_cluster *vc, const char *category,
size_t payload, const char *fmt, va_list va) size_t payload, const char *fmt, va_list va)
{ {
struct vsc_seg *vsg; struct vsc_seg *vsg;
ALLOC_OBJ(vsg, VSC_SEG_MAGIC); ALLOC_OBJ(vsg, VSC_SEG_MAGIC);
AN(vsg); AN(vsg);
vsg->seg = VSMW_Allocv(heritage.proc_vsmw, vc, class, vsg->seg = VSMW_Allocv(heritage.proc_vsmw, vc, category,
VRT_VSC_Overhead(payload), fmt, va); VRT_VSC_Overhead(payload), fmt, va);
AN(vsg->seg); AN(vsg->seg);
vsg->vsm = heritage.proc_vsmw; vsg->vsm = heritage.proc_vsmw;
...@@ -101,13 +101,13 @@ vrt_vsc_mksegv(struct vsmw_cluster *vc, const char *class, ...@@ -101,13 +101,13 @@ vrt_vsc_mksegv(struct vsmw_cluster *vc, const char *class,
} }
static struct vsc_seg * static struct vsc_seg *
vrt_vsc_mksegf(const char *class, size_t payload, const char *fmt, ...) vrt_vsc_mksegf(const char *category, size_t payload, const char *fmt, ...)
{ {
va_list ap; va_list ap;
struct vsc_seg *vsg; struct vsc_seg *vsg;
va_start(ap, fmt); va_start(ap, fmt);
vsg = vrt_vsc_mksegv(NULL, class, payload, fmt, ap); vsg = vrt_vsc_mksegv(NULL, category, payload, fmt, ap);
va_end(ap); va_end(ap);
return (vsg); return (vsg);
} }
......
...@@ -114,7 +114,7 @@ struct vsmwseg { ...@@ -114,7 +114,7 @@ struct vsmwseg {
VTAILQ_ENTRY(vsmwseg) list; VTAILQ_ENTRY(vsmwseg) list;
struct vsmw_cluster *cluster; struct vsmw_cluster *cluster;
char *class; char *category;
size_t off; size_t off;
size_t len; size_t len;
char *id; char *id;
...@@ -163,7 +163,7 @@ vsmw_fmt_index(const struct vsmw *vsmw, const struct vsmwseg *seg, char act) ...@@ -163,7 +163,7 @@ vsmw_fmt_index(const struct vsmw *vsmw, const struct vsmwseg *seg, char act)
seg->cluster->fn, seg->cluster->fn,
seg->off, seg->off,
seg->len, seg->len,
seg->class, seg->category,
seg->id); seg->id);
} }
...@@ -257,7 +257,7 @@ vsmw_delseg(struct vsmw *vsmw, struct vsmwseg *seg) ...@@ -257,7 +257,7 @@ vsmw_delseg(struct vsmw *vsmw, struct vsmwseg *seg)
REPLACE(t, NULL); REPLACE(t, NULL);
vsmw->nsubs = 0; vsmw->nsubs = 0;
} }
REPLACE(seg->class, NULL); REPLACE(seg->category, NULL);
REPLACE(seg->id, NULL); REPLACE(seg->id, NULL);
FREE_OBJ(seg); FREE_OBJ(seg);
} }
...@@ -317,7 +317,7 @@ VSMW_NewCluster(struct vsmw *vsmw, size_t len, const char *pfx) ...@@ -317,7 +317,7 @@ VSMW_NewCluster(struct vsmw *vsmw, size_t len, const char *pfx)
vc->cseg = seg; vc->cseg = seg;
seg->len = vc->len; seg->len = vc->len;
seg->cluster = vc; seg->cluster = vc;
REPLACE(seg->class, ""); REPLACE(seg->category, "");
REPLACE(seg->id, ""); REPLACE(seg->id, "");
vc->refs++; vc->refs++;
vc->named = 1; vc->named = 1;
...@@ -365,7 +365,7 @@ VSMW_DestroyCluster(struct vsmw *vsmw, struct vsmw_cluster **vsmcp) ...@@ -365,7 +365,7 @@ VSMW_DestroyCluster(struct vsmw *vsmw, struct vsmw_cluster **vsmcp)
void * void *
VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc, VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc,
const char *class, size_t payload, const char *category, size_t payload,
const char *fmt, va_list va) const char *fmt, va_list va)
{ {
struct vsmwseg *seg; struct vsmwseg *seg;
...@@ -375,7 +375,7 @@ VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc, ...@@ -375,7 +375,7 @@ VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc,
ALLOC_OBJ(seg, VSMWSEG_MAGIC); ALLOC_OBJ(seg, VSMWSEG_MAGIC);
AN(seg); AN(seg);
REPLACE(seg->class, class); REPLACE(seg->category, category);
seg->len = PRNDUP(payload); seg->len = PRNDUP(payload);
VSB_clear(vsmw->vsb); VSB_clear(vsmw->vsb);
...@@ -384,7 +384,7 @@ VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc, ...@@ -384,7 +384,7 @@ VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc,
REPLACE(seg->id, VSB_data(vsmw->vsb)); REPLACE(seg->id, VSB_data(vsmw->vsb));
if (vc == NULL) if (vc == NULL)
vc = vsmw_newcluster(vsmw, seg->len, class); vc = vsmw_newcluster(vsmw, seg->len, category);
AN(vc); AN(vc);
vc->refs++; vc->refs++;
...@@ -402,13 +402,13 @@ VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc, ...@@ -402,13 +402,13 @@ VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc,
void * void *
VSMW_Allocf(struct vsmw *vsmw, struct vsmw_cluster *vc, VSMW_Allocf(struct vsmw *vsmw, struct vsmw_cluster *vc,
const char *class, size_t len, const char *fmt, ...) const char *category, size_t len, const char *fmt, ...)
{ {
va_list ap; va_list ap;
void *p; void *p;
va_start(ap, fmt); va_start(ap, fmt);
p = VSMW_Allocv(vsmw, vc, class, len, fmt, ap); p = VSMW_Allocv(vsmw, vc, category, len, fmt, ap);
va_end(ap); va_end(ap);
return (p); return (p);
} }
......
...@@ -196,7 +196,7 @@ extern struct params mgt_param; ...@@ -196,7 +196,7 @@ extern struct params mgt_param;
/* mgt_shmem.c */ /* mgt_shmem.c */
void mgt_SHM_Init(void); void mgt_SHM_Init(void);
void mgt_SHM_static_alloc(const void *, ssize_t size, void mgt_SHM_static_alloc(const void *, ssize_t size,
const char *class, const char *ident); const char *category, const char *ident);
void mgt_SHM_Create(void); void mgt_SHM_Create(void);
void mgt_SHM_Destroy(int keep); void mgt_SHM_Destroy(int keep);
......
...@@ -55,11 +55,11 @@ static struct vsmw *mgt_vsmw; ...@@ -55,11 +55,11 @@ static struct vsmw *mgt_vsmw;
void void
mgt_SHM_static_alloc(const void *ptr, ssize_t size, mgt_SHM_static_alloc(const void *ptr, ssize_t size,
const char *class, const char *ident) const char *category, const char *ident)
{ {
void *p; void *p;
p = VSMW_Allocf(mgt_vsmw, NULL, class, size, "%s", ident); p = VSMW_Allocf(mgt_vsmw, NULL, category, size, "%s", ident);
AN(p); AN(p);
memcpy(p, ptr, size); memcpy(p, ptr, size);
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* *
* This is the public API for the VSC access. * This is the public API for the VSC access.
* *
* VSC is a "subclass" of VSM. * VSC is a sub-category of VSM.
* *
*/ */
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* *
* This is the public API for the VSM access. * This is the public API for the VSM access.
* *
* The VSM "class" acts as parent class for the VSL and VSC subclasses. * The VSM category acts as parent category for the VSL and VSC sub-categories.
* *
*/ */
...@@ -49,7 +49,7 @@ struct vsm_fantom { ...@@ -49,7 +49,7 @@ struct vsm_fantom {
uintptr_t priv2; /* VSM private */ uintptr_t priv2; /* VSM private */
void *b; /* first byte of payload */ void *b; /* first byte of payload */
void *e; /* first byte past payload */ void *e; /* first byte past payload */
char *class; char *category;
char *ident; char *ident;
}; };
...@@ -73,7 +73,7 @@ struct vsm *VSM_New(void); ...@@ -73,7 +73,7 @@ struct vsm *VSM_New(void);
void VSM_Destroy(struct vsm **vd); void VSM_Destroy(struct vsm **vd);
/* /*
* Close and deallocate all storage and mappings. * Close and deallocate all storage and mappings.
* (including any VSC and VSL "sub-classes" XXX?) * (including any VSC and VSL "sub-category" XXX?)
*/ */
const char *VSM_Error(const struct vsm *vd); const char *VSM_Error(const struct vsm *vd);
...@@ -173,14 +173,14 @@ const struct vsm_valid *VSM_StillValid(const struct vsm *, const struct vsm_fant ...@@ -173,14 +173,14 @@ const struct vsm_valid *VSM_StillValid(const struct vsm *, const struct vsm_fant
*/ */
int VSM_Get(struct vsm *, struct vsm_fantom *vf, int VSM_Get(struct vsm *, struct vsm_fantom *vf,
const char *class, const char *ident); const char *category, const char *ident);
/* /*
* Find a chunk, produce fantom for it. * Find a chunk, produce fantom for it.
* Returns zero on failure. * Returns zero on failure.
* class is mandatory, ident optional. * category is mandatory, ident optional.
*/ */
char *VSM_Dup(struct vsm*, const char *class, const char *ident); char *VSM_Dup(struct vsm*, const char *category, const char *ident);
/* /*
* Returns a malloc'ed copy of the fanton. * Returns a malloc'ed copy of the fanton.
* *
......
...@@ -362,7 +362,7 @@ vsc_add_seg(const struct vsc *vsc, struct vsm *vsm, const struct vsm_fantom *fp) ...@@ -362,7 +362,7 @@ vsc_add_seg(const struct vsc *vsc, struct vsm *vsm, const struct vsm_fantom *fp)
assert(sp->head->ready > 0); assert(sp->head->ready > 0);
sp->body = (char*)sp->fantom->b + sp->head->body_offset; sp->body = (char*)sp->fantom->b + sp->head->body_offset;
if (!strcmp(fp->class, VSC_CLASS)) { if (!strcmp(fp->category, VSC_CLASS)) {
VTAILQ_FOREACH(spd, &vsc->segs, list) VTAILQ_FOREACH(spd, &vsc->segs, list)
if (spd->head->doc_id == sp->head->doc_id) if (spd->head->doc_id == sp->head->doc_id)
break; break;
...@@ -385,7 +385,7 @@ vsc_add_seg(const struct vsc *vsc, struct vsm *vsm, const struct vsm_fantom *fp) ...@@ -385,7 +385,7 @@ vsc_add_seg(const struct vsc *vsc, struct vsm *vsm, const struct vsm_fantom *fp)
VSB_destroy(&vsb); VSB_destroy(&vsb);
return (sp); return (sp);
} }
assert(!strcmp(fp->class, VSC_DOC_CLASS)); assert(!strcmp(fp->category, VSC_DOC_CLASS));
sp->vj = vjsn_parse(sp->body, &e); sp->vj = vjsn_parse(sp->body, &e);
XXXAZ(e); XXXAZ(e);
AN(sp->vj); AN(sp->vj);
...@@ -456,9 +456,9 @@ VSC_Iter(struct vsc *vsc, struct vsm *vsm, VSC_iter_f *fiter, void *priv) ...@@ -456,9 +456,9 @@ VSC_Iter(struct vsc *vsc, struct vsm *vsm, VSC_iter_f *fiter, void *priv)
AN(vsm); AN(vsm);
sp = VTAILQ_FIRST(&vsc->segs); sp = VTAILQ_FIRST(&vsc->segs);
VSM_FOREACH(&ifantom, vsm) { VSM_FOREACH(&ifantom, vsm) {
AN(ifantom.class); AN(ifantom.category);
if (strcmp(ifantom.class, VSC_CLASS) && if (strcmp(ifantom.category, VSC_CLASS) &&
strcmp(ifantom.class, VSC_DOC_CLASS)) strcmp(ifantom.category, VSC_DOC_CLASS))
continue; continue;
while (sp != NULL && while (sp != NULL &&
(strcmp(ifantom.ident, sp->fantom->ident) || (strcmp(ifantom.ident, sp->fantom->ident) ||
......
...@@ -878,9 +878,9 @@ VSM__itern(struct vsm *vd, struct vsm_fantom *vf) ...@@ -878,9 +878,9 @@ VSM__itern(struct vsm *vd, struct vsm_fantom *vf)
memset(vf, 0, sizeof *vf); memset(vf, 0, sizeof *vf);
vf->priv = VSM_PRIV_MERGE(vg->serial, vd->serial); vf->priv = VSM_PRIV_MERGE(vg->serial, vd->serial);
vf->priv2 = (uintptr_t)vg; vf->priv2 = (uintptr_t)vg;
vf->class = vg->av[4]; vf->category = vg->av[4];
vf->ident = vg->av[5]; vf->ident = vg->av[5];
AN(vf->class); AN(vf->category);
return (1); return (1);
} }
...@@ -901,7 +901,7 @@ VSM_Map(struct vsm *vd, struct vsm_fantom *vf) ...@@ -901,7 +901,7 @@ VSM_Map(struct vsm *vd, struct vsm_fantom *vf)
return (vsm_diag(vd, "VSM_Map: bad fantom")); return (vsm_diag(vd, "VSM_Map: bad fantom"));
assert(vg->serial == VSM_PRIV_LOW(vf->priv)); assert(vg->serial == VSM_PRIV_LOW(vf->priv));
assert(vg->av[4] == vf->class); assert(vg->av[4] == vf->category);
assert(vg->av[5] == vf->ident); assert(vg->av[5] == vf->ident);
if (vg->b != NULL) { if (vg->b != NULL) {
...@@ -1018,13 +1018,13 @@ VSM_StillValid(const struct vsm *vd, const struct vsm_fantom *vf) ...@@ -1018,13 +1018,13 @@ VSM_StillValid(const struct vsm *vd, const struct vsm_fantom *vf)
int int
VSM_Get(struct vsm *vd, struct vsm_fantom *vf, VSM_Get(struct vsm *vd, struct vsm_fantom *vf,
const char *class, const char *ident) const char *category, const char *ident)
{ {
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
AN(vd->attached); AN(vd->attached);
VSM_FOREACH(vf, vd) { VSM_FOREACH(vf, vd) {
if (strcmp(vf->class, class)) if (strcmp(vf->category, category))
continue; continue;
if (ident != NULL && strcmp(vf->ident, ident)) if (ident != NULL && strcmp(vf->ident, ident))
continue; continue;
...@@ -1037,7 +1037,7 @@ VSM_Get(struct vsm *vd, struct vsm_fantom *vf, ...@@ -1037,7 +1037,7 @@ VSM_Get(struct vsm *vd, struct vsm_fantom *vf,
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
char * char *
VSM_Dup(struct vsm *vd, const char *class, const char *ident) VSM_Dup(struct vsm *vd, const char *category, const char *ident)
{ {
struct vsm_fantom vf; struct vsm_fantom vf;
char *p = NULL; char *p = NULL;
...@@ -1045,7 +1045,7 @@ VSM_Dup(struct vsm *vd, const char *class, const char *ident) ...@@ -1045,7 +1045,7 @@ VSM_Dup(struct vsm *vd, const char *class, const char *ident)
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
AN(vd->attached); AN(vd->attached);
VSM_FOREACH(&vf, vd) { VSM_FOREACH(&vf, vd) {
if (strcmp(vf.class, class)) if (strcmp(vf.category, category))
continue; continue;
if (ident != NULL && strcmp(vf.ident, ident)) if (ident != NULL && strcmp(vf.ident, ident))
continue; continue;
......
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