int parse_block(int fd1,int fd2) { char tag; read(fd1,&tag,1); switch(GET_TAG(tag)) { case 0x00: parse_titleblock(fd1); break; case 0x01: parse_sheet(fd1); break; case 0x02: parse_component(fd1,fd2); break; case 0x03: parse_wire(fd1); break; case 0x04: parse_bus(fd1); break; case 0x05: parse_junction(fd1); break; case 0x06: parse_port(fd1); break; case 0x07: parse_label(fd1); break; case 0x08: parse_entry(fd1); break; case 0x09: parse_dashed(fd1); break; case 0x0a: parse_power(fd1); break; case 0x0b: parse_text(fd1); break; case 0x0c: parse_marker(fd1); break; case 0x0f: return 0; break; default: fprintf(stderr,"\nUnknown Block Tag\n"); exit(-1); break; } return 1; }
static void vboot_wrapper(void *arg) { int i; VbError_t res; const struct components *components; struct vboot_context *context; context = arg; gcontext = context; VbExDebug("Calling VbInit()\n"); res = VbInit(context->cparams, &context->handoff->init_params); VbExDebug("VbInit() returned 0x%08x\n", res); if (res != VBERROR_SUCCESS) return; VbExDebug("Calling VbSelectFirmware()\n"); res = VbSelectFirmware(context->cparams, context->fparams); VbExDebug("VbSelectFirmware() returned 0x%08x\n", res); if (res != VBERROR_SUCCESS) return; /* Fix up the handoff structure. */ context->handoff->selected_firmware = context->fparams->selected_firmware; /* Parse out the components for downstream consumption. */ if (context->handoff->selected_firmware == VB_SELECT_FIRMWARE_A) components = (void *)context->fw_a; else if (context->handoff->selected_firmware == VB_SELECT_FIRMWARE_B) components = (void *)context->fw_b; else return; for (i = 0; i < MAX_PARSED_FW_COMPONENTS; i++) { parse_component(components, i, &context->handoff->components[i]); } }
static CFDictionaryRef entity_one(SCDynamicStoreRef store, CFStringRef key) { CFDictionaryRef ent_dict = NULL; CFDictionaryRef if_dict = NULL; CFStringRef if_key = NULL; CFStringRef if_port; CFMutableDictionaryRef new_dict = NULL; static CFStringRef pre = NULL; CFStringRef serviceID = NULL; CFStringRef serviceType; if (!pre) { pre = SCDynamicStoreKeyCreate(NULL, CFSTR("%@/%@/%@/"), kSCDynamicStoreDomainSetup, kSCCompNetwork, kSCCompService); } /* * get entity dictionary for service */ ent_dict = cache_SCDynamicStoreCopyValue(store, key); if (!isA_CFDictionary(ent_dict)) { goto done; } /* * get interface dictionary for service */ serviceID = parse_component(key, pre); if (!serviceID) { goto done; } if_key = SCDynamicStoreKeyCreateNetworkServiceEntity(NULL, kSCDynamicStoreDomainSetup, serviceID, kSCEntNetInterface); if_dict = cache_SCDynamicStoreCopyValue(store, if_key); CFRelease(if_key); if (!isA_CFDictionary(if_dict)) { goto done; } /* check the interface type */ serviceType = CFDictionaryGetValue(if_dict, kSCPropNetInterfaceType); if (!isA_CFString(serviceType) || !CFEqual(serviceType, kSCValNetInterfaceTypeEthernet)) { /* sorry, no AT networking on this interface */ goto done; } /* * get port name (from interface dictionary). */ if_port = CFDictionaryGetValue(if_dict, kSCPropNetInterfaceDeviceName); if (!isA_CFString(if_port)) { goto done; } /* * add ServiceID and interface port name to entity dictionary. */ new_dict = CFDictionaryCreateMutableCopy(NULL, 0, ent_dict); CFDictionarySetValue(new_dict, CFSTR("ServiceID"), serviceID); CFDictionarySetValue(new_dict, kSCPropNetInterfaceDeviceName, if_port); done: if (ent_dict) CFRelease(ent_dict); if (if_dict) CFRelease(if_dict); if (serviceID) CFRelease(serviceID); return (CFDictionaryRef)new_dict; }