
According to David Allan on 3/2/2010 3:13 PM:
+ ret = ftruncate(fd, st->st_size); + if (ret == -1) { + virReportSystemError(ret, + _("Failed to truncate volume with " + "path '%s' to %llu bytes: '%s'\n"), + vol->target.path, st->st_size,
off_t is not guaranteed to be the same as long long. You need a cast.
+ virStrerror(errno, errbuf, sizeof(errbuf))); + } + +out: + return ret; +} + + +static int +storageZeroExtent(virStorageVolDefPtr vol, + struct stat *st, + int fd, + size_t extent_start, + size_t extent_length, + char *writebuf, + size_t *bytes_zeroed)
Is size_t the right type for the extent, or do we want off_t?
+ size_t remaining, write_size; ... + if (written < 0) { + virReportSystemError(written, + _("Failed to write to storage volume with " + "path '%s': '%s' " + "(attempted to write %d bytes)"), + vol->target.path, + virStrerror(errno, errbuf, sizeof(errbuf)), + write_size);
%d and write_size are not compatible.
+ memset(&st, 0, sizeof(st)); + + if (fstat(fd, &st) == -1) {
The memset is wasted work. stat() is sufficient for initializing st. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org