Skip to content

Commit

Permalink
Move data region size static assert check to vmm
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Chan <[email protected]>
  • Loading branch information
erichchan999 committed Oct 3, 2024
1 parent 6b1e39c commit 818dbca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 5 additions & 0 deletions examples/virtio/client_vmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ uintptr_t blk_storage_info;

static struct virtio_blk_device virtio_blk;

_Static_assert(BLK_DATA_REGION_SIZE_CLI0 >= BLK_TRANSFER_SIZE && BLK_DATA_REGION_SIZE_CLI0 % BLK_TRANSFER_SIZE == 0,
"Client0 data region size must be a multiple of the transfer size");
_Static_assert(BLK_DATA_REGION_SIZE_CLI1 >= BLK_TRANSFER_SIZE && BLK_DATA_REGION_SIZE_CLI1 % BLK_TRANSFER_SIZE == 0,
"Client1 data region size must be a multiple of the transfer size");

void init(void)
{
blk_storage_info_t *storage_info = (blk_storage_info_t *)blk_storage_info;
Expand Down
6 changes: 0 additions & 6 deletions src/virtio/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <sddf/blk/queue.h>
#include <sddf/util/fsmalloc.h>
#include <sddf/util/ialloc.h>
#include <blk_config.h>

/* Uncomment this to enable debug logging */
// #define DEBUG_BLOCK
Expand All @@ -29,11 +28,6 @@

#define LOG_BLOCK_ERR(...) do{ printf("VIRTIO(BLOCK)|ERROR: "); printf(__VA_ARGS__); }while(0)

_Static_assert(BLK_DATA_REGION_SIZE_CLI0 >= BLK_TRANSFER_SIZE && BLK_DATA_REGION_SIZE_CLI0 % BLK_TRANSFER_SIZE == 0,
"Client0 data region size must be a multiple of the transfer size");
_Static_assert(BLK_DATA_REGION_SIZE_CLI1 >= BLK_TRANSFER_SIZE && BLK_DATA_REGION_SIZE_CLI1 % BLK_TRANSFER_SIZE == 0,
"Client1 data region size must be a multiple of the transfer size");

static inline struct virtio_blk_device *device_state(struct virtio_device *dev)
{
return (struct virtio_blk_device *)dev->device_data;
Expand Down

0 comments on commit 818dbca

Please sign in to comment.