/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "isns_server.h"
#include "isns_func.h"
#include "isns_msgq.h"
#include "isns_htab.h"
#include "isns_cache.h"
#include "isns_obj.h"
#include "isns_dd.h"
#include "isns_pdu.h"
#include "isns_qry.h"
/*
* external variables
*/
extern const int NUM_OF_ATTRS[MAX_OBJ_TYPE_FOR_SIZE];
extern const int UID_ATTR_INDEX[MAX_OBJ_TYPE_FOR_SIZE];
extern const int NUM_OF_CHILD[MAX_OBJ_TYPE];
/*
* global variables
*/
{ 0, 0 },
};
/*
* local variables
*/
/* Edge functions of each adjacent object */
static int qry_c2e(lookup_ctrl_t *);
static int qry_ds2m(lookup_ctrl_t *);
static int qry_slf(lookup_ctrl_t *);
static int qry_e2i(lookup_ctrl_t *);
static int qry_e2p(lookup_ctrl_t *);
static int qry_e2g(lookup_ctrl_t *);
static int qry_i2g(lookup_ctrl_t *);
static int qry_i2d(lookup_ctrl_t *);
static int qry_p2g(lookup_ctrl_t *);
static int qry_g2i(lookup_ctrl_t *);
static int qry_g2p(lookup_ctrl_t *);
static int qry_d2s(lookup_ctrl_t *);
/* The directed cyclic graph of query procedure. */
/* __|____e_________i_________p_________g_________d_________s____ */
/* e | qry_slf...qry_e2i...qry_e2p...qry_e2g...NULL......NULL.... */
/* i | qry_c2e...qry_slf...NULL......qry_i2g...qry_i2d...NULL.... */
/* p | qry_c2e...NULL......qry_slf...qry_p2g...NULL......NULL.... */
/* g | qry_c2e...qry_g2i...qry_g2p...qry_slf...NULL......NULL.... */
/* d | NULL......qry_ds2m..NULL......NULL......qry_slf...qry_d2s. */
/* s | NULL......NULL......NULL......NULL......qry_ds2m..qry_slf. */
/* The type of spanning tree of query graph. */
typedef struct adjvex {
qry_func_t f;
isns_type_t t;
struct adjvex const *v;
} adjvex_t;
/* The solid edges in the spanning tree. */
/* The virtual edges in the spanning tree. */
/* the vector of query graph */
{ NULL },
};
static int
void *p1,
/* LINTED E_FUNC_ARG_UNUSED */
void *p2
)
{
return ((int)puid);
}
static int
void *p1,
void *p2
)
{
uint32_t *p;
if (p != NULL) {
uidp ++;
} else {
return (ISNS_RSP_INTERNAL_ERROR);
}
}
return (0);
}
static int
e2c(
)
{
int ec = 0;
/* the first times of query */
if (uid == 0) {
}
while (num_of_child > 0) {
break;
}
uids ++;
num_of_child --;
}
/* no more child, clean up memory */
if (uid == 0) {
/* free up the memory */
}
/* save it for returning and querying next uid */
return (ec);
}
static int
)
{
/* child object has only one parent */
} else {
uid = 0;
}
/* save the result for returnning */
return (0);
}
static int
)
{
int ec = 0;
uint32_t n;
bmp_t *p;
/* the first times of query */
if (uid == 0) {
get_dd_matrix(ds_id, &p, &n) :
get_dds_matrix(ds_id, &p, &n);
} else {
}
FOR_EACH_MEMBER(p, n, tmp_uid, {
return (ec);
}
});
/* no more member, clean up memory */
/* free up the matrix */
free(p);
return (ec);
}
static int
)
{
} else {
uid = 0;
}
return (0);
}
static int
)
{
}
static int
)
{
}
static int
)
{
/* this is a shortcut */
/* keep the current uid */
return (0);
}
});
return (0);
}
static int
)
{
int ec = 0;
/* the first times of query */
if (uid == 0) {
}
/* pg lookup */
} else {
uid = 0;
}
/* no more pg, update lcp with pg object */
if (uid == 0) {
/* clean up the memory */
/* reset it */
}
}
/* save it for returning and querying next pg */
return (ec);
}
static int
)
{
/* save it for returning and getting next dd */
return (0);
}
static int
)
{
int ec = 0;
/* the first time of query */
if (uid == 0) {
/* use 1&2 for the portal ip address & port */
}
/* pg lookup */
} else {
uid = 0;
}
/* no more pg, clean up memory */
if (uid == 0) {
/* clean up the memory */
/* reset it */
}
}
/* save it for returning and next query */
return (ec);
}
static int
)
{
int ec = 0;
/* the first time of query */
if (uid == 0) {
/* use slot 1 for the storage node name */
/* iscsi node lookup */
/* no longer need it, clean it up */
}
/* no longer need it, reset it */
} else {
/* one pg has maximum number of one storage node */
uid = 0;
}
/* save it for returning and next query */
return (ec);
}
static int
)
{
int ec = 0;
/* the first times of query */
if (uid == 0) {
/* use 1&2 for the portal ip addr and port */
/* portal lookup */
/* no longer need it, reset it */
}
/* no longer need it, reset it */
} else {
/* one pg has maximum number of one portal */
uid = 0;
}
/* save it for returning and next query */
return (ec);
}
static int
)
{
/* save it for returning and for getting next dds */
return (0);
}
int
)
{
int ec = 0;
if (ec == ISNS_RSP_INVALID_REGIS) {
}
}
}
return (ec);
}
static lookup_method_t
)
{
switch (tag) {
/* OP_STRING */
case ISNS_EID_ATTR_ID:
case ISNS_PORTAL_NAME_ATTR_ID:
case ISNS_ISCSI_ALIAS_ATTR_ID:
case ISNS_DD_SET_NAME_ATTR_ID:
case ISNS_DD_NAME_ATTR_ID:
case ISNS_ISCSI_NAME_ATTR_ID:
break;
/* OP_MEMORY_IP6 */
break;
/* OP_INTEGER */
case ISNS_PORTAL_PORT_ATTR_ID:
case ISNS_ESI_PORT_ATTR_ID:
case ISNS_SCN_PORT_ATTR_ID:
case ISNS_PG_TAG_ATTR_ID:
case ISNS_PG_INDEX_ATTR_ID:
case ISNS_DD_SET_ID_ATTR_ID:
case ISNS_DD_ID_ATTR_ID:
/* all other attrs */
default:
method = OP_INTEGER;
break;
}
return (method);
}
static int
void *p1,
void *p2
)
{
int i;
}
attrs ++;
}
return (match);
}
static int
)
{
return (match);
}
static int
)
{
int ec = 0;
uint32_t u;
uint32_t *t;
/* check for duplication */
if (n > 0 && uid <= p[n - 1]) {
while (n-- > 0) {
if (p[n] == uid) {
return (0);
}
}
n = *np;
u = p[n - 1];
p[n - 1] = uid;
uid = u;
}
if (s == n) {
s = (s == 0) ? 8 : s * 2;
if (t != NULL) {
p = t;
*pp = p;
*sp = s;
} else {
}
}
if (ec == 0) {
p[n ++] = uid;
*np = n;
}
return (ec);
}
static int
)
{
int ec = 0;
/* circular list */
int i, j;
isns_type_t t;
/* initialize the circular list */
i = 0;
j = 1;
p[i] = *obj_uids;
n[i] = *num_of_objs;
s[i] = *size;
p[j][0] = src_uid;
n[j] = 1;
s[j] = 8;
/* initial object type of being queried */
t = src_type;
do {
/* shift one on the circular list */
i = (i + 1) & 1;
j = (j + 1) & 1;
/* prepare lookup control */
/* result object type */
t = vex->t;
/* start query */
}
if (ec == 0) {
} else {
}
}
});
if (ec == 0) {
} else {
}
/* push back */
/* reset the number of objects */
n[i] = 0;
/* clean up the memory */
if (ec != 0) {
n2 = 0;
s2 = 0;
}
*num_of_objs = n2;
return (ec);
}
int
)
{
int ec = 0;
union {
isns_obj_t o;
isns_iscsi_t i;
isns_pg_t g;
isns_dd_t d;
isns_dds_t s;
} an_obj = { 0 };
*num_of_objs = 0;
size = 0;
/* get the object type identified by the key */
if (*type == 0) {
return (ISNS_RSP_INVALID_QRY);
}
/* validate the Message Key */
if (ec != 0) {
return (ec);
}
ec = qry_and_match(
if (ec != 0) {
return (ec);
}
});
} else {
node_uid = 0;
ec = qry_and_match(
if (ec != 0) {
return (ec);
}
});
}
return (ec);
}
int
)
{
int ec = 0;
*num_of_ops = 0;
ec = qry_and_match(
return (ec);
}
int
)
{
int ec = 0;
*num_of_ops = 0;
ec = qry_and_match(
if (ec != 0) {
return (ec);
}
});
} else {
node_uid = 0;
ec = qry_and_match(
if (ec != 0) {
return (ec);
}
});
}
return (ec);
}
)
{
if (tlv_len > 8) {
switch (tag) {
case ISNS_EID_ATTR_ID:
break;
case ISNS_ISCSI_NAME_ATTR_ID:
break;
break;
if (tlv_len > 8 &&
} else {
return (0);
}
break;
break;
case ISNS_PG_INDEX_ATTR_ID:
break;
default:
return (0);
}
if (old == 0) {
return (0);
}
}
while (num > 0) {
}
}
}
return (min);
}
static int
void *p1,
void *p2
)
{
int ec = 0;
void *value;
do {
}
}
} while (ec == 0 &&
tlv_len >= 8 &&
return (ec);
}
int
)
{
int ec = 0;
return (ec);
}
int
)
{
/* clear the length of all of tlv */
while (tmp_len > 8) {
}
}