Exemplo n.º 1
0
static unsigned int protocol_child(struct service_backend *backend, struct service_state *state, unsigned int id, char *path, unsigned int length)
{

    struct system_node *node = (struct system_node *)backend->map(state, id, sizeof (struct system_node));
    struct list_item *current;
    struct system_node *n = node;

    spinlock_acquire(&node->children.spinlock);

    for (current = node->children.head; current; current = current->next)
    {

        struct system_node *n2 = current->data;
        unsigned int length0 = ascii_length(n2->name);

        if (n2->type == SYSTEM_NODETYPE_MULTIGROUP)
        {

            unsigned int colon = memory_findbyte(path, length, ':');
            unsigned int val;

            if (length0 != colon)
                continue;

            if (!memory_match(n2->name, path, colon))
                continue;

            val = ascii_rvalue(path + colon + 1, length - colon - 1, 10);

            if (val != n2->index)
                continue;

        }

        else
        {

            if (length0 != length)
                continue;

            if (!memory_match(n2->name, path, length))
                continue;

        }

        n = n2;

        break;

    }

    spinlock_release(&node->children.spinlock);

    return (unsigned int)n;

}
Exemplo n.º 2
0
static unsigned int findmodulesymbol(unsigned int count, char *symbolname)
{

    unsigned int length = memory_findbyte(symbolname, count, '_') - 1;
    unsigned int offset = 0;
    unsigned int address;
    char module[32];

    offset += memory_write(module, 32, symbolname, length, offset);
    offset += memory_write(module, 32, ".ko", 4, offset);

    if (!file_walkfrom(CALL_L2, CALL_L1, module))
        return 0;

    file_open(CALL_L2);

    address = findsymbol(CALL_L2, count, symbolname);

    file_close(CALL_L2);

    return address;

}