Exemple #1
0
int _utspace_split_add_uts(allocman_t *alloc, void *_split, size_t num, const cspacepath_t *uts, size_t *size_bits, uintptr_t *paddr, int utType) {
    utspace_split_t *split = (utspace_split_t*) _split;
    int error;
    size_t i;
    struct utspace_split_node **list;
    switch (utType) {
        case ALLOCMAN_UT_KERNEL:
            list = split->heads;
            break;
        case ALLOCMAN_UT_DEV:
            list = split->dev_heads;
            break;
        case ALLOCMAN_UT_DEV_MEM:
            list = split->dev_mem_heads;
            break;
        default:
            return -1;
    }
    for (i = 0; i < num; i++) {
        error = _insert_new_node(alloc, &list[size_bits[i]], uts[i], paddr ? paddr[i] : ALLOCMAN_NO_PADDR);
        if (error) {
            return error;
        }
    }
    return 0;
}
Exemple #2
0
int _utspace_split_add_uts(allocman_t *alloc, void *_split, uint32_t num, cspacepath_t *uts, uint32_t *size_bits, uint32_t *paddr) {
    utspace_split_t *split = (utspace_split_t*) _split;
    int error;
    uint32_t i;
    for (i = 0; i < num; i++) {
        error = _insert_new_node(alloc, &split->heads[size_bits[i]], uts[i], paddr ? paddr[i] : 0);
        if (error) {
            return error;
        }
    }
    return 0;
}