Release 4.7 drivers/s390/cio/idset.c
/*
* Copyright IBM Corp. 2007, 2012
* Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
*/
#include <linux/vmalloc.h>
#include <linux/bitmap.h>
#include <linux/bitops.h>
#include "idset.h"
#include "css.h"
struct idset {
int num_ssid;
int num_id;
unsigned long bitmap[0];
};
static inline unsigned long bitmap_size(int num_ssid, int num_id)
{
return BITS_TO_LONGS(num_ssid * num_id) * sizeof(unsigned long);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 27 | 96.43% | 1 | 50.00% |
akinobu mita | akinobu mita | 1 | 3.57% | 1 | 50.00% |
| Total | 28 | 100.00% | 2 | 100.00% |
static struct idset *idset_new(int num_ssid, int num_id)
{
struct idset *set;
set = vmalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id));
if (set) {
set->num_ssid = num_ssid;
set->num_id = num_id;
memset(set->bitmap, 0, bitmap_size(num_ssid, num_id));
}
return set;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 57 | 77.03% | 1 | 50.00% |
michael ernst | michael ernst | 17 | 22.97% | 1 | 50.00% |
| Total | 74 | 100.00% | 2 | 100.00% |
void idset_free(struct idset *set)
{
vfree(set);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 14 | 93.33% | 1 | 50.00% |
michael ernst | michael ernst | 1 | 6.67% | 1 | 50.00% |
| Total | 15 | 100.00% | 2 | 100.00% |
void idset_fill(struct idset *set)
{
memset(set->bitmap, 0xff, bitmap_size(set->num_ssid, set->num_id));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 30 | 100.00% | 1 | 100.00% |
| Total | 30 | 100.00% | 1 | 100.00% |
static inline void idset_add(struct idset *set, int ssid, int id)
{
set_bit(ssid * set->num_id + id, set->bitmap);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 33 | 100.00% | 1 | 100.00% |
| Total | 33 | 100.00% | 1 | 100.00% |
static inline void idset_del(struct idset *set, int ssid, int id)
{
clear_bit(ssid * set->num_id + id, set->bitmap);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 33 | 100.00% | 1 | 100.00% |
| Total | 33 | 100.00% | 1 | 100.00% |
static inline int idset_contains(struct idset *set, int ssid, int id)
{
return test_bit(ssid * set->num_id + id, set->bitmap);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 34 | 100.00% | 1 | 100.00% |
| Total | 34 | 100.00% | 1 | 100.00% |
static inline int idset_get_first(struct idset *set, int *ssid, int *id)
{
int bitnum;
bitnum = find_first_bit(set->bitmap, set->num_ssid * set->num_id);
if (bitnum >= set->num_ssid * set->num_id)
return 0;
*ssid = bitnum / set->num_id;
*id = bitnum % set->num_id;
return 1;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 76 | 100.00% | 1 | 100.00% |
| Total | 76 | 100.00% | 1 | 100.00% |
struct idset *idset_sch_new(void)
{
return idset_new(max_ssid + 1, __MAX_SUBCHANNEL + 1);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 20 | 95.24% | 1 | 50.00% |
sebastian ott | sebastian ott | 1 | 4.76% | 1 | 50.00% |
| Total | 21 | 100.00% | 2 | 100.00% |
void idset_sch_add(struct idset *set, struct subchannel_id schid)
{
idset_add(set, schid.ssid, schid.sch_no);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 27 | 100.00% | 1 | 100.00% |
| Total | 27 | 100.00% | 1 | 100.00% |
void idset_sch_del(struct idset *set, struct subchannel_id schid)
{
idset_del(set, schid.ssid, schid.sch_no);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 27 | 100.00% | 1 | 100.00% |
| Total | 27 | 100.00% | 1 | 100.00% |
/* Clear ids starting from @schid up to end of subchannel set. */
void idset_sch_del_subseq(struct idset *set, struct subchannel_id schid)
{
int pos = schid.ssid * set->num_id + schid.sch_no;
bitmap_clear(set->bitmap, pos, set->num_id - schid.sch_no);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
sebastian ott | sebastian ott | 46 | 100.00% | 1 | 100.00% |
| Total | 46 | 100.00% | 1 | 100.00% |
int idset_sch_contains(struct idset *set, struct subchannel_id schid)
{
return idset_contains(set, schid.ssid, schid.sch_no);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 28 | 100.00% | 1 | 100.00% |
| Total | 28 | 100.00% | 1 | 100.00% |
int idset_is_empty(struct idset *set)
{
return bitmap_empty(set->bitmap, set->num_ssid * set->num_id);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
sebastian ott | sebastian ott | 26 | 100.00% | 2 | 100.00% |
| Total | 26 | 100.00% | 2 | 100.00% |
void idset_add_set(struct idset *to, struct idset *from)
{
int len = min(to->num_ssid * to->num_id, from->num_ssid * from->num_id);
bitmap_or(to->bitmap, to->bitmap, from->bitmap, len);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
sebastian ott | sebastian ott | 54 | 100.00% | 2 | 100.00% |
| Total | 54 | 100.00% | 2 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter oberparleiter | peter oberparleiter | 434 | 73.94% | 1 | 11.11% |
sebastian ott | sebastian ott | 132 | 22.49% | 5 | 55.56% |
michael ernst | michael ernst | 19 | 3.24% | 1 | 11.11% |
akinobu mita | akinobu mita | 1 | 0.17% | 1 | 11.11% |
jiri slaby | jiri slaby | 1 | 0.17% | 1 | 11.11% |
| Total | 587 | 100.00% | 9 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.