static inline int ss_testvfs_init(ssvfs *f, va_list args ssunused) { sstestvfs *o = (sstestvfs*)f->priv; o->fail_from = va_arg(args, int); o->n = 0; ss_spinlockinit(&o->lock); return 0; }
int sx_managerinit(sxmanager *m, srseq *seq, ssa *a, ssa *asxv) { ss_rbinit(&m->i); m->count = 0; ss_spinlockinit(&m->lock); m->seq = seq; m->asxv = asxv; m->a = a; return 0; }
int sx_managerinit(sxmanager *m, sr *r, ssa *asxv) { ss_rbinit(&m->i); m->count_rd = 0; m->count_rw = 0; m->count_gc = 0; m->csn = 0; m->gc = NULL; ss_spinlockinit(&m->lock); ss_listinit(&m->indexes); m->r = r; m->asxv = asxv; return 0; }
int sx_managerinit(sxmanager *m, srseq *seq, ssa *a) { ss_rbinit(&m->i); m->count_rd = 0; m->count_rw = 0; m->count_gc = 0; m->csn = 0; m->gc = NULL; ss_spinlockinit(&m->lock); ss_listinit(&m->indexes); sx_vpool_init(&m->pool, a); m->seq = seq; return 0; }
static inline int ss_slabaopen(ssa *a, va_list args) { ssslaba *s = (ssslaba*)a->priv; s->vfs = va_arg(args, ssvfs*); s->pool_size = va_arg(args, uint64_t); s->slab_size = va_arg(args, uint32_t); assert(s->slab_size >= sizeof(void*)); s->slab_max = s->pool_size / s->slab_size; s->pool_free_count = 0; s->pool_free = NULL; s->pool_next = NULL; ss_mmapinit(&s->pool); int rc = ss_vfsmmap_allocate(s->vfs, &s->pool, s->pool_size); if (ssunlikely(rc == -1)) return -1; ss_spinlockinit(&s->lock); s->pool_next = s->pool.p; s->pool_end = s->pool.p + (s->slab_max * s->slab_size); return 0; }