fmd_rpc_adm.c (162ba6ea) | fmd_rpc_adm.c (44743693) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 6 unchanged lines hidden (view full) --- 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 6 unchanged lines hidden (view full) --- 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* |
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. | 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
24 * Use is subject to license terms. 25 */ 26 27#pragma ident "%Z%%M% %I% %E% SMI" 28 29#include <strings.h> 30#include <limits.h> 31#include <unistd.h> --- 318 unchanged lines hidden (view full) --- 350static void 351fmd_adm_rsrclist_asru(fmd_asru_t *ap, void *arg) 352{ 353 struct fmd_rpc_rsrclist *rrl = arg; 354 size_t name_len, buf_len; 355 void *p; 356 357 /* | 24 * Use is subject to license terms. 25 */ 26 27#pragma ident "%Z%%M% %I% %E% SMI" 28 29#include <strings.h> 30#include <limits.h> 31#include <unistd.h> --- 318 unchanged lines hidden (view full) --- 350static void 351fmd_adm_rsrclist_asru(fmd_asru_t *ap, void *arg) 352{ 353 struct fmd_rpc_rsrclist *rrl = arg; 354 size_t name_len, buf_len; 355 void *p; 356 357 /* |
358 * Skip the ASRU if this fault is marked as invisible. |
|
358 * If rrl_all is false, we take a quick look at asru_flags with no lock | 359 * If rrl_all is false, we take a quick look at asru_flags with no lock |
359 * held to see if the ASRU is either not faulty or invisible. If so, | 360 * held to see if the ASRU is not faulty. If so, |
360 * we don't want to report it by default and can just skip this ASRU. 361 * This helps keep overhead low in the common case, as the call to 362 * fmd_asru_getstate() can be expensive depending on the scheme. 363 */ | 361 * we don't want to report it by default and can just skip this ASRU. 362 * This helps keep overhead low in the common case, as the call to 363 * fmd_asru_getstate() can be expensive depending on the scheme. 364 */ |
364 if (rrl->rrl_all == B_FALSE && (ap->asru_flags & (FMD_ASRU_FAULTY | 365 FMD_ASRU_INVISIBLE)) != FMD_ASRU_FAULTY) | 365 366 if (ap->asru_flags & FMD_ASRU_INVISIBLE) |
366 return; | 367 return; |
368 if (rrl->rrl_all == B_FALSE && !(ap->asru_flags & FMD_ASRU_FAULTY)) 369 return; |
|
367 368 if (rrl->rrl_err != 0 || fmd_asru_getstate(ap) == 0) 369 return; /* error has occurred or resource is in 'ok' state */ 370 371 /* 372 * Lock the ASRU and reallocate rrl_buf[] to be large enough to hold 373 * another string, doubling it as needed. Then copy the new string 374 * on to the end, and increment rrl_len to indicate the used space. --- 321 unchanged lines hidden (view full) --- 696 struct fmd_rpc_caselist *rcl = arg; 697 size_t uuid_len, buf_len; 698 void *p; 699 700 if (rcl->rcl_err != 0) 701 return; 702 703 /* | 370 371 if (rrl->rrl_err != 0 || fmd_asru_getstate(ap) == 0) 372 return; /* error has occurred or resource is in 'ok' state */ 373 374 /* 375 * Lock the ASRU and reallocate rrl_buf[] to be large enough to hold 376 * another string, doubling it as needed. Then copy the new string 377 * on to the end, and increment rrl_len to indicate the used space. --- 321 unchanged lines hidden (view full) --- 699 struct fmd_rpc_caselist *rcl = arg; 700 size_t uuid_len, buf_len; 701 void *p; 702 703 if (rcl->rcl_err != 0) 704 return; 705 706 /* |
707 * skip invisible cases 708 */ 709 if (cip->ci_flags & FMD_CF_INVISIBLE) 710 return; 711 712 /* |
|
704 * Lock the case and reallocate rcl_buf[] to be large enough to hold 705 * another string, doubling it as needed. Then copy the new string 706 * on to the end, and increment rcl_len to indicate the used space. 707 */ 708 if (!(cip->ci_flags & FMD_CF_SOLVED)) 709 return; 710 711 (void) pthread_mutex_lock(&cip->ci_lock); --- 43 unchanged lines hidden (view full) --- 755 756 return (TRUE); 757} 758 759bool_t 760fmd_adm_caseinfo_1_svc(char *uuid, struct fmd_rpc_caseinfo *rvp, 761 struct svc_req *req) 762{ | 713 * Lock the case and reallocate rcl_buf[] to be large enough to hold 714 * another string, doubling it as needed. Then copy the new string 715 * on to the end, and increment rcl_len to indicate the used space. 716 */ 717 if (!(cip->ci_flags & FMD_CF_SOLVED)) 718 return; 719 720 (void) pthread_mutex_lock(&cip->ci_lock); --- 43 unchanged lines hidden (view full) --- 764 765 return (TRUE); 766} 767 768bool_t 769fmd_adm_caseinfo_1_svc(char *uuid, struct fmd_rpc_caseinfo *rvp, 770 struct svc_req *req) 771{ |
763 fmd_case_impl_t *cip; | 772 fmd_case_t *cp; |
764 nvlist_t *nvl; 765 int err = 0; 766 767 bzero(rvp, sizeof (struct fmd_rpc_caseinfo)); 768 769 if (fmd_rpc_deny(req)) { 770 rvp->rci_err = FMD_ADM_ERR_PERM; 771 return (TRUE); 772 } 773 | 773 nvlist_t *nvl; 774 int err = 0; 775 776 bzero(rvp, sizeof (struct fmd_rpc_caseinfo)); 777 778 if (fmd_rpc_deny(req)) { 779 rvp->rci_err = FMD_ADM_ERR_PERM; 780 return (TRUE); 781 } 782 |
774 if ((cip = (fmd_case_impl_t *)fmd_case_hash_lookup(fmd.d_cases, uuid)) 775 == NULL) { | 783 if ((cp = fmd_case_hash_lookup(fmd.d_cases, uuid)) == NULL) { |
776 rvp->rci_err = FMD_ADM_ERR_CASESRCH; 777 return (TRUE); 778 } 779 | 784 rvp->rci_err = FMD_ADM_ERR_CASESRCH; 785 return (TRUE); 786 } 787 |
780 if (!(cip->ci_flags & FMD_CF_SOLVED)) { 781 fmd_case_rele((fmd_case_t *)cip); | 788 if (!(((fmd_case_impl_t *)cp)->ci_flags & FMD_CF_SOLVED)) { 789 fmd_case_rele(cp); |
782 rvp->rci_err = FMD_ADM_ERR_CASESRCH; 783 return (TRUE); 784 } 785 | 790 rvp->rci_err = FMD_ADM_ERR_CASESRCH; 791 return (TRUE); 792 } 793 |
786 /* 787 * Avoid a race on cip->ci_diag; we can't call fmd_case_mkevent 788 * while holding the case lock, so we do this dance instead. 789 */ 790 (void) pthread_mutex_lock(&cip->ci_lock); 791 nvl = cip->ci_diag; 792 (void) pthread_mutex_unlock(&cip->ci_lock); | 794 nvl = fmd_case_mkevent(cp, FM_LIST_SUSPECT_CLASS); |
793 | 795 |
794 if (nvl == NULL) 795 nvl = fmd_case_mkevent((fmd_case_t *)cip, 796 FM_LIST_SUSPECT_CLASS); 797 798 (void) pthread_mutex_lock(&cip->ci_lock); 799 if (cip->ci_diag == NULL) { 800 cip->ci_diag = nvl; 801 } else if (nvl != cip->ci_diag) { 802 nvlist_free(nvl); 803 nvl = cip->ci_diag; 804 } 805 (void) pthread_mutex_unlock(&cip->ci_lock); 806 | |
807 err = nvlist_pack(nvl, &rvp->rci_evbuf.rci_evbuf_val, 808 &rvp->rci_evbuf.rci_evbuf_len, NV_ENCODE_XDR, 0); 809 | 796 err = nvlist_pack(nvl, &rvp->rci_evbuf.rci_evbuf_val, 797 &rvp->rci_evbuf.rci_evbuf_len, NV_ENCODE_XDR, 0); 798 |
799 nvlist_free(nvl); 800 |
|
810 if (err != 0) 811 rvp->rci_err = FMD_ADM_ERR_NOMEM; 812 | 801 if (err != 0) 802 rvp->rci_err = FMD_ADM_ERR_NOMEM; 803 |
813 fmd_case_rele((fmd_case_t *)cip); | 804 fmd_case_rele(cp); |
814 815 return (TRUE); 816} 817 818/*ARGSUSED*/ 819static void 820fmd_adm_xprtlist_one(fmd_idspace_t *ids, id_t id, void *arg) 821{ --- 139 unchanged lines hidden --- | 805 806 return (TRUE); 807} 808 809/*ARGSUSED*/ 810static void 811fmd_adm_xprtlist_one(fmd_idspace_t *ids, id_t id, void *arg) 812{ --- 139 unchanged lines hidden --- |