/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <unistd.h>
#include <strings.h>
#include <string.h>
#include <limits.h>
#include <libnvpair.h>
#include <dlfcn.h>
#include <link.h>
#include <rp_plugin.h>
#include <fcntl.h>
#include <rpcsvc/nfs4_prot.h>
#include "ref_subr.h"
extern int errno;
char *nfs_basic_service_type(void);
boolean_t nfs_basic_supports_svc(const char *);
int nfs_basic_deref(const char *, const char *, char *, size_t *);
int nfs_basic_form(const char *, const char *, char *, size_t *);
NULL, /* rpo_init */
NULL, /* rpo_fini */
};
/*
* What service type does this module support?
*/
char *
{
return (SERVICE_TYPE);
}
/*
* Does this module support a particular service type?
*/
{
if (!svc_type)
return (0);
}
/*
* Take a string with a set of locations like this:
* host1:/path1 host2:/path2 host3:/path3
* and convert it to an fs_locations4 for the deref routine.
*/
static fs_locations4 *
{
int i, gothost;
int len;
return (NULL);
#ifdef DEBUG
#endif
/*
* Count fs_location entries by counting spaces.
* Remember that escaped spaces ("\ ") may exist.
* We mark the location boundaries with null bytes.
* Variable use:
* escape - set if we have found a backspace,
* part of either "\ " or "\\"
* delimiter - set if we have found a space and
* used to skip multiple spaces
*/
if (*sp == '\\') {
escape = 1;
delimiter = 0;
continue;
}
if (*sp == ' ') {
if (delimiter == 1)
continue;
if (escape == 0) {
delimiter = 1;
fsl_count++;
*sp = '\0';
} else
escape = 0;
} else
delimiter = 0;
}
sp--;
fsl_count++;
#ifdef DEBUG
#endif
if (fsl_count == 0)
goto out;
/* Alloc space for everything */
goto out;
goto out;
}
/*
*/
i = gothost = 0;
if (!gothost) {
/* Drop leading spaces */
if (*sp == ' ') {
sp++;
continue;
}
/* Look for the rightmost colon for host */
if (!p) {
#ifdef DEBUG
#endif
fsl_count--;
} else {
sp = p + 1;
#ifdef DEBUG
#endif
malloc(sizeof (utf8string));
int j;
for (j = 0; j < i; j++)
goto out;
}
gothost = 1;
}
continue;
}
/* End of string should mean a pathname */
#ifdef DEBUG
#endif
i++;
gothost = 0;
sp++;
continue;
}
/* Skip a single escape character */
if (*sp == '\\')
sp++;
/* Plain char, just copy it */
}
/*
* If we're still expecting a path name, we don't have a
* server:/path pair and should discard the server and
* note that we got fewer locations than expected.
*/
if (gothost) {
fsl_count--;
}
/*
* If we have zero entries, we never got a whole server:/path
* pair, and so cannot have anything else allocated.
*/
if (fsl_count <= 0) {
return (NULL);
}
/*
* Make sure we reflect the right number of locations.
*/
out:
return (result);
}
/*
* Deref function for nfs-basic service type returns an fs_locations4.
*/
int
{
return (EINVAL);
return (ENOTSUP);
return (ENOENT);
#ifdef DEBUG
printf("nfs_basic_deref: past get_fs_locations()\n");
#endif
return (EOVERFLOW);
}
#ifdef DEBUG
printf("nfs_basic_deref: past buffer check\n");
#endif
XDR_DESTROY(&xdr);
return (EINVAL);
#ifdef DEBUG
printf("nfs_basic_deref: past xdr_fs_locations4() and done\n");
#endif
return (0);
}
/*
* Form function for nfs-basic service type.
*/
int
{
int slen;
return (EINVAL);
return (ENOTSUP);
return (EOVERFLOW);
}
return (0);
}