availdevs.c revision a55b6846f87afedf14b3f9b64fbb8c0d0a3f2fe2
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "availdevs.h"
#include <libzfs.h>
#include <libzfs_jni_diskmgt.h>
#include <libzfs_jni_ipool.h>
/*
* Function prototypes
*/
static void handle_error(const char *, va_list);
static int add_disk_to_xml(dmgt_disk_t *, void *);
static int add_pool_to_xml(nvlist_t *, void *);
static xmlDocPtr create_doc();
int main();
/*
* Static functions
*/
static void
{
}
static void
{
static char tmp[64];
}
static int
{
int i;
}
}
}
}
}
}
return (0);
}
static int
{
char *c;
char *name;
uint_t n;
return (-1);
}
return (0);
}
static xmlDocPtr
create_doc(void)
{
/* Create the XML document */
/* Create the root node */
return (doc);
}
/*
* Main entry to availdisks.
*
* @return 0 on successful exit, non-zero otherwise
*/
int
{
int error = 0;
int get_pools = 0;
int get_devices = 0;
/* Examine first arg */
switch (c) {
case CLI_ARG_ALL:
get_devices = 1;
get_pools = 1;
break;
case CLI_ARG_DEVICES:
get_devices = 1;
break;
case CLI_ARG_POOLS:
get_pools = 1;
break;
default:
return (1);
break;
}
if (get_pools || get_devices) {
if (get_devices) {
/* Create the available node */
/* libzfs_jni_diskmgt.o error handler */
}
/* Create the importable node */
}
if (!error) {
/* Print out XML */
}
}
return (error != 0);
}