fmd_asru.h revision 25c6ff4b77fcddf4097ce78a8277275ca603b46c
/*
* 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 _FMD_ASRU_H
#define _FMD_ASRU_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <fmd_api.h>
#include <fmd_log.h>
#include <fmd_list.h>
#include <fmd_topo.h>
/*
* The resource is represented by an fmd_asru_t structure and one or more
* fmd_asru_link_t structures. Each of the latter represents a separate
* unrepaired case (problem) involving the resource. There are separate
* reference counts for both the fmd_asru_t and fmd_asru_link_t structures,
* but only one lock is used (asru_lock) which protects both the parent
* fmd_asru_t and its associated fmd_asru_link_t structures. The FMD_ASRU_FAULTY
* flags in the fmd_asru_t represents the cumulative value of the associated
* FMD_ASRU_FAULTY flags in the fmd_asru_link_t structures (and therefore of
* all independant unrepaired problems that are affecting that resource).
*/
typedef struct fmd_asru {
char *asru_name; /* string form of resource fmri (ro) */
char *asru_root; /* directory for cache entry (ro) */
char *asru_uuid; /* uuid for asru cache entry (ro) */
} fmd_asru_t;
typedef struct fmd_asru_link {
char *al_uuid; /* uuid for asru cache entry (ro) */
char *al_asru_name; /* string form of asru fmri (ro) */
char *al_fru_name; /* string form of fru fmri (ro) */
char *al_rsrc_name; /* string form of resource fmri (ro) */
char *al_label; /* label */
char *al_case_uuid; /* case uuid */
/*
* Note the following are defined in order of increasing precedence and
* this should not be changed
*/
#define FMD_ASRU_AL_HASH_NAME(a, off) \
#define FMD_ASRU_AL_HASH_NEXT(a, off) \
#define FMD_ASRU_AL_HASH_NEXTP(a, off) \
typedef struct fmd_asru_hash {
char *ah_dirpath; /* path of hash's log file directory */
int ah_error; /* error from opening asru log */
extern fmd_asru_hash_t *fmd_asru_hash_create(const char *, const char *);
extern void fmd_asru_hash_destroy(fmd_asru_hash_t *);
extern void fmd_asru_hash_refresh(fmd_asru_hash_t *);
extern void fmd_asru_hash_replay(fmd_asru_hash_t *);
extern void fmd_asru_hash_apply(fmd_asru_hash_t *,
void (*)(fmd_asru_t *, void *), void *);
extern void fmd_asru_al_hash_apply(fmd_asru_hash_t *,
void (*)(fmd_asru_link_t *, void *), void *);
extern void fmd_asru_hash_apply_by_asru(fmd_asru_hash_t *, char *,
void (*)(fmd_asru_link_t *, void *), void *);
extern void fmd_asru_hash_apply_by_label(fmd_asru_hash_t *, char *,
void (*)(fmd_asru_link_t *, void *), void *);
extern void fmd_asru_hash_apply_by_fru(fmd_asru_hash_t *, char *,
void (*)(fmd_asru_link_t *, void *), void *);
extern void fmd_asru_hash_apply_by_rsrc(fmd_asru_hash_t *, char *,
void (*)(fmd_asru_link_t *, void *), void *);
void (*)(fmd_asru_link_t *, void *), void *);
fmd_case_t *, nvlist_t *);
extern void fmd_asru_clear_aged_rsrcs();
extern void fmd_asru_repaired(fmd_asru_link_t *, void *);
extern void fmd_asru_acquit(fmd_asru_link_t *, void *);
extern void fmd_asru_replaced(fmd_asru_link_t *, void *);
extern void fmd_asru_removed(fmd_asru_link_t *);
extern int fmd_asru_al_getstate(fmd_asru_link_t *);
extern int fmd_asru_getstate(fmd_asru_t *);
#ifdef __cplusplus
}
#endif
#endif /* _FMD_ASRU_H */