typedef void storage_init_f(struct stevedore *, const char *spec);
typedef void storage_open_f(struct stevedore *);
typedef struct storage *storage_alloc_f(struct stevedore *, size_t size);
+typedef void storage_trim_f(struct storage *, size_t size);
typedef void storage_free_f(struct storage *);
typedef void storage_send_f(struct storage *, struct sess *);
storage_init_f *init; /* called by mgt process */
storage_open_f *open; /* called by cache process */
storage_alloc_f *alloc;
+ storage_trim_f *trim;
storage_free_f *free;
storage_send_f *send;
{
struct smf *sp, *sp2;
- bytes += (sc->pagesize - 1);
- bytes &= ~(sc->pagesize - 1);
TAILQ_FOREACH(sp, &sc->free, status) {
if (sp->size >= bytes)
break;
smf_alloc(struct stevedore *st, unsigned size)
{
struct smf *smf;
+ struct smf_sc *sc = st->priv;
- smf = alloc_smf(st->priv, size);
+ size += (sc->pagesize - 1);
+ size &= ~(sc->pagesize - 1);
+ smf = alloc_smf(sc, size);
assert(smf != NULL);
+ smf->s.space = size;
smf->s.priv = smf;
smf->s.ptr = smf->ptr;
- smf->s.len = size;
+ smf->s.len = 0;
smf->s.stevedore = st;
return (&smf->s);
}
/*--------------------------------------------------------------------*/
+static void
+smf_trim(struct storage *s, size_t size)
+{
+
+ /* XXX: implement */
+}
+
+/*--------------------------------------------------------------------*/
+
static void
smf_free(struct storage *s)
{
smf_init,
smf_open,
smf_alloc,
+ smf_trim,
smf_free,
smf_send
};