From c3f7371c5ea82549f865fbdea9d39e2d726042dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 11 Dec 2015 17:14:01 +0100 Subject: [PATCH] storage: drop 'Extent' from virStorageBackendWipeExtentLocal The only caller always passes 0 for the extent start. Drop the 'extent_start' parameter, as well as the mention of extents from the function name. Change off_t extent_length to unsigned long long wipe_len, as well as the 'remain' variable. --- src/storage/storage_backend.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 120d654bf7..530177f643 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1987,33 +1987,31 @@ virStorageBackendVolZeroSparseFileLocal(virStorageVolDefPtr vol, static int -virStorageBackendWipeExtentLocal(virStorageVolDefPtr vol, - int fd, - off_t extent_start, - off_t extent_length, - size_t writebuf_length, - size_t *bytes_wiped) +virStorageBackendWipeLocal(virStorageVolDefPtr vol, + int fd, + unsigned long long wipe_len, + size_t writebuf_length, + size_t *bytes_wiped) { int ret = -1, written = 0; - off_t remaining = 0; + unsigned long long remaining = 0; size_t write_size = 0; char *writebuf = NULL; - VIR_DEBUG("extent logical start: %ju len: %ju", - (uintmax_t)extent_start, (uintmax_t)extent_length); + VIR_DEBUG("wiping start: 0 len: %llu", wipe_len); if (VIR_ALLOC_N(writebuf, writebuf_length) < 0) goto cleanup; - if (lseek(fd, extent_start, SEEK_SET) < 0) { + if (lseek(fd, 0, SEEK_SET) < 0) { virReportSystemError(errno, - _("Failed to seek to position %ju in volume " + _("Failed to seek to the start in volume " "with path '%s'"), - (uintmax_t)extent_start, vol->target.path); + vol->target.path); goto cleanup; } - remaining = extent_length; + remaining = wipe_len; while (remaining > 0) { write_size = (writebuf_length < remaining) ? writebuf_length : remaining; @@ -2126,12 +2124,11 @@ virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED, if (S_ISREG(st.st_mode) && st.st_blocks < (st.st_size / DEV_BSIZE)) { ret = virStorageBackendVolZeroSparseFileLocal(vol, st.st_size, fd); } else { - ret = virStorageBackendWipeExtentLocal(vol, - fd, - 0, - vol->target.allocation, - st.st_blksize, - &bytes_wiped); + ret = virStorageBackendWipeLocal(vol, + fd, + vol->target.allocation, + st.st_blksize, + &bytes_wiped); } }