From 9dcf4400a14afec086b4716a2b271b25b7f342e5 Mon Sep 17 00:00:00 2001 From: Ivan Velickovic Date: Mon, 22 Jul 2024 10:24:48 +1000 Subject: [PATCH] Fix style for virtio/block.c and uio_tools/blk.c Signed-off-by: Ivan Velickovic --- .../include/serial_config/serial_config.h | 2 +- examples/virtio/include/serial_config.h | 2 +- src/virtio/block.c | 38 ++++++++++--------- tools/linux/uio_drivers/blk/blk.c | 4 +- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/examples/virtio-snd/include/serial_config/serial_config.h b/examples/virtio-snd/include/serial_config/serial_config.h index 04e9dee7..380f87b9 100644 --- a/examples/virtio-snd/include/serial_config/serial_config.h +++ b/examples/virtio-snd/include/serial_config/serial_config.h @@ -75,7 +75,7 @@ static inline void serial_virt_queue_init_sys(char *pd_name, serial_queue_handle serial_queue_init(&cli_queue_handle[1], (serial_queue_t *)(cli_queue_ptr + SERIAL_QUEUE_SIZE), SERIAL_RX_DATA_REGION_SIZE_CLI1, (char *)(cli_data + SERIAL_RX_DATA_REGION_SIZE_CLI0)); serial_queue_init(&cli_queue_handle[2], (serial_queue_t *)(cli_queue_ptr + 2 * SERIAL_QUEUE_SIZE), - SERIAL_RX_DATA_REGION_SIZE_CLI2, + SERIAL_RX_DATA_REGION_SIZE_CLI2, (char *)(cli_data + SERIAL_RX_DATA_REGION_SIZE_CLI0 + SERIAL_RX_DATA_REGION_SIZE_CLI1)); } else if (!sddf_strcmp(pd_name, SERIAL_VIRT_TX_NAME)) { serial_queue_init(cli_queue_handle, cli_queue, SERIAL_TX_DATA_REGION_SIZE_CLI0, cli_data); diff --git a/examples/virtio/include/serial_config.h b/examples/virtio/include/serial_config.h index 83664bba..d3e4b5bb 100644 --- a/examples/virtio/include/serial_config.h +++ b/examples/virtio/include/serial_config.h @@ -78,7 +78,7 @@ static inline void serial_virt_queue_init_sys(char *pd_name, serial_queue_handle serial_queue_init(&cli_queue_handle[1], (serial_queue_t *)(cli_queue_ptr + SERIAL_QUEUE_SIZE), SERIAL_RX_DATA_REGION_SIZE_CLI1, (char *)(cli_data + SERIAL_RX_DATA_REGION_SIZE_CLI0)); serial_queue_init(&cli_queue_handle[2], (serial_queue_t *)(cli_queue_ptr + 2 * SERIAL_QUEUE_SIZE), - SERIAL_RX_DATA_REGION_SIZE_CLI2, + SERIAL_RX_DATA_REGION_SIZE_CLI2, (char *)(cli_data + SERIAL_RX_DATA_REGION_SIZE_CLI0 + SERIAL_RX_DATA_REGION_SIZE_CLI1)); } else if (!sddf_strcmp(pd_name, SERIAL_VIRT_TX_NAME)) { serial_queue_init(cli_queue_handle, cli_queue, SERIAL_TX_DATA_REGION_SIZE_CLI0, cli_data); diff --git a/src/virtio/block.c b/src/virtio/block.c index f961d749..3d612111 100644 --- a/src/virtio/block.c +++ b/src/virtio/block.c @@ -241,9 +241,9 @@ static int virtio_blk_mmio_queue_notify(struct virtio_device *dev) /* Book keep the request */ uint32_t req_id; ialloc_alloc(&state->ialloc, &req_id); - state->reqbk[req_id] = (reqbk_t){ + state->reqbk[req_id] = (reqbk_t) { desc_head, sddf_data, sddf_count, sddf_block_number, - virtio_data, virtio_data_size, 0 + virtio_data, virtio_data_size, 0 }; uintptr_t offset = sddf_data - ((struct virtio_blk_device *)dev->device_data)->data_region; @@ -287,9 +287,9 @@ static int virtio_blk_mmio_queue_notify(struct virtio_device *dev) /* Book keep the request */ uint32_t req_id; ialloc_alloc(&state->ialloc, &req_id); - state->reqbk[req_id] = (reqbk_t){ + state->reqbk[req_id] = (reqbk_t) { desc_head, sddf_data, sddf_count, sddf_block_number, - virtio_data, virtio_data_size, aligned + virtio_data, virtio_data_size, aligned }; uintptr_t offset = sddf_data - ((struct virtio_blk_device *)dev->device_data)->data_region; @@ -313,9 +313,9 @@ static int virtio_blk_mmio_queue_notify(struct virtio_device *dev) /* Book keep the request */ uint32_t req_id; ialloc_alloc(&state->ialloc, &req_id); - state->reqbk[req_id] = (reqbk_t){ + state->reqbk[req_id] = (reqbk_t) { desc_head, sddf_data, sddf_count, sddf_block_number, - virtio_data, virtio_data_size, aligned + virtio_data, virtio_data_size, aligned }; /* Copy data from virtio buffer to data buffer, create sddf write request and initialise it with data buffer */ @@ -341,7 +341,9 @@ static int virtio_blk_mmio_queue_notify(struct virtio_device *dev) ialloc_alloc(&state->ialloc, &req_id); /* except for virtio desc, nothing else needs to be retrieved later * so leave as 0 */ - state->reqbk[req_id] = (reqbk_t){desc_head, 0, 0, 0, 0, 0}; + state->reqbk[req_id] = (reqbk_t) { + desc_head, 0, 0, 0, 0, 0 + }; err = blk_enqueue_req(&state->queue_h, FLUSH, 0, 0, 0, req_id); break; @@ -422,10 +424,10 @@ bool virtio_blk_handle_resp(struct virtio_blk_device *state) uint32_t new_sddf_id; ialloc_alloc(&state->ialloc, &new_sddf_id); - state->reqbk[new_sddf_id] = (reqbk_t){ + state->reqbk[new_sddf_id] = (reqbk_t) { data->virtio_desc_head, - data->sddf_data, data->sddf_count, - data->sddf_block_number, 0, 0, true + data->sddf_data, data->sddf_count, + data->sddf_block_number, 0, 0, true }; err = blk_enqueue_req(&state->queue_h, @@ -503,14 +505,14 @@ static virtio_device_funs_t functions = { }; bool virtio_mmio_blk_init(struct virtio_blk_device *blk_dev, - uintptr_t region_base, - uintptr_t region_size, - size_t virq, - uintptr_t data_region, - size_t data_region_size, - blk_storage_info_t *storage_info, - blk_queue_handle_t *queue_h, - int server_ch) + uintptr_t region_base, + uintptr_t region_size, + size_t virq, + uintptr_t data_region, + size_t data_region_size, + blk_storage_info_t *storage_info, + blk_queue_handle_t *queue_h, + int server_ch) { struct virtio_device *dev = &blk_dev->virtio_device; diff --git a/tools/linux/uio_drivers/blk/blk.c b/tools/linux/uio_drivers/blk/blk.c index c51d7004..0c826c43 100644 --- a/tools/linux/uio_drivers/blk/blk.c +++ b/tools/linux/uio_drivers/blk/blk.c @@ -116,12 +116,12 @@ int driver_init(void **maps, uintptr_t *maps_phys, int num_maps, int argc, char blk_config->capacity = size / BLK_TRANSFER_SIZE; LOG_UIO_BLOCK("Raw block device: read_only=%d, sector_size=%d, size=%ld\n", (int)blk_config->read_only, - blk_config->sector_size, blk_config->size); + blk_config->sector_size, blk_config->size); /* Optimal size */ /* As far as I know linux does not let you query this from userspace, set as 0 to mean undefined */ blk_config->block_size = 0; - + /* Driver is ready to go, set ready in shared config page */ __atomic_store_n(&blk_config->ready, true, __ATOMIC_RELEASE);