mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
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>
This commit is contained in:
committed by
Kevin Wolf
parent
771b799bfb
commit
b22ff5ed6c
@@ -637,7 +637,7 @@ static void fuse_read(fuse_req_t req, fuse_ino_t inode,
|
||||
size_t size, off_t offset, struct fuse_file_info *fi)
|
||||
{
|
||||
FuseExport *exp = fuse_req_userdata(req);
|
||||
int64_t length;
|
||||
int64_t blk_len;
|
||||
void *buf;
|
||||
int ret;
|
||||
|
||||
@@ -651,14 +651,14 @@ static void fuse_read(fuse_req_t req, fuse_ino_t inode,
|
||||
* Clients will expect short reads at EOF, so we have to limit
|
||||
* offset+size to the image length.
|
||||
*/
|
||||
length = blk_getlength(exp->common.blk);
|
||||
if (length < 0) {
|
||||
fuse_reply_err(req, -length);
|
||||
blk_len = blk_getlength(exp->common.blk);
|
||||
if (blk_len < 0) {
|
||||
fuse_reply_err(req, -blk_len);
|
||||
return;
|
||||
}
|
||||
|
||||
if (offset + size > length) {
|
||||
size = length - offset;
|
||||
if (offset + size > blk_len) {
|
||||
size = blk_len - offset;
|
||||
}
|
||||
|
||||
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,
|
||||
{
|
||||
FuseExport *exp = fuse_req_userdata(req);
|
||||
QEMU_AUTO_VFREE void *copied = NULL;
|
||||
int64_t length;
|
||||
int64_t blk_len;
|
||||
int ret;
|
||||
|
||||
/* 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,
|
||||
* Clients will expect short writes at EOF, so we have to limit
|
||||
* offset+size to the image length.
|
||||
*/
|
||||
length = blk_getlength(exp->common.blk);
|
||||
if (length < 0) {
|
||||
fuse_reply_err(req, -length);
|
||||
blk_len = blk_getlength(exp->common.blk);
|
||||
if (blk_len < 0) {
|
||||
fuse_reply_err(req, -blk_len);
|
||||
return;
|
||||
}
|
||||
|
||||
if (offset + size > length) {
|
||||
if (offset + size > blk_len) {
|
||||
if (exp->growable) {
|
||||
ret = fuse_do_truncate(exp, offset + size, true, PREALLOC_MODE_OFF);
|
||||
if (ret < 0) {
|
||||
@@ -725,7 +725,7 @@ static void fuse_write(fuse_req_t req, fuse_ino_t inode, const char *buf,
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
size = length - offset;
|
||||
size = blk_len - offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user