sci_object.h revision 230557
112891Swpaul/*- 212891Swpaul * This file is provided under a dual BSD/GPLv2 license. When using or 312891Swpaul * redistributing this file, you may do so under either license. 412891Swpaul * 512891Swpaul * GPL LICENSE SUMMARY 612891Swpaul * 712891Swpaul * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 812891Swpaul * 912891Swpaul * This program is free software; you can redistribute it and/or modify 1012891Swpaul * it under the terms of version 2 of the GNU General Public License as 1112891Swpaul * published by the Free Software Foundation. 1212891Swpaul * 1312891Swpaul * This program is distributed in the hope that it will be useful, but 1412891Swpaul * WITHOUT ANY WARRANTY; without even the implied warranty of 1512891Swpaul * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1612891Swpaul * General Public License for more details. 1712891Swpaul * 1812891Swpaul * You should have received a copy of the GNU General Public License 1912891Swpaul * along with this program; if not, write to the Free Software 2012891Swpaul * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 2112891Swpaul * The full GNU General Public License is included in this distribution 2212891Swpaul * in the file called LICENSE.GPL. 2312891Swpaul * 2412891Swpaul * BSD LICENSE 2512891Swpaul * 2612891Swpaul * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 2712891Swpaul * All rights reserved. 2812891Swpaul * 2912891Swpaul * Redistribution and use in source and binary forms, with or without 3012891Swpaul * modification, are permitted provided that the following conditions 3112891Swpaul * are met: 3230827Scharnier * 33114601Sobrien * * Redistributions of source code must retain the above copyright 34114601Sobrien * notice, this list of conditions and the following disclaimer. 3530827Scharnier * * Redistributions in binary form must reproduce the above copyright 3630827Scharnier * notice, this list of conditions and the following disclaimer in 3730827Scharnier * the documentation and/or other materials provided with the 3830827Scharnier * distribution. 3930827Scharnier * 4030827Scharnier * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 4112891Swpaul * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 4212891Swpaul * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 4312891Swpaul * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 4412891Swpaul * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 4512891Swpaul * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 4615426Swpaul * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 4715426Swpaul * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 4812891Swpaul * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 4912891Swpaul * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 5012997Swpaul * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5120818Swpaul * 5212891Swpaul * $FreeBSD$ 5312891Swpaul */ 5412891Swpaul#ifndef _SCI_OBJECT_H_ 5512891Swpaul#define _SCI_OBJECT_H_ 5612891Swpaul 5716118Swpaul/** 5815426Swpaul * @file 5912891Swpaul * 6012891Swpaul * @brief This file contains all of the method and constants associated with 6112891Swpaul * the SCI base object. The SCI base object is the class from which 6212891Swpaul * all other objects derive in the Storage Controller Interface. 6315426Swpaul */ 6416999Swpaul 6516999Swpaul#ifdef __cplusplus 6616999Swpaulextern "C" { 6715426Swpaul#endif // __cplusplus 6816999Swpaul 6915426Swpaul#include <dev/isci/scil/sci_types.h> 7016999Swpaul#include <dev/isci/scil/sci_status.h> 7116999Swpaul 7215426Swpaul/** 7315426Swpaul * @brief This method returns the object to which a previous association was 7415426Swpaul * created. This association represents a link between an SCI object 7515426Swpaul * and another SCI object or potentially a user object. The 7615426Swpaul * association essentially acts as a cookie for the user of an object. 7719161Swpaul * The user of an SCI object is now able to retrieve a handle to their 7815426Swpaul * own object that is managing, or related in someway, to said SCI 7915426Swpaul * object. 8070493Sphk * 8115426Swpaul * @param[in] base_object This parameter specifies the SCI object for 8216999Swpaul * which to retrieve the association reference. 8316999Swpaul * 8470493Sphk * @return This method returns a pointer to the object that was previously 8516999Swpaul * associated to the supplied base_object parameter. 8616999Swpaul * @retval SCI_INVALID_HANDLE This value is returned when there is no known 8712891Swpaul * association for the supplied base_object instance. 8816999Swpaul */ 8912891Swpaul#if defined(SCI_OBJECT_USE_ASSOCIATION_FUNCTIONS) 9090298Sdesvoid * sci_object_get_association( 9190298Sdes SCI_OBJECT_HANDLE_T base_object 9215426Swpaul); 9370493Sphk#else 9416999Swpaul#define sci_object_get_association(object) (*((void **)object)) 9516999Swpaul#endif 9615426Swpaul 9716999Swpaul/** 9816999Swpaul * @brief This method will associate to SCI objects. 9916999Swpaul * 10016999Swpaul * @see For more information about associations please reference the 10190298Sdes * sci_object_get_association() method. 10290298Sdes * 10316999Swpaul * @param[in] base_object This parameter specifies the SCI object for 10416999Swpaul * which to set the association reference. 10516999Swpaul * @param[in] associated_object This parameter specifies a pointer to the 10616999Swpaul * object being associated. 10716999Swpaul * 10830827Scharnier * @return This method will return an indication as to whether the 10916999Swpaul * association was set successfully. 11016999Swpaul * @retval SCI_SUCCESS This value is currently always returned. 11116999Swpaul */ 11216999Swpaul#if defined(SCI_OBJECT_USE_ASSOCIATION_FUNCTIONS) 11316999SwpaulSCI_STATUS sci_object_set_association( 11430827Scharnier SCI_OBJECT_HANDLE_T base_object, 11516999Swpaul void * associated_object 11616999Swpaul); 11716999Swpaul#else 11816999Swpaul#define sci_object_set_association(base_object, associated_object) \ 11916999Swpaul ((*((void **)base_object)) = (associated_object)) 12016999Swpaul#endif 12116999Swpaul 12216999Swpaul/** 12316999Swpaul * @brief This method will get the logger for an object. 12416999Swpaul * 12516999Swpaul * @param[in] object This parameter specifies SCI object for 12616999Swpaul * which to retrieve its logger. 12790298Sdes * 12890298Sdes * @return This method returns a SCI_LOGGER_HANDLE to SCI user. 12916999Swpaul */ 13016999SwpaulSCI_LOGGER_HANDLE_T sci_object_get_logger( 13116999Swpaul SCI_OBJECT_HANDLE_T object 13216999Swpaul); 13316999Swpaul 13416999Swpaul#ifdef __cplusplus 13516999Swpaul} 13616999Swpaul#endif // __cplusplus 13716999Swpaul 13816999Swpaul#endif // _SCI_OBJECT_H_ 13916999Swpaul 14016999Swpaul