Example #1
0
/*
 * Allocate a cnode.
 */
struct cnode *
coda_alloc(void)
{
    struct cnode *cp;

    if (coda_freelist) {
	cp = coda_freelist;
	coda_freelist = CNODE_NEXT(cp);
        bzero(cp, sizeof (struct cnode));
	SET_CNODE_NAME("Cnode is reused");
	coda_reuse++;
    }
    else {
	CODA_ALLOC(cp, struct cnode *, sizeof(struct cnode));
        if(cp == 0) return cp;
	/* NetBSD vnodes don't have any Pager info in them ('cause there are
	   no external pagers, duh!) */
#define VNODE_VM_INFO_INIT(vp)         /* MT */
	VNODE_VM_INFO_INIT(CTOV(cp));
	bzero(cp, sizeof (struct cnode));
	SET_CNODE_NAME("Cnode is fresh");
	coda_new++;
    }

    return(cp);
}
Example #2
0
/*
 * Allocate a cnode.
 */
struct cnode *
coda_alloc(void)
{
	struct cnode *cp;

	if (coda_freelist != NULL) {
		cp = coda_freelist;
		coda_freelist = CNODE_NEXT(cp);
		coda_reuse++;
	} else {
		CODA_ALLOC(cp, struct cnode *, sizeof(struct cnode));

		/*
		 * FreeBSD vnodes don't have any Pager info in them ('cause
		 * there are no external pagers, duh!).
		 */
#define	VNODE_VM_INFO_INIT(vp)         /* MT */
		VNODE_VM_INFO_INIT(CTOV(cp));
		coda_new++;
	}
	bzero(cp, sizeof (struct cnode));
	return (cp);
}