Lines Matching refs:dir
100 struct tb_property_dir *dir;
116 dir = __tb_property_parse_dir(block, block_len, entry->value,
118 if (!dir) {
122 property->value.dir = dir;
167 struct tb_property_dir *dir;
169 dir = kzalloc(sizeof(*dir), GFP_KERNEL);
170 if (!dir)
177 dir->uuid = kmemdup(&block[dir_offset], sizeof(*dir->uuid),
179 if (!dir->uuid) {
180 tb_property_free_dir(dir);
190 INIT_LIST_HEAD(&dir->properties);
197 tb_property_free_dir(dir);
201 list_add_tail(&property->list, &dir->properties);
204 return dir;
244 struct tb_property_dir *dir;
246 dir = kzalloc(sizeof(*dir), GFP_KERNEL);
247 if (!dir)
250 INIT_LIST_HEAD(&dir->properties);
252 dir->uuid = kmemdup(uuid, sizeof(*dir->uuid), GFP_KERNEL);
253 if (!dir->uuid) {
254 kfree(dir);
259 return dir;
267 tb_property_free_dir(property->value.dir);
287 * @dir: Directory to release
290 * descendants. It is OK to pass %NULL @dir, then the function does
293 void tb_property_free_dir(struct tb_property_dir *dir)
297 if (!dir)
300 list_for_each_entry_safe(property, tmp, &dir->properties, list) {
304 kfree(dir->uuid);
305 kfree(dir);
309 static size_t tb_property_dir_length(const struct tb_property_dir *dir,
315 if (dir->uuid)
316 len += sizeof(*dir->uuid) / 4;
320 list_for_each_entry(property, &dir->properties, list) {
327 property->value.dir, recurse, data_len);
348 static ssize_t __tb_property_format_dir(const struct tb_property_dir *dir,
402 dir_len = tb_property_dir_length(dir, false, &data_len);
412 if (dir->uuid) {
416 memcpy(pe->uuid, dir->uuid, sizeof(pe->uuid));
427 list_for_each_entry(property, &dir->properties, list) {
435 child = property->value.dir;
479 * @dir: Directory to format
488 ssize_t tb_property_format_dir(const struct tb_property_dir *dir, u32 *block,
496 dir_len = tb_property_dir_length(dir, true, &data_len);
500 ret = __tb_property_format_dir(dir, block, 0, block_len);
607 * @dir: Directory to add
610 struct tb_property_dir *dir)
621 property->value.dir = dir;
644 * @dir: Directory where the property is searched
651 struct tb_property *tb_property_find(struct tb_property_dir *dir,
656 list_for_each_entry(property, &dir->properties, list) {
667 * @dir: Directory holding properties
670 struct tb_property *tb_property_get_next(struct tb_property_dir *dir,
674 if (list_is_last(&prev->list, &dir->properties))
678 return list_first_entry_or_null(&dir->properties, struct tb_property,