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;
static const size_t vsc_overhead = PRNDUP(sizeof(struct vsc_head));
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)
{
struct vsc_seg *vsg;
ALLOC_OBJ(vsg, VSC_SEG_MAGIC);
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);
AN(vsg->seg);
vsg->vsm = heritage.proc_vsmw;
......@@ -101,13 +101,13 @@ vrt_vsc_mksegv(struct vsmw_cluster *vc, const char *class,
}
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;
struct vsc_seg *vsg;
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);
return (vsg);
}
......
......@@ -114,7 +114,7 @@ struct vsmwseg {
VTAILQ_ENTRY(vsmwseg) list;
struct vsmw_cluster *cluster;
char *class;
char *category;
size_t off;
size_t len;
char *id;
......@@ -163,7 +163,7 @@ vsmw_fmt_index(const struct vsmw *vsmw, const struct vsmwseg *seg, char act)
seg->cluster->fn,
seg->off,
seg->len,
seg->class,
seg->category,
seg->id);
}
......@@ -257,7 +257,7 @@ vsmw_delseg(struct vsmw *vsmw, struct vsmwseg *seg)
REPLACE(t, NULL);
vsmw->nsubs = 0;
}
REPLACE(seg->class, NULL);
REPLACE(seg->category, NULL);
REPLACE(seg->id, NULL);
FREE_OBJ(seg);
}
......@@ -317,7 +317,7 @@ VSMW_NewCluster(struct vsmw *vsmw, size_t len, const char *pfx)
vc->cseg = seg;
seg->len = vc->len;
seg->cluster = vc;
REPLACE(seg->class, "");
REPLACE(seg->category, "");
REPLACE(seg->id, "");
vc->refs++;
vc->named = 1;
......@@ -365,7 +365,7 @@ VSMW_DestroyCluster(struct vsmw *vsmw, struct vsmw_cluster **vsmcp)
void *
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)
{
struct vsmwseg *seg;
......@@ -375,7 +375,7 @@ VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc,
ALLOC_OBJ(seg, VSMWSEG_MAGIC);
AN(seg);
REPLACE(seg->class, class);
REPLACE(seg->category, category);
seg->len = PRNDUP(payload);
VSB_clear(vsmw->vsb);
......@@ -384,7 +384,7 @@ VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc,
REPLACE(seg->id, VSB_data(vsmw->vsb));
if (vc == NULL)
vc = vsmw_newcluster(vsmw, seg->len, class);
vc = vsmw_newcluster(vsmw, seg->len, category);
AN(vc);
vc->refs++;
......@@ -402,13 +402,13 @@ VSMW_Allocv(struct vsmw *vsmw, struct vsmw_cluster *vc,
void *
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;
void *p;
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);
return (p);
}
......
......@@ -196,7 +196,7 @@ extern struct params mgt_param;
/* mgt_shmem.c */
void mgt_SHM_Init(void);
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_Destroy(int keep);
......
......@@ -55,11 +55,11 @@ static struct vsmw *mgt_vsmw;
void
mgt_SHM_static_alloc(const void *ptr, ssize_t size,
const char *class, const char *ident)
const char *category, const char *ident)
{
void *p;
p = VSMW_Allocf(mgt_vsmw, NULL, class, size, "%s", ident);
p = VSMW_Allocf(mgt_vsmw, NULL, category, size, "%s", ident);
AN(p);
memcpy(p, ptr, size);
}
......
......@@ -30,7 +30,7 @@
*
* 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 @@
*
* 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 {
uintptr_t priv2; /* VSM private */
void *b; /* first byte of payload */
void *e; /* first byte past payload */
char *class;
char *category;
char *ident;
};
......@@ -73,7 +73,7 @@ struct vsm *VSM_New(void);
void VSM_Destroy(struct vsm **vd);
/*
* 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);
......@@ -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,
const char *class, const char *ident);
const char *category, const char *ident);
/*
* Find a chunk, produce fantom for it.
* 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.
*
......
......@@ -362,7 +362,7 @@ vsc_add_seg(const struct vsc *vsc, struct vsm *vsm, const struct vsm_fantom *fp)
assert(sp->head->ready > 0);
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)
if (spd->head->doc_id == sp->head->doc_id)
break;
......@@ -385,7 +385,7 @@ vsc_add_seg(const struct vsc *vsc, struct vsm *vsm, const struct vsm_fantom *fp)
VSB_destroy(&vsb);
return (sp);
}
assert(!strcmp(fp->class, VSC_DOC_CLASS));
assert(!strcmp(fp->category, VSC_DOC_CLASS));
sp->vj = vjsn_parse(sp->body, &e);
XXXAZ(e);
AN(sp->vj);
......@@ -456,9 +456,9 @@ VSC_Iter(struct vsc *vsc, struct vsm *vsm, VSC_iter_f *fiter, void *priv)
AN(vsm);
sp = VTAILQ_FIRST(&vsc->segs);
VSM_FOREACH(&ifantom, vsm) {
AN(ifantom.class);
if (strcmp(ifantom.class, VSC_CLASS) &&
strcmp(ifantom.class, VSC_DOC_CLASS))
AN(ifantom.category);
if (strcmp(ifantom.category, VSC_CLASS) &&
strcmp(ifantom.category, VSC_DOC_CLASS))
continue;
while (sp != NULL &&
(strcmp(ifantom.ident, sp->fantom->ident) ||
......
......@@ -878,9 +878,9 @@ VSM__itern(struct vsm *vd, struct vsm_fantom *vf)
memset(vf, 0, sizeof *vf);
vf->priv = VSM_PRIV_MERGE(vg->serial, vd->serial);
vf->priv2 = (uintptr_t)vg;
vf->class = vg->av[4];
vf->category = vg->av[4];
vf->ident = vg->av[5];
AN(vf->class);
AN(vf->category);
return (1);
}
......@@ -901,7 +901,7 @@ VSM_Map(struct vsm *vd, struct vsm_fantom *vf)
return (vsm_diag(vd, "VSM_Map: bad fantom"));
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);
if (vg->b != NULL) {
......@@ -1018,13 +1018,13 @@ VSM_StillValid(const struct vsm *vd, const struct vsm_fantom *vf)
int
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);
AN(vd->attached);
VSM_FOREACH(vf, vd) {
if (strcmp(vf->class, class))
if (strcmp(vf->category, category))
continue;
if (ident != NULL && strcmp(vf->ident, ident))
continue;
......@@ -1037,7 +1037,7 @@ VSM_Get(struct vsm *vd, struct vsm_fantom *vf,
/*--------------------------------------------------------------------*/
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;
char *p = NULL;
......@@ -1045,7 +1045,7 @@ VSM_Dup(struct vsm *vd, const char *class, const char *ident)
CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
AN(vd->attached);
VSM_FOREACH(&vf, vd) {
if (strcmp(vf.class, class))
if (strcmp(vf.category, category))
continue;
if (ident != NULL && strcmp(vf.ident, ident))
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