mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virStorageBackendCopyToFD: remove unused return variable
None of the callers care about errno really. The errno will be reported by virReportSystemError(). Signed-off-by: Yi Li <yili@winhong.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
dbc643d598
commit
b3667052de
@ -128,7 +128,6 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
|
|||||||
bool reflink_copy)
|
bool reflink_copy)
|
||||||
{
|
{
|
||||||
int amtread = -1;
|
int amtread = -1;
|
||||||
int ret = 0;
|
|
||||||
size_t rbytes = READ_BLOCK_SIZE_DEFAULT;
|
size_t rbytes = READ_BLOCK_SIZE_DEFAULT;
|
||||||
int wbytes = 0;
|
int wbytes = 0;
|
||||||
int interval;
|
int interval;
|
||||||
@ -138,11 +137,10 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
|
|||||||
VIR_AUTOCLOSE inputfd = -1;
|
VIR_AUTOCLOSE inputfd = -1;
|
||||||
|
|
||||||
if ((inputfd = open(inputvol->target.path, O_RDONLY)) < 0) {
|
if ((inputfd = open(inputvol->target.path, O_RDONLY)) < 0) {
|
||||||
ret = -errno;
|
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("could not open input path '%s'"),
|
_("could not open input path '%s'"),
|
||||||
inputvol->target.path);
|
inputvol->target.path);
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
@ -160,11 +158,10 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
|
|||||||
|
|
||||||
if (reflink_copy) {
|
if (reflink_copy) {
|
||||||
if (reflinkCloneFile(fd, inputfd) < 0) {
|
if (reflinkCloneFile(fd, inputfd) < 0) {
|
||||||
ret = -errno;
|
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("failed to clone files from '%s'"),
|
_("failed to clone files from '%s'"),
|
||||||
inputvol->target.path);
|
inputvol->target.path);
|
||||||
return ret;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
VIR_DEBUG("btrfs clone finished.");
|
VIR_DEBUG("btrfs clone finished.");
|
||||||
return 0;
|
return 0;
|
||||||
@ -178,11 +175,10 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
|
|||||||
rbytes = *total;
|
rbytes = *total;
|
||||||
|
|
||||||
if ((amtread = saferead(inputfd, buf, rbytes)) < 0) {
|
if ((amtread = saferead(inputfd, buf, rbytes)) < 0) {
|
||||||
ret = -errno;
|
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("failed reading from file '%s'"),
|
_("failed reading from file '%s'"),
|
||||||
inputvol->target.path);
|
inputvol->target.path);
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
*total -= amtread;
|
*total -= amtread;
|
||||||
|
|
||||||
@ -195,36 +191,32 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
|
|||||||
|
|
||||||
if (want_sparse && memcmp(buf+offset, zerobuf, interval) == 0) {
|
if (want_sparse && memcmp(buf+offset, zerobuf, interval) == 0) {
|
||||||
if (lseek(fd, interval, SEEK_CUR) < 0) {
|
if (lseek(fd, interval, SEEK_CUR) < 0) {
|
||||||
ret = -errno;
|
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot extend file '%s'"),
|
_("cannot extend file '%s'"),
|
||||||
vol->target.path);
|
vol->target.path);
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (safewrite(fd, buf+offset, interval) < 0) {
|
} else if (safewrite(fd, buf+offset, interval) < 0) {
|
||||||
ret = -errno;
|
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("failed writing to file '%s'"),
|
_("failed writing to file '%s'"),
|
||||||
vol->target.path);
|
vol->target.path);
|
||||||
return ret;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
} while ((amtleft -= interval) > 0);
|
} while ((amtleft -= interval) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virFileDataSync(fd) < 0) {
|
if (virFileDataSync(fd) < 0) {
|
||||||
ret = -errno;
|
|
||||||
virReportSystemError(errno, _("cannot sync data to file '%s'"),
|
virReportSystemError(errno, _("cannot sync data to file '%s'"),
|
||||||
vol->target.path);
|
vol->target.path);
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_CLOSE(inputfd) < 0) {
|
if (VIR_CLOSE(inputfd) < 0) {
|
||||||
ret = -errno;
|
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot close file '%s'"),
|
_("cannot close file '%s'"),
|
||||||
inputvol->target.path);
|
inputvol->target.path);
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user