fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
530e2b59e3a1e24b97617608e33a1786f2875502wl * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * external variables
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * global data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * local variables
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* type of parent object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int TYPE_OF_PARENT[MAX_OBJ_TYPE_FOR_SIZE] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DD */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DDS */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* MAX_OBJ_TYPE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY2 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY3 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY4 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* number of children object type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* type of a child object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int TYPE_OF_CHILD[MAX_OBJ_TYPE][MAX_CHILD_TYPE] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* number of attributes of certain type of object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* MAX_OBJ_TYPE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY2 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY3 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY4 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* the tag of UID of each type of object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const int UID_TAG[MAX_OBJ_TYPE_FOR_SIZE] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* MAX_OBJ_TYPE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY2 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY3 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY4 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* the index of UID of each type of object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int UID_ATTR_INDEX[MAX_OBJ_TYPE_FOR_SIZE] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* MAX_OBJ_TYPE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY2 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY3 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 0, /* OBJ_DUMMY4 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ATTR_INDEX_ASSOC_ISCSI(ISNS_DD_ISCSI_INDEX_ATTR_ID),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* the index of the key attributes of each type of object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const int KEY_ATTR_INDEX[MAX_OBJ_TYPE][MAX_KEY_ATTRS] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { ATTR_INDEX_PORTAL(ISNS_PORTAL_IP_ADDR_ATTR_ID),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* the operating methods for key attributes of each type of object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const int KEY_ATTR_OP[MAX_OBJ_TYPE][MAX_KEY_ATTRS] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* the size of each type of object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const int SIZEOF_OBJ[MAX_OBJ_TYPE_FOR_SIZE] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const int NUM_OF_REF[MAX_OBJ_TYPE_FOR_SIZE] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* the type of the reference object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const int TYPE_OF_REF[MAX_OBJ_TYPE][MAX_REF_COUNT + 1] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* the operating method for match operation of the reference object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const int REF_MATCH_OPS[MAX_OBJ_TYPE][MAX_REF_MATCH] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* the index of the attribute of being matched object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const int REF_MATCH_ID1[MAX_OBJ_TYPE][MAX_REF_MATCH] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { ATTR_INDEX_ISCSI(ISNS_ISCSI_NAME_ATTR_ID), 0 },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { ATTR_INDEX_PORTAL(ISNS_PORTAL_IP_ADDR_ATTR_ID),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* the index of the attribute of matching object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const int REF_MATCH_ID2[MAX_OBJ_TYPE][MAX_REF_MATCH] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { ATTR_INDEX_PG(ISNS_PG_ISCSI_NAME_ATTR_ID), 0 },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * local functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic lookup_ctrl_t *set_lookup_ctrl(lookup_ctrl_t *, isns_obj_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int cb_get_parent(void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int cb_node_child(void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int cb_set_ref(void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int cb_clear_ref(void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int cb_add_child(void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int cb_remove_child(void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int cb_verify_ref(void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int cb_ref_new2old(void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int cb_new_ref(void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lookup_ctrl_t *, isns_type_t, uint32_t, const isns_obj_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lookup_ctrl_t *, const isns_obj_t *, const isns_obj_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int new_ref(const isns_obj_t *, const isns_obj_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t setup_parent_lcp(lookup_ctrl_t *, isns_obj_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int copy_attrs(isns_obj_t *, const isns_obj_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic isns_obj_t *make_default_pg(const isns_obj_t *, const isns_obj_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic isns_obj_t *(*const make_ref[MAX_OBJ_TYPE])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t entity_hval(void *, uint16_t, uint32_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t iscsi_hval(void *, uint16_t, uint32_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t portal_hval(void *, uint16_t, uint32_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t pg_hval(void *, uint16_t, uint32_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t dd_hval(void *, uint16_t, uint32_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t dds_hval(void *, uint16_t, uint32_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * entity_hval:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caculate the hash value of a network entity object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer pointers to network entity object or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the lookup control data, both have the key attribute
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of a network entity object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * chunk- which chunk of the hash table.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flags- pointer to flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the hash value.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_FUNC_ARG_UNUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p pointers to a network entity object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte key = obj->attrs[ATTR_INDEX_ENTITY(ISNS_EID_ATTR_ID)].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p is lookup control data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi_hval:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caculate the hash value of an iscsi storage node object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer pointers to iscsi storage node object or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the lookup control data, both have the key attribute
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of an iscsi storage node object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * chunk- which chunk of the hash table.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flags- pointer to flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the hash value.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_FUNC_ARG_UNUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p pointers to an iscsi storage node object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte key = obj->attrs[ATTR_INDEX_ISCSI(ISNS_ISCSI_NAME_ATTR_ID)].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p is lookup control data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * portal_hval:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caculate the hash value of a portal object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer pointers to a portal object or the lookup control
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * data, both have the key attributes of a portal object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * chunk- which chunk of the hash table.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flags- pointer to flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the hash value.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_FUNC_ARG_UNUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p pointers to a portal object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p is lookup control data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(buff2, sizeof (buff2), "%d", port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caculate the hash value of a portal group object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer pointers to a portal group object or the lookup
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * control data, both have the key attributes of a portal object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * chunk- which chunk of the hash table.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flags- pointer to flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the hash value.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p is a portal group object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the first chunk */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* another chunk */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p is a lookup control data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* clear the chunk flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the first chunk */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* another chunk */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(buff2, sizeof (buff2), "%d", port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caculate the hash value of a DD object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer pointers to a DD object or the lookup control data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * both have the key attributes of a DD object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * chunk- which chunk of the hash table.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flags- pointer to flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the hash value.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_FUNC_ARG_UNUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p is a DD object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte key = obj->attrs[ATTR_INDEX_DD(ISNS_DD_NAME_ATTR_ID)].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p is a lookup control data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caculate the hash value of a DD-set object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer pointers to a DD-set object or the lookup control data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * both have the key attributes of a DD-set object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * chunk- which chunk of the hash table.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flags- pointer to flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the hash value.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_FUNC_ARG_UNUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p is a DD-set object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte key = obj->attrs[ATTR_INDEX_DDS(ISNS_DD_SET_NAME_ATTR_ID)].
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* p is lookup control data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * caculate the hash value of an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer pointers to an object or lookup control data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * both has the object type and the key attributes of an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * chunk- which chunk of the hash table.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flags- pointer to flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the hash value.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_obj_uid:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the UID of an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer pointers to an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the UID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const void *p
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t *attr = &obj->attrs[UID_ATTR_INDEX[obj->type]];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * set_obj_uid:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * set the UID of an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer pointers to an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * uid - the UID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the UID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isns_attr_t *attr = &obj->attrs[UID_ATTR_INDEX[obj->type]];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set the tag, len and value */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compare between two objects or an object with a lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p1 - the pointer points to an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p2 - the pointer points to an object or a lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flags- 0: p2 is an object; otherwise p2 is a lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the comparsion result.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the object are linked with decending order by */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the object UID, if the object UID is greater than */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* or equal to the current UID, it needs to compare */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* for the next one. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lcp->curr_uid != 0 && uid >= lcp->curr_uid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * replace_object:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * replace an existing object with the new one.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p1 - the pointer points to an object being replaced.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p2 - the pointer points to a new object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * uid_p- points to uid for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * flag - 0: do not free the source object, otherwise free it.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (src->type == OBJ_DD || src->type == OBJ_DDS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* replace not allowed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set cache update flag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* update parent uid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* update all of attributes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* free up the src object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (online == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* update data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we should never have duplicated entry in data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* trigger a scn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * add_object:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * post function after adding a new object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - object which has been added.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* add the new object to data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* trigger a scn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj_tab_init:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * initialize the object hash tables.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * c - points to the cache.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * allocate an array of pointer for the object hash tables.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c->t = (struct htab **)calloc(sizeof (struct htab *), MAX_OBJ_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (c->t == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hash table for network entity objects.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hash table for iscsi storage node objects.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hash table for portal objects.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hash table for portal group objects.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hash table for discovery domain objects.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hash table for discovery domain set objects.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_ref_np:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the ref pointer of the portal group object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - portal group object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - ref pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obj->type == OBJ_PG ? &((isns_pg_t *)obj)->ref[n] : NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < NUM_OF_REF[t]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_NOP_ELSE_STMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_parent_p:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the pointer of the parent object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - parent object pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_child_np:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the pointer of the UID array of the n'th child of an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * n - the child index.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the pointer of the UID array.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obj->type == OBJ_ENTITY ? &((isns_entity_t *)obj)->cuid[n] : NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_child_n:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the UID array of the n'th child of an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * n - the child index.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the UID array.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_child_p:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the pointer of the UID array of the child matching the type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * base - an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * child_type - the child object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the pointer of the UID array.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (child_type == TYPE_OF_CHILD[base->type][i]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_child_t:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the UID array of the child object matching the type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * base - an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * child_type - the child object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the UID array.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compare the object against the lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lcp - the lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - comparison result.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < MAX_LOOKUP_CTRL && lcp->op[i] > 0 && match) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * set_lookup_ctrl:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fill in the lookup control data for an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lcp - the lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (op != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * assign_attr:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * assign an attribute.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * attr - the attribute being assigned.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tmp - the attribute.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* memory exhausted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* memory exhausted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attr->value.ip = (in6_addr_t *)calloc(1, tmp->len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* memory exhausted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attr->value.ui = MIN_ESI_INTVAL; /* 20 seconds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* don't assign the attribute */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * copy_attrs:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * copy all of attributes from one object to another.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dst - the destination object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tmp - the source object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < n) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * extract_attr:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * extract an attribute from a TLV format data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * attr - the attribute.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tlv - the TLV format data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tlv->attr_len < min_len || tlv->attr_len > max_len) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attr->value.ptr = (uchar_t *)&(tlv->attr_value[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attr->value.ptr = (uchar_t *)&(tlv->attr_value[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fall throught */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fall throught */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fall throught */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fall throught */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fall throught */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ignore scn bitmap attribute during object registration, */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* it is registered by scn_reg message. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * copy_attr:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * copy an attribute from a TLV format data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * attr - the attribute.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tlv - the TLV format data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* extract the attribute first */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* assign the attribute */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_timestamp:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get current timestamp.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - current timestamp.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* block the scheduler */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get most current time */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* need to wakeup idle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* unblock it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get_reg_period:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get the longest registration period.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the longest registration period.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get most current time */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* just one second before the end of the world */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj_calloc:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * allocate memory space for an object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * type - the object type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - pointer of the object being allocated.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * make_default_entity:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * generate a default network entity object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - pointer of the default network entity object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *eid = make_unique_name(&len, ISNS_EID_ATTR_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attr = &obj->attrs[ATTR_INDEX_ENTITY(ISNS_EID_ATTR_ID)];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set default entity name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set default registration period */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ATTR_INDEX_ENTITY(ISNS_ENTITY_REG_PERIOD_ATTR_ID)];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * make_default_pg:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * generate a default portal group object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi - the iscsi storage node object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * portal - the portal object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - pointer of the default portal group object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte name = &iscsi->attrs[ATTR_INDEX_ISCSI(ISNS_ISCSI_NAME_ATTR_ID)];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr = &portal->attrs[ATTR_INDEX_PORTAL(ISNS_PORTAL_IP_ADDR_ATTR_ID)];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port = &portal->attrs[ATTR_INDEX_PORTAL(ISNS_PORTAL_PORT_ATTR_ID)];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pg != NULL && pg_name != NULL && pg_addr != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy((char *)pg_name, (char *)name->value.ptr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attr = &pg->attrs[ATTR_INDEX_PG(ISNS_PG_ISCSI_NAME_ATTR_ID)];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) set_parent_obj(pg, get_parent_uid(iscsi));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reg_get_entity:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * parse the Operating Attributes of the DevAttrReg message and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * create the Network Entity object if it has one.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer of the object for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op - the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op_len - the length of the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parse the entity object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tmp_len >= 8 && IS_ENTITY_KEY(tmp->attr_id)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } while (ec == 0 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set default registration period */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ATTR_INDEX_ENTITY(ISNS_ENTITY_REG_PERIOD_ATTR_ID)];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reg_get_iscsi:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * parse the Operating Attributes of the DevAttrReg message and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * create an iSCSI Storage Node object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer of the object for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pg_key1 - the pointer of iscsi storage node name for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op - the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op_len - the length of the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* keep the iscsi storage node name for */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parsing a pg object which is immediately */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* followed with a PGT by the iscsi storage node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_key1->value.ptr = (uchar_t *)&tmp->attr_value[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parse one iscsi storage node object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parse key & non-key attributes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } while (ec == 0 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reg_get_portal:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * parse the Operating Attributes of the DevAttrReg message and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * create a Portal object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer of the object for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pg_key1 - the pointer of portal ip addr for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pg_key2 - the pointer of portal port for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op - the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op_len - the length of the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* keep the portal ip addr */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* keep the portal port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pg_key2->value.ui = ntohl(*(uint32_t *)&tmp->attr_value[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parse one portal object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copy ip addr attribute */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copy port attribute */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parse non-key attributes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (ec == 0 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ip address is not followed by port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reg_get_pg:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * parse the Operating Attributes of the DevAttrReg message and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * create a Portal Group object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer of the object for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op - the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op_len - the length of the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parse a complete pg object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parse attributes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } while (ec == 0 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reg_get_pg1:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * parse the Operating Attributes of the DevAttrReg message and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * create a Portal Group object which is followed to a Portal object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer of the object for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pgt - the size-3 array of pointers which have the pg portal ip addr, port
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and the pg tag attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op - the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op_len - the length of the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the pg iscsi storage node name is */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* followed to a portal group tag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copy pg iscsi storage node name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copy pg ip addr, pg port & pgt */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reg_get_pg2:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * parse the Operating Attributes of the DevAttrReg message and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * create a Portal Group object which is followed to a iSCSI
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Storage Node object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer of the object for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pgt - the size-3 array of pointers which have the pg iscsi storage
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * node name and the pg tag attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op - the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op_len - the length of the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* keep ip address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* expect pg portal port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* expect pg tag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* expect pg iscsi storage node name only */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the pg portal ip addr & port is followed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* to a pg tag and we have the iscsi storage */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* node parsed previously */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copy the pg ip addr */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copy the pg port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copy pg iscsi storage node name & pgt */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reg_get_obj:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * parse and create one object from the rest of Operating Attributes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of the DevAttrReg message, the object can be iSCSI Storage Node,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Portal or Portal Group.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer of the object for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pgt - an attribute array with size 3, the elements are:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0: the first pg key attribute, it is either the name of an
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi storage node object or the ip addr of a portal object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1: the second pg key attribute, i.e. the portal port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2: the portal group tag attribute.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op - the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op_len - the length of the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*op_len == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ec = reg_get_portal(p, &pgt[0], &pgt[1], op, op_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* pg iscsi storage node name is */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* followed to a pgt */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* a complete pg object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* pg portal ip addr is followed to a pgt */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* portal group tag does not follow */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* iscsi storage node or portal object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* should never happen */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reg_auth_src:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Authorize the source attribute the DevAttrReg message.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The update can only performed by the node who has the owenership.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the pointer of the object for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pgt - an attribute array with size 3, the elements are:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0: the first pg key attribute, it is either the name of an
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi storage node object or the ip addr of a portal object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1: the second pg key attribute, i.e. the portal port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2: the portal group tag attribute.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op - the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * op_len - the length of the operating attributes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is_obj_online:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * determine if the object is currently registered with the server.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - the object being checked.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - 0: not registered, otherwise registered.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ISNS_ISCSI_NODE_TYPE_ATTR_ID)].value.ui == 0 ? 0 : 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * assoc_clone:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * clone the association object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p - the object being cloned.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * clone_flag - 0: the object is being removed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1: only the association is being removed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the clone object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dd_flag = (get_dd_id(get_obj_uid(obj), ISNS_DEFAULT_DD_ID) == 0) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state = (clone_flag << 2) | (dd_flag << 1) | online;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* clone_flag dd_flag online action */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 0 0 0 ASSERT(0) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 0 0 1 NULL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 0 1 0 itself */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 0 1 1 clone it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 1 0 0 NULL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 1 0 1 itself */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 1 1 0 itself */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 1 1 1 itself */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (op != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ((void *)clone);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * free_one_object:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * free up one object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - the object being freed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* free child uids */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* at last, free the object itself */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * free_object:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * free up one object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - the object being freed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * set_parent_obj:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * set the parent object UID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - the child object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * puid- the parent object UID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * buff_child_obj:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * add a child object UID to the child object array.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - the parent object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * child_type - the type of the child object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * number - the number of the child object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the length of the child object UID array.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const void *c,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void const ***child
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get the pointer of the array which the child belongs to */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the child type is not applicable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get an empty slot from the uid array for this child */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < num) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (p[++i] == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* found it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the array is full, enlarge the child uid array */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte p = (void const **)realloc(p, (new_num + 1) * sizeof (void *));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *p = (void *)new_num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * update_child_object:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * update the child object of a network entity object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * puid - the UID of the parent object, i.e. the network entity object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * child_type - the type of the child object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * child_uid - the uid of the child object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void const ***child,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (TYPE_OF_REF[t][0] != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } while (uid != 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * verify_ref_obj:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * update the reference bit of a portal group object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - the object being ref'ed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void const ***child
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < NUM_OF_REF[t]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i > 0 && ref_count == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * register_object:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * add one object to the object container.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - the object being added.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * uid_p- the pointer for returning object UID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * update_p- the pointer for returning flag which indicates if the object
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is newly registered or updated with an existing one.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * register_assoc:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * add one association object to the object container, the association
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * object has only the information for discovery domain membership, i.e.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a name and UID only.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - the association object being added.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * uid_p- the pointer for returning object UID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is_obj_there:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * check if the object is registered or not.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lcp - the lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the object UID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lc.id[0] = ATTR_INDEX_ISCSI(ISNS_ISCSI_NAME_ATTR_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * setup_ref_lcp:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * prepare the lookup control data for looking up a portal group
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * object which references to a iscsi stroage node and/or a portal
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lcp - the lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iscsi- the ref'ed iscsi storage node object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * portal- the ref'ed portal object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i = 0, j = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* extrace the matching attributes from iscsi storage node object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* extrace the matching attributes from portal object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* extrace the matching attributes from iscsi storage node object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * setup_parent_lcp:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * prepare the lookup control data for looking up parent object
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * with a child object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lcp - the lookup control data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * obj - the child object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - parent object UID.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_FUNC_ARG_UNUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_FUNC_ARG_UNUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (num > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cb_set_ref:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callback function which sets the reference bit to 1 according to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the type of object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p1 - the object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p2 - the lcp.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* successful */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cb_clear_ref:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callback function which clears the reference bit according to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the type of object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p1 - the object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p2 - the lcp.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - 1: the object is no longer ref'ed, 0: otherwise.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copy required */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (vnum > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (child_flag == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (is_obj_online(o) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cb_remove_child:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * callback function which removes a child object UID from the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * children objet UID array of the parent object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p1 - the object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * p2 - the lcp.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - 1: no more such type of child object, 0: otherwise.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get the children object UID array */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check if all of child object UIDs are removed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, j, k;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rt == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (j > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (k > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (u != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* End of while each unum */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* End of while each vnum */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (j > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (k > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* End of while each vnum */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* End of for each type of child */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no such ref, create a default one */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Physically remove an object along with the children objects,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the reference object and the parent object recursively.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Apporiate SCN is triggered.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lcp - the lookup control for the object being removed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * parent_flag - 1: the object being removed is the parent object;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0: otherwise.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * child_flag - 1: the object being removed is a child object;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0: otherwise.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pending - 1: do not remove the ESI entry immediately;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0: remove the ESI entry without any delay.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove the object from object container */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* trigger a scn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* dereg children */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* clear the ref bit on the ref'd object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cache_lookup(lcp, &uid, cb_clear_ref) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } while (uid != 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove it from the parent */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cache_lookup(lcp, NULL, cb_remove_child) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove it from persistent data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove esi event entry */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save the parent uid for caller */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* it's the parent itself */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove this portal from scn registry */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* free the object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dereg_assoc:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Remove one association object from object container.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lcp - the lookup control for the object being removed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* free the object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dereg_object:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Remove one object from object container.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lcp - the lookup control for the object being removed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * data_sync:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Synchronize the cache with persistent data store.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Flush the cache data to data store if the input ec is zero,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * retreat the changes in cache and ignore data store update
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if there is an error.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ec - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - error code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* cache is updated successfully, commit the data to data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* successful, trigger the SCN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) queue_msg_set(scn_q, SCN_TRIGGER, (void *)NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ignore all SCNs which have been generated */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) queue_msg_set(scn_q, SCN_IGNORE, (void *)NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "ENTITY_ID_%d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * make_unique_name:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * make a default unique name for a newly registered network entity,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * discovery domain or discovery domain set object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * len - pointer of the length of the new name for returning.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tag - which attribute of the new name is for.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return - the name being made.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lc.id[0] = ATTR_INDEX_DDS(ISNS_DD_SET_NAME_ATTR_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no more space, failure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 4-bytes aligned length */