[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UNIKRAFT PATCH v2 6/7] lib/ukblkdev: Provide `uk_blkdev_size()`



Hi Simon,

Looks good to me.

Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@xxxxxxxxx>

On Tue, Dec 22, 2020 at 5:38 PM Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:
This commits provides a shortcut macro for retrieving the block device size in
number of bytes.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/ukblkdev/include/uk/blkdev.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/ukblkdev/include/uk/blkdev.h b/lib/ukblkdev/include/uk/blkdev.h
index 56b95c88c..1861bb3b7 100644
--- a/lib/ukblkdev/include/uk/blkdev.h
+++ b/lib/ukblkdev/include/uk/blkdev.h
@@ -255,6 +255,9 @@ static inline const struct uk_blkdev_cap *uk_blkdev_capabilities(
 #define uk_blkdev_sectors(blkdev) \
        (uk_blkdev_capabilities(blkdev)->sectors)

+#define uk_blkdev_size(blkdev) \
+       ((size_t) uk_blkdev_sectors(blkdev) * uk_blkdev_ssize(blkdev))
+
 #define uk_blkdev_ioalign(blkdev) \
        (uk_blkdev_capabilities(blkdev)->ioalign)
 /**
--
2.20.1

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.