cfsd_svc.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
*/
// -----------------------------------------------------------------
//
// cfsd_svc.cc
//
// RPC service routines.
#pragma ident "%Z%%M% %I% %E% SMI"
// Copyright (c) 1994 by Sun Microsystems, Inc.
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h> /* strcmp */
#include <signal.h>
#include <sysent.h> /* getdtablesize, open */
#include <unistd.h> /* setsid */
#include <time.h>
#include <memory.h>
#include <stropts.h>
#include <netconfig.h>
#include <thread.h>
#include <synch.h>
#include <common/cachefsd.h>
#include "cfsd_kmod.h"
#include "cfsd_maptbl.h"
#include "cfsd_logfile.h"
#include "cfsd_fscache.h"
#include "cfsd_cache.h"
#include "cfsd_all.h"
#include "cfsd_subr.h"
// declared in cfsd_main.cc
//
// cachefsd_caches_1_svc
//
// Description:
// Returns list of caches on the system.
// Arguments:
// inp should be NULL
// outp should point to return object
// reqp svc_req info
// Returns:
// Returns 1 for success 0 if an error occurs.
// Preconditions:
// precond(reqp)
{
dbug_enter("cachefsd_caches_1_svc");
return (0);
int xx;
// if there are any caches
if (cnt) {
// allocate space for each cache information
// for each cache
// get the cache
// get the cache id and name
}
}
// fill in the return object
all.all_unlock();
return (1);
}
//
// cachefsd_cache_status_1_svc
//
// Description:
// Returns status about a particular cache.
// Arguments:
// inp should be ptr to cache id
// outp should be ptr to place to put cache status
// reqp svc_req info
// Returns:
// Returns 1 for success 0 if an error occurs.
// Preconditions:
// precond(reqp)
{
dbug_enter("cachefsd_cache_status_1_svc");
return (0);
// find the requested cache
// get the cache
// if a match
cachep->cache_lock();
cachep->cache_refinc();
cachep->cache_unlock();
break;
}
}
all.all_unlock();
// if no match
return (1);
// find a mounted file system in the cache
cachep->cache_lock();
// get the fscache
// mounted
if (fscachep->fscache_mounted()) {
fscachep->fscache_lock();
break;
}
}
cachep->cache_unlock();
outp->ccs_lrusize = 0;
outp->ccs_packsize = 0;
outp->ccs_freesize = 0;
outp->ccs_lrutime = 0;
while (fscachep) {
if (xx != 0) {
dbug_print("err",
("setup of kmod interface failed %d", xx));
break;
}
if (xx) {
break;
}
fscachep->fscache_lock();
break;
}
cachep->cache_lock();
cachep->cache_refdec();
cachep->cache_unlock();
return (1);
}
//
// cachefsd_mounts_1_svc
//
// Description:
// Returns the list of file systems that are in the cache.
// Arguments:
// inp should be ptr to cache id
// outp should be ptr to place to put mounts
// reqp svc_req info
// Returns:
// Returns 1 for success 0 if an internal error occurs.
// Preconditions:
// precond(reqp)
{
dbug_enter("cachefsd_mounts_1_svc");
return (0);
int xx;
// find the requested cache
// get the cache
// if a match
cachep->cache_lock();
cachep->cache_refinc();
cachep->cache_unlock();
break;
}
}
all.all_unlock();
// if no match was found
return (1);
}
cachep->cache_lock();
// if there are any fscaches
if (cnt) {
// allocate space for each fscache information
// for each fscache
// get the fscache
// get the fscache id and name
}
}
// fill in the return object
cachep->cache_refdec();
cachep->cache_unlock();
return (1);
}
//
// cachefsd_mount_stat_1_svc
//
// Description:
// Returns status information about a single file system
// in the cache.
// Arguments:
// inp should be which file system to get info for
// outp should be place to put mount info
// reqp svc_req info
// Returns:
// Returns 1 for success 0 if an error occurs.
// Preconditions:
// precond(reqp)
{
dbug_enter("cachefsd_mount_stat_1_svc");
return (0);
int xx;
// find the requested cache
// get the cache
// if a match
cachep->cache_lock();
cachep->cache_refinc();
cachep->cache_unlock();
break;
}
}
all.all_unlock();
// if no match was found
return (1);
}
// find the requested fscache
cachep->cache_lock();
// get the fscache
// if a match
fscachep->fscache_lock();
break;
}
}
cachep->cache_unlock();
// if no match was found
cachep->cache_lock();
cachep->cache_refdec();
cachep->cache_unlock();
return (1);
}
fscachep->fscache_lock();
// see if there are changes to roll to the server
if ((fscachep->fscache_connected() == 0) &&
(fscachep->fscache_changes() == 0)) {
}
}
// fill in the return object
cachep->cache_lock();
cachep->cache_refdec();
cachep->cache_unlock();
return (1);
}
//
// cachefsd_fs_mounted_1_svc
//
// Description:
// Sent by the mount command to indicate a new file system
// has been mounted
// Arguments:
// inp ptr to mount information
// outp should be null
// reqp svc_req info
// Returns:
// Returns 1 for success 0 if an internal error occurs.
// Preconditions:
// precond(inp)
{
dbug_enter("cachefsd_fs_mounted_1_svc");
return (0);
int error = 0;
error = 1;
}
error = 1;
}
if (error == 0) {
}
return (1);
}
//
// cachefsd_fs_unmounted_1_svc
//
// Description:
// Arguments:
// inp
// outp
// reqp
// Returns:
// Returns 1 for success 0 if an internal error occurs.
// Preconditions:
// precond(inp)
// precond(outp == NULL)
// precond(reqp)
{
dbug_enter("cachefsd_fs_unmounted_1_svc");
return (0);
return (1);
}
int found = 0;
// for each cache
// get the cache
// for each file system in this cache
cachep->cache_lock();
// get the fscache
// skip if not mounted
if (fscachep->fscache_mounted() == 0)
continue;
// if a match
== 0) {
fscachep->fscache_lock();
found = 1;
break;
}
}
cachep->cache_unlock();
if (found)
break;
}
all.all_unlock();
// if no match
} else {
fscachep->fscache_lock();
}
return (1);
}
//
// cachefsd_disconnection_1_svc
//
// Description:
// Arguments:
// inp
// outp
// reqp
// Returns:
// Returns 1 for success 0 if an internal error occurs.
// Preconditions:
// precond(inp)
// precond(outp)
// precond(reqp)
{
dbug_enter("cachefsd_disconnection_1_svc");
return (0);
int found = 0;
// for each cache
// get the cache
// for each file system in this cache
cachep->cache_lock();
// get the fscache
// if a match
== 0) {
fscachep->fscache_lock();
found = 1;
break;
}
}
cachep->cache_unlock();
if (found)
break;
}
all.all_unlock();
/* if no match */
*outp = 3;
} else {
fscachep->fscache_lock();
}
return (1);
}
//
// cachefsdprog_1_freeresult
//
// Description:
// Arguments:
// transp
// xdr_result
// resultp
// Returns:
// Returns ...
// Preconditions:
// precond(transp)
int
{
dbug_enter("cachefsdprog_1_freeresult");
return (1);
}