File 16000-3012365-bnc612043-Make-enableIndications-variable-per-provider.patch of Package sblim-sfcb-sle11-sp1

From b96744ed03cb52f13cd44ecaf3e6fdc0e3079a9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Mon, 26 Jul 2010 12:44:23 +0200
Subject: [PATCH] [3012365] Make enableIndications variable per-provider instead of per-process.

---
 brokerUpc.c        |    8 --------
 providerDrv.c      |   15 +++++++--------
 providerRegister.h |    1 +
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/brokerUpc.c b/brokerUpc.c
index b010e17..fdd8862 100644
--- a/brokerUpc.c
+++ b/brokerUpc.c
@@ -39,7 +39,6 @@
 
 #ifdef SFCB_INCL_INDICATION_SUPPORT 
 #include "selectexp.h"
-extern int indicationEnabled;
 #endif
 
 extern MsgSegment setArgsMsgSegment(const CMPIArgs * args);
@@ -117,13 +116,6 @@ static CMPIStatus deliverIndication(const CMPIBroker* mb, const CMPIContext* ctx
    
    _SFCB_ENTER(TRACE_INDPROVIDER | TRACE_UPCALLS, "deliverIndication");
    
-   if (indicationEnabled==0) {      
-      _SFCB_TRACE(1,("--- Provider not enabled for indications"));
-      printf("Provider not enabled for indications\n");
-      setStatus(&st,CMPI_RC_ERR_FAILED, "Provider not enabled for indications");
-      _SFCB_RETURN(st);
-   }
-
    NativeSelectExp *se=activFilters;
    
    while (se) {
diff --git a/providerDrv.c b/providerDrv.c
index 56de721..6e32a9a 100644
--- a/providerDrv.c
+++ b/providerDrv.c
@@ -135,7 +135,6 @@ static int provProcMax=0;
 static int idleThreadStartHandled=0;
 
 ProviderInfo *activProvs = NULL;
-int indicationEnabled=0;
 
 unsigned long provSampleInterval=10;
 unsigned long provTimeoutInterval=25;
@@ -2127,8 +2126,8 @@ static BinResponseHdr *activateFilter(BinRequestHdr *hdr, ProviderInfo* info,
       TIMING_STOP(hdr,info)
       _SFCB_TRACE(1, ("--- Back from provider rc: %d", rci.rc));
 
-      /*if (indicationEnabled==0 && rci.rc==CMPI_RC_OK) {
-      indicationEnabled=1;
+      /*if (info->indicationEnabled==0 && rci.rc==CMPI_RC_OK) {
+      info->indicationEnabled=1;
 	TIMING_START(hdr,info)
       info->indicationMI->ft->enableIndications(info->indicationMI,ctx);
 	TIMING_STOP(hdr,info)
@@ -2183,7 +2182,7 @@ static BinResponseHdr *deactivateFilter(BinRequestHdr *hdr, ProviderInfo* info,
          *sef=se->next;
          if (activFilters==NULL) {
             _SFCB_TRACE(1, ("--- Calling disableIndications %s",info->providerName));
-            indicationEnabled=0;
+            info->indicationEnabled=0;
 	   TIMING_START(hdr,info)
             info->indicationMI->ft->disableIndications(info->indicationMI,ctx);
 	   TIMING_STOP(hdr,info)
@@ -2240,8 +2239,8 @@ static BinResponseHdr *enableIndications(BinRequestHdr *hdr, ProviderInfo* info,
 		_SFCB_RETURN(resp);  
 	}
 	
-	if (indicationEnabled==0 && rci.rc==CMPI_RC_OK) {
-		indicationEnabled=1;
+	if (info->indicationEnabled==0 && rci.rc==CMPI_RC_OK) {
+		info->indicationEnabled=1;
 		TIMING_START(hdr,info)
 		info->indicationMI->ft->enableIndications(info->indicationMI,ctx);
 		TIMING_STOP(hdr,info)
@@ -2283,8 +2282,8 @@ static BinResponseHdr *disableIndications(BinRequestHdr *hdr, ProviderInfo* info
 		_SFCB_RETURN(resp);  
 	}
 	
-	if (indicationEnabled==1 && rci.rc==CMPI_RC_OK) {
-		indicationEnabled=0;
+	if (info->indicationEnabled==1 && rci.rc==CMPI_RC_OK) {
+		info->indicationEnabled=0;
 		TIMING_START(hdr,info)
 		info->indicationMI->ft->disableIndications(info->indicationMI,ctx);
 		TIMING_STOP(hdr,info)
diff --git a/providerRegister.h b/providerRegister.h
index 38ee180..9b57a7d 100644
--- a/providerRegister.h
+++ b/providerRegister.h
@@ -61,6 +61,7 @@ typedef struct _ProviderInfo {
    pthread_mutex_t initMtx;
    time_t lastActivity;
    int startSeq;
+   int indicationEnabled;
    struct _ProviderInfo *next;
    struct _ProviderInfo *nextInRegister; /*not actually next in Register,but
    pointer to the next provider serving the same class (for indications)*/
-- 
1.7.1

openSUSE Build Service is sponsored by