コード例 #1
0
/*
 * Put a cnode in the hash table.
 */
void
coda_save(struct cnode *cp)
{

	CNODE_NEXT(cp) = coda_cache[coda_hash(&cp->c_fid)];
	coda_cache[coda_hash(&cp->c_fid)] = cp;
}
コード例 #2
0
/*
 * Deallocate a cnode.
 */
void
coda_free(struct cnode *cp)
{

	CNODE_NEXT(cp) = coda_freelist;
	coda_freelist = cp;
}
コード例 #3
0
ファイル: coda_subr.c プロジェクト: OpenDarwin-CVS/DarwinCoda
/*
 * 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);
}
コード例 #4
0
/*
 * Remove a cnode from the hash table.
 */
void
coda_unsave(struct cnode *cp)
{
	struct cnode *ptr;
	struct cnode *ptrprev = NULL;

	ptr = coda_cache[coda_hash(&cp->c_fid)];
	while (ptr != NULL) {
		if (ptr == cp) {
			if (ptrprev == NULL)
				coda_cache[coda_hash(&cp->c_fid)] =
				    CNODE_NEXT(ptr);
	    		else
				CNODE_NEXT(ptrprev) = CNODE_NEXT(ptr);
			CNODE_NEXT(cp) = (struct cnode *)NULL;
			return;
		}
		ptrprev = ptr;
		ptr = CNODE_NEXT(ptr);
	}
}
コード例 #5
0
/*
 * Lookup a cnode by fid. If the cnode is dying, it is bogus so skip it.
 *
 * NOTE: this allows multiple cnodes with same fid -- dcs 1/25/95
 */
struct cnode *
coda_find(struct CodaFid *fid)
{
	struct cnode *cp;

	cp = coda_cache[coda_hash(fid)];
	while (cp) {
		if (coda_fid_eq(&(cp->c_fid), fid) && (!IS_UNMOUNTING(cp))) {
			coda_active++;
			return (cp);
		}
		cp = CNODE_NEXT(cp);
	}
	return (NULL);
}
コード例 #6
0
/*
 * Clear all cached access control decisions from Coda.
 */
static void
coda_acccache_purge(struct mount *mnt)
{
	struct cnode *cp;
	int hash;

	for (hash = 0; hash < CODA_CACHESIZE; hash++) {
		for (cp = coda_cache[hash]; cp != NULL;
		    cp = CNODE_NEXT(cp)) {
			if (CTOV(cp)->v_mount == mnt && VALID_ACCCACHE(cp)) {
				CODADEBUG(CODA_FLUSH, myprintf(("acccache "
				    "purge fid %s uid %d mode 0x%x\n",
				    coda_f2s(&cp->c_fid), cp->c_cached_uid,
				    (int)cp->c_cached_mode)););
				cp->c_flags &= ~C_ACCCACHE;
			}
		}
コード例 #7
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);
}