errcode_t magic;
ext2_filsys fs;
struct ext2_xattr *attrs;
- size_t length, count;
+ size_t capacity, count;
ext2_ino_t ino;
unsigned int flags;
int dirty;
struct ext2_xattr *new_attrs;
errcode_t err;
- err = ext2fs_get_arrayzero(h->length + expandby,
+ err = ext2fs_get_arrayzero(h->capacity + expandby,
sizeof(struct ext2_xattr), &new_attrs);
if (err)
return err;
- memcpy(new_attrs, h->attrs, h->length * sizeof(struct ext2_xattr));
+ memcpy(new_attrs, h->attrs, h->capacity * sizeof(struct ext2_xattr));
ext2fs_free_mem(&h->attrs);
- h->length += expandby;
+ h->capacity += expandby;
h->attrs = new_attrs;
return 0;
memset(entries_start, 0, storage_size);
/* For all remaining x... */
- for (; x < handle->attrs + handle->length; x++) {
+ for (; x < handle->attrs + handle->capacity; x++) {
if (!x->name)
continue;
* to the end.
*/
x = handle->attrs;
- qsort(x, handle->length, sizeof(struct ext2_xattr), attr_compare);
+ qsort(x, handle->capacity, sizeof(struct ext2_xattr), attr_compare);
/* Does the inode have space for EA? */
if (inode->i_extra_isize < sizeof(inode->i_extra_isize) ||
if (err)
goto out2;
- if (x < handle->attrs + handle->length) {
+ if (x < handle->attrs + handle->capacity) {
err = EXT2_ET_EA_NO_SPACE;
goto out2;
}
!EXT2_EXT_IS_LAST_ENTRY(entry)) {
/* Allocate space for more attrs? */
- if (x == handle->attrs + handle->length) {
+ if (x == handle->attrs + handle->capacity) {
err = ext2fs_xattrs_expand(handle, 4);
if (err)
return err;
- x = handle->attrs + handle->length - 4;
+ x = handle->attrs + handle->capacity - 4;
}
/* header eats this space */
struct ext2_xattr *a = h->attrs;
size_t i;
- for (i = 0; i < h->length; i++) {
+ for (i = 0; i < h->capacity; i++) {
if (a[i].name)
ext2fs_free_mem(&a[i].name);
if (a[i].value)
int ret;
EXT2_CHECK_MAGIC(h, EXT2_ET_MAGIC_EA_HANDLE);
- for (x = h->attrs; x < h->attrs + h->length; x++) {
+ for (x = h->attrs; x < h->attrs + h->capacity; x++) {
if (!x->name)
continue;
errcode_t err;
EXT2_CHECK_MAGIC(h, EXT2_ET_MAGIC_EA_HANDLE);
- for (x = h->attrs; x < h->attrs + h->length; x++) {
+ for (x = h->attrs; x < h->attrs + h->capacity; x++) {
if (!x->name || strcmp(x->name, key))
continue;
} else
memcpy(new_value, value, value_len);
- for (x = handle->attrs; x < handle->attrs + handle->length; x++) {
+ for (x = handle->attrs; x < handle->attrs + handle->capacity; x++) {
if (!x->name) {
last_empty = x;
continue;
if (err)
goto errout;
- x = handle->attrs + handle->length - 4;
+ x = handle->attrs + handle->capacity - 4;
err = ext2fs_get_mem(strlen(key) + 1, &x->name);
if (err)
goto errout;
struct ext2_xattr *x;
EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EA_HANDLE);
- for (x = handle->attrs; x < handle->attrs + handle->length; x++) {
+ for (x = handle->attrs; x < handle->attrs + handle->capacity; x++) {
if (!x->name)
continue;
return err;
h->magic = EXT2_ET_MAGIC_EA_HANDLE;
- h->length = 4;
- err = ext2fs_get_arrayzero(h->length, sizeof(struct ext2_xattr),
+ h->capacity = 4;
+ err = ext2fs_get_arrayzero(h->capacity, sizeof(struct ext2_xattr),
&h->attrs);
if (err) {
ext2fs_free_mem(&h);