/*
* 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"
#include <libintl.h>
#include <string.h>
#include "volume_nvpair.h"
#include "volume_error.h"
/*
* ******************************************************************
*
* Function prototypes
*
* ******************************************************************
*/
/*
* ******************************************************************
*
* External functions
*
* ******************************************************************
*/
/*
* Get the named uint16 from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* RETURN: the value of the requested uint16
*
* @return 0
* if successful
*
* @return ENOENT
* if no matching name-value pair is found
*/
int
char *which,
{
int error;
} else {
}
return (error);
}
/*
* Set the named uint16 in the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* the value to set
*
* @return 0
* if successful
*
* @return EINVAL
* if there is an invalid argument
*
* @return ENOMEM
* if there is insufficient memory
*/
int
char *which,
{
int error = 0;
}
return (error);
}
/*
* Get the named uint32 from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* RETURN: the value of the requested uint32
*
* @return 0
* if successful
*
* @return ENOENT
* if no matching name-value pair is found
*/
int
char *which,
{
int error;
} else {
}
return (error);
}
/*
* Set the named uint32 in the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* the value to set
*
* @return 0
* if successful
*
* @return EINVAL
* if there is an invalid argument
*
* @return ENOMEM
* if there is insufficient memory
*/
int
char *which,
{
int error = 0;
}
return (error);
}
/*
* Get the named uint64 from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* RETURN: the value of the requested uint64
*
* @return 0
* if successful
*
* @return ENOENT
* if no matching name-value pair is found
*/
int
char *which,
{
int error;
} else {
}
return (error);
}
/*
* Set the named uint64 in the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* the value to set
*
* @return 0
* if successful
*
* @return EINVAL
* if there is an invalid argument
*
* @return ENOMEM
* if there is insufficient memory
*/
int
char *which,
{
int error = 0;
}
return (error);
}
/*
* Set the named boolean in the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* the value to set
*
* @return 0
* if successful
*
* @return EINVAL
* if there is an invalid argument
*
* @return ENOMEM
* if there is insufficient memory
*/
int
char *which,
{
/*
* Use set_uint16 to distinguish "attr = B_FALSE" from
* "attribute unset".
*/
}
/*
* Get the named boolean from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param boolval
* RETURN: the value of the requested boolean
*
* @return 0
* if successful
*
* @return ENOENT
* if no matching name-value pair is found
*/
int
char *which,
{
int error;
/*
* Use get_uint16 to distinguish "attr = B_FALSE" from
* "attribute unset".
*/
}
return (error);
}
/*
* Get the named string from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param str
* RETURN: the requested string
*
* @return 0
* if successful
*
* @return ENOENT
* if no matching name-value pair is found
*/
int
char *which,
char **str)
{
int error;
} else {
}
return (error);
}
/*
* Set the named string in the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* the value to set
*
* @return 0
* if successful
*
* @return EINVAL
* if there is an invalid argument
*
* @return ENOMEM
* if there is insufficient memory
*/
int
char *which,
char *val)
{
int error = 0;
}
return (error);
}
/*
* Get the named uint16 array from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* RETURN: the value of the requested uint16 array
*
* @param nelem
* RETURN: the number of elements in the array
*
* @return 0
* if successful
*
* @return ENOENT
* if no matching name-value pair is found
*/
int
char *which,
{
int error;
} else {
}
return (error);
}
/*
* Set the named uint16 array from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* the value of the requested uint16 array
*
* @param nelem
* the number of elements in the array
*
* @return 0
* if successful
*
* @return EINVAL
* if there is an invalid argument
*
* @return ENOMEM
* if there is insufficient memory
*/
int
char *which,
{
int error = 0;
if ((error = nvlist_add_uint16_array(
gettext("nvlist_add_uint16_array(%s) failed: %d.\n"),
}
return (error);
}
/*
* Get the named uint64 array from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* RETURN: the value of the requested uint64 array
*
* @param nelem
* RETURN: the number of elements in the array
*
* @return 0
* if successful
*
* @return ENOENT
* if no matching name-value pair is found
*/
int
char *which,
{
int error;
} else {
}
return (error);
}
/*
* Set the named uint64 array from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* the value of the requested uint64 array
*
* @param nelem
* the number of elements in the array
*
* @return 0
* if successful
*
* @return EINVAL
* if there is an invalid argument
*
* @return ENOMEM
* if there is insufficient memory
*/
int
char *which,
{
int error = 0;
if ((error = nvlist_add_uint64_array(
gettext("nvlist_add_uint64_array(%s) failed: %d.\n"),
}
return (error);
}
/*
* Get the named string array from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* RETURN: the value of the requested string array
*
* @param nelem
* RETURN: the number of elements in the array
*
* @return 0
* if successful
*
* @return ENOENT
* if no matching name-value pair is found
*/
int
char *which,
char ***val,
{
int error;
} else {
}
return (error);
}
/*
* Set the named string array from the given nvlist_t.
*
* @param attrs
* the nvlist_t to search
*
* @param which
* the string key for this element in the list
*
* @param val
* the value of the requested string array
*
* @param nelem
* the number of elements in the array
*
* @return 0
* if successful
*
* @return EINVAL
* if there is an invalid argument
*
* @return ENOMEM
* if there is insufficient memory
*/
int
char *which,
char **val,
{
int error = 0;
if ((error = nvlist_add_string_array(
gettext("nvlist_add_string_array(%s) failed: %d.\n"),
}
return (error);
}
/*
* ******************************************************************
*
* Static functions
*
* ******************************************************************
*/
/*
* Get a handle to the next nvpair with the specified name and data
* type in the list following the given nvpair.
*
* Some variation of this function will likely appear in the libnvpair
* library per 4981923.
*
* @param nvl
* the nvlist_t to search
*
* @param name
* the string key for the pair to find in the list, or
* NULL to match any name
*
* @param type
* the data type for the pair to find in the list, or
* DATA_TYPE_UNKNOWN to match any type
*
* @param nvp
* the pair to search from in the list, or NULL to search
* from the beginning of the list
*
* @return the next nvpair in the list matching the given
* criteria, or NULL if no matching nvpair is found
*/
static nvpair_t *
const char *name,
{
/* For each nvpair in the list following nvp... */
/* Does this pair's name match the given name? */
/* Does this pair's type match the given type? */
return (nvp);
}
}
return (NULL);
}