javacall_result bt_push_parse_url(const char *url, bt_port_t *port, bt_params_t *params) { int i; if (test_prefix(&url, "btl2cap://")) { port->protocol = BT_L2CAP; } else if (test_prefix(&url, "btspp://")) { port->protocol = BT_SPP; } else if (test_prefix(&url, "btgoep://")) { port->protocol = BT_GOEP; } else { return JAVACALL_FAIL; } if (!test_prefix(&url, "localhost:")) { return JAVACALL_FAIL; } for (i = 0; i < 16; i++) { int hex1, hex2; hex1 = get_hex(*url++); if (hex1 < 0) { return JAVACALL_FAIL; } hex2 = get_hex(*url++); if (hex2 < 0) { return JAVACALL_FAIL; } port->uuid[i] = hex1 << 4 | hex2; } if (params == NULL) { /* params parsing is not needed */ return JAVACALL_OK; } params->authenticate = JAVACALL_FALSE; params->authorize = JAVACALL_FALSE; params->encrypt = JAVACALL_FALSE; params->rmtu = DEFAULT_MTU; params->tmtu = -1; url = strchr(url, ';'); while (url != NULL) { if (test_prefix(&url, ";authenticate=")) { params->authenticate = read_bool(&url); } else if (test_prefix(&url, ";authorize=")) { params->authorize = read_bool(&url); } else if (test_prefix(&url, ";encrypt=")) { params->encrypt = read_bool(&url); } else if (test_prefix(&url, ";master=")) { params->master = read_bool(&url); } else if (test_prefix(&url, ";receiveMTU=")) { params->rmtu = read_short(&url); } else if (test_prefix(&url, ";transmitMTU=")) { params->tmtu = read_short(&url); } url = strchr(url + 1, ';'); } if (params->authorize || params->encrypt) { params->authenticate = JAVACALL_TRUE; } return JAVACALL_OK; }
static javacall_bool read_bool(const char **pstring) { if (test_prefix(pstring, "true")) { return JAVACALL_TRUE; } if (test_prefix(pstring, "false")) { return JAVACALL_FALSE; } /* unexpected boolean value */ REPORT_ERROR(LC_PUSH, "Invalid boolean value."); return JAVACALL_FALSE; }
javacall_bool bt_is_bluetooth_url(const char *url) { if (test_prefix(&url, "btl2cap://")) { return JAVACALL_TRUE; } if (test_prefix(&url, "btspp://")) { return JAVACALL_TRUE; } if (test_prefix(&url, "btgoep://")) { return JAVACALL_TRUE; } return JAVACALL_FALSE; }
void ivy_bridge_ep_memerr_misc(struct mce *m, int *channel, int *dimm) { u64 status = m->status; unsigned failrank, chan; /* Ignore unless this is an corrected extended error from an iMC bank */ if (!imc_log || m->bank < 9 || m->bank > 16 || (status & MCI_STATUS_UC) || !test_prefix(7, status & 0xefff)) return; chan = EXTRACT(status, 0, 3); if (chan == 0xf) return; if (EXTRACT(m->misc, 62, 62)) { failrank = EXTRACT(m->misc, 46, 50); dimm[0] = failrank2dimm(failrank, m->socketid, chan); channel[0] = chan; } if (EXTRACT(m->misc, 63, 63)) { failrank = EXTRACT(m->misc, 51, 55); dimm[1] = failrank2dimm(failrank, m->socketid, chan); channel[1] = chan; } }
javacall_bool bt_push_test_filter(const javacall_bt_address bdaddr, const char *filter) { char address[13] = {0}; javacall_bool auth; sprintf(address, "%02X%02X%02X%02X%02X%02X", bdaddr[5], bdaddr[4], bdaddr[3], bdaddr[2], bdaddr[1], bdaddr[0]); if (!test_address(address, &filter)) { return JAVACALL_FALSE; } if (javacall_bt_bcc_is_trusted(bdaddr, &auth) != JAVACALL_OK) { return JAVACALL_FALSE; } if (auth == JAVACALL_TRUE) { if (!test_prefix(&filter, ";authorized")) { return JAVACALL_FALSE; } } else { if (javacall_bt_bcc_is_authenticated(bdaddr, &auth) != JAVACALL_OK) { return JAVACALL_FALSE; } if (auth == JAVACALL_TRUE) { if (!test_prefix(&filter, ";authenticated")) { return JAVACALL_FALSE; } } } if (test_prefix(&filter, ";blacklist=")) { while (*filter != '\0') { if (test_address(address, &filter)) { return JAVACALL_FALSE; } while ((*filter != ';') && (*filter != '\0')) { filter++; } if (*filter == ';') { filter++; } else if (*filter != '\0') { return JAVACALL_FALSE; } } } return JAVACALL_TRUE; }
/* * There isn't enough information to identify the DIMM. But * we can derive the channel from the bank number. * There can be two memory controllers. We number the channels * on the second controller: 3, 4, 5 */ void skylake_memerr_misc(struct mce *m, int *channel, int *dimm) { u64 status = m->status; unsigned chan; /* Check this is a memory error */ if (!test_prefix(7, status & 0xefff)) return; chan = EXTRACT(status, 0, 3); if (chan == 0xf) return; switch (m->bank) { case 7: /* Home agent 0 */ break; case 8: /* Home agent 1 */ chan += 3; break; case 13: /* Memory controller 0, channel 0 */ chan = 0; break; case 14: /* Memory controller 0, channel 1 */ chan = 1; break; case 15: /* Memory controller 1, channel 0 */ chan = 3; break; case 16: /* Memory controller 1, channel 1 */ chan = 4; break; case 17: /* Memory controller 0, channel 2 */ chan = 2; break; case 18: /* Memory controller 1, channel 2 */ chan = 5; break; default: return; } channel[0] = chan; }
my_bool do_test(uint bitsize) { MY_BITMAP map; uint32 buf[MAX_TESTED_BITMAP_SIZE]; if (bitmap_init(&map, buf, bitsize, FALSE)) { diag("init error for bitsize %d", bitsize); goto error; } if (test_set_get_clear_bit(&map,bitsize)) goto error; bitmap_clear_all(&map); if (test_flip_bit(&map,bitsize)) goto error; bitmap_clear_all(&map); if (test_get_all_bits(&map, bitsize)) goto error; bitmap_clear_all(&map); if (test_compare_operators(&map,bitsize)) goto error; bitmap_clear_all(&map); if (test_count_bits_set(&map,bitsize)) goto error; bitmap_clear_all(&map); if (test_get_first_bit(&map,bitsize)) goto error; bitmap_clear_all(&map); if (test_get_next_bit(&map,bitsize)) goto error; bitmap_clear_all(&map); if (test_prefix(&map,bitsize)) goto error; bitmap_clear_all(&map); if (test_compare(&map,bitsize)) goto error; bitmap_clear_all(&map); if (test_intersect(&map,bitsize)) goto error; return FALSE; error: return TRUE; }