Last active
February 19, 2019 19:14
-
-
Save ricarkol/b66c899edd96fd7f8fb2fbaeabad0694 to your computer and use it in GitHub Desktop.
solo5-blksize-test.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/tenders/hvt/hvt_module_blk.c | |
+++ b/tenders/hvt/hvt_module_blk.c | |
@@ -116,8 +116,8 @@ static int setup(struct hvt *hvt) | |
if (diskfd == -1) | |
err(1, "Could not open disk: %s", diskfile); | |
- blkinfo.sector_size = 512; | |
- blkinfo.num_sectors = lseek(diskfd, 0, SEEK_END) / 512; | |
+ blkinfo.sector_size = 16384; | |
+ blkinfo.num_sectors = lseek(diskfd, 0, SEEK_END) / 16384; | |
blkinfo.rw = 1; | |
assert(hvt_core_register_hypercall(HVT_HYPERCALL_BLKINFO, | |
diff --git a/tenders/spt/spt_module_block.c b/tenders/spt/spt_module_block.c | |
index 4018aa9..0f1a6a1 100644 | |
--- a/tenders/spt/spt_module_block.c | |
+++ b/tenders/spt/spt_module_block.c | |
@@ -59,12 +59,12 @@ static int setup(struct spt *spt) | |
off_t capacity = lseek(diskfd, 0, SEEK_END); | |
if (capacity == -1) | |
err(1, "%s: Could not determine capacity", diskfile); | |
- if (capacity < 512) | |
- errx(1, "%s: Backing storage must be at least 1 block (512 bytes) " | |
+ if (capacity < 16384) | |
+ errx(1, "%s: Backing storage must be at least 1 block (16384 bytes) " | |
"in size", diskfile); | |
spt->bi->blocki.present = 1; | |
- spt->bi->blocki.block_size = 512; | |
+ spt->bi->blocki.block_size = 16384; | |
spt->bi->blocki.capacity = capacity; | |
spt->bi->blocki.hostfd = diskfd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "solo5.h" | |
#include "../../bindings/lib.c" | |
int solo5_app_main(const struct solo5_start_info *si __attribute__((unused))) | |
{ | |
struct solo5_block_info bi; | |
solo5_block_info(&bi); | |
uint8_t rbuf[bi.block_size]; | |
for (solo5_off_t offset = 0; offset < bi.capacity; | |
offset += bi.block_size) { | |
if (solo5_block_read(offset, rbuf, bi.block_size) != SOLO5_R_OK) | |
return false; | |
} | |
return SOLO5_EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment