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
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * extern global variables
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const int UID_ATTR_INDEX[MAX_OBJ_TYPE_FOR_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * extern functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * global variables
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * local variables
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * local functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte which = ATTR_INDEX_DDS(ISNS_DD_SET_NAME_ATTR_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte which = ATTR_INDEX_DDS(ISNS_DD_SET_STATUS_ATTR_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check if the name is in use */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* memory exhausted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy((char *)attr->value.ptr, (char *)name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* cache has been updated, set the flag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* update data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attr = &obj->attrs[ATTR_INDEX_ISCSI(ISNS_ISCSI_NAME_ATTR_ID)];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (uid != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &obj->attrs[ATTR_INDEX_DD(ISNS_DD_NAME_ATTR_ID)],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lc.id[i] = ATTR_INDEX_ISCSI(ISNS_ISCSI_NAME_ATTR_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* a member id or member name is required */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* add member */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove member (isnsp msg request only) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* add member */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* object does not exist, create one */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* don't create it if uid is specified */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove member */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* object does not exist, create one */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* enlarge the matrix on x axis */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (x_info == 0 && k == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the first available slot */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i == matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (k == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enlarge the matrix.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (j < matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (TEST_MEMBERSHIP(bmp, primary, second) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (TEST_MEMBERSHIP(bmp, primary, second) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i == matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (update_matrix(matrix, op, dd_id, m_id, 1));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte matrix_t *dds_matrix = cache_get_matrix(OBJ_DDS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (update_matrix(dds_matrix, op, dds_id, m_id, 0));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* dup it for caller */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*p != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *n * sizeof (bmp_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* clean it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ASSERT(MATRIX_X_INFO(bmp) == ISNS_DEFAULT_DD_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Test the membership for each node which is a */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* member in the dd that is being deleted. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (j == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* put it to the default dd */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* dup it for caller */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*p != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *n * sizeof (bmp_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (clear_matrix(matrix, dds_id, NULL, NULL, 0));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (cache_lookup(&lc, NULL, cb_get_dds_status));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < dds_matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* clear it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get the source object uid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lc.id[0] = ATTR_INDEX_ISCSI(ISNS_ISCSI_NAME_ATTR_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no such object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < dd_matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*p == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*n >= tmp_n) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (j < short_n) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*p)[j] |= short_p[j];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*p != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*p != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (ec == 0 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* memory exhausted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* memory exhausted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lcp->data[i].ip = (in6_addr_t *)malloc(attr->len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* memory exhausted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lcp->data[i].ip = (in6_addr_t *)malloc(attr->len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* memory exhausted */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attr = &obj->attrs[ATTR_INDEX_PORTAL(lcp->id[i])];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte matrix->m = (bmp_t *)calloc(y, SIZEOF_X_UNIT(matrix));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * allocate an array of pointer for dd and dd-set matrix.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c->x = (matrix_t **)calloc(2, sizeof (matrix_t *));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (c->x == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * create dd matrix.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c->x[0] = x;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Mark the first array on the y axis for Default DD.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * create dd set matrix.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c->x[1] = x;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Mark the first array on the y axis for Default DD-set.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Add Default DD as a member of Default DD-set.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (matrix->x > primary1 && matrix->x > primary2) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (i < matrix->y) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte id3 = ATTR_INDEX_DDS(ISNS_DD_SET_STATUS_ATTR_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte assign_attr(&obj->attrs[id1], name_attr) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (status_attr == NULL || status_attr->value.ui == 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte assign_attr(&obj->attrs[id3], status_attr) == 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no memory */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* need to include the null terminator */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* and be on 4 bytes aligned */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* need to include the null terminator */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* and be on 4 bytes aligned */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do now allow changing the default DD and DD-set name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (update_ds_name(OBJ_DD, uid, ISNS_DD_NAME_ATTR_ID, len, name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do now allow changing the default DD and DD-set name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do now allow placing any node to the default DD explicitly.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* add the membership to data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* trigger a management scn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t m_id = assoc->attrs[ATTR_INDEX_ASSOC_DD(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do now allow changing the membership of the default DD
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and DD-set.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* add the membership to data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* trigger a management scn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do now allow removing the member from default DD explicitly.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* update data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove it from data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* trigger a management scn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove it from object container if */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* it is not a registered object */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do now allow removing the member from default DD-set.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* update data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove it from data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* trigger a management scn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* clean the membership */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* update data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove it from data store */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do now allow removing the default DD.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* de-register the object at first */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* clear it from all of dd-set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) remove_member_wildchar(dds_matrix, dd_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* clear its member bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* deregister the member nodes which are not-registered node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* and have no longer membership in other DD(s). */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do now allow removing the default DD-set.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (update_matrix(matrix, op, ISNS_DEFAULT_DD_ID, uid, 0));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Ensure the Default DD is registered. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Ensure the Default DD-set is registered. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ec != 0) {