Commit dbb9d5eb authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

files-reg: Make try_clean_ghost() use struct ghost_file ptr

This cleanup will be used in next patch.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 78a0f8db
......@@ -432,17 +432,18 @@ int prepare_remaps(void)
return ret;
}
static void try_clean_ghost(struct remap_info *ri)
static void try_clean_ghost(struct ghost_file *gf)
{
char path[PATH_MAX];
int mnt_id, ret;
mnt_id = ri->rfi->rfe->mnt_id; /* rirfirfe %) */
mnt_id = gf->remap.rmnt_id;
ret = rst_get_mnt_root(mnt_id, path, sizeof(path));
if (ret < 0)
return;
ghost_path(path + ret, sizeof(path) - 1, ri->rfi, ri->rfe);
snprintf(path + ret, PATH_MAX - ret, "/%s", gf->remap.rpath);
if (!unlink(path)) {
pr_info(" `- X [%s] ghost\n", path);
return;
......@@ -455,7 +456,6 @@ static void try_clean_ghost(struct remap_info *ri)
*/
if ((errno == EISDIR)) {
strncpy(path + ret, ri->rfi->path, sizeof(path) - 1);
if (!rmdir(path)) {
pr_info(" `- Xd [%s] ghost\n", path);
return;
......@@ -467,7 +467,7 @@ static void try_clean_ghost(struct remap_info *ri)
void try_clean_remaps(int ns_fd)
{
struct remap_info *ri;
struct ghost_file *gf;
int old_ns = -1;
int cwd_fd = -1;
......@@ -497,9 +497,8 @@ void try_clean_remaps(int ns_fd)
}
}
list_for_each_entry(ri, &remaps, list)
if (ri->rfe->remap_type == REMAP_TYPE__GHOST)
try_clean_ghost(ri);
list_for_each_entry(gf, &ghost_files, list)
try_clean_ghost(gf);
if (old_ns >= 0) {
if (setns(old_ns, CLONE_NEWNS) < 0)
......
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