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

files-reg: Delete ghost file numeric index

Since ghost_files content is not available for parent
tasks, leave ghost_file names unchanged.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent f4202481
...@@ -170,8 +170,8 @@ err: ...@@ -170,8 +170,8 @@ err:
static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img) static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img)
{ {
int ret, len, root_len, try = 0;
char path[PATH_MAX]; char path[PATH_MAX];
int ret, root_len;
char *msg; char *msg;
root_len = ret = rst_get_mnt_root(gf->remap.rmnt_id, path, sizeof(path)); root_len = ret = rst_get_mnt_root(gf->remap.rmnt_id, path, sizeof(path));
...@@ -180,7 +180,7 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_im ...@@ -180,7 +180,7 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_im
goto err; goto err;
} }
len = snprintf(path + ret, sizeof(path) - ret, "/%s", gf->remap.rpath) + ret; snprintf(path + ret, sizeof(path) - ret, "/%s", gf->remap.rpath);
ret = -1; ret = -1;
again: again:
if (S_ISFIFO(gfe->mode)) { if (S_ISFIFO(gfe->mode)) {
...@@ -210,24 +210,13 @@ again: ...@@ -210,24 +210,13 @@ again:
pr_err("trim failed: @%s@\n", path); pr_err("trim failed: @%s@\n", path);
goto err; goto err;
} }
len = strlen(path);
goto again; goto again;
} }
/* Use numeric suffix, if a namesake already exists */
if (errno != EEXIST) {
pr_perror("%s", msg); pr_perror("%s", msg);
goto err; goto err;
} }
if (++try == INT_MAX) {
pr_err("Can't find available file name\n");
goto err;
}
sprintf(path + len, ".%x", try);
goto again;
}
strcpy(gf->remap.rpath, path + root_len + 1); strcpy(gf->remap.rpath, path + root_len + 1);
pr_debug("Remap rpath is %s\n", gf->remap.rpath); pr_debug("Remap rpath is %s\n", gf->remap.rpath);
......
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