mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-29 05:55:30 -04:00
[ext2fs] update to latest e2fsprogs
* e2fsprogs commit [cecc2bc78b39ddcd34a819a4d7e7cd30897958cb] * Also add LGPLv2 license text
This commit is contained in:
parent
cda716c1ff
commit
cec443ef61
36 changed files with 1721 additions and 597 deletions
|
@ -357,13 +357,13 @@ static const char *find_ea_prefix(int index)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int find_ea_index(const char *fullname, char **name, int *index)
|
||||
static int find_ea_index(const char *fullname, const char **name, int *index)
|
||||
{
|
||||
struct ea_name_index *e;
|
||||
|
||||
for (e = ea_names; e->name; e++) {
|
||||
if (strncmp(fullname, e->name, strlen(e->name)) == 0) {
|
||||
*name = (char *)fullname + strlen(e->name);
|
||||
*name = fullname + strlen(e->name);
|
||||
*index = e->index;
|
||||
return 1;
|
||||
}
|
||||
|
@ -525,8 +525,10 @@ posix_acl_xattr_count(size_t size)
|
|||
static errcode_t convert_posix_acl_to_disk_buffer(const void *value, size_t size,
|
||||
void *out_buf, size_t *size_out)
|
||||
{
|
||||
posix_acl_xattr_header *header = (posix_acl_xattr_header*) value;
|
||||
posix_acl_xattr_entry *entry = (posix_acl_xattr_entry *)(header+1), *end;
|
||||
const posix_acl_xattr_header *header =
|
||||
(const posix_acl_xattr_header*) value;
|
||||
const posix_acl_xattr_entry *end, *entry =
|
||||
(const posix_acl_xattr_entry *)(header+1);
|
||||
ext4_acl_header *ext_acl;
|
||||
size_t s;
|
||||
char *e;
|
||||
|
@ -574,12 +576,12 @@ static errcode_t convert_posix_acl_to_disk_buffer(const void *value, size_t size
|
|||
return 0;
|
||||
}
|
||||
|
||||
static errcode_t convert_disk_buffer_to_posix_acl(const char *value, size_t size,
|
||||
static errcode_t convert_disk_buffer_to_posix_acl(const void *value, size_t size,
|
||||
void **out_buf, size_t *size_out)
|
||||
{
|
||||
posix_acl_xattr_header *header;
|
||||
posix_acl_xattr_entry *entry;
|
||||
ext4_acl_header *ext_acl = (ext4_acl_header *) value;
|
||||
const ext4_acl_header *ext_acl = (const ext4_acl_header *) value;
|
||||
errcode_t err;
|
||||
const char *cp;
|
||||
char *out;
|
||||
|
@ -597,7 +599,7 @@ static errcode_t convert_disk_buffer_to_posix_acl(const char *value, size_t size
|
|||
header->a_version = ext2fs_cpu_to_le32(POSIX_ACL_XATTR_VERSION);
|
||||
entry = (posix_acl_xattr_entry *) (out + sizeof(posix_acl_xattr_header));
|
||||
|
||||
cp = value + sizeof(ext4_acl_header);
|
||||
cp = (const char *) value + sizeof(ext4_acl_header);
|
||||
size -= sizeof(ext4_acl_header);
|
||||
|
||||
while (size > 0) {
|
||||
|
@ -635,13 +637,13 @@ static errcode_t convert_disk_buffer_to_posix_acl(const char *value, size_t size
|
|||
|
||||
static errcode_t
|
||||
write_xattrs_to_buffer(ext2_filsys fs, struct ext2_xattr *attrs, int count,
|
||||
char *entries_start, unsigned int storage_size,
|
||||
void *entries_start, unsigned int storage_size,
|
||||
unsigned int value_offset_correction, int write_hash)
|
||||
{
|
||||
struct ext2_xattr *x;
|
||||
struct ext2_ext_attr_entry *e = (struct ext2_ext_attr_entry *) entries_start;
|
||||
char *end = entries_start + storage_size;
|
||||
char *shortname;
|
||||
struct ext2_ext_attr_entry *e = entries_start;
|
||||
char *end = (char *) entries_start + storage_size;
|
||||
const char *shortname;
|
||||
unsigned int value_size;
|
||||
int idx, ret;
|
||||
errcode_t err;
|
||||
|
@ -652,7 +654,6 @@ write_xattrs_to_buffer(ext2_filsys fs, struct ext2_xattr *attrs, int count,
|
|||
shortname = x->name;
|
||||
ret = find_ea_index(x->name, &shortname, &idx);
|
||||
|
||||
/* Calculate value size */
|
||||
value_size = ((x->value_len + EXT2_EXT_ATTR_PAD - 1) /
|
||||
EXT2_EXT_ATTR_PAD) * EXT2_EXT_ATTR_PAD;
|
||||
|
||||
|
@ -669,8 +670,8 @@ write_xattrs_to_buffer(ext2_filsys fs, struct ext2_xattr *attrs, int count,
|
|||
e->e_value_offs = 0;
|
||||
} else {
|
||||
end -= value_size;
|
||||
e->e_value_offs = end - entries_start +
|
||||
value_offset_correction;
|
||||
e->e_value_offs = end - (char *) entries_start +
|
||||
value_offset_correction;
|
||||
memcpy(end, x->value, e->e_value_size);
|
||||
}
|
||||
|
||||
|
@ -692,7 +693,7 @@ write_xattrs_to_buffer(ext2_filsys fs, struct ext2_xattr *attrs, int count,
|
|||
errcode_t ext2fs_xattrs_write(struct ext2_xattr_handle *handle)
|
||||
{
|
||||
ext2_filsys fs = handle->fs;
|
||||
const int inode_size = EXT2_INODE_SIZE(fs->super);
|
||||
const unsigned int inode_size = EXT2_INODE_SIZE(fs->super);
|
||||
struct ext2_inode_large *inode;
|
||||
char *start, *block_buf = NULL;
|
||||
struct ext2_ext_attr_header *header;
|
||||
|
@ -1359,7 +1360,7 @@ static int xattr_find_position(struct ext2_xattr *attrs, int count,
|
|||
{
|
||||
struct ext2_xattr *x;
|
||||
int i;
|
||||
char *shortname, *x_shortname;
|
||||
const char *shortname, *x_shortname;
|
||||
int name_idx, x_name_idx;
|
||||
int shortname_len, x_shortname_len;
|
||||
|
||||
|
@ -1395,7 +1396,7 @@ static errcode_t xattr_array_update(struct ext2_xattr_handle *h,
|
|||
int add_to_ibody;
|
||||
int needed;
|
||||
int name_len, name_idx;
|
||||
char *shortname;
|
||||
const char *shortname;
|
||||
int new_idx;
|
||||
int ret;
|
||||
|
||||
|
@ -1501,7 +1502,7 @@ static int space_used(struct ext2_xattr *attrs, int count)
|
|||
{
|
||||
int total = 0;
|
||||
struct ext2_xattr *x;
|
||||
char *shortname;
|
||||
const char *shortname;
|
||||
int i, len, name_idx;
|
||||
|
||||
for (i = 0, x = attrs; i < count; i++, x++) {
|
||||
|
@ -1594,7 +1595,8 @@ errcode_t ext2fs_xattr_set(struct ext2_xattr_handle *h,
|
|||
ret = EXT2_ET_FILESYSTEM_CORRUPTED;
|
||||
goto out;
|
||||
}
|
||||
ret = xattr_array_update(h, name, value, value_len, ibody_free,
|
||||
ret = xattr_array_update(h, name, new_value, value_len,
|
||||
ibody_free,
|
||||
0 /* block_free */, old_idx,
|
||||
0 /* in_inode */);
|
||||
if (ret)
|
||||
|
@ -1613,12 +1615,12 @@ errcode_t ext2fs_xattr_set(struct ext2_xattr_handle *h,
|
|||
value_len > EXT4_XATTR_MIN_LARGE_EA_SIZE(fs->blocksize))
|
||||
in_inode = 1;
|
||||
|
||||
ret = xattr_array_update(h, name, value, value_len, ibody_free,
|
||||
ret = xattr_array_update(h, name, new_value, value_len, ibody_free,
|
||||
block_free, old_idx, in_inode);
|
||||
if (ret == EXT2_ET_EA_NO_SPACE && !in_inode &&
|
||||
ext2fs_has_feature_ea_inode(fs->super))
|
||||
ret = xattr_array_update(h, name, value, value_len, ibody_free,
|
||||
block_free, old_idx, 1 /* in_inode */);
|
||||
ret = xattr_array_update(h, name, new_value, value_len,
|
||||
ibody_free, block_free, old_idx, 1 /* in_inode */);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue