mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-03 00:54:09 +08:00
s390/cio: rename bitmap_size() -> idset_bitmap_size()
bitmap_size() is a pretty generic name and one may want to use it for a generic bitmap API function. At the same time, its logic is not "generic", i.e. it's not just `nbits -> size of bitmap in bytes` converter as it would be expected from its name. Add the prefix 'idset_' used throughout the file where the function resides. Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8fab6a9d72
commit
c1023f5634
@ -16,7 +16,7 @@ struct idset {
|
|||||||
unsigned long bitmap[];
|
unsigned long bitmap[];
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline unsigned long bitmap_size(int num_ssid, int num_id)
|
static inline unsigned long idset_bitmap_size(int num_ssid, int num_id)
|
||||||
{
|
{
|
||||||
return BITS_TO_LONGS(num_ssid * num_id) * sizeof(unsigned long);
|
return BITS_TO_LONGS(num_ssid * num_id) * sizeof(unsigned long);
|
||||||
}
|
}
|
||||||
@ -25,11 +25,12 @@ static struct idset *idset_new(int num_ssid, int num_id)
|
|||||||
{
|
{
|
||||||
struct idset *set;
|
struct idset *set;
|
||||||
|
|
||||||
set = vmalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id));
|
set = vmalloc(sizeof(struct idset) +
|
||||||
|
idset_bitmap_size(num_ssid, num_id));
|
||||||
if (set) {
|
if (set) {
|
||||||
set->num_ssid = num_ssid;
|
set->num_ssid = num_ssid;
|
||||||
set->num_id = num_id;
|
set->num_id = num_id;
|
||||||
memset(set->bitmap, 0, bitmap_size(num_ssid, num_id));
|
memset(set->bitmap, 0, idset_bitmap_size(num_ssid, num_id));
|
||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
@ -41,7 +42,8 @@ void idset_free(struct idset *set)
|
|||||||
|
|
||||||
void idset_fill(struct idset *set)
|
void idset_fill(struct idset *set)
|
||||||
{
|
{
|
||||||
memset(set->bitmap, 0xff, bitmap_size(set->num_ssid, set->num_id));
|
memset(set->bitmap, 0xff,
|
||||||
|
idset_bitmap_size(set->num_ssid, set->num_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void idset_add(struct idset *set, int ssid, int id)
|
static inline void idset_add(struct idset *set, int ssid, int id)
|
||||||
|
Loading…
Reference in New Issue
Block a user