/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Simple nfs V4 ops
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "clnt.h"
#include <errno.h>
#include "nfs_inet.h"
#include <sys/bootdebug.h>
#include "brpc.h"
#include <rpcsvc/nfs4_prot.h>
/*
* NFS Version 4 specific functions
*/
{
char *buf_offset;
int framing_errs = 0;
static int blks_read;
/*
* read
*/
buf_offset = buf;
if (nfs_readsize == 0)
if (size < nfs_readsize)
else
else
/*
* zero out the stateid field
*/
do {
do {
timeout);
if (status == RPC_TIMEDOUT) {
framing_errs++;
if (framing_errs > NFS_MAX_FERRS &&
nfs_readsize /= 2;
dprintf("NFS read size now %d.\n",
framing_errs = 0;
} else {
else
}
}
} while (status == RPC_TIMEDOUT);
if (status != RPC_SUCCESS)
return (-1);
return (-1);
}
#ifdef NFS_OPS_DEBUG
printf("nfs4read: partial read %d instead "
#endif
}
buf_offset += readcnt;
if ((blks_read++ & 0x3) == 0)
return (count);
}
};
int
{
/*
* Putfh
*/
else
/*
* getattr
*/
/*
* Set up the attribute bitmap. We pretty much need everything
* except for the filehandle and supported attrs.
*/
if (status != RPC_SUCCESS) {
return (-1);
}
return (getattrres.gr_attr_status);
}
else
}
/*
* XXX - may need to do something more here.
*/
}
}
}
return (NFS4_OK);
}
/*
* Display nfs error messages.
*/
/*ARGSUSED*/
void
{
return;
switch (status) {
case NFS4_OK:
printf("NFS: No error.\n");
break;
case NFS4ERR_PERM:
printf("NFS: Not owner.\n");
break;
case NFS4ERR_NOENT:
#ifdef NFS_OPS_DEBUG
printf("NFS: No such file or directory.\n");
#endif /* NFS_OPS_DEBUG */
break;
case NFS4ERR_IO:
printf("NFS: IO ERROR occurred on NFS server.\n");
break;
case NFS4ERR_NXIO:
printf("NFS: No such device or address.\n");
break;
case NFS4ERR_ACCESS:
printf("NFS: Permission denied.\n");
break;
case NFS4ERR_EXIST:
printf("NFS: File exists.\n");
break;
case NFS4ERR_XDEV:
printf("NFS: Cross device hard link.\n");
break;
case NFS4ERR_NOTDIR:
printf("NFS: Not a directory.\n");
break;
case NFS4ERR_ISDIR:
printf("NFS: Is a directory.\n");
break;
case NFS4ERR_INVAL:
printf("NFS: Invalid argument.\n");
break;
case NFS4ERR_FBIG:
printf("NFS: File too large.\n");
break;
case NFS4ERR_NOSPC:
printf("NFS: No space left on device.\n");
break;
case NFS4ERR_ROFS:
printf("NFS: Read-only filesystem.\n");
break;
case NFS4ERR_MLINK:
printf("NFS: Too many hard links.\n");
break;
case NFS4ERR_NAMETOOLONG:
printf("NFS: File name too long.\n");
break;
case NFS4ERR_NOTEMPTY:
printf("NFS: Directory not empty.\n");
break;
case NFS4ERR_DQUOT:
printf("NFS: Disk quota exceeded.\n");
break;
case NFS4ERR_STALE:
printf("NFS: Stale file handle.\n");
break;
case NFS4ERR_BADHANDLE:
printf("NFS: Illegal NFS file handle.\n");
break;
case NFS4ERR_BAD_COOKIE:
printf("NFS: Stale Cookie.\n");
break;
case NFS4ERR_NOTSUPP:
printf("NFS: Operation is not supported.\n");
break;
case NFS4ERR_TOOSMALL:
printf("NFS: Buffer too small.\n");
break;
case NFS4ERR_SERVERFAULT:
printf("NFS: Server fault.\n");
break;
case NFS4ERR_BADTYPE:
printf("NFS: Unsupported object type.\n");
break;
case NFS4ERR_BAD_STATEID:
printf("NFS: Bad stateid\n");
break;
case NFS4ERR_BAD_SEQID:
printf("NFS: Bad seqid\n");
break;
default:
printf("NFS: unknown error.\n");
break;
}
}
/*
* lookup one component. for multicomponent lookup use a driver like lookup().
*/
struct nfs_file *
{
/*
* NFSv4 uses a special LOOKUPP op
* for looking up the parent directory.
*/
/*
* Check if we have a filehandle and initialize the compound
* with putfh or putrootfh appropriately.
*/
else
/*
* lookup
*/
/*
* convert the pathname from char * to utf8string
*/
dprintf("nfs4lookup: bkmem_alloc failed\n");
return (NULL);
}
/*
* Setup the attr bitmap. All we need is the type and filehandle info
*/
if (status != RPC_SUCCESS) {
return (NULL);
}
#ifdef DEBUG
dprintf("nfs4lookup: lookup status = %d\n",
#endif
return (NULL);
}
#ifdef DEBUG
dprintf("nfs4lookup: getattr status = %d\n",
#endif
return (NULL);
}
/*
* We have all the information we need to update the file pointer
*/
/*
* Free the arg string
*/
return (&cd);
}
/*
* lookup parent directory.
*/
struct nfs_file *
{
/*
* Check if we have a filehandle and initialize the compound
* with putfh or putrootfh appropriately.
*/
else
/*
* lookupp
*/
/*
* Setup the attr bitmap. Normally, all we need is the type and
* filehandle info, but getdents might require the fileid of the
* parent.
*/
if (status != RPC_SUCCESS) {
return (NULL);
}
#ifdef DEBUG
dprintf("nfs4lookupp: lookupp status = %d\n",
#endif
return (NULL);
}
#ifdef DEBUG
dprintf("nfs4lookupp: getattr status = %d\n",
#endif
return (NULL);
}
/*
* We have all the information we need to update the file pointer
*/
/*
* Fill in the fileid if the user passed in one
*/
return (&cd);
}
/*
* Gets symbolic link into pathname.
*/
int
{
int spathlen;
/*
* readlink
*/
else
if (status != RPC_SUCCESS) {
error = -1;
goto out;
}
goto out;
}
/*
* Convert the utf8string to a normal character string
*/
goto out;
}
*path = symlink_path;
out:
/*
* Free the results
*/
return (error);
}
/*
* Should just forget about the tag, but will leave in support for the time
* being.
*/
void
{
} else {
}
} else {
}
}