cfga_fp.h revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CFGA_FP_H
#define _CFGA_FP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <locale.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <locale.h>
#include <langinfo.h>
#include <time.h>
#include <stdarg.h>
#include <sys/dditypes.h>
#include <libdevinfo.h>
#include <libdevice.h>
#include <librcm.h>
#include <dirent.h>
#include <strings.h>
#include <sys/byteorder.h>
#include <strings.h>
#include <setjmp.h>
#include <signal.h>
#include <hbaapi.h>
#include <synch.h>
#include <thread.h>
#include <limits.h>
#include <ftw.h>
#define CFGA_PLUGIN_LIB
#include <config_admin.h>
#if !defined(DEBUG)
#define NDEBUG 1
#else
#endif
#include <assert.h>
typedef enum {
FPCFGA_ERR = -2,
FPCFGA_LIB_ERR = -1,
FPCFGA_OK = 0,
} fpcfga_ret_t;
/* Commands used internally */
typedef enum {
FPCFGA_INVAL_CMD = -1,
FPCFGA_DEV_OP = 0,
} fpcfga_cmd_t;
typedef enum {
FPCFGA_TERMINATE = 0,
/* Structures for tree walking code */
typedef struct {
} walk_node_t;
typedef struct {
const char *nodetype;
} walk_minor_t;
typedef union {
} walkmode_t;
typedef struct {
} walkarg_t;
typedef struct {
char *phys;
char *log;
int match_minor;
int l_errno;
} pathm_t;
typedef struct ldata_list {
struct ldata_list *next;
} ldata_list_t;
typedef struct {
struct cfga_confirm *confp;
} prompt_t;
typedef struct luninfo_list {
int lunnum;
char *path;
struct luninfo_list *next;
typedef struct {
char *xport_phys;
char *dyncomp;
} apid_t;
/* Report luns names */
#define FP_SCMD_REPORT_LUN 0xA0
#define DEFAULT_NUM_LUN 1024
#define REPORT_LUN_HDR_SIZE 8
#define SAM_LUN_SIZE 8
#ifdef _BIG_ENDIAN
#define htonll(x) (x)
#define ntohll(x) (x)
#else
#endif
typedef struct report_lun_resp {
/*
* Hardware options acceptable for fp plugin.
* list related options are handled by getsupopts() and set to
* index of array.
*/
#define OPT_DEVINFO_FORCE 0
#define OPT_SHOW_SCSI_LUN 1
#define OPT_FCP_DEV 2
#define OPT_DISABLE_RCM 0
#define OPT_FORCE_UPDATE_REP 1
#define OPT_NO_UPDATE_REP 2
#define OPT_REMOVE_UNUSABLE_SCSI_LUN 3
#define OPT_REMOVE_UNUSABLE_FCP_DEV 4
/* walk tree flag */
#define FLAG_PATH_INFO_WALK 0x00000001
/* apid_t flags */
#define FLAG_DISABLE_RCM 0x00000001
#define FLAG_FORCE_UPDATE_REP 0x00000010
#define FLAG_NO_UPDATE_REP 0x00000100
#define FLAG_DYN_AP_CONFIGURED 0x00001000
#define FLAG_DEVINFO_FORCE 0x00010000
#define FLAG_FCP_DEV 0x00100000
#define FLAG_REMOVE_UNUSABLE_FCP_DEV 0x01000000
/* apid_t lun flags */
#define FLAG_SKIP_RCMOFFLINE 0x00000001
#define FLAG_SKIP_RCMREMOVE 0x00000010
#define FLAG_SKIP_ONLINEOTHERS 0x00000100
/* define for peripheral qualifier mask */
#define FP_PERI_QUAL_MASK 0xE0
/* Message ids */
typedef enum {
/* ERRORS */
ERR_UNKNOWN = -1,
/* Errors with arguments */
/* RCM Errors */
/* Commands */
/* help messages */
/* Hotplug messages */
/* Hotplugging confirmation prompts */
/* Misc. */
} msgid_t;
typedef struct {
} hw_cmd_t;
typedef struct {
int nargs; /* Number of arguments following msgid */
int intl; /* Flag: if 1, internationalize */
const char *msgstr;
} msgcvt_t;
#define SLASH "/"
#define CFGA_DEV_DIR "/dev/cfg"
#define DEV_DIR "/dev"
#define DEVICES_DIR "/devices"
#define DSK_DIR "dsk"
#define RDSK_DIR "rdsk"
#define RMT_DIR "rmt"
#define DYN_SEP "::"
#define LUN_COMP_SEP ","
#define MINOR_SEP ":"
di_nodeid(s) == (DI_PROM_NODEID))
/*
* The following macro removes the separator from the dynamic component.
*/
/*
* Property names
*/
#define PORT_WWN_PROP "port-wwn"
#define LUN_GUID_PROP "client-guid"
#define LUN_PROP "lun"
#define WWN_SIZE 8
/* Constants used for repository updates */
#define ADD_ENTRY 0
#define REMOVE_ENTRY 1
#define FAB_REPOSITORY_DIR "/etc/cfg/fp"
#define FAB_REPOSITORY "/etc/cfg/fp/fabric_WWN_map"
#define TMP_FAB_REPOSITORY "/etc/cfg/fp/fabric_WWN_map.tmp"
#define OLD_FAB_REPOSITORY "/etc/cfg/fp/fabric_WWN_map.old"
/* MPXIO VHCI root dir */
#define SCSI_VHCI_ROOT "/devices/scsi_vhci/"
#define SCSI_VHCI_DRVR "scsi_vhci"
#define HBA_MAX_RETRIES 10
/* Function prototypes */
/* Functions in cfga_cs.c */
/* Functions in cfga_rep.c */
int update_fabric_wwn_list(int, const char *, char **);
char **errstring);
char **errstring);
char **errstring);
char **errstring);
/* List related routines */
/* Conversion routines */
int *l_errnop);
int *l_errnop);
char **node_pathp, int *l_errnop);
/* Functions in cfga_rcm.c */
fpcfga_ret_t fp_rcm_info(char *, char **, char **);
/* Utility routines */
char **errstring);
char **errstring);
char *cfga_str(int append_newline, ...);
#ifdef __cplusplus
}
#endif
#endif /* _CFGA_FP_H */