acquire_iodevs.c revision a08731ec17cb062d80f19791149c20e0f2f43b01
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "statcommon.h"
#include "dsr.h"
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <strings.h>
#include <errno.h>
#include <limits.h>
static struct iodev_snapshot *
make_controller(int cid)
{
struct iodev_snapshot *new;
return (new);
}
static struct iodev_snapshot *
{
struct iodev_snapshot *pos;
struct iodev_snapshot *pos2;
return (pos);
return (pos2);
}
return (NULL);
}
static enum iodev_type
{
switch (type) {
case IODEV_CONTROLLER: return (0);
case IODEV_NFS: return (0);
case IODEV_TAPE: return (0);
case IODEV_IOPATH: return (IODEV_DISK);
case IODEV_DISK: return (IODEV_CONTROLLER);
case IODEV_PARTITION: return (IODEV_DISK);
}
return (IODEV_UNKNOWN);
}
static int
{
}
static struct iodev_snapshot *
{
struct iodev_snapshot *pos;
struct iodev_snapshot *pos2;
return (NULL);
return (NULL);
if (parent_type == IODEV_CONTROLLER) {
continue;
continue;
return (pos);
}
return (NULL);
return (pos);
}
/* IODEV_DISK parent */
return (pos);
continue;
continue;
return (pos2);
}
}
return (NULL);
}
static void
{
}
static void
struct iodev_snapshot *new)
{
return;
}
else
}
static void
struct iodev_snapshot *new)
{
return;
}
}
static void
{
return;
}
for (;;) {
return;
}
break;
}
}
static int
{
}
static void
{
struct iodev_snapshot **list;
parent->is_nr_children++;
} else {
ss->s_nr_iodevs++;
}
}
static int
{
size_t i;
/* no filter, pass */
return (1);
/* no filtered names, pass if not floppy and skipped */
for (i = 0; i < df->if_nr_names; i++) {
return (1);
return (1);
}
/* not found in specified names, fail match */
return (0);
}
/* select which I/O devices to collect stats for */
static void
struct iodev_filter *df)
{
if (nr_iodevs == UNLIMITED_IODEVS)
continue;
--nr_iodevs;
}
/* now insert any iodevs into the remaining slots */
continue;
--nr_iodevs;
}
/* clear the unwanted ones */
while (pos) {
}
}
static int
struct iodev_snapshot *disk)
{
return (errno);
return (0);
}
static int
{
struct iodev_snapshot *pos;
int err = 0;
/* controllers don't have stats (yet) */
return (errno);
}
return (err);
return (err);
}
}
}
return (0);
}
static int
{
return (0);
char kstat_name[KSTAT_STRLEN];
char *dname = kstat_name;
struct iodev_snapshot *iodev;
continue;
continue;
/*
* Some drivers may not follow the naming convention
* for error kstats (i.e., drivername,err) so
* be sure we don't walk off the end.
*/
dname++;
ename++;
}
*dname = '\0';
continue;
return (errno);
return (errno);
}
return (0);
}
static void
{
char *target;
const char *p1;
const char *p2;
return;
return;
++p1;
if (!*p1)
return;
++p1;
++p2;
return;
} else if (ret == 1) {
}
}
}
static char *
{
char *tmpbuf;
return (NULL);
return (NULL);
/* space for 's', and integer < NDKMAP (16) */
/*
* This is a regular slice. Create the name and
* copy it for use by the calling routine.
*/
return (tmpbuf);
}
static char *
{
char *tmpbuf;
return (NULL);
/*
* See if it falls in the range of allowable partitions. The
* fdisk partitions show up after the traditional slices so we
* determine which partition we're in and return that.
* The NUMPART + 1 is not a mistake. There are currently
* FD_NUMPART + 1 partitions that show up in the device directory.
*/
return (NULL);
/* space for 'p', and integer < NDKMAP (16) */
return (tmpbuf);
}
static void
{
char *tmp;
int partition;
if (!(types & SNAP_IODEV_PRETTY))
return;
return;
}
char buf[KSTAT_STRLEN];
tmp++;
if (!*tmp)
return;
return;
goto out;
}
return;
if (types & SNAP_IODEV_PRETTY) {
}
/* look for a possible partition number */
tmp++;
if (*tmp != ',')
goto out;
tmp++;
char *part;
}
}
out:
/* only fill in the pretty name if specifically asked for */
if (types & SNAP_IODEV_PRETTY) {
} else {
}
}
static enum iodev_type
{
return (IODEV_DISK);
return (IODEV_PARTITION);
return (IODEV_NFS);
return (IODEV_IOPATH);
return (IODEV_TAPE);
return (IODEV_UNKNOWN);
}
int
{
/* neutral sort order between disk and part */
return (-1);
return (1);
}
/* controller doesn't have ksp */
return (-1);
return (1);
} else {
return (-1);
return (1);
}
}
int
{
int err = 0;
struct iodev_snapshot *pos;
ss->s_nr_iodevs = 0;
/*
* Call cleanup_iodevs_snapshot() so that a cache miss in
* lookup_ks_name() will result in a fresh snapshot.
*/
enum iodev_type type;
continue;
/* e.g. "usb_byte_count" is not handled */
continue;
continue;
goto out;
}
/*
* We must insert in sort order so e.g. vmstat -l
* chooses in order.
*/
}
/* before acquire_stats for collate_controller()'s benefit */
goto out;
}
goto out;
err = 0;
out:
return (err);
}
void
{
while (iodev->is_children) {
}
}