@samitouri / QOSamiQemu / commits / b22ff5ed6c

fuse: fuse_{read,write}: Rename length to blk_len

The term "length" is ambiguous, use "blk_len" instead to be clear. Signed-off-by: Hanna Czenczek <hreitz@redhat.com> Message-ID: <20260309150856.26800-13-hreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Hanna Czenczek committed Mar 9, 2026 at 16:08 UTC b22ff5ed6cb6a64d3f770db0ef5208e1f6a652da
1 file changed +12 -12
block/export/fuse.c
+12 -12
@@ -637,7 +637,7 @@ static void fuse_read(fuse_req_t req, fuse_ino_t inode,
637 size_t size, off_t offset, struct fuse_file_info *fi)
638 {
639 FuseExport *exp = fuse_req_userdata(req);
640 - int64_t length;
640 + int64_t blk_len;
641 void *buf;
642 int ret;
643
@@ -651,14 +651,14 @@ static void fuse_read(fuse_req_t req, fuse_ino_t inode,
651 * Clients will expect short reads at EOF, so we have to limit
652 * offset+size to the image length.
653 */
654 - length = blk_getlength(exp->common.blk);
655 - if (length < 0) {
656 - fuse_reply_err(req, -length);
654 + blk_len = blk_getlength(exp->common.blk);
655 + if (blk_len < 0) {
656 + fuse_reply_err(req, -blk_len);
657 return;
658 }
659
660 - if (offset + size > length) {
661 - size = length - offset;
660 + if (offset + size > blk_len) {
661 + size = blk_len - offset;
662 }
663
664 buf = qemu_try_blockalign(blk_bs(exp->common.blk), size);
@@ -685,7 +685,7 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
685 {
686 FuseExport *exp = fuse_req_userdata(req);
687 QEMU_AUTO_VFREE void *copied = NULL;
688 - int64_t length;
688 + int64_t blk_len;
689 int ret;
690
691 /* Limited by max_write, should not happen */
@@ -711,13 +711,13 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
711 * Clients will expect short writes at EOF, so we have to limit
712 * offset+size to the image length.
713 */
714 - length = blk_getlength(exp->common.blk);
715 - if (length < 0) {
716 - fuse_reply_err(req, -length);
714 + blk_len = blk_getlength(exp->common.blk);
715 + if (blk_len < 0) {
716 + fuse_reply_err(req, -blk_len);
717 return;
718 }
719
720 - if (offset + size > length) {
720 + if (offset + size > blk_len) {
721 if (exp->growable) {
722 ret = fuse_do_truncate(exp, offset + size, true, PREALLOC_MODE_OFF);
723 if (ret < 0) {
@@ -725,7 +725,7 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
725 return;
726 }
727 } else {
728 - size = length - offset;
728 + size = blk_len - offset;
729 }
730 }
731