Lines Matching defs:child
19 struct hotplug2_child_t *add_child(struct hotplug2_child_t *child, pid_t pid, event_seqnum_t seqnum) {
22 if (child == NULL) {
23 child = xmalloc(sizeof(struct hotplug2_child_t));
26 for (; child->next; child = child->next);
28 child->next = xmalloc(sizeof(struct hotplug2_child_t));
29 tmp = child;
30 child = child->next;
33 child->seqnum = seqnum;
34 child->pid = pid;
35 child->prev = tmp;
36 child->next = NULL;
38 return child;
41 struct hotplug2_child_t *remove_child_by_pid(struct hotplug2_child_t *child, pid_t pid, event_seqnum_t *largest_seqnum, int *child_c) {
44 if (child == NULL) {
45 ERROR("remove_child_by_pid", "Invalid child list passed (NULL).");
49 tmp_child = child;
51 for (; child->prev && child->pid != pid; child = child->prev);
53 if (child->pid != pid) {
57 if (child->prev != NULL)
58 ((struct hotplug2_child_t *)(child->prev))->next = child->next;
60 if (child->next != NULL)
61 ((struct hotplug2_child_t *)(child->next))->prev = child->prev;
64 if (child->seqnum > *largest_seqnum)
65 *largest_seqnum = child->seqnum;
70 if (child == tmp_child) {
71 if (child->next != NULL)
72 tmp_child = child->next;
73 else if (child->prev != NULL)
74 tmp_child = child->prev;
83 free(child);