Commit 85b3d86e authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

ghost: create ghost devices and directories in a specified ns

Here is a bug now. A path for devices and directories should be
generated with a specified root.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 967dba60
......@@ -73,8 +73,9 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, char *root,
int gfd, ghost_flags, ret = -1;
char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s", root, gf->remap.path);
if (S_ISFIFO(gfe->mode)) {
if (mknod(gf->remap.path, gfe->mode, 0)) {
if (mknod(path, gfe->mode, 0)) {
pr_perror("Can't create node for ghost file");
goto err;
}
......@@ -85,13 +86,13 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, char *root,
goto err;
}
if (mknod(gf->remap.path, gfe->mode, gfe->rdev)) {
if (mknod(path, gfe->mode, gfe->rdev)) {
pr_perror("Can't create node for ghost dev");
goto err;
}
ghost_flags = O_WRONLY;
} else if (S_ISDIR(gfe->mode)) {
if (mkdir(gf->remap.path, gfe->mode)) {
if (mkdir(path, gfe->mode)) {
pr_perror("Can't make ghost dir");
goto err;
}
......@@ -99,7 +100,6 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, char *root,
} else
ghost_flags = O_WRONLY | O_CREAT | O_EXCL;
snprintf(path, sizeof(path), "%s/%s", root, gf->remap.path);
gfd = open(path, ghost_flags, gfe->mode);
if (gfd < 0) {
pr_perror("Can't open ghost file %s", path);
......
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