| 508 | } |
| 509 | |
| 510 | node_t * |
| 511 | native_location(resource_t * rsc, GListPtr * list, gboolean current) |
| 512 | { |
| 513 | node_t *one = NULL; |
| 514 | GListPtr result = NULL; |
| 515 | |
| 516 | if (rsc->children) { |
| 517 | GListPtr gIter = rsc->children; |
| 518 | |
| 519 | for (; gIter != NULL; gIter = gIter->next) { |
| 520 | resource_t *child = (resource_t *) gIter->data; |
| 521 | |
| 522 | child->fns->location(child, &result, current); |
| 523 | } |
| 524 | |
| 525 | } else if (current && rsc->running_on) { |
| 526 | result = g_list_copy(rsc->running_on); |
| 527 | |
| 528 | } else if (current == FALSE && rsc->allocated_to) { |
| 529 | result = g_list_append(NULL, rsc->allocated_to); |
| 530 | } |
| 531 | |
| 532 | if (result && g_list_length(result) == 1) { |
| 533 | one = g_list_nth_data(result, 0); |
| 534 | } |
| 535 | |
| 536 | if (list) { |
| 537 | GListPtr gIter = result; |
| 538 | |
| 539 | for (; gIter != NULL; gIter = gIter->next) { |
| 540 | node_t *node = (node_t *) gIter->data; |
| 541 | |
| 542 | if (*list == NULL || pe_find_node_id(*list, node->details->id) == NULL) { |
| 543 | *list = g_list_append(*list, node); |
| 544 | } |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | g_list_free(result); |
| 549 | return one; |
| 550 | } |
nothing calls this directly
no test coverage detected