Commit da6e455f authored by Timo Teräs's avatar Timo Teräs

rename file info related functions for consistency

parent be8e133c
......@@ -148,9 +148,9 @@ apk_blob_t apk_blob_from_file(int atfd, const char *file);
int apk_blob_to_file(int atfd, const char *file, apk_blob_t b, unsigned int flags);
#define APK_FI_NOFOLLOW 0x80000000
int apk_file_get_info(int atfd, const char *filename, unsigned int flags,
struct apk_file_info *fi);
void apk_file_info_free(struct apk_file_info *fi);
int apk_fileinfo_get(int atfd, const char *filename, unsigned int flags,
struct apk_file_info *fi);
void apk_fileinfo_free(struct apk_file_info *fi);
typedef int apk_dir_file_cb(void *ctx, int dirfd, const char *entry);
int apk_dir_foreach_file(int dirfd, apk_dir_file_cb cb, void *ctx);
......
......@@ -314,7 +314,7 @@ err:
EVP_MD_CTX_cleanup(&teis.mdctx);
free(pax.ptr);
free(longname.ptr);
apk_file_info_free(&entry);
apk_fileinfo_free(&entry);
return r;
err_nomem:
......@@ -480,7 +480,7 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
} else {
r = errno;
}
if (r < 0) {
if (r) {
apk_error("Failed to set xattrs on %s: %s",
fn, strerror(r));
return -r;
......
......@@ -99,7 +99,7 @@ static int audit_file(struct audit_ctx *actx,
dbf->audited = 1;
if (apk_file_get_info(dirfd, name, APK_FI_NOFOLLOW | dbf->csum.type, &fi) != 0)
if (apk_fileinfo_get(dirfd, name, APK_FI_NOFOLLOW | dbf->csum.type, &fi) != 0)
return -EPERM;
if (dbf->csum.type != APK_CHECKSUM_NONE &&
......@@ -175,7 +175,7 @@ static int audit_directory_tree_item(void *ctx, int dirfd, const char *name)
if (bdir.len + bent.len + 1 >= sizeof(atctx->path))
return -ENOMEM;
if (apk_file_get_info(dirfd, name, APK_FI_NOFOLLOW, &fi) < 0)
if (apk_fileinfo_get(dirfd, name, APK_FI_NOFOLLOW, &fi) < 0)
return -EPERM;
memcpy(&atctx->path[atctx->pathlen], bent.ptr, bent.len);
......
......@@ -2425,7 +2425,7 @@ static void apk_db_purge_pkg(struct apk_database *db,
if ((diri->dir->protect_mode == APK_PROTECT_NONE) ||
(apk_flags & APK_PURGE) ||
(file->csum.type != APK_CHECKSUM_NONE &&
apk_file_get_info(db->root_fd, name, APK_FI_NOFOLLOW | file->csum.type, &fi) == 0 &&
apk_fileinfo_get(db->root_fd, name, APK_FI_NOFOLLOW | file->csum.type, &fi) == 0 &&
apk_checksum_compare(&file->csum, &fi.csum) == 0))
unlinkat(db->root_fd, name, 0);
if (apk_verbosity >= 3)
......@@ -2483,7 +2483,7 @@ static void apk_db_migrate_files(struct apk_database *db,
cstype = ofile->csum.type;
cstype |= APK_FI_NOFOLLOW;
r = apk_file_get_info(db->root_fd, name, cstype, &fi);
r = apk_fileinfo_get(db->root_fd, name, cstype, &fi);
if (ofile && ofile->diri->pkg->name == NULL) {
/* File was from overlay, delete the
* packages version */
......@@ -2500,7 +2500,7 @@ static void apk_db_migrate_files(struct apk_database *db,
* existing file */
if (ofile == NULL ||
ofile->csum.type != file->csum.type)
apk_file_get_info(db->root_fd, name,
apk_fileinfo_get(db->root_fd, name,
APK_FI_NOFOLLOW | file->csum.type, &fi);
if ((apk_flags & APK_CLEAN_PROTECTED) ||
(file->csum.type != APK_CHECKSUM_NONE &&
......
......@@ -138,7 +138,7 @@ static int fetch_package(apk_hash_item item, void *pctx)
}
if (!(ctx->flags & FETCH_STDOUT)) {
if (apk_file_get_info(ctx->outdir_fd, filename, APK_CHECKSUM_NONE, &fi) == 0 &&
if (apk_fileinfo_get(ctx->outdir_fd, filename, APK_CHECKSUM_NONE, &fi) == 0 &&
fi.size == pkg->size)
return 0;
}
......
......@@ -81,7 +81,7 @@ static int index_read_file(struct apk_database *db, struct index_ctx *ictx)
if (ictx->index == NULL)
return 0;
if (apk_file_get_info(AT_FDCWD, ictx->index, APK_CHECKSUM_NONE, &fi) < 0)
if (apk_fileinfo_get(AT_FDCWD, ictx->index, APK_CHECKSUM_NONE, &fi) < 0)
return -EIO;
ictx->index_mtime = fi.mtime;
......@@ -133,7 +133,7 @@ static int index_main(void *ctx, struct apk_database *db, struct apk_string_arra
}
foreach_array_item(parg, args) {
if (apk_file_get_info(AT_FDCWD, *parg, APK_CHECKSUM_NONE, &fi) < 0) {
if (apk_fileinfo_get(AT_FDCWD, *parg, APK_CHECKSUM_NONE, &fi) < 0) {
apk_warning("File '%s' is unaccessible", *parg);
continue;
}
......
......@@ -529,8 +529,8 @@ int apk_blob_to_file(int atfd, const char *file, apk_blob_t b, unsigned int flag
return r;
}
int apk_file_get_info(int atfd, const char *filename, unsigned int flags,
struct apk_file_info *fi)
int apk_fileinfo_get(int atfd, const char *filename, unsigned int flags,
struct apk_file_info *fi)
{
struct stat64 st;
struct apk_bstream *bs;
......@@ -586,7 +586,7 @@ int apk_file_get_info(int atfd, const char *filename, unsigned int flags,
return 0;
}
void apk_file_info_free(struct apk_file_info *fi)
void apk_fileinfo_free(struct apk_file_info *fi)
{
apk_xattr_array_free(&fi->xattrs);
}
......
......@@ -892,7 +892,7 @@ int apk_pkg_read(struct apk_database *db, const char *file,
struct apk_istream *tar;
int r;
r = apk_file_get_info(AT_FDCWD, file, APK_CHECKSUM_NONE, &fi);
r = apk_fileinfo_get(AT_FDCWD, file, APK_CHECKSUM_NONE, &fi);
if (r != 0)
return r;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment