mgmt_list.c revision a9fd9a9e12bea66c9ea9b31f4b6f0ef584933f59
/*
* 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 <time.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <strings.h>
#include <dirent.h>
#include <priv.h>
#include <iscsitgt_impl.h>
#include "utility.h"
#include "queue.h"
#include "target.h"
#include "iscsi_cmd.h"
#include "iscsi_conn.h"
#include "port.h"
#include "errcode.h"
#include "mgmt_scf.h"
static char *list_targets(tgt_node_t *x);
static char *list_initiator(tgt_node_t *x);
static char *list_tpgt(tgt_node_t *x);
static char *list_admin(tgt_node_t *x);
/*ARGSUSED*/
void
{
tgt_node_t *x;
char msgbuf[80];
} else {
x = p->x_child;
reply_msg = list_targets(x);
reply_msg = list_initiator(x);
reply_msg = list_admin(x);
} else {
"Unknown object '%s' for list element",
x->x_name);
}
}
}
/*ARGSUSED*/
static char *
{
/*
* It's okay to not supply a "name" element. That just means the
* administrator wants a complete list of targets. However if a
* "name" is supplied then there must be a value for that element.
*/
return (msg);
}
/* ---- optional arguments ---- */
"bogus entry");
continue;
}
False) {
"missing iscsi-name");
continue;
}
Tag_End);
}
} else {
}
}
return (msg);
}
/*ARGSUSED*/
static char *
{
/* ---- Optional arguments ---- */
return (msg);
}
NULL) {
}
"Set");
}
}
}
}
return (msg);
}
/*ARGSUSED*/
static char *
list_tpgt(tgt_node_t *x)
{
/* ---- Optional arguments ---- */
return (msg);
}
NULL) {
}
}
}
return (msg);
}
/*ARGSUSED*/
static char *
list_admin(tgt_node_t *x)
{
admin_table_t *p;
if (node) {
else
}
}
return (msg);
}
static void
{
iscsi_conn_t *c;
msg_t *m;
target_queue_t *q = queue_alloc();
int msg_sent;
int i;
extern pthread_mutex_t port_mutex;
(void) pthread_mutex_lock(&port_mutex);
msg_sent = 0;
if (c->c_state == S5_LOGGED_IN) {
/*
* Only send requests for statistics to
* connections that are up. Could even
* go further and only look at connections
* which are S5_LOGGED_IN, but there may
* be statistics, such as connection time,
* which we'd like to have.
*/
&mgmt_rqst);
msg_sent++;
}
}
(void) pthread_mutex_unlock(&port_mutex);
/*
* Comment: main.c:list_targets:1
* We wait for the responses without the port_mutex
* being held. There is a small window between when the
* connection last listens for a message and when the
* queue is freed. During that time the connection will
* attempt to grab the port_mutex lock so that it
* can unlink itself and call queueu_free(). If we sent
* the message with the lock held and then wait for a response
* it's possible that the connection will deadlock waiting
* to get the port_mutex.
*/
for (i = 0; i < msg_sent; i++) {
m = queue_message_get(q);
}
queue_free(q, NULL);
}
static void
{
char lun_buf[16];
char *prop;
char *local_name = NULL;
int lun_num;
NULL) {
NULL)
}
NULL) {
NULL)
}
return;
else
} else
continue;
if (local_name != NULL) {
}
} else {
}
True) {
}
True) {
}
True) {
}
True) {
}
True) {
}
True) {
}
True) {
}
}
}