/*
* 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
*/
/*
*/
#include <door.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <zone.h>
#include <fcntl.h>
#include <libdladm.h>
#include <libdladm_impl.h>
#include <libdllink.h>
#include <libdlmgmt.h>
/*
* Table of data type sizes indexed by dladm_datatype_t.
*/
0, /* DLADM_TYPE_STR, use strnlen() */
sizeof (boolean_t), /* DLADM_TYPE_BOOLEAN */
sizeof (uint64_t) /* DLADM_TYPE_UINT64 */
};
static dladm_status_t
{
int door_fd;
/* The door descriptor is opened if it isn't already */
return (status);
/*
* Stale door descriptor is possible if dlmgmtd was re-started
* since last door_fd open so try re-opening door file.
*/
goto reopen;
}
}
if (status != DLADM_STATUS_OK)
return (status);
/*
* The size of the input rbuf is not big enough so that
* the door allocate the rbuf itself. In this case, return
* the required size to the caller.
*/
return (DLADM_STATUS_TOOSMALL);
return (DLADM_STATUS_FAILED);
}
}
/*
* Allocate a new linkid with the given name. Return the new linkid.
*/
{
return (DLADM_STATUS_BADARG);
}
}
return (status);
}
/*
* Destroy the given link ID.
*/
{
}
/*
* Remap a given link ID to a new name.
*/
const char *link)
{
}
/*
* Make a given link ID active.
*/
{
}
/*
* Create a new link with the given name. Return the new link's handle
*/
{
return (DLADM_STATUS_BADARG);
}
return (status);
}
/*
* An active physical link reported by the dlmgmtd daemon might not be active
* anymore as this link might be removed during system shutdown. Check its
* real status by calling dladm_phys_info().
*/
{
if (status == DLADM_STATUS_NOTFOUND) {
/*
* No active status, this link was removed. Update its status
* in the daemon and delete all active linkprops.
*
* Note that the operation could fail. If it does, return
* failure now since otherwise dladm_set_linkprop() might
* call back to i_dladm_phys_status() recursively.
*/
return (status);
(*flagsp) &= ~DLMGMT_ACTIVE;
}
return (status);
}
/*
* Walk each entry in the data link configuration repository and
* call fn on the linkid and arg.
*/
{
return (DLADM_STATUS_BADARG);
do {
/*
* Done with walking. If no next datalink is found,
* return success.
*/
if (status == DLADM_STATUS_NOTFOUND)
break;
}
/*
* An active physical link reported by the dlmgmtd
* daemon might not be active anymore. Check its
* real status.
*/
continue;
}
continue;
}
break;
} while (linkid != DATALINK_INVALID_LINKID);
return (status);
}
/*
* Get a handle of a copy of the link configuration (kept in the daemon)
* for the given link so it can be updated later by dladm_write_conf().
*/
{
return (DLADM_STATUS_BADARG);
}
return (status);
}
/*
* Get the handle of a local snapshot of the link configuration. Note that
* any operations with this handle are read-only, i.e., one can not update
* the configuration with this handle.
*/
{
char *nvlbuf;
int err;
return (DLADM_STATUS_BADARG);
sz = sizeof (dlmgmt_getconfsnapshot_retval_t);
return (DLADM_STATUS_NOMEM);
goto again;
}
if (status != DLADM_STATUS_OK) {
return (status);
}
}
return (status);
}
/*
* Commit the given link to the data link configuration repository so
* that it will persist across reboots.
*/
{
return (DLADM_STATUS_BADARG);
if (conf.ds_readonly)
return (DLADM_STATUS_DENIED);
}
/*
* Given a dladm_conf_t, get the specific configuration field
*
* If the specified dladm_conf_t is a read-only snapshot of the configuration,
* get a specific link propertie from that snapshot (nvl), otherwise, get
* the link protperty from the dlmgmtd daemon using the given confid.
*/
{
return (DLADM_STATUS_BADARG);
if (conf.ds_readonly) {
int err;
return (dladm_errno2status(err));
}
return (DLADM_STATUS_TOOSMALL);
} else {
return (DLADM_STATUS_BADARG);
return (status);
}
return (DLADM_STATUS_TOOSMALL);
}
return (status);
}
/*
* Get next property attribute from data link configuration repository.
* If last_attr is "", return the first property.
*/
/* ARGSUSED */
{
int err;
return (DLADM_STATUS_BADARG);
if (last_attr[0] == '\0')
break;
break;
}
return (DLADM_STATUS_NOTFOUND);
return (dladm_errno2status(err));
}
return (DLADM_STATUS_TOOSMALL);
return (DLADM_STATUS_OK);
}
/*
* Get the link ID that is associated with the given name.
*/
{
return (status);
}
/*
* An active physical link reported by the dlmgmtd daemon
* might not be active anymore. Check and set its real status.
*/
if (status != DLADM_STATUS_OK)
return (status);
}
DLADM_OPT_PERSIST : 0;
}
return (DLADM_STATUS_OK);
}
/*
* Get the link name that is associated with the given id.
*/
{
return (DLADM_STATUS_BADARG);
}
return (status);
}
return (DLADM_STATUS_TOOSMALL);
/*
* An active physical link reported by the dlmgmtd daemon
* might not be active anymore. Check and set its real status.
*/
if (status != DLADM_STATUS_OK)
return (status);
}
DLADM_OPT_ACTIVE : 0;
DLADM_OPT_PERSIST : 0;
}
return (DLADM_STATUS_OK);
}
/*
* Set the given attr with the given attrval for the given link.
*/
{
return (DLADM_STATUS_BADARG);
if (conf.ds_readonly)
return (DLADM_STATUS_DENIED);
if (type == DLADM_TYPE_STR)
else
if (attrsz > MAXLINKATTRVALLEN)
return (DLADM_STATUS_TOOSMALL);
}
/*
* Unset the given attr the given link.
*/
const char *attr)
{
return (DLADM_STATUS_BADARG);
if (conf.ds_readonly)
return (DLADM_STATUS_DENIED);
}
/*
* Remove the given link ID and its entry from the data link configuration
* repository.
*/
{
}
/*
* Free the contents of the link structure.
*/
void
{
if (conf.ds_readonly) {
} else {
return;
}
}
{
}
{
}