void psc_stree_init(struct psc_streenode *ptn) { memset(ptn, 0, sizeof(*ptn)); INIT_PSCLIST_HEAD(&ptn->ptn_children); INIT_PSC_LISTENTRY(&ptn->ptn_sibling); }
struct psc_streenode * psc_stree_addchild(struct psc_streenode *ptn, void *data) { struct psc_streenode *child; child = PSCALLOC(sizeof(*child)); INIT_PSCLIST_HEAD(&child->ptn_children); INIT_PSC_LISTENTRY(&child->ptn_sibling); child->ptn_data = data; psclist_add(&child->ptn_sibling, &ptn->ptn_children); return (child); }
struct psc_streenode * psc_stree_addchild_sorted(struct psc_streenode *ptn, void *data, int (*cmpf)(const void *, const void *), off_t offset) { struct psc_streenode *child; child = PSCALLOC(sizeof(*child)); INIT_PSCLIST_HEAD(&child->ptn_children); INIT_PSC_LISTENTRY(&child->ptn_sibling); child->ptn_data = data; psclist_add_sorted(&ptn->ptn_children, &child->ptn_sibling, cmpf, offset); return (child); }
void _pll_initf(struct psc_lockedlist *pll, int offset, psc_spinlock_t *lkp, int flags) { memset(pll, 0, sizeof(*pll)); INIT_PSCLIST_HEAD(&pll->pll_listhd); pll->pll_flags = flags; if (lkp) { pll->pll_flags |= PLLF_EXTLOCK; pll->pll_lockp = lkp; } else { if (flags & PLLF_LOGTMP) INIT_SPINLOCK_LOGTMP(&pll->pll_lock); else if (flags & PLLF_NOLOG) INIT_SPINLOCK_NOLOG(&pll->pll_lock); else INIT_SPINLOCK(&pll->pll_lock); } pll->pll_offset = offset; }