From: Alan Cox Date: Sun, 21 May 2017 21:16:41 +0000 (+0100) Subject: blkdev: allow for 16bit block counts X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=b771268a119530b711d9523644b3e619e1d1a403;p=FUZIX.git blkdev: allow for 16bit block counts On a 32bit system we can end up writing more than 256 blocks in a run when we swap so blkdev needs to use 16bits for the block counter. (We could make this a typedef for 8 v 16bit but it's not clear it matters enough) --- diff --git a/Kernel/dev/blkdev.c b/Kernel/dev/blkdev.c index 74fc3a0e..d78463d7 100644 --- a/Kernel/dev/blkdev.c +++ b/Kernel/dev/blkdev.c @@ -74,7 +74,8 @@ int blkdev_open(uint8_t minor, uint16_t flags) static int blkdev_transfer(uint8_t minor, uint8_t rawflag) { - uint8_t partition, n, count=0; + uint8_t partition, n; + uint16_t count = 0; /* we trust that blkdev_open() has already verified that this minor number is valid */ blk_op.blkdev = &blkdev_table[minor >> 4]; diff --git a/Kernel/dev/blkdev.h b/Kernel/dev/blkdev.h index e7098297..89c6320c 100644 --- a/Kernel/dev/blkdev.h +++ b/Kernel/dev/blkdev.h @@ -27,7 +27,7 @@ struct blkparam { uint8_t swap_page; /* page to pass to map_swap */ blkdev_t *blkdev; /* active block device */ uint32_t lba; /* LBA for first sectors to transfer */ - uint8_t nblock; /* number of sectors to transfer */ + uint16_t nblock; /* number of sectors to transfer */ bool is_read; /* true: read sectors, false: write sectors */ }; /* macros that inline assembler code can use to access blkparam fields */