summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2018-05-03 09:37:43 +0100
committerJoe Thornber <ejt@redhat.com>2018-05-03 09:37:43 +0100
commitdc30d4b2f2712568f4d7163c790c51655f047ed4 (patch)
tree0baf1d45eea617d7a75e93598fabeb1667dce812 /lib
parentefad84ebc297a652a2b88ced57128fc51edcf8ef (diff)
downloadlvm2-dc30d4b2f2712568f4d7163c790c51655f047ed4.tar.gz
bcache: switch off_t -> uint64_t
We always want it to be 64bit
Diffstat (limited to 'lib')
-rw-r--r--lib/device/bcache-utils.c24
-rw-r--r--lib/device/bcache.h8
2 files changed, 16 insertions, 16 deletions
diff --git a/lib/device/bcache-utils.c b/lib/device/bcache-utils.c
index c9a685c7d..3a256fcb7 100644
--- a/lib/device/bcache-utils.c
+++ b/lib/device/bcache-utils.c
@@ -21,7 +21,7 @@
//----------------------------------------------------------------
-static void byte_range_to_block_range(struct bcache *cache, off_t start, size_t len,
+static void byte_range_to_block_range(struct bcache *cache, uint64_t start, size_t len,
block_address *bb, block_address *be)
{
block_address block_size = bcache_block_sectors(cache) << SECTOR_SHIFT;
@@ -29,7 +29,7 @@ static void byte_range_to_block_range(struct bcache *cache, off_t start, size_t
*be = (start + len + block_size - 1) / block_size;
}
-void bcache_prefetch_bytes(struct bcache *cache, int fd, off_t start, size_t len)
+void bcache_prefetch_bytes(struct bcache *cache, int fd, uint64_t start, size_t len)
{
block_address bb, be;
@@ -40,7 +40,7 @@ void bcache_prefetch_bytes(struct bcache *cache, int fd, off_t start, size_t len
}
}
-static off_t _min(off_t lhs, off_t rhs)
+static uint64_t _min(uint64_t lhs, uint64_t rhs)
{
if (rhs < lhs)
return rhs;
@@ -51,12 +51,12 @@ static off_t _min(off_t lhs, off_t rhs)
// These functions are all utilities, they should only use the public
// interface to bcache.
// FIXME: there's common code that can be factored out of these 3
-bool bcache_read_bytes(struct bcache *cache, int fd, off_t start, size_t len, void *data)
+bool bcache_read_bytes(struct bcache *cache, int fd, uint64_t start, size_t len, void *data)
{
struct block *b;
block_address bb, be, i;
unsigned char *udata = data;
- off_t block_size = bcache_block_sectors(cache) << SECTOR_SHIFT;
+ uint64_t block_size = bcache_block_sectors(cache) << SECTOR_SHIFT;
int errors = 0;
byte_range_to_block_range(cache, start, len, &bb, &be);
@@ -70,7 +70,7 @@ bool bcache_read_bytes(struct bcache *cache, int fd, off_t start, size_t len, vo
}
if (i == bb) {
- off_t block_offset = start % block_size;
+ uint64_t block_offset = start % block_size;
size_t blen = _min(block_size - block_offset, len);
memcpy(udata, ((unsigned char *) b->data) + block_offset, blen);
len -= blen;
@@ -88,12 +88,12 @@ bool bcache_read_bytes(struct bcache *cache, int fd, off_t start, size_t len, vo
return errors ? false : true;
}
-bool bcache_write_bytes(struct bcache *cache, int fd, off_t start, size_t len, void *data)
+bool bcache_write_bytes(struct bcache *cache, int fd, uint64_t start, size_t len, void *data)
{
struct block *b;
block_address bb, be, i;
unsigned char *udata = data;
- off_t block_size = bcache_block_sectors(cache) << SECTOR_SHIFT;
+ uint64_t block_size = bcache_block_sectors(cache) << SECTOR_SHIFT;
int errors = 0;
byte_range_to_block_range(cache, start, len, &bb, &be);
@@ -107,7 +107,7 @@ bool bcache_write_bytes(struct bcache *cache, int fd, off_t start, size_t len, v
}
if (i == bb) {
- off_t block_offset = start % block_size;
+ uint64_t block_offset = start % block_size;
size_t blen = _min(block_size - block_offset, len);
memcpy(((unsigned char *) b->data) + block_offset, udata, blen);
len -= blen;
@@ -125,11 +125,11 @@ bool bcache_write_bytes(struct bcache *cache, int fd, off_t start, size_t len, v
return errors ? false : true;
}
-bool bcache_write_zeros(struct bcache *cache, int fd, off_t start, size_t len)
+bool bcache_write_zeros(struct bcache *cache, int fd, uint64_t start, size_t len)
{
struct block *b;
block_address bb, be, i;
- off_t block_size = bcache_block_sectors(cache) << SECTOR_SHIFT;
+ uint64_t block_size = bcache_block_sectors(cache) << SECTOR_SHIFT;
int errors = 0;
byte_range_to_block_range(cache, start, len, &bb, &be);
@@ -143,7 +143,7 @@ bool bcache_write_zeros(struct bcache *cache, int fd, off_t start, size_t len)
}
if (i == bb) {
- off_t block_offset = start % block_size;
+ uint64_t block_offset = start % block_size;
size_t blen = _min(block_size - block_offset, len);
memset(((unsigned char *) b->data) + block_offset, 0, blen);
len -= blen;
diff --git a/lib/device/bcache.h b/lib/device/bcache.h
index db41eebce..c6b6fb7e2 100644
--- a/lib/device/bcache.h
+++ b/lib/device/bcache.h
@@ -156,12 +156,12 @@ bool bcache_invalidate_fd(struct bcache *cache, int fd);
// The next four functions are utilities written in terms of the above api.
// Prefetches the blocks neccessary to satisfy a byte range.
-void bcache_prefetch_bytes(struct bcache *cache, int fd, off_t start, size_t len);
+void bcache_prefetch_bytes(struct bcache *cache, int fd, uint64_t start, size_t len);
// Reads, writes and zeroes bytes. Returns false if errors occur.
-bool bcache_read_bytes(struct bcache *cache, int fd, off_t start, size_t len, void *data);
-bool bcache_write_bytes(struct bcache *cache, int fd, off_t start, size_t len, void *data);
-bool bcache_write_zeros(struct bcache *cache, int fd, off_t start, size_t len);
+bool bcache_read_bytes(struct bcache *cache, int fd, uint64_t start, size_t len, void *data);
+bool bcache_write_bytes(struct bcache *cache, int fd, uint64_t start, size_t len, void *data);
+bool bcache_write_zeros(struct bcache *cache, int fd, uint64_t start, size_t len);
//----------------------------------------------------------------