From: Christian Brauner Date: Sun, 16 Jul 2017 20:35:50 +0000 (+0200) Subject: btrfs: non-functional changes X-Git-Tag: lxc-2.1.0~32^2~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3324c2557e304a2d665db0ec78d570474afe5d10;p=thirdparty%2Flxc.git btrfs: non-functional changes Signed-off-by: Christian Brauner --- diff --git a/src/lxc/bdev/bdev.c b/src/lxc/bdev/bdev.c index e1c78141c..ef351b64b 100644 --- a/src/lxc/bdev/bdev.c +++ b/src/lxc/bdev/bdev.c @@ -322,16 +322,15 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, /* if the container name doesn't show up in the rootfs path, then * we don't know how to come up with a new name */ - if (strstr(src, oldname) == NULL) { - ERROR( - "original rootfs path %s doesn't include container name %s", - src, oldname); + if (!strstr(src, oldname)) { + ERROR("original rootfs path %s doesn't include container name %s", + src, oldname); return NULL; } orig = bdev_init(c0->lxc_conf, src, NULL, NULL); if (!orig) { - ERROR("failed to detect blockdev type for %s", src); + ERROR("Failed to detect storage driver for \"%s\"", src); return NULL; } @@ -343,14 +342,14 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, len = strlen(oldpath) + strlen(oldname) + strlen("/rootfs") + 2; orig->dest = malloc(len); if (!orig->dest) { - ERROR("out of memory"); + ERROR("Failed to allocate memory"); bdev_put(orig); return NULL; } ret = snprintf(orig->dest, len, "%s/%s/rootfs", oldpath, oldname); if (ret < 0 || (size_t)ret >= len) { - ERROR("rootfs path too long"); + ERROR("Failed to create string"); bdev_put(orig); return NULL; } @@ -358,14 +357,13 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, if (ret < 0 && errno == ENOENT) if (mkdir_p(orig->dest, 0755) < 0) - WARN("Error creating '%s', continuing.", + WARN("Failed to create directoy \"%s\"", orig->dest); } - /* - * special case for snapshot - if caller requested maybe_snapshot and - * keepbdevtype and backing store is directory, then proceed with a copy - * clone rather than returning error + /* Special case for snapshot. If the caller requested maybe_snapshot and + * keepbdevtype and the backing store is directory, then proceed with a + * a copy clone rather than returning error. */ if (maybe_snap && keepbdevtype && !bdevtype && !orig->ops->can_snapshot) snap = false; @@ -410,7 +408,7 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, if (new->ops->clone_paths(orig, new, oldname, cname, oldpath, lxcpath, snap, newsize, c0->lxc_conf) < 0) { - ERROR("failed getting pathnames for cloned storage: %s", src); + ERROR("Failed getting pathnames for clone of \"%s\"", src); goto err; } @@ -424,10 +422,9 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, if (snap) return new; - /* - * https://github.com/lxc/lxc/issues/131 + /* https://github.com/lxc/lxc/issues/131 * Use btrfs snapshot feature instead of rsync to restore if both orig - * and new are btrfs + * and new are btrfs. */ if (bdevtype && strcmp(orig->type, "btrfs") == 0 && strcmp(new->type, "btrfs") == 0 && @@ -435,12 +432,12 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, struct rsync_data_char arg; if (btrfs_destroy(new) < 0) { - ERROR("Error destroying %s subvolume", new->dest); + ERROR("Failed to destroy \"%s\" btrfs subvolume", new->dest); goto err; } if (mkdir_p(new->dest, 0755) < 0) { - ERROR("Error creating %s directory", new->dest); + ERROR("Failed to create directory \"%s\"", new->dest); goto err; } @@ -484,7 +481,7 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname, else ret = rsync_rootfs(&data); if (ret < 0) - ERROR("Failed to rsync"); + ERROR("Failed to rsync from"); exit(ret == 0 ? 0 : 1);