aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-receive.c
diff options
context:
space:
mode:
authorStefan Behrens <sbehrens@giantdisaster.de>2013-04-09 19:08:38 +0200
committerDavid Sterba <dsterba@suse.cz>2013-04-23 18:56:24 +0200
commitfea32e39836831fa8ea4349d166c3480ba09be06 (patch)
tree40ab9d7d73c981d2db72bc6a7cb19a3f7b45e393 /cmds-receive.c
parentadf67ff7613e51dfa331f73a15a3e98f8e354b70 (diff)
downloadbtrfs-progs-fea32e39836831fa8ea4349d166c3480ba09be06.tar.gz
btrfs-progs-fea32e39836831fa8ea4349d166c3480ba09be06.tar.xz
btrfs-progs-fea32e39836831fa8ea4349d166c3480ba09be06.zip
Btrfs-progs: small parent_subvol cleanup for cmds-receive.c
parent_subvol is local to process_snapshot() and not needed outside. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Diffstat (limited to 'cmds-receive.c')
-rw-r--r--cmds-receive.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/cmds-receive.c b/cmds-receive.c
index 763caba..9795276 100644
--- a/cmds-receive.c
+++ b/cmds-receive.c
@@ -64,7 +64,6 @@ struct btrfs_receive
char *full_subvol_path;
struct subvol_info *cur_subvol;
- struct subvol_info *parent_subvol;
struct subvol_uuid_search sus;
};
@@ -152,7 +151,6 @@ static int process_subvol(const char *path, const u8 *uuid, u64 ctransid,
goto out;
r->cur_subvol = calloc(1, sizeof(*r->cur_subvol));
- r->parent_subvol = NULL;
r->cur_subvol->path = strdup(path);
free(r->full_subvol_path);
@@ -192,13 +190,13 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
struct btrfs_receive *r = user;
char uuid_str[128];
struct btrfs_ioctl_vol_args_v2 args_v2;
+ struct subvol_info *parent_subvol;
ret = finish_subvol(r);
if (ret < 0)
goto out;
r->cur_subvol = calloc(1, sizeof(*r->cur_subvol));
- r->parent_subvol = NULL;
r->cur_subvol->path = strdup(path);
free(r->full_subvol_path);
@@ -222,9 +220,9 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
memset(&args_v2, 0, sizeof(args_v2));
strncpy_null(args_v2.name, path);
- r->parent_subvol = subvol_uuid_search(&r->sus, 0, parent_uuid,
+ parent_subvol = subvol_uuid_search(&r->sus, 0, parent_uuid,
parent_ctransid, NULL, subvol_search_by_received_uuid);
- if (!r->parent_subvol) {
+ if (!parent_subvol) {
ret = -ENOENT;
fprintf(stderr, "ERROR: could not find parent subvolume\n");
goto out;
@@ -240,12 +238,12 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
}
}*/
- args_v2.fd = openat(r->mnt_fd, r->parent_subvol->path,
+ args_v2.fd = openat(r->mnt_fd, parent_subvol->path,
O_RDONLY | O_NOATIME);
if (args_v2.fd < 0) {
ret = -errno;
fprintf(stderr, "ERROR: open %s failed. %s\n",
- r->parent_subvol->path, strerror(-ret));
+ parent_subvol->path, strerror(-ret));
goto out;
}
@@ -254,7 +252,7 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
if (ret < 0) {
ret = -errno;
fprintf(stderr, "ERROR: creating snapshot %s -> %s "
- "failed. %s\n", r->parent_subvol->path,
+ "failed. %s\n", parent_subvol->path,
path, strerror(-ret));
goto out;
}