int ret;
int subvol_fd = -1;
struct btrfs_ioctl_received_subvol_args rs_args;
- char uuid_str[128];
+ char uuid_str[BTRFS_UUID_UNPARSED_SIZE];
u64 flags;
if (r->cur_subvol == NULL)
int ret;
struct btrfs_receive *r = user;
struct btrfs_ioctl_vol_args args_v1;
- char uuid_str[128];
+ char uuid_str[BTRFS_UUID_UNPARSED_SIZE];
ret = finish_subvol(r);
if (ret < 0)
{
int ret;
struct btrfs_receive *r = user;
- char uuid_str[128];
+ char uuid_str[BTRFS_UUID_UNPARSED_SIZE];
struct btrfs_ioctl_vol_args_v2 args_v2;
struct subvol_info *parent_subvol = NULL;
parent_subvol = subvol_uuid_search(&r->sus, 0, parent_uuid,
parent_ctransid, NULL, subvol_search_by_received_uuid);
if (!parent_subvol) {
+ parent_subvol = subvol_uuid_search(&r->sus, 0, parent_uuid,
+ parent_ctransid, NULL, subvol_search_by_uuid);
+ }
+ if (!parent_subvol) {
ret = -ENOENT;
fprintf(stderr, "ERROR: could not find parent subvolume\n");
goto out;
O_RDONLY | O_NOATIME);
if (args_v2.fd < 0) {
ret = -errno;
- fprintf(stderr, "ERROR: open %s failed. %s\n",
- parent_subvol->path, strerror(-ret));
+ if (errno != ENOENT)
+ fprintf(stderr, "ERROR: open %s failed. %s\n",
+ parent_subvol->path, strerror(-ret));
+ else
+ fprintf(stderr,
+ "It seems that you have changed your default "
+ "subvolume or you specify other subvolume to\n"
+ "mount btrfs, try to remount this btrfs filesystem "
+ "with fs tree, and run btrfs receive again!\n");
goto out;
}
}
-struct btrfs_send_ops send_ops = {
+static struct btrfs_send_ops send_ops = {
.subvol = process_subvol,
.snapshot = process_snapshot,
.mkfile = process_mkfile,
.utimes = process_utimes,
};
-int do_receive(struct btrfs_receive *r, const char *tomnt, int r_fd)
+static int do_receive(struct btrfs_receive *r, const char *tomnt, int r_fd)
{
int ret;
char *dest_dir_full_path;
receive_fd = open(fromfile, O_RDONLY | O_NOATIME);
if (receive_fd < 0) {
fprintf(stderr, "ERROR: failed to open %s\n", fromfile);
- return -errno;
+ return 1;
}
}
ret = do_receive(&r, tomnt, receive_fd);
- return ret;
+ return !!ret;
}
const char * const cmd_receive_usage[] = {