aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/9p.c
diff options
context:
space:
mode:
authorChristian Schoenebeck <qemu_oss@crudebyte.com>2021-09-27 17:50:36 +0200
committerChristian Schoenebeck <qemu_oss@crudebyte.com>2021-10-27 14:45:22 +0200
commit04a7f9e55e0930b87805f7c97851eea4610e78fc (patch)
treee71564b18c752c0068b57eab1f9f949eb39416a0 /hw/9pfs/9p.c
parentb565bccb00afe8b73d529bbc3a38682996dac5c7 (diff)
downloadqemu-04a7f9e55e0930b87805f7c97851eea4610e78fc.zip
qemu-04a7f9e55e0930b87805f7c97851eea4610e78fc.tar.gz
qemu-04a7f9e55e0930b87805f7c97851eea4610e78fc.tar.bz2
9pfs: simplify blksize_to_iounit()
Use QEMU_ALIGN_DOWN() macro to reduce code and to make it more human readable. Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <b84eb324d2ebdcc6f9c442c97b5b4d01eecb4f43.1632758315.git.qemu_oss@crudebyte.com>
Diffstat (limited to 'hw/9pfs/9p.c')
-rw-r--r--hw/9pfs/9p.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 5c57344..e874899 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1280,8 +1280,7 @@ static int32_t blksize_to_iounit(const V9fsPDU *pdu, int32_t blksize)
* as well as less than (client msize - P9_IOHDRSZ)
*/
if (blksize) {
- iounit = blksize;
- iounit *= (s->msize - P9_IOHDRSZ) / blksize;
+ iounit = QEMU_ALIGN_DOWN(s->msize - P9_IOHDRSZ, blksize);
}
if (!iounit) {
iounit = s->msize - P9_IOHDRSZ;