/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "cfga_ib.h"
cfga_ib_ret_t ib_rcm_offline(const char *, char **, char *,
cfga_ib_ret_t ib_rcm_online(const char *, char **, char *,
cfga_ib_ret_t ib_rcm_remove(const char *, char **, char *,
uint_t *);
/*
* Function:
* ib_rcm_offline
* Input:
* rsrc - Resource name (typically an ap_id)
* errstring - Error message filled in case of a failure
* rsrc_fixed - Pointer to fixed path
* flags - flags to RCM
* Output:
* NONE
* Returns:
* CFGA_IB_OK on success or an appropriate error
* Description:
* Offline IB resource consumers.
*/
{
int rret;
DPRINTF("ib_rcm_offline:\n");
CFGA_IB_OK) {
return (ret);
}
!= RCM_SUCCESS) {
DPRINTF("ib_rcm_offline: rcm_request_offline failed\n");
if (rinfo) {
}
if (rret == RCM_FAILURE) {
rsrc_fixed, flags);
}
}
return (ret);
}
/*
* Function:
* ib_rcm_online
* Input:
* rsrc - Resource name (typically an ap_id)
* errstring - Error message filled in case of a failure
* rsrc_fixed - Pointer to fixed path
* flags - flags to RCM
* Output:
* NONE
* Returns:
* CFGA_IB_OK on success or an appropriate error
* Description:
* Online IB resource consumers that were previously offlined.
*/
{
DPRINTF("ib_rcm_online:\n");
return (ret);
}
DPRINTF("ib_rcm_online: rcm_notify_online failed\n");
}
return (ret);
}
/*
* Function:
* ib_rcm_remove
* Input:
* rsrc - Resource name (typically an ap_id)
* errstring - Error message filled in case of a failure
* rsrc_fixed - Pointer to fixed path
* flags - flags to RCM
* Output:
* NONE
* Returns:
* CFGA_IB_OK on success or an appropriate error
* Description:
* Remove IB resource consumers after their kernel removal.
*/
{
DPRINTF("ib_rcm_remove:\n");
return (ret);
}
DPRINTF("ib_rcm_remove: rcm_notify_remove failed\n");
}
return (ret);
}
/*
* Function:
* ib_rcm_init
* Input:
* rsrc - Resource name (typically an ap_id)
* flags - flags to RCM
* errstring - Error message filled in case of a failure
* rflags - Flags filled up in case of a failure
* Output:
* NONE
* Returns:
* CFGA_IB_OK on success or an appropriate error
* Description:
* Contains common initialization code for entering a ib_rcm_xx() routine.
*/
/* ARGSUSED */
static cfga_ib_ret_t
{
DPRINTF("ib_rcm_init:\n");
/* Validate the rsrc argument */
DPRINTF("ib_rcm_init: rsrc is NULL\n");
return (CFGA_IB_INTERNAL_ERR);
}
/* Translate the cfgadm flags to RCM flags */
}
/* Get a handle for the RCM operations */
(void) mutex_lock(&rcm_handle_lock);
if (rcm_handle == NULL) {
RCM_SUCCESS) {
DPRINTF("ib_rcm_init: alloc_handle failed\n");
(void) mutex_unlock(&rcm_handle_lock);
return (CFGA_IB_RCM_HANDLE_ERR);
}
}
(void) mutex_unlock(&rcm_handle_lock);
return (CFGA_IB_OK);
}
/*
* Function:
* ib_rcm_info_table
* Input:
* rinfo - Resource information
* table - table to be printed
* Output:
* NONE
* Returns:
* CFGA_IB_OK on success or an appropriate error
* Description:
* Takes an opaque rcm_info_t pointer and a character pointer,
* and appends the rcm_info_t data in the form of a table to the
* given character pointer.
*/
static cfga_ib_ret_t
{
int i;
size_t w;
char *rsrc;
char *info;
char *newtable;
const char *infostr;
DPRINTF("ib_rcm_info_table:\n");
/* Protect against invalid arguments */
return (CFGA_IB_INTERNAL_ERR);
}
/* Set localized table header strings */
/* A first pass, to size up the RCM information */
tuples++;
w_rsrc = w;
w_info = w;
}
}
/* If nothing was sized up above, stop early */
if (tuples == 0) {
DPRINTF("ib_rcm_info_table: no tuples\n");
return (CFGA_IB_OK);
}
/* Adjust column widths for column headings */
w_rsrc = w;
} else if ((w_rsrc - w) % 2) {
w_rsrc++;
}
w_info = w;
} else if ((w_info - w) % 2) {
w_info++;
}
/*
* Compute the total line width of each line,
* accounting for intercolumn spacing.
*/
/* Allocate space for the table */
} else {
else {
return (CFGA_IB_ALLOC_FAIL);
}
}
DPRINTF("ib_rcm_info_table: no table\n");
return (CFGA_IB_ALLOC_FAIL);
}
/* Place a table header into the string */
/* The resource header */
for (i = 0; i < ((w_rsrc - w) / 2); i++) {
}
for (i = 0; i < ((w_rsrc - w) / 2); i++) {
}
/* The information header */
for (i = 0; i < ((w_info - w) / 2); i++) {
}
for (i = 0; i < ((w_info - w) / 2); i++) {
}
/* Underline the headers */
for (i = 0; i < w_rsrc; i++) {
}
for (i = 0; i < w_info; i++) {
}
/* Construct the format string */
/* Add the tuples to the table string */
}
}
return (CFGA_IB_OK);
}