usb-mtp: breakup MTP write into smaller chunks
authorBandan Das <bsd@redhat.com>
Tue, 29 Jan 2019 13:19:07 +0000 (08:19 -0500)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 30 Jan 2019 05:47:52 +0000 (06:47 +0100)
commitc1ef0f2519c706f738d76b9b68b6627c889bab14
tree8fe4d8fa416eaf0499a696d833c04d7fa0bfa8a1
parent179fcf8a83a91c74e323b1fe1b5397520a8af047
usb-mtp: breakup MTP write into smaller chunks

For every MTP_WRITE_BUF_SZ copied, this patch writes it to file before
getting the next block of data. The file is kept opened for the
duration of the operation but the sanity checks on the write operation
are performed only once when the write operation starts. Additionally,
we also update the file size in the object metadata once the file has
completely been written.

Suggested-by: Gerd Hoffman <kraxel@redhat.com>
Signed-off-by: Bandan Das <bsd@redhat.com>
Message-id: 20190129131908.27924-3-bsd@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/dev-mtp.c