cfsd_kmod.c 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
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Source file for the cfsd_kmod class.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include "cfsd.h"
#include "cfsd_kmod.h"
/*
* copy_cred (copy dl_cred_t followed by a list of gid_t)
*/
static void
{
int n = src->cr_ngroups;
if (n > NGROUPS_MAX_DEFAULT)
n = NGROUPS_MAX_DEFAULT;
dst->cr_ngroups = n;
}
/*
* ------------------------------------------------------------
* cfsd_kmod_create
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
cfsd_kmod_create(void)
{
dbug_enter("cfsd_kmod_create");
dbug_leave("cfsd_kmod_create");
return (kmod_object_p);
}
/*
* ------------------------------------------------------------
* cfsd_kmod_destory
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("cfsd_kmod_destroy");
/* clean up old stuff */
dbug_leave("cfsd_kmod_destroy");
}
/*
* ------------------------------------------------------------
* kmod_setup
*
* Description:
* Arguments:
* path
* Returns:
* Returns ...
* Preconditions:
* precond(path)
*/
int
{
int xx;
int error;
dbug_enter("kmod_setup");
/* clean up old stuff */
/* try to open the file */
/* return result */
} else {
xx = 0;
sizeof (kmod_object_p->i_path));
kmod_object_p->i_fd));
/* tell the cachefs kmod we are here */
if (xx) {
}
}
dbug_leave("kmod_setup");
return (xx);
}
/*
* kmod_shutdown
*
* Description:
* Arguments:
* Returns:
* Preconditions:
*/
void
{
dbug_enter("kmod_shutdown");
/* close down the old fd if necessary */
if (kmod_object_p->i_fd >= 0) {
}
dbug_leave("kmod_shutdown");
}
/*
* ------------------------------------------------------------
* kmod_xwait
*
* Description:
* Arguments:
* Returns:
* Returns ...
* Preconditions:
*/
int
{
int xx;
int error = 0;
dbug_enter("kmod_xwait");
if (xx)
dbug_leave("kmod_xwait");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_stateget
*
* Description:
* Arguments:
* Returns:
* Returns ...
* Preconditions:
*/
int
{
int state;
int xx;
dbug_enter("kmod_stateget");
sizeof (state));
if (xx == -1) {
/* XXX do what? */
dbug_assert(0);
}
dbug_leave("kmod_stateget");
return (state);
}
/*
* ------------------------------------------------------------
* kmod_stateset
*
* Description:
* Arguments:
* state
* Returns:
* Returns ...
* Preconditions:
*/
int
{
int xx;
int error = 0;
dbug_enter("kmod_stateset");
if (xx)
dbug_leave("kmod_stateset");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_exists
*
* Description:
* Arguments:
* cidp
* Returns:
* Returns ...
* Preconditions:
* precond(cidp)
*/
int
{
int xx;
int error = 0;
dbug_enter("kmod_exists");
if (xx)
dbug_leave("kmod_exists");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_lostfound
*
* Description:
* Arguments:
* cidp
* Returns:
* Returns ...
* Preconditions:
* precond(cidp)
*/
int
{
int error = 0;
int xx;
dbug_enter("kmod_lostfound");
if (xx)
if (xx == 0) {
if (newnamep)
}
dbug_leave("kmod_lostfound");
return (error);
}
#if 0
/*
* ------------------------------------------------------------
* kmod_lostfoundall
*
* Description:
* Arguments:
* Returns:
* Returns ...
* Preconditions:
*/
int
{
int error = 0;
int xx = -1;
dbug_enter("kmod_lostfoundall");
/* xx = ioctl(kmod_object_p->i_fd, CACHEFSIO_LOSTFOUNDALL, 0); */
if (xx)
dbug_leave("kmod_lostfoundall");
return (error);
}
/*
* kmod_rofs
*
* Description:
* Arguments:
* Returns:
* Returns ...
* Preconditions:
*/
int
{
int error = 0;
int xx = -1;
dbug_enter("kmod_rofs");
/* xx = ioctl(kmod_object_p->i_fd, CACHEFSIO_ROFS, 0); */
if (xx)
dbug_leave("kmod_rofs");
return (error);
}
#endif
/*
* kmod_rootfid
*
* Description:
* Fills in fidp with the fid of the root of the file system.
* Arguments:
* fidp
* Returns:
* Returns 0 for success, errno value for an error
* Preconditions:
* precond(fidp)
*/
int
{
int error = 0;
int xx;
dbug_enter("kmod_rootfid");
sizeof (*fidp));
if (xx)
dbug_leave("kmod_rootfid");
return (error);
}
/*
* kmod_getstats
*
* Description:
* Arguments:
* gsp
* Returns:
* Returns ...
* Preconditions:
* precond(gsp)
*/
int
{
int error = 0;
int xx;
dbug_enter("kmod_getstats");
sizeof (*gsp));
if (xx)
dbug_leave("kmod_getstats");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_getinfo
*
* Description:
* Arguments:
* filep
* Returns:
* Returns ...
* Preconditions:
* precond(filep)
* precond(infop)
*/
int
{
int error = 0;
int xx;
dbug_enter("kmod_getinfo");
if (xx)
if (xx == 0) {
}
dbug_leave("kmod_getinfo");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_cidtofid
*
* Description:
* Arguments:
* cidp
* fidp
* Returns:
* Returns ...
* Preconditions:
* precond(cidp)
* precond(fidp)
*/
int
{
int error = 0;
int xx;
dbug_enter("kmod_cidtofid");
if (xx)
if (xx == 0) {
}
dbug_leave("kmod_cidtofid");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_getattrfid
*
* Description:
* Arguments:
* fidp
* credp
* vattrp
* Returns:
* Returns ...
* Preconditions:
* precond(fidp)
* precond(credp)
* precond(vattrp)
*/
int
{
int error = 0;
int xx;
dbug_enter("kmod_getattrfid");
if (xx)
if (xx == 0) {
}
dbug_leave("kmod_getattrfid");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_getattrname
*
* Description:
* Arguments:
* dirp
* name
* credp
* vattrp
* filep
* Returns:
* Returns ...
* Preconditions:
* precond(dirp)
* precond(name)
* precond(credp)
*/
int
{
int error = 0;
int xx;
dbug_enter("kmod_getattrname");
if (xx)
if (xx == 0) {
if (vattrp)
if (filep)
}
dbug_leave("kmod_getattrname");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_create
*
* Description:
* Arguments:
* dirp
* namep
* vattrp
* exclusive
* mode
* credp
* newfidp
* mtimep
* ctimep
* Returns:
* Returns ...
* Preconditions:
* precond(dirp)
* precond(namep)
* precond(vattrp)
* precond(credp)
*/
int
const char *namep,
int exclusive,
int mode,
{
int error = 0;
int xx;
dbug_enter("kmod_create");
if (cidp) {
} else {
}
if (xx)
if (xx == 0) {
if (newfidp)
if (ctimep)
if (mtimep)
}
dbug_leave("kmod_create");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_pushback
*
* Description:
* Arguments:
* filep
* fidp
* credp
* Returns:
* Returns ...
* Preconditions:
* precond(filep)
* precond(fidp)
* precond(credp)
*/
int
int update)
{
int error = 0;
int xx;
dbug_enter("kmod_pushback");
/* note: update is no longer used */
if (xx)
if (xx == 0) {
if (ctimep)
if (mtimep)
}
dbug_leave("kmod_pushback");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_rename
*
* Description:
* Arguments:
* olddir
* oldname
* newdir
* newname
* credp
* Returns:
* Returns ...
* Preconditions:
* precond(olddir)
* precond(oldname)
* precond(newdir)
* precond(newname)
* precond(credp)
*/
int
const char *oldname,
const char *newname,
{
int error = 0;
int xx;
dbug_enter("kmod_rename");
if (xx)
if (xx == 0) {
if (delctimep) {
}
}
dbug_leave("kmod_rename");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_setattr
*
* Description:
* Arguments:
* fidp
* vattrp
* flags
* credp
* Returns:
* Returns ...
* Preconditions:
* precond(fidp)
* precond(vattrp)
* precond(credp)
*/
int
int flags,
{
int error = 0;
int xx;
dbug_enter("kmod_setattr");
if (xx)
if (xx == 0) {
}
dbug_leave("kmod_setattr");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_setsecattr
*
* Description:
* Arguments:
* fidp
* aclcnt
* dfaclcnt
* acl
* flags
* credp
* Returns:
* Returns ...
* Preconditions:
* precond(fidp)
* precond(acl)
* precond(credp)
* precond(aclcnt + dfaclcnt <= MAX_ACL_ENTRIES)
*/
int
int aclcnt,
int dfaclcnt,
{
int error = 0;
int xx;
dbug_enter("kmod_setsecattr");
if (xx)
if (xx == 0) {
}
dbug_leave("kmod_setsecattr");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_remove
*
* Description:
* Arguments:
* fidp
* namep
* credp
* ctimep
* Returns:
* Returns ...
* Preconditions:
* precond(fidp)
* precond(namep)
* precond(credp)
*/
int
const char *namep,
{
int len;
int error = 0;
int xx;
dbug_enter("kmod_remove");
if (ctimep)
else
len = 0;
if (xx)
}
dbug_leave("kmod_remove");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_link
*
* Description:
* Arguments:
* dirfidp
* namep
* filefidp
* credp
* ctimep
* Returns:
* Returns ...
* Preconditions:
* precond(dirfidp)
* precond(namep)
* precond(filefidp)
* precond(credp)
*/
int
const char *namep,
{
int error = 0;
int xx;
dbug_enter("kmod_link");
if (xx)
if (xx == 0) {
}
dbug_leave("kmod_link");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_mkdir
*
* Description:
* Arguments:
* dirfidp
* namep
* vattrp
* credp
* newfidp
* Returns:
* Returns ...
* Preconditions:
* precond(dirfidp)
* precond(namep)
* precond(vattrp)
* precond(credp)
* precond(newfidp)
*/
int
const char *namep,
{
int error = 0;
int xx;
dbug_enter("kmod_mkdir");
if (xx)
if (xx == 0) {
}
dbug_leave("kmod_mkdir");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_rmdir
*
* Description:
* Arguments:
* dirfidp
* namep
* credp
* Returns:
* Returns ...
* Preconditions:
* precond(dirfidp)
* precond(namep)
* precond(credp)
*/
int
const char *namep,
{
int error = 0;
int xx;
dbug_enter("kmod_rmdir");
NULL, 0);
if (xx)
dbug_leave("kmod_rmdir");
return (error);
}
/*
* ------------------------------------------------------------
* kmod_symlink
*
* Description:
* Arguments:
* dirfidp
* namep
* linkvalp
* vattrp
* credp
* ctimep
* mtimep
* Returns:
* Returns ...
* Preconditions:
* precond(dirfidp)
* precond(namep)
* precond(linkvalp)
* precond(vattrp)
* precond(credp)
* precond(ctimep)
* precond(mtimep)
*/
int
const char *namep,
const char *linkvalp,
{
int error = 0;
int xx;
dbug_enter("kmod_symlink");
if (xx)
if (xx == 0) {
}
dbug_leave("kmod_symlink");
return (error);
}
#ifndef DBUG_OFF
/*
* ------------------------------------------------------------
* kmod_format_fid
*
* Description:
* Arguments:
* fidp
* Returns:
* Preconditions:
* precond(fidp)
*/
void
{
int index;
char format[10];
sizeof (kmod_object_p->i_fidbuf));
}
}
/*
* ------------------------------------------------------------
* kmod_print_cred
*
* Description:
* Arguments:
* credp
* Returns:
* Preconditions:
* precond(credp)
*/
void
{
char buf[100];
char format[10];
int xx;
dbug_enter("kmod_print_cred");
buf[0] = '\0';
}
dbug_leave("kmod_print_cred");
}
/*
* ------------------------------------------------------------
* kmod_print_attr
*
* Description:
* Arguments:
* vattrp
* Returns:
* Preconditions:
* precond(vattrp)
*/
void
{
dbug_enter("kmod_print_attr");
dbug_leave("kmod_print_attr");
}
#endif /* DBUG_OFF */
/*
* kmod_doioctl
*
* Description:
* Helper routine for others in this file. Just packages up
* arguments and does the ioctl operation.
* Arguments:
* cmd
* sdata
* slen
* rdata
* rlen
* Returns:
* Returns the result of the ioctl operation.
* Preconditions:
*/
int
enum cfsdcmd_cmds cmd,
void *sdata,
int slen,
void *rdata,
int rlen)
{
int xx;
dbug_enter("kmod_doioctl");
if (xx) {
}
dbug_leave("kmod_doioctl");
return (xx);
}