17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5749f21d3Swesolows * Common Development and Distribution License (the "License"). 6749f21d3Swesolows * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21749f21d3Swesolows 227c478bd9Sstevel@tonic-gate /* 2325c6ff4bSstephh * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 27*f1c3c469SJohn Levon /* 28*f1c3c469SJohn Levon * Copyright (c) 2018, Joyent, Inc. 29*f1c3c469SJohn Levon */ 30*f1c3c469SJohn Levon 317c478bd9Sstevel@tonic-gate #ifndef _FMD_ADM_H 327c478bd9Sstevel@tonic-gate #define _FMD_ADM_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <fm/fmd_api.h> 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #ifdef __cplusplus 377c478bd9Sstevel@tonic-gate extern "C" { 387c478bd9Sstevel@tonic-gate #endif 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * Fault Management Daemon Administrative Interfaces 427c478bd9Sstevel@tonic-gate * 437c478bd9Sstevel@tonic-gate * Note: The contents of this file are private to the implementation of the 447c478bd9Sstevel@tonic-gate * Solaris system and FMD subsystem and are subject to change at any time 457c478bd9Sstevel@tonic-gate * without notice. Applications and drivers using these interfaces will fail 467c478bd9Sstevel@tonic-gate * to run on future releases. These interfaces should not be used for any 477c478bd9Sstevel@tonic-gate * purpose until they are publicly documented for use outside of Sun. 487c478bd9Sstevel@tonic-gate */ 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate #define FMD_ADM_VERSION 1 /* library ABI interface version */ 517c478bd9Sstevel@tonic-gate #define FMD_ADM_PROGRAM 0 /* connect library to system fmd */ 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate typedef struct fmd_adm fmd_adm_t; 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate extern fmd_adm_t *fmd_adm_open(const char *, uint32_t, int); 567c478bd9Sstevel@tonic-gate extern void fmd_adm_close(fmd_adm_t *); 577c478bd9Sstevel@tonic-gate extern const char *fmd_adm_errmsg(fmd_adm_t *); 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate typedef struct fmd_adm_stats { 607c478bd9Sstevel@tonic-gate fmd_stat_t *ams_buf; /* statistics data array */ 617c478bd9Sstevel@tonic-gate uint_t ams_len; /* length of data array */ 627c478bd9Sstevel@tonic-gate } fmd_adm_stats_t; 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate extern int fmd_adm_stats_read(fmd_adm_t *, const char *, fmd_adm_stats_t *); 657c478bd9Sstevel@tonic-gate extern int fmd_adm_stats_free(fmd_adm_t *, fmd_adm_stats_t *); 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate typedef struct fmd_adm_modinfo { 687c478bd9Sstevel@tonic-gate const char *ami_name; /* string name of module */ 697c478bd9Sstevel@tonic-gate const char *ami_desc; /* module description */ 707c478bd9Sstevel@tonic-gate const char *ami_vers; /* module version */ 717c478bd9Sstevel@tonic-gate uint_t ami_flags; /* flags (see below) */ 727c478bd9Sstevel@tonic-gate } fmd_adm_modinfo_t; 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate #define FMD_ADM_MOD_FAILED 0x1 /* module has failed */ 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate typedef int fmd_adm_module_f(const fmd_adm_modinfo_t *, void *); 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate extern int fmd_adm_module_iter(fmd_adm_t *, fmd_adm_module_f *, void *); 797c478bd9Sstevel@tonic-gate extern int fmd_adm_module_load(fmd_adm_t *, const char *); 807c478bd9Sstevel@tonic-gate extern int fmd_adm_module_unload(fmd_adm_t *, const char *); 817c478bd9Sstevel@tonic-gate extern int fmd_adm_module_reset(fmd_adm_t *, const char *); 827c478bd9Sstevel@tonic-gate extern int fmd_adm_module_stats(fmd_adm_t *, const char *, fmd_adm_stats_t *); 837c478bd9Sstevel@tonic-gate extern int fmd_adm_module_gc(fmd_adm_t *, const char *); 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate typedef struct fmd_adm_rsrcinfo { 867c478bd9Sstevel@tonic-gate const char *ari_fmri; /* fmri name of resource */ 877c478bd9Sstevel@tonic-gate const char *ari_uuid; /* uuid name of resource */ 887c478bd9Sstevel@tonic-gate const char *ari_case; /* uuid of case associated w/ state */ 897c478bd9Sstevel@tonic-gate uint_t ari_flags; /* flags (see below) */ 907c478bd9Sstevel@tonic-gate } fmd_adm_rsrcinfo_t; 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #define FMD_ADM_RSRC_FAULTY 0x1 /* resource is faulty */ 937c478bd9Sstevel@tonic-gate #define FMD_ADM_RSRC_UNUSABLE 0x2 /* resource is unusable */ 947c478bd9Sstevel@tonic-gate #define FMD_ADM_RSRC_INVISIBLE 0x4 /* resource is not directly visible */ 957c478bd9Sstevel@tonic-gate 96749f21d3Swesolows typedef struct fmd_adm_caseinfo { 97749f21d3Swesolows const char *aci_uuid; 98749f21d3Swesolows const char *aci_code; 99749f21d3Swesolows const char *aci_url; 100749f21d3Swesolows nvlist_t *aci_event; 101749f21d3Swesolows } fmd_adm_caseinfo_t; 1027c478bd9Sstevel@tonic-gate 103749f21d3Swesolows typedef int fmd_adm_rsrc_f(const fmd_adm_rsrcinfo_t *, void *); 104749f21d3Swesolows typedef int fmd_adm_case_f(const fmd_adm_caseinfo_t *, void *); 105749f21d3Swesolows 106749f21d3Swesolows extern int fmd_adm_rsrc_count(fmd_adm_t *, int, uint32_t *); 1077c478bd9Sstevel@tonic-gate extern int fmd_adm_rsrc_iter(fmd_adm_t *, int, fmd_adm_rsrc_f *, void *); 1087c478bd9Sstevel@tonic-gate extern int fmd_adm_rsrc_flush(fmd_adm_t *, const char *); 10925c6ff4bSstephh extern int fmd_adm_rsrc_repaired(fmd_adm_t *, const char *); 11025c6ff4bSstephh extern int fmd_adm_rsrc_replaced(fmd_adm_t *, const char *); 11125c6ff4bSstephh extern int fmd_adm_rsrc_acquit(fmd_adm_t *, const char *, const char *); 1127c478bd9Sstevel@tonic-gate extern int fmd_adm_case_repair(fmd_adm_t *, const char *); 11325c6ff4bSstephh extern int fmd_adm_case_acquit(fmd_adm_t *, const char *); 114749f21d3Swesolows extern int fmd_adm_case_iter(fmd_adm_t *, const char *, fmd_adm_case_f *, 115749f21d3Swesolows void *); 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate typedef struct fmd_adm_serdinfo { 1187c478bd9Sstevel@tonic-gate const char *asi_name; /* name of serd engine */ 1197c478bd9Sstevel@tonic-gate uint64_t asi_delta; /* nsecs from oldest event to now */ 1207c478bd9Sstevel@tonic-gate uint64_t asi_n; /* N parameter (event count) */ 1217c478bd9Sstevel@tonic-gate uint64_t asi_t; /* T parameter (nanoseconds) */ 1227c478bd9Sstevel@tonic-gate uint_t asi_count; /* number of events in engine */ 1237c478bd9Sstevel@tonic-gate uint_t asi_flags; /* flags (see below) */ 1247c478bd9Sstevel@tonic-gate } fmd_adm_serdinfo_t; 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate #define FMD_ADM_SERD_FIRED 0x1 /* serd engine has fired */ 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate typedef int fmd_adm_serd_f(const fmd_adm_serdinfo_t *, void *); 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate extern int fmd_adm_serd_iter(fmd_adm_t *, const char *, 1317c478bd9Sstevel@tonic-gate fmd_adm_serd_f *, void *); 1327c478bd9Sstevel@tonic-gate extern int fmd_adm_serd_reset(fmd_adm_t *, const char *, const char *); 1337c478bd9Sstevel@tonic-gate 134*f1c3c469SJohn Levon typedef void fmd_adm_xprt_f(id_t, void *); 135d9638e54Smws 136d9638e54Smws extern int fmd_adm_xprt_iter(fmd_adm_t *, fmd_adm_xprt_f *, void *); 137d9638e54Smws extern int fmd_adm_xprt_stats(fmd_adm_t *, id_t, fmd_adm_stats_t *); 138d9638e54Smws 1397c478bd9Sstevel@tonic-gate extern int fmd_adm_log_rotate(fmd_adm_t *, const char *); 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1427c478bd9Sstevel@tonic-gate } 1437c478bd9Sstevel@tonic-gate #endif 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate #endif /* _FMD_ADM_H */ 146