Exemplo n.º 1
0
char *tboot_config_get(char *key)
{
	if (!tboot_config) {
		pr_error("tboot config wasn't init.\n");
		return NULL;
	}

	if (!hashmapContainsKey(tboot_config, (void *)key)) {
		pr_error("invalid tboot config keyword:%s\n", key);
		return NULL;
	}

	return hashmapGet(tboot_config, (void *)key);
}
Exemplo n.º 2
0
void ttref_add_activity(Hashmap *map, long dr) {
    if (dr) {
        long t = dr;
        for (int i = 0; i < 6; i++) {
            long v = t&MASK;
            t = t >> 6;
            if (v) {
                // -1 as 0 means no-activity
                v = (v - 1) << 1;
                if (!hashmapContainsKey(map, (void *) data[v]))
                    hashmapPut(map, (void *) data[v], (void *) data[v + 1]);
            }
        }
    }
}
Exemplo n.º 3
0
/**
 * Handles a request to be connected to another peer.
 */
static void masterHandleConnectionRequest(PeerProxy* peerProxy, 
        Header* header) {
    Peer* master = peerProxy->peer;
    pid_t targetPid = header->credentials.pid;
    if (!hashmapContainsKey(peerProxy->connections, &targetPid)) {
        // We haven't connected these peers yet.
        PeerProxy* targetPeer 
            = (PeerProxy*) hashmapGet(master->peerProxies, &targetPid);
        if (targetPeer == NULL) {
            // Unknown process.
            masterReportConnectionError(peerProxy, header->credentials);
        } else {
            masterConnectPeers(peerProxy, targetPeer);
        }
    }
    
    // This packet is complete. Get ready for the next one.
    peerProxyExpectHeader(peerProxy);
}