diff options
Diffstat (limited to 'lib/io/src')
-rw-r--r-- | lib/io/src/unix/dir_iterator.c | 3 | ||||
-rw-r--r-- | lib/io/src/win32/dir_iterator.c | 3 | ||||
-rw-r--r-- | lib/io/src/xattr.c | 25 |
3 files changed, 31 insertions, 0 deletions
diff --git a/lib/io/src/unix/dir_iterator.c b/lib/io/src/unix/dir_iterator.c index fb7edae..7154ec9 100644 --- a/lib/io/src/unix/dir_iterator.c +++ b/lib/io/src/unix/dir_iterator.c @@ -118,6 +118,9 @@ static int dir_next(dir_iterator_t *base, dir_entry_t **out) decoded->gid = it->sb.st_gid; decoded->mode = it->sb.st_mode; + if (S_ISREG(it->sb.st_mode)) + decoded->size = it->sb.st_size; + if (decoded->dev != it->device) decoded->flags |= DIR_ENTRY_FLAG_MOUNT_POINT; diff --git a/lib/io/src/win32/dir_iterator.c b/lib/io/src/win32/dir_iterator.c index c9defc7..f504b65 100644 --- a/lib/io/src/win32/dir_iterator.c +++ b/lib/io/src/win32/dir_iterator.c @@ -91,6 +91,9 @@ static int dir_iterator_next(dir_iterator_t *it, dir_entry_t **out) ent->mode = S_IFDIR | 0755; } else { ent->mode = S_IFREG | 0644; + ent->size = w32->ent.nFileSizeHigh; + ent->size <<= 32UL; + ent->size |= w32->ent.nFileSizeLow; } ent->mtime = w32time_to_unix(&(w32->ent.ftLastWriteTime)); diff --git a/lib/io/src/xattr.c b/lib/io/src/xattr.c index dd9a338..85b7e53 100644 --- a/lib/io/src/xattr.c +++ b/lib/io/src/xattr.c @@ -28,6 +28,31 @@ dir_entry_xattr_t *dir_entry_xattr_create(const char *key, const sqfs_u8 *value, return out; } +dir_entry_xattr_t *dir_entry_xattr_list_copy(const dir_entry_xattr_t *list) +{ + dir_entry_xattr_t *new, *copy = NULL, *copy_last = NULL; + const dir_entry_xattr_t *it; + + for (it = list; it != NULL; it = it->next) { + new = dir_entry_xattr_create(it->key, it->value, + it->value_len); + if (new == NULL) { + dir_entry_xattr_list_free(copy); + return NULL; + } + + if (copy_last == NULL) { + copy = new; + copy_last = new; + } else { + copy_last->next = new; + copy_last = new; + } + } + + return copy; +} + void dir_entry_xattr_list_free(dir_entry_xattr_t *list) { dir_entry_xattr_t *old; |