a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * CDDL HEADER START
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * The contents of this file are subject to the terms of the
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Common Development and Distribution License (the "License").
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * You may not use this file except in compliance with the License.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * or http://www.opensolaris.org/os/licensing.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * See the License for the specific language governing permissions
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * and limitations under the License.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * When distributing Covered Code, include this CDDL HEADER in each
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * If applicable, add the following below this CDDL HEADER, with the
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * fields enclosed by brackets "[]" replaced with your own identifying
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * information: Portions Copyright [yyyy] [name of copyright owner]
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * CDDL HEADER END
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
836fc322d4b4884a4c64c7b5d172a4a3bb6a5772Sam Cramer * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Use is subject to license terms.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman/*
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#ifndef _LIBISCSIT_H
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define _LIBISCSIT_H
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#ifndef _KERNEL
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#include <libnvpair.h>
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#include <sys/socket.h>
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#endif
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
bf604c6405d5cbc4e94e3d0ecc9e6e074ed4ea67Peter Dunlap#include <sys/iscsit/iscsit_common.h>
bf604c6405d5cbc4e94e3d0ecc9e6e074ed4ea67Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#ifdef __cplusplus
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapextern "C" {
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#endif
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
e20dd2eed1abc2cdf00090cf24a23a2c33f9b868Charles Ting#define MAX_TARGETS 255 /* maximum targets that may be created */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define MAX_TPGT 256
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define CFG_TPGTLIST "tpgt-list"
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
fcc214c383d20beb968b623b83d851672e174702Charles Ting#define IS_IQN_NAME(s) (strncmp((s), "iqn.", 4) == 0)
fcc214c383d20beb968b623b83d851672e174702Charles Ting#define IS_EUI_NAME(s) (strncmp((s), "eui.", 4) == 0)
fcc214c383d20beb968b623b83d851672e174702Charles Ting
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman/*
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman * We change the default IQN here to org.illumos.
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman * Other distros using it need to change accordingly.
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman */
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman#define DEFAULT_IQN "iqn.2010-08.org.illumos:"
9fc69cd99026dc35cc62ad524193fa0dfd4de20fShampavman
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Object Hierarchy
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * _______________________
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | iSCSI Target Config |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | it_config_t |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * |_______________________|
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | ________ ________ ________
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | | | | | | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | | Target |-->| Target |-- - - -->| Target |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | |________| |________| |________|
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | | ______ ______
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | | | | | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | +----->| TPGT |-- - - -->| TPGT |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | |______| |______|
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | +--+ | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | _______ _______ | ______ |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | | | | |<--+ | |<--+
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | +->| TPG |-->| TPG |-- - - -->| TPG |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | |_______| |_______| |______|
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | ___________ ___________ ___________
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | | | | | | |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * +---->| Initiator |-->| Initiator |-- - - -->| Initiator |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * | Context | | Context | | Context |
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * |___________| |___________| |___________|
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_t includes a list of global properties
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Targets include a list of properties which override the global properties
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * if set
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Initiators also include a list of properties but never inherit properties
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * from the global config.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Allocate and create an it_config_t structure representing the
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * current iSCSI configuration. This structure is compiled using
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the 'provider' data returned by stmfGetProviderData(). If there
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * is no provider data associated with iscsit, the it_config_t
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * structure will be set to a default configuration.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg A C representation of the current iSCSI configuration
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Could not allocate resources
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid parameter
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_config_load(it_config_t **cfg);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_config_commit()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Informs the iscsit service that the configuration has changed and
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * commits the new configuration to persistent store by calling
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * stmfSetProviderData. This function can be called multiple times
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * during a configuration sequence if necessary.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg A C representation of the current iSCSI configuration
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Could not allocate resources
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid it_config_t structure
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * STMF_ERROR_SERVICE_DATA_VERSION Configuration was updated by another
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * client. See stmfSetProviderDataProt().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_config_commit(it_config_t *cfg);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_config_setprop()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Validate the provided property list and set the global properties
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * for iSCSI Target. If errlist is not NULL, returns detailed
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * errors for each property that failed. The format for errorlist
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * is key = property, value = error string.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configuration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * proplist nvlist_t containing properties for this target.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * errlist (optional) nvlist_t of errors encountered when
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * validating the properties.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Could not allocate resources
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid property
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_config_setprop(it_config_t *cfg, nvlist_t *proplist, nvlist_t **errlist);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_config_free()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Free any resources associated with the it_config_t structure.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg A C representation of the current iSCSI configuration
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvoid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_config_free(it_config_t *cfg);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tgt_create()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Allocate and create an it_tgt_t structure representing a new iSCSI
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * target node. If tgt_name is NULL, then a unique target node name will
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * be generated automatically. Otherwise, the value of tgt_name will be
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * used as the target node name. The new it_tgt_t structure is added to
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the target list (cfg_tgt_list) in the configuration structure, and the
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * new target will not be instantiated until the modified configuration
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * is committed by calling it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configuration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tgt Pointer to an iSCSI target structure
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tgt_name The target node name for the target to be created.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * The name must be in either IQN or EUI format. If
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * this value is NULL, a node name will be generated
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * automatically in IQN format.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Could not allocate resources
836fc322d4b4884a4c64c7b5d172a4a3bb6a5772Sam Cramer * EINVAL Invalid parameter or creating would create too many
836fc322d4b4884a4c64c7b5d172a4a3bb6a5772Sam Cramer * targets.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EEXIST The requested target node name is already configured
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EFAULT Invalid iSCSI target name
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tgt_create(it_config_t *cfg, it_tgt_t **tgt, char *tgt_name);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tgt_setprop()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Validate the provided property list and set the properties for
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the specified target. If errlist is not NULL, returns detailed
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * errors for each property that failed. The format for errorlist
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * is key = property, value = error string.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configuration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tgt Pointer to an iSCSI target structure
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * proplist nvlist_t containing properties for this target.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * errlist (optional) nvlist_t of errors encountered when
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * validating the properties.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Could not allocate resources
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid property
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tgt_setprop(it_config_t *cfg, it_tgt_t *tgt, nvlist_t *proplist,
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap nvlist_t **errlist);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tgt_delete()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Delete target represented by 'tgt', where 'tgt' is an existing
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_tgt_t structure within the configuration 'cfg'. The target removal
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * will not take effect until the modified configuration is committed
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * by calling it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configuration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tgt Pointer to an iSCSI target structure
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * force Set the target to offline before removing it from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the config. If not specified, the operation will
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * fail if the target is determined to be online.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EBUSY Target is online
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tgt_delete(it_config_t *cfg, it_tgt_t *tgt, boolean_t force);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tpgt_create()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Allocate and create an it_tpgt_t structure representing a new iSCSI
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * target portal group tag. The new it_tpgt_t structure is added to the
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * target tpgt list (tgt_tpgt_list) in the it_tgt_t structure. The new
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * target portal group tag will not be instantiated until the modified
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * configuration is committed by calling it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configuration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tgt Pointer to the iSCSI target structure associated
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * with the target portal group tag
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpgt Pointer to a target portal group tag structure
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpg_name The name of the TPG to be associated with this TPGT
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpgt_tag 16-bit numerical identifier for this TPGT. Valid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * values are 2 through 65535. If tpgt_tag is '0',
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * this function will assign an appropriate tag number.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * If tpgt_tag is != 0, and the requested number is
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * unavailable, another value will be chosen.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Could not allocate resources
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid parameter
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EEXIST Specified TPG is already associated with the target
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * E2BIG All tag numbers already in use
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tpgt_create(it_config_t *cfg, it_tgt_t *tgt, it_tpgt_t **tpgt,
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap char *tpg_name, uint16_t tpgt_tag);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tpgt_delete()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Delete the target portal group tag represented by 'tpgt', where
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 'tpgt' is an existing is_tpgt_t structure within the target 'tgt'.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * The target portal group tag removal will not take effect until the
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * modified configuation is committed by calling it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configuration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tgt Pointer to the iSCSI target structure associated
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * with the target portal group tag
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpgt Pointer to a target portal group tag structure
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvoid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tpgt_delete(it_config_t *cfg, it_tgt_t *tgt, it_tpgt_t *tpgt);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tpg_create()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Allocate and create an it_tpg_t structure representing a new iSCSI
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * target portal group. The new it_tpg_t structure is added to the global
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpg list (cfg_tgt_list) in the it_config_t structure. The new target
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * portal group will not be instantiated until the modified configuration
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * is committed by calling it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configuration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpg Pointer to the it_tpg_t structure representing
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the target portal group
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpg_name Identifier for the target portal group
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * portal_ip_port A string containing an appropriatedly formatted
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * IP address:port. Both IPv4 and IPv6 addresses are
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * permitted. This value becomes the first portal in
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the TPG -- applications can add additional values
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * using it_portal_create() before committing the TPG.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Cannot allocate resources
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid parameter
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EEXIST Portal already configured for another portal group
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * associated with this target.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tpg_create(it_config_t *cfg, it_tpg_t **tpg, char *tpg_name,
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap char *portal_ip_port);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tpg_delete()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Delete target portal group represented by 'tpg', where 'tpg' is an
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * existing it_tpg_t structure within the global configuration 'cfg'.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * The target portal group removal will not take effect until the
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * modified configuration is committed by calling it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configuration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpg Pointer to the it_tpg_t structure representing
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the target portal group
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * force Remove this target portal group even if it's
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * associated with one or more targets.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid parameter
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EBUSY Portal group associated with one or more targets.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tpg_delete(it_config_t *cfg, it_tpg_t *tpg, boolean_t force);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_portal_create()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Add an it_portal_t structure representing a new portal to the specified
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * target portal group. The change to the target portal group will not take
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * effect until the modified configuration is committed by calling
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpg Pointer to the it_tpg_t structure representing the
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * target portal group or "none" to remove
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * portal Pointer to the it_portal_t structure representing
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the portal
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * portal_ip_port A string containing an appropriately formatted
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * IP address or IP address:port in either IPv4 or
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * IPv6 format.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Could not allocate resources
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid parameter
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EEXIST Portal already configured for another portal group
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_portal_create(it_config_t *cfg, it_tpg_t *tpg, it_portal_t **portal,
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap char *portal_ip_port);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_portal_delete()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Remove the specified portal from the specified target portal group.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * The portal removal will not take effect until the modified configuration
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * is committed by calling it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * tpg Pointer to the it_tpg_t structure representing the
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * target portal group
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * portal Pointer to the it_portal_t structure representing
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the portal
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvoid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_portal_delete(it_config_t *cfg, it_tpg_t *tpg, it_portal_t *portal);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_ini_create()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Add an initiator context to the global configuration. The new
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * initiator context will not be instantiated until the modified
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * configuration is committed by calling it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ini Pointer to the it_ini_t structure representing
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the initiator context.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ini_node_name The iSCSI node name of the remote initiator.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Could not allocate resources
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid parameter.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EEXIST Initiator already configured
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EFAULT Invalid initiator name
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_ini_create(it_config_t *cfg, it_ini_t **ini, char *ini_node_name);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_ini_setprop()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Validate the provided property list and set the initiator properties.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * If errlist is not NULL, returns detailed errors for each property
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * that failed. The format for errorlist is
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * key = property, value = error string.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ini The initiator being updated.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * proplist nvlist_t containing properties for this target.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * errlist (optional) nvlist_t of errors encountered when
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * validating the properties.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Return Values:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * 0 Success
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ENOMEM Could not allocate resources
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * EINVAL Invalid property
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapint
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_ini_setprop(it_ini_t *ini, nvlist_t *proplist, nvlist_t **errlist);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_ini_delete()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Remove the specified initiator context from the global configuration.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * The removal will not take effect until the modified configuration is
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * committed by calling it_config_commit().
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg The current iSCSI configration obtained from
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * it_config_load()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * ini Pointer to the it_ini_t structure representing
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * the initiator context.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvoid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_ini_delete(it_config_t *cfg, it_ini_t *ini);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_config_free()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Free any resources associated with the it_config_t structure.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Parameters:
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * cfg A C representation of the current iSCSI configuration
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvoid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_config_free(it_config_t *cfg);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tgt_free()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Frees an it_tgt_t structure. If tgt_next is not NULL, frees
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * all structures in the list.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvoid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tgt_free(it_tgt_t *tgt);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tpgt_free()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Deallocates resources of an it_tpgt_t structure. If tpgt->next
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * is not NULL, frees all members of the list.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvoid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tpgt_free(it_tpgt_t *tpgt);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_tpg_free()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Deallocates resources associated with an it_tpg_t structure.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * If tpg->next is not NULL, frees all members of the list.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvoid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_tpg_free(it_tpg_t *tpg);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: it_ini_free()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Deallocates resources of an it_ini_t structure. If ini->next is
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * not NULL, frees all members of the list.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvoid
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapit_ini_free(it_ini_t *ini);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/*
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Function: validate_iscsi_name()
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap *
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Ensures the passed-in string is a valid IQN or EUI iSCSI name
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapboolean_t
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlapvalidate_iscsi_name(char *in_name);
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
fcc214c383d20beb968b623b83d851672e174702Charles Ting/*
fcc214c383d20beb968b623b83d851672e174702Charles Ting * Function: canonical_iscsi_name()
fcc214c383d20beb968b623b83d851672e174702Charles Ting *
fcc214c383d20beb968b623b83d851672e174702Charles Ting * Fold the iqn iscsi name to lower-case and the EUI-64 identifier of
fcc214c383d20beb968b623b83d851672e174702Charles Ting * the eui iscsi name to upper-case.
fcc214c383d20beb968b623b83d851672e174702Charles Ting * Ensures the passed-in string is a valid IQN or EUI iSCSI name
fcc214c383d20beb968b623b83d851672e174702Charles Ting */
fcc214c383d20beb968b623b83d851672e174702Charles Tingvoid
fcc214c383d20beb968b623b83d851672e174702Charles Tingcanonical_iscsi_name(char *tgt);
fcc214c383d20beb968b623b83d851672e174702Charles Ting
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#ifdef __cplusplus
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap}
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#endif
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#endif /* _LIBISCSIT_H */