This patch adds two marshall calls to mar_msg.h for handling
mar_msg_queue_thresholds_t data. The library now uses these calls in
the saMsgQueueCapacityThresholdSet and saMsgQueueCapacityThresholdGet
API calls.
Also, I've fixed a couple other routines in mar_msg.h that have for
loops that begin with i = 0 when they should beging with i =
SA_MSG_MESSAGE_HIGHEST_PRIORITY.
Ryan
Index: include/mar_msg.h
===================================================================
--- include/mar_msg.h (revision 2055)
+++ include/mar_msg.h (working copy)
@@ -185,7 +185,7 @@
swab_mar_time_t (&to_swab->retention_time);
swab_mar_time_t (&to_swab->close_time);
- for (i = 0; i < SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) {
+ for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <
SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) {
swab_mar_msg_queue_usage_t (&to_swab->queue_usage[i]);
}
}
@@ -368,12 +368,36 @@
{
int i;
- for (i = 0; i < SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) {
+ for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <
SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) {
swab_mar_size_t (&to_swab->capacity_reached[i]);
swab_mar_size_t (&to_swab->capacity_available[i]);
}
}
+static inline void marshall_from_mar_msg_queue_thresholds_t (
+ SaMsgQueueThresholdsT *dst,
+ mar_msg_queue_thresholds_t *src)
+{
+ int i;
+
+ for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <
SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) {
+ dst->capacityReached[i] = src->capacity_reached[i];
+ dst->capacityAvailable[i] = src->capacity_available[i];
+ }
+}
+
+static inline void marshall_to_mar_msg_queue_thresholds_t (
+ mar_msg_queue_thresholds_t *dst,
+ SaMsgQueueThresholdsT *src)
+{
+ int i;
+
+ for (i = SA_MSG_MESSAGE_HIGHEST_PRIORITY; i <
SA_MSG_MESSAGE_LOWEST_PRIORITY; i++) {
+ dst->capacity_reached[i] = src->capacityReached[i];
+ dst->capacity_available[i] = src->capacityAvailable[i];
+ }
+}
+
/*
* SaMsgLimitIdT
*/
Index: lib/msg.c
===================================================================
--- lib/msg.c (revision 2055)
+++ lib/msg.c (working copy)
@@ -2031,8 +2031,9 @@
&req_lib_msg_queuecapacitythresholdset.queue_name,
(SaNameT *)(&queueInstance->queue_name));
- memcpy (&req_lib_msg_queuecapacitythresholdset.thresholds,
- thresholds, sizeof (SaMsgQueueThresholdsT));
+ marshall_to_mar_msg_queue_thresholds_t (
+ &req_lib_msg_queuecapacitythresholdset.thresholds,
+ (SaMsgQueueThresholdsT *)(thresholds));
iov.iov_base = (void *)&req_lib_msg_queuecapacitythresholdset;
iov.iov_len = sizeof (struct req_lib_msg_queuecapacitythresholdset);
@@ -2112,9 +2113,8 @@
goto error_put;
}
- memcpy (thresholds,
- &res_lib_msg_queuecapacitythresholdget.thresholds,
- sizeof (SaMsgQueueThresholdsT));
+ marshall_from_mar_msg_queue_thresholds_t (thresholds,
+ &res_lib_msg_queuecapacitythresholdget.thresholds);
error_put:
hdb_handle_put (&queueHandleDatabase, queueHandle);
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais