Lines Matching refs:dir

100 	struct tb_property_dir *dir;  in tb_property_parse()  local
116 dir = __tb_property_parse_dir(block, block_len, entry->value, in tb_property_parse()
118 if (!dir) { in tb_property_parse()
122 property->value.dir = dir; in tb_property_parse()
167 struct tb_property_dir *dir; in __tb_property_parse_dir() local
169 dir = kzalloc(sizeof(*dir), GFP_KERNEL); in __tb_property_parse_dir()
170 if (!dir) in __tb_property_parse_dir()
177 dir->uuid = kmemdup(&block[dir_offset], sizeof(*dir->uuid), in __tb_property_parse_dir()
179 if (!dir->uuid) { in __tb_property_parse_dir()
180 tb_property_free_dir(dir); in __tb_property_parse_dir()
190 INIT_LIST_HEAD(&dir->properties); in __tb_property_parse_dir()
197 tb_property_free_dir(dir); in __tb_property_parse_dir()
201 list_add_tail(&property->list, &dir->properties); in __tb_property_parse_dir()
204 return dir; in __tb_property_parse_dir()
244 struct tb_property_dir *dir; in tb_property_create_dir() local
246 dir = kzalloc(sizeof(*dir), GFP_KERNEL); in tb_property_create_dir()
247 if (!dir) in tb_property_create_dir()
250 INIT_LIST_HEAD(&dir->properties); in tb_property_create_dir()
252 dir->uuid = kmemdup(uuid, sizeof(*dir->uuid), GFP_KERNEL); in tb_property_create_dir()
253 if (!dir->uuid) { in tb_property_create_dir()
254 kfree(dir); in tb_property_create_dir()
259 return dir; in tb_property_create_dir()
267 tb_property_free_dir(property->value.dir); in tb_property_free()
293 void tb_property_free_dir(struct tb_property_dir *dir) in tb_property_free_dir() argument
297 if (!dir) in tb_property_free_dir()
300 list_for_each_entry_safe(property, tmp, &dir->properties, list) { in tb_property_free_dir()
304 kfree(dir->uuid); in tb_property_free_dir()
305 kfree(dir); in tb_property_free_dir()
309 static size_t tb_property_dir_length(const struct tb_property_dir *dir, in tb_property_dir_length() argument
315 if (dir->uuid) in tb_property_dir_length()
316 len += sizeof(*dir->uuid) / 4; in tb_property_dir_length()
320 list_for_each_entry(property, &dir->properties, list) { in tb_property_dir_length()
327 property->value.dir, recurse, data_len); in tb_property_dir_length()
348 static ssize_t __tb_property_format_dir(const struct tb_property_dir *dir, in __tb_property_format_dir() argument
402 dir_len = tb_property_dir_length(dir, false, &data_len); in __tb_property_format_dir()
412 if (dir->uuid) { in __tb_property_format_dir()
416 memcpy(pe->uuid, dir->uuid, sizeof(pe->uuid)); in __tb_property_format_dir()
427 list_for_each_entry(property, &dir->properties, list) { in __tb_property_format_dir()
435 child = property->value.dir; in __tb_property_format_dir()
488 ssize_t tb_property_format_dir(const struct tb_property_dir *dir, u32 *block, in tb_property_format_dir() argument
496 dir_len = tb_property_dir_length(dir, true, &data_len); in tb_property_format_dir()
500 ret = __tb_property_format_dir(dir, block, 0, block_len); in tb_property_format_dir()
512 struct tb_property_dir *tb_property_copy_dir(const struct tb_property_dir *dir) in tb_property_copy_dir() argument
517 if (!dir) in tb_property_copy_dir()
520 d = tb_property_create_dir(dir->uuid); in tb_property_copy_dir()
524 list_for_each_entry(property, &dir->properties, list) { in tb_property_copy_dir()
535 p->value.dir = tb_property_copy_dir(property->value.dir); in tb_property_copy_dir()
536 if (!p->value.dir) in tb_property_copy_dir()
681 struct tb_property_dir *dir) in tb_property_add_dir() argument
692 property->value.dir = dir; in tb_property_add_dir()
722 struct tb_property *tb_property_find(struct tb_property_dir *dir, in tb_property_find() argument
727 list_for_each_entry(property, &dir->properties, list) { in tb_property_find()
741 struct tb_property *tb_property_get_next(struct tb_property_dir *dir, in tb_property_get_next() argument
745 if (list_is_last(&prev->list, &dir->properties)) in tb_property_get_next()
749 return list_first_entry_or_null(&dir->properties, struct tb_property, in tb_property_get_next()