Lines Matching full:ea

48  *   | Overall EA | First FEA Element | Second FEA Element | .....
55 * written directly. An EA list may be in-lined in the inode if there is
62 dxd_t new_ea; /* dxd to replace ea when modifying xattr */
63 struct metapage *mp; /* metapage containing ea list */
64 struct jfs_ea_list *xattr; /* buffer containing ea list */
95 static inline int name_size(struct jfs_ea *ea) in name_size() argument
97 if (is_known_namespace(ea->name)) in name_size()
98 return ea->namelen; in name_size()
100 return ea->namelen + XATTR_OS2_PREFIX_LEN; in name_size()
103 static inline int copy_name(char *buffer, struct jfs_ea *ea) in copy_name() argument
105 int len = ea->namelen; in copy_name()
107 if (!is_known_namespace(ea->name)) { in copy_name()
112 memcpy(buffer, ea->name, ea->namelen); in copy_name()
113 buffer[ea->namelen] = 0; in copy_name()
124 * FUNCTION: Attempt to write an EA inline if area is available
127 * Already verified that the specified EA is small enough to fit inline
131 * ealist - EA list pointer
133 * ea - dxd_t structure to be filled in with necessary EA information
134 * if we successfully copy the EA inline
137 * Checks if the inode's inline area is available. If so, copies EA inline
138 * and sets <ea> fields appropriately. Otherwise, returns failure, EA will
144 int size, dxd_t * ea) in ea_write_inline() argument
149 * Make sure we have an EA -- the NULL EA list is valid, but you in ea_write_inline()
157 * used for an inline EA. in ea_write_inline()
159 if (!(ji->mode2 & INLINEEA) && !(ji->ea.flag & DXD_INLINE)) in ea_write_inline()
162 DXDsize(ea, size); in ea_write_inline()
163 DXDlength(ea, 0); in ea_write_inline()
164 DXDaddress(ea, 0); in ea_write_inline()
166 ea->flag = DXD_INLINE; in ea_write_inline()
169 ea->flag = 0; in ea_write_inline()
170 DXDsize(ea, 0); in ea_write_inline()
171 DXDlength(ea, 0); in ea_write_inline()
172 DXDaddress(ea, 0); in ea_write_inline()
175 if (ji->ea.flag & DXD_INLINE) in ea_write_inline()
185 * FUNCTION: Write an EA for an inode
187 * PRE CONDITIONS: EA has been verified
191 * ealist - EA list pointer
193 * ea - dxd_t structure to be filled in appropriately with where the
194 * EA was copied
196 * NOTES: Will write EA inline if able to, otherwise allocates blocks for an
202 dxd_t * ea) in ea_write() argument
216 * Quick check to see if this is an in-linable EA. Short EAs in ea_write()
220 if (!ea_write_inline(ip, ealist, size, ea)) in ea_write()
287 ea->flag = DXD_EXTENT; in ea_write()
288 DXDsize(ea, le32_to_cpu(ealist->size)); in ea_write()
289 DXDlength(ea, nblocks); in ea_write()
290 DXDaddress(ea, blkno); in ea_write()
293 if (ji->ea.flag & DXD_INLINE) in ea_write()
309 * FUNCTION: Read an inlined EA into user's buffer
313 * ealist - Pointer to buffer to fill in with EA
320 int ea_size = sizeDXD(&ji->ea); in ea_read_inline()
328 if ((sizeDXD(&ji->ea) > sizeof (ji->i_inline_ea))) in ea_read_inline()
341 * FUNCTION: copy EA data into user's buffer
345 * ealist - Pointer to buffer to fill in with EA
347 * NOTES: If EA is inline calls ea_read_inline() to copy EA.
364 /* quick check for in-line EA */ in ea_read()
365 if (ji->ea.flag & DXD_INLINE) in ea_read()
368 nbytes = sizeDXD(&ji->ea); in ea_read()
375 * Figure out how many blocks were allocated when this EA list was in ea_read()
378 nblocks = lengthDXD(&ji->ea) << sbi->l2nbperpage; in ea_read()
379 blkno = addressDXD(&ji->ea) << sbi->l2nbperpage; in ea_read()
431 int ea_size = sizeDXD(&ji->ea); in ea_get()
439 /* When fsck.jfs clears a bad ea, it doesn't clear the size */ in ea_get()
440 if (ji->ea.flag == 0) in ea_get()
462 } else if (ji->ea.flag & DXD_INLINE) { in ea_get()
471 if (!(ji->ea.flag & DXD_EXTENT)) { in ea_get()
472 jfs_error(sb, "invalid ea.flag\n"); in ea_get()
549 ea_buf->mp = read_metapage(inode, addressDXD(&ji->ea), in ea_get()
550 lengthDXD(&ji->ea) << sb->s_blocksize_bits, in ea_get()
620 /* ->xattr must point to original ea's metapage */ in ea_put()
629 if (ji->ea.flag & DXD_EXTENT) { in ea_put()
630 invalidate_dxd_metapages(inode, ji->ea); in ea_put()
631 old_blocks = lengthDXD(&ji->ea); in ea_put()
635 txEA(tid, inode, &ji->ea, &ea_buf->new_ea); in ea_put()
638 if (ji->ea.flag & DXD_INLINE) in ea_put()
641 ji->ea = ea_buf->new_ea; in ea_put()
643 txEA(tid, inode, &ji->ea, NULL); in ea_put()
644 if (ji->ea.flag & DXD_INLINE) in ea_put()
646 ji->ea.flag = 0; in ea_put()
647 ji->ea.size = 0; in ea_put()
663 struct jfs_ea *ea, *old_ea = NULL, *next_ea = NULL; in __jfs_setxattr() local
686 for (ea = FIRST_EA(ealist); ea < END_EALIST(ealist); in __jfs_setxattr()
687 ea = NEXT_EA(ea)) { in __jfs_setxattr()
688 if ((namelen == ea->namelen) && in __jfs_setxattr()
689 (memcmp(name, ea->name, namelen) == 0)) { in __jfs_setxattr()
695 old_ea = ea; in __jfs_setxattr()
696 old_ea_size = EA_SIZE(ea); in __jfs_setxattr()
697 next_ea = NEXT_EA(ea); in __jfs_setxattr()
699 new_size += EA_SIZE(ea); in __jfs_setxattr()
718 * We need to allocate more space for merged ea list. in __jfs_setxattr()
730 /* Remove old ea of the same name */ in __jfs_setxattr()
732 /* number of bytes following target EA */ in __jfs_setxattr()
742 /* Completely new ea list */ in __jfs_setxattr()
746 * The size of EA value is limitted by on-disk format up to in __jfs_setxattr()
758 ea = (struct jfs_ea *) ((char *) ealist + xattr_size); in __jfs_setxattr()
759 ea->flag = 0; in __jfs_setxattr()
760 ea->namelen = namelen; in __jfs_setxattr()
761 ea->valuelen = (cpu_to_le16(value_len)); in __jfs_setxattr()
762 memcpy(ea->name, name, namelen); in __jfs_setxattr()
763 ea->name[namelen] = 0; in __jfs_setxattr()
765 memcpy(&ea->name[namelen + 1], value, value_len); in __jfs_setxattr()
766 xattr_size += EA_SIZE(ea); in __jfs_setxattr()
780 * If we're left with an empty list, there's no ea in __jfs_setxattr()
802 struct jfs_ea *ea, *ealist_end; in __jfs_getxattr() local
825 for (ea = FIRST_EA(ealist); ea < ealist_end; ea = NEXT_EA(ea)) { in __jfs_getxattr()
826 if (unlikely(ea + 1 > ealist_end) || in __jfs_getxattr()
827 unlikely(NEXT_EA(ea) > ealist_end)) { in __jfs_getxattr()
832 if ((namelen == ea->namelen) && in __jfs_getxattr()
833 memcmp(name, ea->name, namelen) == 0) { in __jfs_getxattr()
835 size = le16_to_cpu(ea->valuelen); in __jfs_getxattr()
842 value = ((char *) &ea->name) + ea->namelen + 1; in __jfs_getxattr()
860 static inline int can_list(struct jfs_ea *ea) in can_list() argument
862 return (strncmp(ea->name, XATTR_TRUSTED_PREFIX, in can_list()
874 struct jfs_ea *ea, *ealist_end; in jfs_listxattr() local
892 for (ea = FIRST_EA(ealist); ea < ealist_end; ea = NEXT_EA(ea)) { in jfs_listxattr()
893 if (unlikely(ea + 1 > ealist_end) || in jfs_listxattr()
894 unlikely(NEXT_EA(ea) > ealist_end)) { in jfs_listxattr()
899 if (can_list(ea)) in jfs_listxattr()
900 size += name_size(ea) + 1; in jfs_listxattr()
913 for (ea = FIRST_EA(ealist); ea < END_EALIST(ealist); ea = NEXT_EA(ea)) { in jfs_listxattr()
914 if (can_list(ea)) { in jfs_listxattr()
915 int namelen = copy_name(buffer, ea); in jfs_listxattr()