diff options
author | marcel <marcel@FreeBSD.org> | 2015-08-03 01:24:48 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2015-08-03 01:24:48 +0000 |
commit | 58a2b7b1419a198457841311eb13965e25ea8306 (patch) | |
tree | de771007372d5dedd8353c0a4a067801ff18c66c /usr.bin/mkimg | |
parent | 4129b1a798113684d3d0077f9357ff8415ac6a9b (diff) | |
download | FreeBSD-src-58a2b7b1419a198457841311eb13965e25ea8306.zip FreeBSD-src-58a2b7b1419a198457841311eb13965e25ea8306.tar.gz |
Make image_copyout_zeroes() an interface function.
Diffstat (limited to 'usr.bin/mkimg')
-rw-r--r-- | usr.bin/mkimg/image.c | 12 | ||||
-rw-r--r-- | usr.bin/mkimg/image.h | 1 |
2 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/mkimg/image.c b/usr.bin/mkimg/image.c index be1c2e9..a3bec63 100644 --- a/usr.bin/mkimg/image.c +++ b/usr.bin/mkimg/image.c @@ -517,14 +517,14 @@ image_copyout_memory(int fd, size_t size, void *ptr) return (0); } -static int -image_copyout_zeroes(int fd, size_t size) +int +image_copyout_zeroes(int fd, size_t count) { static uint8_t *zeroes = NULL; size_t sz; int error; - if (lseek(fd, (off_t)size, SEEK_CUR) != -1) + if (lseek(fd, (off_t)count, SEEK_CUR) != -1) return (0); /* @@ -537,12 +537,12 @@ image_copyout_zeroes(int fd, size_t size) return (ENOMEM); } - while (size > 0) { - sz = (size > secsz) ? secsz : size; + while (count > 0) { + sz = (count > secsz) ? secsz : count; error = image_copyout_memory(fd, sz, zeroes); if (error) return (error); - size -= sz; + count -= sz; } return (0); } diff --git a/usr.bin/mkimg/image.h b/usr.bin/mkimg/image.h index ce195d9..0405c5b 100644 --- a/usr.bin/mkimg/image.h +++ b/usr.bin/mkimg/image.h @@ -35,6 +35,7 @@ int image_copyin(lba_t blk, int fd, uint64_t *sizep); int image_copyout(int fd); int image_copyout_done(int fd); int image_copyout_region(int fd, lba_t blk, lba_t size); +int image_copyout_zeroes(int fd, size_t count); int image_data(lba_t blk, lba_t size); lba_t image_get_size(void); int image_init(void); |