bool_e omaprpc_unregister(omaprpc_t *rpc, int memdevice, void *ptr, void **reserved) { bool_e unregistered = false_e; if (rpc) { #if defined(OMAPRPC_USE_ION) struct ion_fd_data data; node_t node, *tmp; memdevice = memdevice; // removes warning ptr = ptr; // removes warning data.handle = *((struct ion_handle **)reserved); if (ioctl(rpc->device, OMAPRPC_IOC_IONUNREGISTER, &data) >= 0) unregistered = true_e; if (unregistered) { OMAPRPC_PRINT(OMAPRPC_ZONE_INFO, "Unregistered %p with OMAPRPC:%u\n", ptr, rpc->device); } else { OMAPRPC_PRINT(OMAPRPC_ZONE_ERROR, "Failed to unregister %p with OMAPRPC:%u\n", ptr, rpc->device); } node.data = (value_t)&data; tmp = list_remove_match(&rpc->fd_list, &node, list_hdl_compare); if (tmp) { struct ion_fd_data *fd_hdl = (struct ion_fd_data *)tmp->data; close(fd_hdl->fd); free(fd_hdl); free(tmp); } #endif } return unregistered; }
int parse_nf (char *string, List *list) { newts_nfref *ref = nfref_alloc (); char *copy; if (string == NULL || list == NULL) return -1; copy = newts_strdup (string); if (!pattern_flag) sense = PARSE_ADD; if (*copy == ':') { return parse_file (copy + 1, list); } if (*copy == '!') { char *change = newts_strdup (copy + 1); newts_free (copy); copy = change; sense = PARSE_DELETE; } if (!pattern_flag && (strchr (copy, '?') || strchr (copy, '[') || strchr (copy, '*') || strchr (copy, ' '))) { /* Pattern matching. */ int result; pattern_flag = TRUE; result = parse_pattern (copy, list); pattern_flag = FALSE; return result; } parse_single_nf (copy, ref); if (sense == PARSE_ADD) list_insert_next (list, list_tail (list), (void *) ref); else { list_remove_match (list, (void *) ref); nfref_free (ref); } newts_free (copy); return 0; }