cfsd_cache.cc revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
// -----------------------------------------------------------------
//
// cache.cc
//
// Methods of the cfsd_cache class.
#pragma ident "%Z%%M% %I% %E% SMI"
// Copyright (c) 1994 by Sun Microsystems, Inc.
#include <stdio.h>
#include <stdlib.h>
#include <thread.h>
#include <synch.h>
#include "cfsd_kmod.h"
#include "cfsd_maptbl.h"
#include "cfsd_logfile.h"
#include "cfsd_fscache.h"
#include "cfsd_cache.h"
// -----------------------------------------------------------------
//
// cfsd_cache::cfsd_cache
//
// Description:
// Arguments:
// Returns:
// Preconditions:
{
dbug_enter("cfsd_cache::cfsd_cache");
i_cachedir = "unknown";
i_refcnt = 0;
i_nextfscacheid = 0;
i_cacheid = 0;
i_modify = 1;
// initialize the locking mutex
dbug_assert(xx == 0);
}
// -----------------------------------------------------------------
//
// cfsd_cache::~cfsd_cache
//
// Description:
// Arguments:
// Returns:
// Preconditions:
cfsd_cache::~cfsd_cache()
{
dbug_enter("cfsd_cache::~cfsd_cache");
// get rid of any fscache objects
// destroy the locking mutex
dbug_assert(xx == 0);
}
// -----------------------------------------------------------------
//
// cfsd_cache::cache_setup
//
// Description:
// Performs setup for the cache.
// Arguments:
// cachedirp
// cacheid
// Returns:
// Preconditions:
// precond(cachedirp)
int
{
dbug_enter("cfsd_cache::cache_setup");
// XXX either need to prevent multiple calls to this or
// clean up here.
int ret;
(*cachedirp != '/')) {
ret = 0;
} else {
ret = 1;
}
i_modify++;
// return result
return (ret);
}
// -----------------------------------------------------------------
//
// cfsd_cache::cache_cachedir
//
// Description:
// Arguments:
// Returns:
// Returns ...
// Preconditions:
const char *
{
dbug_enter("cfsd_cache::cache_cachedir");
return (i_cachedir);
}
// -----------------------------------------------------------------
//
// cfsd_cache::cache_lock
//
// Description:
// Arguments:
// Returns:
// Preconditions:
void
{
dbug_enter("cfsd_cache::cache_lock");
mutex_lock(&i_lock);
}
// -----------------------------------------------------------------
//
// cfsd_cache::cache_unlock
//
// Description:
// Arguments:
// Returns:
// Preconditions:
void
{
dbug_enter("cfsd_cache::cache_unlock");
}
// -----------------------------------------------------------------
//
// cfsd_cache::cache_fscachelist_entries
//
// Description:
// Arguments:
// Returns:
// Returns ...
// Preconditions:
{
dbug_enter("cfsd_cache::cache_fscachelist_entries");
return (i_fscachelist.entries());
}
// -----------------------------------------------------------------
//
// cfsd_cache::cache_fscachelist_at
//
// Description:
// Arguments:
// index
// Returns:
// Returns ...
// Preconditions:
{
dbug_enter("cfsd_cache::cache_fscachelist_at");
}
// -----------------------------------------------------------------
//
// cfsd_cache::cache_fscachelist_add
//
// Description:
// Arguments:
// cachep
// Returns:
// Preconditions:
// precond(fscachep)
void
{
dbug_enter("cfsd_cache::cache_fscachelist_add");
i_modify++;
}
// -----------------------------------------------------------------
//
// cfsd_cache::cache_fscachelist_find
//
// Description:
// Arguments:
// namep
// Returns:
// Returns ...
// Preconditions:
// precond(namep)
{
dbug_enter("cfsd_cache::cache_fscachelist_find");
// see if the fscache exists
break;
}
}
return (fscachep);
}
// -----------------------------------------------------------------
//
// cfsd_cache::operator==
//
// Description:
// Arguments:
// cachep
// Returns:
// Returns ...
// Preconditions:
int
{
dbug_enter("cfsd_cache::operator==");
int xx;
return (xx);
}