Logoj0ke.net Open Build Service > Projects > GFS > openais > revision-1449.patch
Sign Up | Log In

File revision-1449.patch of Package openais (Revision 27)

Currently displaying revision 27, show latest

x
 
1
Index: exec/service.c
2
===================================================================
3
--- exec/service.c  (revision 1446)
4
+++ exec/service.c  (revision 1449)
5
@@ -87,7 +87,7 @@
6
    }
7
 };
8
 
9
-struct openais_service_handler *ais_service[128];
10
+struct openais_service_handler *ais_service[SERVICE_HANDLER_MAXIMUM_COUNT];
11
 
12
 /*
13
  * Adds a service handler to the object database
14
Index: exec/service.h
15
===================================================================
16
--- exec/service.h  (revision 1446)
17
+++ exec/service.h  (revision 1449)
18
@@ -44,6 +44,7 @@
19
 #endif
20
 
21
 #define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) )
22
+#define SERVICE_HANDLER_MAXIMUM_COUNT 64
23
 
24
 enum openais_flow_control {
25
    OPENAIS_FLOW_CONTROL_REQUIRED = 1,
26
Index: exec/sync.c
27
===================================================================
28
--- exec/sync.c (revision 1446)
29
+++ exec/sync.c (revision 1449)
30
@@ -198,9 +198,10 @@
31
 {
32
    int res;
33
 
34
-// TODO rewrite this to get rid of the for (;;)
35
    for (;;) {
36
-       res = sync_callbacks_retrieve (sync_recovery_index, &sync_callbacks);
37
+       res = sync_callbacks_retrieve (sync_recovery_index,
38
+           &sync_callbacks);
39
+
40
        /*
41
         * No more service handlers have sync callbacks at this time
42
    `    */
43
@@ -418,7 +419,6 @@
44
        log_printf (LOG_LEVEL_DEBUG,
45
            "Committing synchronization for (%s)\n",
46
            sync_callbacks.name);
47
-   
48
    }
49
 
50
    /*
51
Index: exec/main.c
52
===================================================================
53
--- exec/main.c (revision 1446)
54
+++ exec/main.c (revision 1449)
55
@@ -175,15 +175,29 @@
56
 static int openais_sync_callbacks_retrieve (int sync_id,
57
    struct sync_callbacks *callbacks)
58
 {
59
-   if (ais_service[sync_id] == NULL) {
60
+   unsigned int ais_service_index;
61
+   unsigned int ais_services_found = 0;
62
+   
63
+   for (ais_service_index = 0;
64
+       ais_service_index < SERVICE_HANDLER_MAXIMUM_COUNT;
65
+       ais_service_index++) {
66
+
67
+       if (ais_service[ais_service_index] != NULL) {
68
+           if (ais_services_found == sync_id) {
69
+               break;
70
+           }
71
+           ais_services_found += 1;
72
+       }
73
+   }
74
+   if (ais_service_index == SERVICE_HANDLER_MAXIMUM_COUNT) {
75
        memset (callbacks, 0, sizeof (struct sync_callbacks));
76
        return (-1);
77
    }
78
-   callbacks->name = ais_service[sync_id]->name;
79
-   callbacks->sync_init = ais_service[sync_id]->sync_init;
80
-   callbacks->sync_process = ais_service[sync_id]->sync_process;
81
-   callbacks->sync_activate = ais_service[sync_id]->sync_activate;
82
-   callbacks->sync_abort = ais_service[sync_id]->sync_abort;
83
+   callbacks->name = ais_service[ais_service_index]->name;
84
+   callbacks->sync_init = ais_service[ais_service_index]->sync_init;
85
+   callbacks->sync_process = ais_service[ais_service_index]->sync_process;
86
+   callbacks->sync_activate = ais_service[ais_service_index]->sync_activate;
87
+   callbacks->sync_abort = ais_service[ais_service_index]->sync_abort;
88
    return (0);
89
 }
90
 
91