/*
* 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
*/
/*
*/
/*
* functions to handle legacy ndd ioctls
*/
#include <sys/mac_impl.h>
#include <sys/mac_client_priv.h>
#include <sys/mac_ether.h>
/*
* add "<name> (<rwtag>) " into the mblk, allocating more memory if needed.
*/
static boolean_t
{
switch (flags) {
case 0:
rwtag = "no read or write";
break;
case MAC_PROP_PERM_WRITE:
rwtag = "write only";
break;
case MAC_PROP_PERM_READ:
rwtag = "read only";
break;
default:
rwtag = "read and write";
break;
}
/*
* allocate space for name, <space>, '(', rwtag, ')', and
* two terminating null chars.
*/
return (B_FALSE);
}
return (B_TRUE);
}
/*
* handle a query for "ndd -get \?". The result is put into mp, and
* more memory is allocated if needed. The resulting size of the data
* is returned.
*/
static int
{
int size_out, i;
int status;
char *prop_name;
return (-1);
/* first the known ndd mappings */
!= 0)
else {
if (status != 0)
continue;
if (status != 0)
continue;
}
return (-1);
}
/* now the driver's ndd variables */
for (i = 0; i < mip->mi_priv_prop_count; i++) {
return (-1);
/* skip over the "_" */
return (-1);
}
return (size_out);
}
/*
* Handle legacy ndd ioctls for ND_GET and ND_SET.
*/
void
{
goto done;
}
}
done:
if (err == 0)
else
}
static int
{
char *valp;
int size_out = 0, i;
return (EINVAL);
return (ENOMEM);
/*
* handle "ndd -get <..> \?" queries.
*/
if (size_out < 0) {
goto get_done;
}
int excess;
char *cp;
/*
* need more user buffer space. Return as many
* mblks as will fit and return the needed
* buffer size in ioc_rval.
*/
*cp = '\0';
}
status = 0;
goto get_done;
}
/* first lookup ndd <-> public property mapping */
continue;
case 1:
break;
case 2:
break;
case 4:
break;
default:
break;
}
!= 0) {
status = 0;
/*
* ether_stats are all always KSTAT_DATA_UINT32
*/
} else {
case 1:
break;
case 2:
break;
case 4:
break;
case 8:
/*
* The only uint64_t is for speed, which is
* converted to Mbps in ndd reports.
*/
break;
}
}
if (status != 0)
goto get_done;
goto update_reply;
}
/*
* could not find a public property. try the private prop route
* where all string processing will be done by the driver.
*/
if (status != 0)
goto get_done;
*valp++ = '\0';
*rval = 0;
if (status == 0)
else {
}
return (status);
}
static int
{
long new_value;
int status, i;
return (EINVAL);
}
*rval = 0;
while (*valp++)
;
new_valuep = valp;
goto priv_prop;
return (status);
/* first lookup ndd <-> public property mapping */
continue;
return (EINVAL);
== 0)
return (EINVAL);
case 1:
break;
case 2:
break;
case 4:
break;
case 8:
break;
default:
return (ENOTSUP);
}
goto done;
}
done:
return (status);
}