*---------------------------------------------------------------*/
static struct hash_cell *__get_name_cell(const char *str)
{
- struct list_head *tmp;
struct hash_cell *hc;
unsigned int h = hash_str(str);
- list_for_each (tmp, _name_buckets + h) {
- hc = list_entry(tmp, struct hash_cell, name_list);
+ list_for_each_entry (hc, _name_buckets + h, name_list)
if (!strcmp(hc->name, str))
return hc;
- }
return NULL;
}
static struct hash_cell *__get_uuid_cell(const char *str)
{
- struct list_head *tmp;
struct hash_cell *hc;
unsigned int h = hash_str(str);
- list_for_each (tmp, _uuid_buckets + h) {
- hc = list_entry(tmp, struct hash_cell, uuid_list);
+ list_for_each_entry (hc, _uuid_buckets + h, uuid_list)
if (!strcmp(hc->uuid, str))
return hc;
- }
return NULL;
}
unsigned int count = 0;
struct list_head *tmp;
size_t len, needed;
+ struct dm_dev *dd;
struct dm_target_deps *deps;
deps = get_result_buffer(param, param_size, &len);
/*
* Count the devices.
*/
- list_for_each(tmp, dm_table_get_devices(table))
+ list_for_each (tmp, dm_table_get_devices(table))
count++;
/*
*/
deps->count = count;
count = 0;
- list_for_each(tmp, dm_table_get_devices(table)) {
- struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
+ list_for_each_entry (dd, dm_table_get_devices(table), list)
deps->dev[count++] = huge_encode_dev(dd->bdev->bd_dev);
- }
param->data_size = param->data_start + needed;
}
*/
static struct dm_dev *find_device(struct list_head *l, dev_t dev)
{
- struct list_head *tmp;
+ struct dm_dev *dd;
- list_for_each(tmp, l) {
- struct dm_dev *dd = list_entry(tmp, struct dm_dev, list);
+ list_for_each_entry (dd, l, list)
if (dd->bdev->bd_dev == dev)
return dd;
- }
return NULL;
}
static inline struct tt_internal *__find_target_type(const char *name)
{
- struct list_head *tih;
struct tt_internal *ti;
- list_for_each(tih, &_targets) {
- ti = list_entry(tih, struct tt_internal, list);
-
+ list_for_each_entry (ti, &_targets, list)
if (!strcmp(name, ti->tt.name))
return ti;
- }
return NULL;
}