Board Thread:Off-Topic/@comment-25672400-20150413194144

struct group_info init_groups = { .usage = ATOMIC_INIT(2) };  struct group_info *groups_alloc(int gidsetsize){     struct group_info *group_info;     int nblocks;     int i;       nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;     /* Make sure we always allocate at least one indirect block pointer */     nblocks = nblocks ? : 1;      group_info = kmalloc(sizeof(*group_info) + nblocks*sizeof(gid_t *), GFP_USER);     if (!group_info)         return NULL;      group_info->ngroups = gidsetsize; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    group_info->nblocks = nblocks; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    atomic_set(&group_info->usage, 1); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    if (gidsetsize <= NGROUPS_SMALL) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        group_info->blocks[0] = group_info->small_block; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    else { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        for (i = 0; i < nblocks; i++) { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            gid_t *b; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            b = (void *)__get_free_page(GFP_USER); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            if (!b) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">                goto out_undo_partial_alloc; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            group_info->blocks[i] = b; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    return group_info; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">out_undo_partial_alloc: <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    while (--i >= 0) { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        free_page((unsigned long)group_info->blocks[i]); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    kfree(group_info); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    return NULL; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">} <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">EXPORT_SYMBOL(groups_alloc); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">void groups_free(struct group_info *group_info) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">{ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    if (group_info->blocks[0] != group_info->small_block) { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        int i; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        for (i = 0; i < group_info->nblocks; i++) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            free_page((unsigned long)group_info->blocks[i]); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    kfree(group_info); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">} <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">EXPORT_SYMBOL(groups_free); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">/* export the group_info to a user-space array */ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">static int groups_to_user(gid_t __user *grouplist,  <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">  <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">              const struct group_info *group_info) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">{ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    int i; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    unsigned int count = group_info->ngroups; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    for (i = 0; i < group_info->nblocks; i++) { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        unsigned int cp_count = min(NGROUPS_PER_BLOCK, count); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        unsigned int len = cp_count * sizeof(*grouplist); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        if (copy_to_user(grouplist, group_info->blocks[i], len)) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            return -EFAULT; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        grouplist += NGROUPS_PER_BLOCK; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        count -= cp_count; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    return 0; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">} <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">/* fill a group_info from a user-space array - it must be allocated already */ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">static int groups_from_user(struct group_info *group_info,  <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">  <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    gid_t __user *grouplist) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">{ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    int i; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    unsigned int count = group_info->ngroups; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    for (i = 0; i < group_info->nblocks; i++) { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        unsigned int cp_count = min(NGROUPS_PER_BLOCK, count); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        unsigned int len = cp_count * sizeof(*grouplist); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        if (copy_from_user(group_info->blocks[i], grouplist, len)) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            return -EFAULT; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        grouplist += NGROUPS_PER_BLOCK; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        count -= cp_count; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    return 0; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">} <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">/* a simple Shell sort */ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">static void groups_sort(struct group_info *group_info) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">{ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    int base, max, stride; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    int gidsetsize = group_info->ngroups; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    for (stride = 1; stride < gidsetsize; stride = 3 * stride + 1) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        ; /* nothing */ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    stride /= 3; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    while (stride) { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        max = gidsetsize - stride; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        for (base = 0; base < max; base++) { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            int left = base; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            int right = left + stride; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            gid_t tmp = GROUP_AT(group_info, right); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            while (left >= 0 && GROUP_AT(group_info, left) > tmp) { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">                GROUP_AT(group_info, right) = <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">                    GROUP_AT(group_info, left); <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">                right = left; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">                left -= stride; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            GROUP_AT(group_info, right) = tmp; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        stride /= 3; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">} <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">/* a simple bsearch */ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">int groups_search(const struct group_info *group_info, gid_t grp) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">{ <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    unsigned int left, right; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    if (!group_info) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        return 0; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    left = 0; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    right = group_info->ngroups; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    while (left < right) { <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        unsigned int mid = left + (right - left)/2; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        if (grp > GROUP_AT(group_info, mid)) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            left = mid + 1; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        else if (grp < GROUP_AT(group_info, mid)) <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            right = mid; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">        else <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">            return 1; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    } <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">    return 0; <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">} <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;">/** <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> * set_groups - Change a group subscription in a set of credentials <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> * @new: The newly prepared set of credentials to alter <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> * @group_info: The group list to install <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> * <span style="color:rgb(0,255,0);font-family:monospace;font-size:medium;line-height:normal;"> hacktyper.net <ac_metadata title="How 2 hack"> </ac_metadata>