I have made the following changes intended for : CE:MW:Shared / ohm-plugins-misc
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/5840 Thank You, Juho Hämäläinen [This message was auto-generated] --- Request # 5840: Messages from BOSS: State: review at 2012-08-15T13:48:57 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:jhamalai:branches:CE:MW:Shared / ohm-plugins-misc -> CE:MW:Shared / ohm-plugins-misc changes files: -------------- --- ohm-plugins-misc.changes +++ ohm-plugins-misc.changes @@ -0,0 +1,3 @@ +* Wed Aug 15 2012 Juho Hämäläinen <[email protected]> - 1.1.59 +- Fixes NEMO#331: Update resource-set queue implementation. + new: ---- 0001-resource-Update-resource-set-queue-implementation.-F.patch spec files: ----------- --- ohm-plugins-misc.spec +++ ohm-plugins-misc.spec @@ -17,6 +17,7 @@ Source0: maemo-multimedia-ohm-plugins-misc-264ebb39.tar.gz Source100: ohm-plugins-misc.yaml Patch0: disable-cgroups-plugin.patch +Patch1: 0001-resource-Update-resource-set-queue-implementation.-F.patch Requires: ohm BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(x11-xcb) @@ -47,6 +48,8 @@ # disable-cgroups-plugin.patch %patch0 -p1 +# 0001-resource-Update-resource-set-queue-implementation.-F.patch +%patch1 -p1 # >> setup # << setup other changes: -------------- ++++++ 0001-resource-Update-resource-set-queue-implementation.-F.patch (new) --- 0001-resource-Update-resource-set-queue-implementation.-F.patch +++ 0001-resource-Update-resource-set-queue-implementation.-F.patch @@ -0,0 +1,157 @@ +From 7d9a7fe41350e19c901e2dba10ab2e1c851c13cd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Juho=20H=C3=A4m=C3=A4l=C3=A4inen?= <[email protected]> +Date: Mon, 13 Aug 2012 13:34:53 +0300 +Subject: [PATCH] resource: Update resource-set queue implementation. Fixes NEMO#331 + +--- + plugins/resource/resource-set.c | 67 ++++++++++++++++++++++---------------- + plugins/resource/resource-set.h | 4 +- + 2 files changed, 41 insertions(+), 30 deletions(-) + +diff --git a/plugins/resource/resource-set.c b/plugins/resource/resource-set.c +index 8b982ae..415d68f 100644 +--- a/plugins/resource/resource-set.c ++++ b/plugins/resource/resource-set.c +@@ -97,13 +97,7 @@ resource_set_t *resource_set_create(pid_t client_pid, resset_t *resset) + rs->manager_id = manager_id++; + rs->resset = resset; + rs->request = strdup("release"); +- +- rs->granted.queue.first = (void *)&rs->granted.queue; +- rs->granted.queue.last = (void *)&rs->granted.queue; +- +- rs->advice.queue.first = (void *)&rs->advice.queue; +- rs->advice.queue.last = (void *)&rs->advice.queue; +- ++ + resset->userdata = rs; + add_to_hash_table(rs); + add_factstore_entry(rs); +@@ -379,6 +373,41 @@ static gboolean idle_task(gpointer data) + return FALSE; + } + ++static resource_set_queue_t* queue_pop_head(resource_set_qhead_t *qhead) ++{ ++ resource_set_queue_t *qentry; ++ ++ if (!qhead) ++ return NULL; ++ ++ qentry = qhead->head; ++ ++ if (qhead->head) { ++ qhead->head = qhead->head->next; ++ ++ if (qhead->head) ++ qhead->head->prev = NULL; ++ else ++ qhead->tail = NULL; ++ } ++ ++ return qentry; ++} ++ ++static void queue_push_tail(resource_set_qhead_t *qhead, resource_set_queue_t *qentry) ++{ ++ if (!qhead || !qentry) ++ return; ++ ++ if (qhead->tail) { ++ qhead->tail->next = qentry; ++ qentry->prev = qhead->tail; ++ qhead->tail = qentry; ++ } else { ++ qhead->head = qentry; ++ qhead->tail = qentry; ++ } ++} + + static void enqueue_send_request(resource_set_t *rs, + resource_set_field_id_t what, +@@ -409,14 +438,11 @@ static void enqueue_send_request(resource_set_t *rs, + qhead = &value->queue; + + memset(qentry, 0, sizeof(resource_set_queue_t)); +- qentry->next = (void *)qhead; +- qentry->prev = qhead->last; + qentry->txid = txid; + qentry->reqno = reqno; + qentry->value = value->factstore; + +- qhead->last->next = qentry; +- qhead->last = qentry; ++ queue_push_tail(qhead, qentry); + + OHM_DEBUG(DBG_SET, "%s/%u (manager_id %u) enqued %s value %s", + resset->peer, resset->id, rs->manager_id, type, +@@ -433,7 +459,6 @@ static void dequeue_and_send(resource_set_t *rs, + resource_set_output_t *value; + resource_set_qhead_t *qhead; + resource_set_queue_t *qentry; +- resource_set_queue_t *qnext; + int32_t block; + resmsg_t msg; + char buf[128]; +@@ -452,13 +477,11 @@ static void dequeue_and_send(resource_set_t *rs, + qhead = &value->queue; + block = rs->block; + +- qnext = (void *) qhead->first; +- + /* + * we assume that the queue contains strictly monoton increasing txid's + * and this function is called with strictly monoton txid's + */ +- while ((void *)(qentry = qnext) != (void *)qhead) { ++ while ((qentry = queue_pop_head(qhead)) != NULL) { + if (qentry->txid > txid) + return; /* nothing to send */ + +@@ -502,9 +525,6 @@ static void dequeue_and_send(resource_set_t *rs, + resset->peer, resset->id, rs->manager_id, txid); + } + +- qentry->prev->next = qentry->next; +- qentry->next->prev = qentry->prev; +- qnext = (void *) qhead->first; + free(qentry); + } /* while */ + } +@@ -521,17 +541,8 @@ static void destroy_queue(resource_set_t *rs, resource_set_field_id_t what) + default: return; + } + +- qnext = (void *) qhead->first; +- +- while ((void *)(qentry = qnext) != (void *)qhead) { +- +- qentry->prev->next = qentry->next; +- qentry->next->prev = qentry->prev; +- +- qnext = (void *) qhead->first; +- ++ while ((qentry = queue_pop_head(qhead)) != NULL) + free(qentry); +- } + } + + +diff --git a/plugins/resource/resource-set.h b/plugins/resource/resource-set.h +index 135d8a9..29387ec 100644 +--- a/plugins/resource/resource-set.h ++++ b/plugins/resource/resource-set.h +@@ -57,8 +57,8 @@ typedef struct resource_set_queue_s { + } resource_set_queue_t; + + typedef struct { +- resource_set_queue_t *first; +- resource_set_queue_t *last; ++ resource_set_queue_t *head; ++ resource_set_queue_t *tail; + } resource_set_qhead_t; + + typedef struct { +-- +1.7.0.4 + ++++++ ohm-plugins-misc.yaml --- ohm-plugins-misc.yaml +++ ohm-plugins-misc.yaml @@ -11,6 +11,7 @@ Patches: - disable-cgroups-plugin.patch + - 0001-resource-Update-resource-set-queue-implementation.-F.patch Requires: - ohm
