util: drop unused safezero argument

No caller was using the flags argument, and this function is internal
only, so we might as well skip it.

* src/util/util.h (safezero): Update signature.
* src/util/util.c (safezero): Update function.
* src/locking/lock_driver_sanlock.c
(virLockManagerSanlockSetupLockspace)
(virLockManagerSanlockCreateLease): Update all callers.
* src/storage/storage_backend.c (createRawFile): Likewise.
This commit is contained in:
Eric Blake 2011-07-06 16:32:10 -06:00
parent 7931639b7a
commit 17da0669e0
4 changed files with 8 additions and 8 deletions

View File

@ -196,7 +196,7 @@ static int virLockManagerSanlockSetupLockspace(void)
/* /*
* Pre allocate enough data for 1 block of leases at preferred alignment * Pre allocate enough data for 1 block of leases at preferred alignment
*/ */
if (safezero(fd, 0, 0, rv) < 0) { if (safezero(fd, 0, rv) < 0) {
virReportSystemError(errno, virReportSystemError(errno,
_("Unable to allocate lockspace %s"), _("Unable to allocate lockspace %s"),
path); path);
@ -567,7 +567,7 @@ static int virLockManagerSanlockCreateLease(struct sanlk_resource *res)
/* /*
* Pre allocate enough data for 1 block of leases at preferred alignment * Pre allocate enough data for 1 block of leases at preferred alignment
*/ */
if (safezero(fd, 0, 0, rv) < 0) { if (safezero(fd, 0, rv) < 0) {
virReportSystemError(errno, virReportSystemError(errno,
_("Unable to allocate lease %s"), _("Unable to allocate lease %s"),
res->disks[0].path); res->disks[0].path);

View File

@ -331,7 +331,7 @@ createRawFile(int fd, virStorageVolDefPtr vol,
if (bytes > remain) if (bytes > remain)
bytes = remain; bytes = remain;
if (safezero(fd, 0, vol->allocation - remain, bytes) < 0) { if (safezero(fd, vol->allocation - remain, bytes) < 0) {
ret = -errno; ret = -errno;
virReportSystemError(errno, _("cannot fill file '%s'"), virReportSystemError(errno, _("cannot fill file '%s'"),
vol->target.path); vol->target.path);
@ -340,7 +340,7 @@ createRawFile(int fd, virStorageVolDefPtr vol,
remain -= bytes; remain -= bytes;
} }
} else { /* No progress bars to be shown */ } else { /* No progress bars to be shown */
if (safezero(fd, 0, 0, remain) < 0) { if (safezero(fd, 0, remain) < 0) {
ret = -errno; ret = -errno;
virReportSystemError(errno, _("cannot fill file '%s'"), virReportSystemError(errno, _("cannot fill file '%s'"),
vol->target.path); vol->target.path);

View File

@ -133,7 +133,7 @@ safewrite(int fd, const void *buf, size_t count)
} }
#ifdef HAVE_POSIX_FALLOCATE #ifdef HAVE_POSIX_FALLOCATE
int safezero(int fd, int flags ATTRIBUTE_UNUSED, off_t offset, off_t len) int safezero(int fd, off_t offset, off_t len)
{ {
int ret = posix_fallocate(fd, offset, len); int ret = posix_fallocate(fd, offset, len);
if (ret == 0) if (ret == 0)
@ -144,7 +144,7 @@ int safezero(int fd, int flags ATTRIBUTE_UNUSED, off_t offset, off_t len)
#else #else
# ifdef HAVE_MMAP # ifdef HAVE_MMAP
int safezero(int fd, int flags ATTRIBUTE_UNUSED, off_t offset, off_t len) int safezero(int fd, off_t offset, off_t len)
{ {
int r; int r;
char *buf; char *buf;
@ -168,7 +168,7 @@ int safezero(int fd, int flags ATTRIBUTE_UNUSED, off_t offset, off_t len)
# else /* HAVE_MMAP */ # else /* HAVE_MMAP */
int safezero(int fd, int flags ATTRIBUTE_UNUSED, off_t offset, off_t len) int safezero(int fd, off_t offset, off_t len)
{ {
int r; int r;
char *buf; char *buf;

View File

@ -39,7 +39,7 @@
ssize_t saferead(int fd, void *buf, size_t count) ATTRIBUTE_RETURN_CHECK; ssize_t saferead(int fd, void *buf, size_t count) ATTRIBUTE_RETURN_CHECK;
ssize_t safewrite(int fd, const void *buf, size_t count) ssize_t safewrite(int fd, const void *buf, size_t count)
ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_RETURN_CHECK;
int safezero(int fd, int flags, off_t offset, off_t len) int safezero(int fd, off_t offset, off_t len)
ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_RETURN_CHECK;
int virSetBlocking(int fd, bool blocking) ATTRIBUTE_RETURN_CHECK; int virSetBlocking(int fd, bool blocking) ATTRIBUTE_RETURN_CHECK;