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()
437 /* When fsck.jfs clears a bad ea, it doesn't clear the size */ in ea_get()
438 if (ji->ea.flag == 0) in ea_get()
460 } else if (ji->ea.flag & DXD_INLINE) { in ea_get()
469 if (!(ji->ea.flag & DXD_EXTENT)) { in ea_get()
470 jfs_error(sb, "invalid ea.flag\n"); in ea_get()
547 ea_buf->mp = read_metapage(inode, addressDXD(&ji->ea), in ea_get()
548 lengthDXD(&ji->ea) << sb->s_blocksize_bits, in ea_get()
616 /* ->xattr must point to original ea's metapage */ in ea_put()
625 if (ji->ea.flag & DXD_EXTENT) { in ea_put()
626 invalidate_dxd_metapages(inode, ji->ea); in ea_put()
627 old_blocks = lengthDXD(&ji->ea); in ea_put()
631 txEA(tid, inode, &ji->ea, &ea_buf->new_ea); in ea_put()
634 if (ji->ea.flag & DXD_INLINE) in ea_put()
637 ji->ea = ea_buf->new_ea; in ea_put()
639 txEA(tid, inode, &ji->ea, NULL); in ea_put()
640 if (ji->ea.flag & DXD_INLINE) in ea_put()
642 ji->ea.flag = 0; in ea_put()
643 ji->ea.size = 0; in ea_put()
659 struct jfs_ea *ea, *old_ea = NULL, *next_ea = NULL; in __jfs_setxattr() local
682 for (ea = FIRST_EA(ealist); ea < END_EALIST(ealist); in __jfs_setxattr()
683 ea = NEXT_EA(ea)) { in __jfs_setxattr()
684 if ((namelen == ea->namelen) && in __jfs_setxattr()
685 (memcmp(name, ea->name, namelen) == 0)) { in __jfs_setxattr()
691 old_ea = ea; in __jfs_setxattr()
692 old_ea_size = EA_SIZE(ea); in __jfs_setxattr()
693 next_ea = NEXT_EA(ea); in __jfs_setxattr()
695 new_size += EA_SIZE(ea); in __jfs_setxattr()
714 * We need to allocate more space for merged ea list. in __jfs_setxattr()
726 /* Remove old ea of the same name */ in __jfs_setxattr()
728 /* number of bytes following target EA */ in __jfs_setxattr()
738 /* Completely new ea list */ in __jfs_setxattr()
742 * The size of EA value is limitted by on-disk format up to in __jfs_setxattr()
754 ea = (struct jfs_ea *) ((char *) ealist + xattr_size); in __jfs_setxattr()
755 ea->flag = 0; in __jfs_setxattr()
756 ea->namelen = namelen; in __jfs_setxattr()
757 ea->valuelen = (cpu_to_le16(value_len)); in __jfs_setxattr()
758 memcpy(ea->name, name, namelen); in __jfs_setxattr()
759 ea->name[namelen] = 0; in __jfs_setxattr()
761 memcpy(&ea->name[namelen + 1], value, value_len); in __jfs_setxattr()
762 xattr_size += EA_SIZE(ea); in __jfs_setxattr()
776 * If we're left with an empty list, there's no ea in __jfs_setxattr()
798 struct jfs_ea *ea; in __jfs_getxattr() local
820 for (ea = FIRST_EA(ealist); ea < END_EALIST(ealist); ea = NEXT_EA(ea)) in __jfs_getxattr()
821 if ((namelen == ea->namelen) && in __jfs_getxattr()
822 memcmp(name, ea->name, namelen) == 0) { in __jfs_getxattr()
824 size = le16_to_cpu(ea->valuelen); in __jfs_getxattr()
831 value = ((char *) &ea->name) + ea->namelen + 1; in __jfs_getxattr()
848 static inline int can_list(struct jfs_ea *ea) in can_list() argument
850 return (strncmp(ea->name, XATTR_TRUSTED_PREFIX, in can_list()
862 struct jfs_ea *ea; in jfs_listxattr() local
879 for (ea = FIRST_EA(ealist); ea < END_EALIST(ealist); ea = NEXT_EA(ea)) { in jfs_listxattr()
880 if (can_list(ea)) in jfs_listxattr()
881 size += name_size(ea) + 1; in jfs_listxattr()
894 for (ea = FIRST_EA(ealist); ea < END_EALIST(ealist); ea = NEXT_EA(ea)) { in jfs_listxattr()
895 if (can_list(ea)) { in jfs_listxattr()
896 int namelen = copy_name(buffer, ea); in jfs_listxattr()