db, uvol: commit regular files before uvol volumes
add priority to order fsdir commit sequencecute-signatures
parent
3a194ea5d7
commit
86d75e10f5
|
@ -13,6 +13,9 @@
|
|||
#include "apk_io.h"
|
||||
#include "apk_pathbuilder.h"
|
||||
|
||||
#define APK_FS_PRIO_DISK 0
|
||||
#define APK_FS_PRIO_UVOL 1
|
||||
|
||||
#define APK_FS_CTRL_COMMIT 1
|
||||
#define APK_FS_CTRL_APKNEW 2
|
||||
#define APK_FS_CTRL_CANCEL 3
|
||||
|
@ -30,6 +33,8 @@ struct apk_fsdir {
|
|||
};
|
||||
|
||||
struct apk_fsdir_ops {
|
||||
uint8_t priority;
|
||||
|
||||
int (*dir_create)(struct apk_fsdir *, mode_t);
|
||||
int (*dir_delete)(struct apk_fsdir *);
|
||||
int (*dir_check)(struct apk_fsdir *, mode_t, uid_t, gid_t);
|
||||
|
@ -47,6 +52,10 @@ int apk_fs_extract(struct apk_ctx *, const struct apk_file_info *, struct apk_is
|
|||
|
||||
void apk_fsdir_get(struct apk_fsdir *, apk_blob_t dir, struct apk_ctx *, apk_blob_t);
|
||||
|
||||
static inline uint8_t apk_fsdir_priority(struct apk_fsdir *fs) {
|
||||
return fs->ops->priority;
|
||||
}
|
||||
|
||||
static inline int apk_fsdir_create(struct apk_fsdir *fs, mode_t mode) {
|
||||
return fs->ops->dir_create(fs, mode);
|
||||
}
|
||||
|
|
|
@ -2801,9 +2801,9 @@ static void apk_db_purge_pkg(struct apk_database *db,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void apk_db_migrate_files(struct apk_database *db,
|
||||
struct apk_installed_package *ipkg)
|
||||
static uint8_t apk_db_migrate_files_for_priority(struct apk_database *db,
|
||||
struct apk_installed_package *ipkg,
|
||||
uint8_t priority)
|
||||
{
|
||||
struct apk_out *out = &db->ctx->out;
|
||||
struct apk_db_dir_instance *diri;
|
||||
|
@ -2816,13 +2816,20 @@ static void apk_db_migrate_files(struct apk_database *db,
|
|||
unsigned long hash;
|
||||
apk_blob_t dirname;
|
||||
int r, ctrl;
|
||||
uint8_t dir_priority, next_priority = 0xff;
|
||||
|
||||
hlist_for_each_entry_safe(diri, dc, dn, &ipkg->owned_dirs, pkg_dirs_list) {
|
||||
dir = diri->dir;
|
||||
dir->modified = 1;
|
||||
dirname = APK_BLOB_PTR_LEN(dir->name, dir->namelen);
|
||||
apk_fsdir_get(&d, dirname, db->ctx, apk_pkg_ctx(ipkg->pkg));
|
||||
dir_priority = apk_fsdir_priority(&d);
|
||||
if (dir_priority != priority) {
|
||||
if (dir_priority > priority && dir_priority < next_priority)
|
||||
next_priority = dir_priority;
|
||||
continue;
|
||||
}
|
||||
|
||||
dir->modified = 1;
|
||||
hlist_for_each_entry_safe(file, fc, fn, &diri->owned_files, diri_files_list) {
|
||||
key = (struct apk_db_file_hash_key) {
|
||||
.dirname = dirname,
|
||||
|
@ -2883,6 +2890,14 @@ static void apk_db_migrate_files(struct apk_database *db,
|
|||
}
|
||||
}
|
||||
}
|
||||
return next_priority;
|
||||
}
|
||||
|
||||
static void apk_db_migrate_files(struct apk_database *db,
|
||||
struct apk_installed_package *ipkg)
|
||||
{
|
||||
for (uint8_t prio = APK_FS_PRIO_DISK; prio != 0xff; )
|
||||
prio = apk_db_migrate_files_for_priority(db, ipkg, prio);
|
||||
}
|
||||
|
||||
static int apk_db_unpack_pkg(struct apk_database *db,
|
||||
|
|
|
@ -285,6 +285,7 @@ static int fsys_file_digest(struct apk_fsdir *d, apk_blob_t filename, uint8_t al
|
|||
}
|
||||
|
||||
static const struct apk_fsdir_ops fsdir_ops_fsys = {
|
||||
.priority = APK_FS_PRIO_DISK,
|
||||
.dir_create = fsys_dir_create,
|
||||
.dir_delete = fsys_dir_delete,
|
||||
.dir_check = fsys_dir_check,
|
||||
|
|
|
@ -156,6 +156,7 @@ static int uvol_file_digest(struct apk_fsdir *d, apk_blob_t filename, uint8_t al
|
|||
}
|
||||
|
||||
const struct apk_fsdir_ops fsdir_ops_uvol = {
|
||||
.priority = APK_FS_PRIO_UVOL,
|
||||
.dir_create = uvol_dir_create,
|
||||
.dir_delete = uvol_dir_delete,
|
||||
.dir_check = uvol_dir_check,
|
||||
|
|
Loading…
Reference in New Issue