libdladm.c revision 210db2243d3b5ca39c96a4c34c6d9453ddfbeaa9
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <stropts.h>
#include <stdlib.h>
#include <errno.h>
#include <libdevinfo.h>
#include <libdlpi.h>
#include <libdladm.h>
/*
* Issue an ioctl to the specified file descriptor attached to the
* DLD control driver interface.
*/
static int
{
}
/*
* Return the attributes of the specified datalink from the DLD driver.
*/
static int
{
return (-1);
}
return (-1);
return (0);
}
/*
* Callback function used to count the number of DDI_NT_NET.
*/
/* ARGSUSED */
static int
{
(*countp)++;
return (DI_WALK_CONTINUE);
}
/*
* Adds a datalink to the array corresponding to arg.
*/
static void
{
char *elem;
for (;;) {
if (elem[0] == '\0')
break;
return;
}
}
/*
* Walker callback invoked for each DDI_NT_NET node.
*/
static int
{
int fd;
char *provider;
return (DI_WALK_CONTINUE);
(void) dlpi_close(fd);
return (DI_WALK_CONTINUE);
}
(void) dlpi_close(fd);
return (DI_WALK_CONTINUE);
}
(void) dlpi_close(fd);
return (DI_WALK_CONTINUE);
}
(void) dlpi_close(fd);
return (DI_WALK_CONTINUE);
}
/*
* Invoke the specified callback function for each active DDI_NT_NET
* node.
*/
int
{
char **array;
char *elem;
int i;
return (-1);
}
count = 0;
if (count == 0)
goto done;
for (i = 0; i < count; i++) {
continue;
}
while (--i >= 0)
goto done;
}
for (i = 0; i < count; i++) {
if (elem[0] != '\0')
}
done:
}
/*
* Invoke the specified callback function for each vlan managed by dld
*/
int
{
int nvlan = 512;
return (-1);
for (;;) {
bufsize = sizeof (dld_ioc_vlan_t) +
nvlan * sizeof (dld_vlan_info_t);
goto done;
if (rc == 0)
break;
nvlan *= 2;
continue;
}
goto done;
}
}
done:
return (0);
}
/*
* Returns the current attributes of the specified datalink.
*/
int
{
int fd;
return (-1);
goto failed;
return (0);
return (-1);
}