rc < 0 if 'node1' has more capacity remaining * rc > 0 if 'node1' has less capacity remaining */
| 164 | * rc > 0 if 'node1' has less capacity remaining |
| 165 | */ |
| 166 | static int |
| 167 | compare_capacity(const node_t * node1, const node_t * node2) |
| 168 | { |
| 169 | struct compare_data data; |
| 170 | |
| 171 | data.node1 = node1; |
| 172 | data.node2 = node2; |
| 173 | data.result = 0; |
| 174 | |
| 175 | g_hash_table_foreach(node1->details->utilization, do_compare_capacity1, &data); |
| 176 | g_hash_table_foreach(node2->details->utilization, do_compare_capacity2, &data); |
| 177 | |
| 178 | return data.result; |
| 179 | } |
| 180 | |
| 181 | /* return -1 if 'a' is more preferred |
| 182 | * return 1 if 'b' is more preferred |