Lines Matching refs:item
35 struct xattr_item *item; member
86 static unsigned int put_xattritem(struct xattr_item *item) in put_xattritem() argument
88 if (item->count > 1) in put_xattritem()
89 return --item->count; in put_xattritem()
90 free(item); in put_xattritem()
97 struct xattr_item *item; in get_xattritem() local
102 hash_for_each_possible(ea_hashtable, item, node, hkey) { in get_xattritem()
103 if (prefix == item->prefix && in get_xattritem()
104 item->len[0] == len[0] && item->len[1] == len[1] && in get_xattritem()
105 item->hash[0] == hash[0] && item->hash[1] == hash[1] && in get_xattritem()
106 !memcmp(kvbuf, item->kvbuf, len[0] + len[1])) { in get_xattritem()
108 ++item->count; in get_xattritem()
109 return item; in get_xattritem()
113 item = malloc(sizeof(*item)); in get_xattritem()
114 if (!item) { in get_xattritem()
118 INIT_HLIST_NODE(&item->node); in get_xattritem()
119 item->count = 1; in get_xattritem()
120 item->kvbuf = kvbuf; in get_xattritem()
121 item->len[0] = len[0]; in get_xattritem()
122 item->len[1] = len[1]; in get_xattritem()
123 item->hash[0] = hash[0]; in get_xattritem()
124 item->hash[1] = hash[1]; in get_xattritem()
125 item->shared_xattr_id = -1; in get_xattritem()
126 item->prefix = prefix; in get_xattritem()
127 hash_add(ea_hashtable, &item->node, hkey); in get_xattritem()
128 return item; in get_xattritem()
239 static int inode_xattr_add(struct list_head *hlist, struct xattr_item *item) in inode_xattr_add() argument
246 node->item = item; in inode_xattr_add()
251 static int shared_xattr_add(struct xattr_item *item) in shared_xattr_add() argument
259 node->item = item; in shared_xattr_add()
264 item->len[0] + item->len[1]); in shared_xattr_add()
268 static int erofs_xattr_add(struct list_head *ixattrs, struct xattr_item *item) in erofs_xattr_add() argument
271 return inode_xattr_add(ixattrs, item); in erofs_xattr_add()
273 if (item->count == cfg.c_inline_xattr_tolerance + 1) { in erofs_xattr_add()
274 int ret = shared_xattr_add(item); in erofs_xattr_add()
299 struct xattr_item *item; in read_xattrs_from_file() local
336 item = parse_one_xattr(path, key, keylen); in read_xattrs_from_file()
337 if (IS_ERR(item)) { in read_xattrs_from_file()
338 ret = PTR_ERR(item); in read_xattrs_from_file()
342 ret = erofs_xattr_add(ixattrs, item); in read_xattrs_from_file()
350 item = erofs_get_selabel_xattr(path, mode); in read_xattrs_from_file()
351 if (IS_ERR(item)) in read_xattrs_from_file()
352 return PTR_ERR(item); in read_xattrs_from_file()
353 if (item) in read_xattrs_from_file()
354 ret = erofs_xattr_add(ixattrs, item); in read_xattrs_from_file()
369 struct xattr_item *item; in erofs_droid_xattr_set_caps() local
389 item = get_xattritem(EROFS_XATTR_INDEX_SECURITY, kvbuf, len); in erofs_droid_xattr_set_caps()
390 if (IS_ERR(item)) in erofs_droid_xattr_set_caps()
391 return PTR_ERR(item); in erofs_droid_xattr_set_caps()
392 if (!item) in erofs_droid_xattr_set_caps()
395 return erofs_xattr_add(&inode->i_xattrs, item); in erofs_droid_xattr_set_caps()
428 const struct xattr_item *item = node->item; in erofs_prepare_xattr_ibody() local
430 if (item->shared_xattr_id >= 0) { in erofs_prepare_xattr_ibody()
435 ret = EROFS_XATTR_ALIGN(ret + item->len[0] + item->len[1]); in erofs_prepare_xattr_ibody()
509 struct xattr_item *item; in erofs_cleanxattrs() local
512 hash_for_each_safe(ea_hashtable, i, tmp, item, node) { in erofs_cleanxattrs()
513 if (sharedxattrs && item->shared_xattr_id >= 0) in erofs_cleanxattrs()
516 hash_del(&item->node); in erofs_cleanxattrs()
517 free(item); in erofs_cleanxattrs()
586 struct xattr_item *const item = node->item; in erofs_build_shared_xattrs_from_path() local
588 .e_name_index = item->prefix, in erofs_build_shared_xattrs_from_path()
589 .e_name_len = item->len[0], in erofs_build_shared_xattrs_from_path()
590 .e_value_size = cpu_to_le16(item->len[1]) in erofs_build_shared_xattrs_from_path()
595 item->shared_xattr_id = (off + p) / in erofs_build_shared_xattrs_from_path()
600 memcpy(buf + p, item->kvbuf, item->len[0] + item->len[1]); in erofs_build_shared_xattrs_from_path()
601 p = EROFS_XATTR_ALIGN(p + item->len[0] + item->len[1]); in erofs_build_shared_xattrs_from_path()
627 struct xattr_item *const item = node->item; in erofs_export_xattr_ibody() local
632 if (item->shared_xattr_id < 0) { in erofs_export_xattr_ibody()
637 *(__le32 *)(buf + p) = cpu_to_le32(item->shared_xattr_id); in erofs_export_xattr_ibody()
641 put_xattritem(item); in erofs_export_xattr_ibody()
645 struct xattr_item *const item = node->item; in erofs_export_xattr_ibody() local
647 .e_name_index = item->prefix, in erofs_export_xattr_ibody()
648 .e_name_len = item->len[0], in erofs_export_xattr_ibody()
649 .e_value_size = cpu_to_le16(item->len[1]) in erofs_export_xattr_ibody()
654 memcpy(buf + p, item->kvbuf, item->len[0] + item->len[1]); in erofs_export_xattr_ibody()
655 p = EROFS_XATTR_ALIGN(p + item->len[0] + item->len[1]); in erofs_export_xattr_ibody()
659 put_xattritem(item); in erofs_export_xattr_ibody()