Am 25.02.26 um 1:06 PM schrieb Markus Ebner:
> The previous implementation only allowed reads of fixed size starting
> at byte offset 0. This made the Proxmox's agent/file-read unsuitable
> for reading large files.
> The new offset parameter allows specifying a byte offset position
> relative to the start of the file (offset 0) from which the following
> read should be performed. The implementation's behavior follows the
> lseek semantics - directly following qemu-guest-agent's behavior:
>
> - fseek() does not perform validation against the file size
> - Seeking beyond the end of the file is not an error but explicitly
> allowed and specified behavior
> - Subsequent fread() calls at positions beyond the file size return
> zero bytes
>
> Additionally, this is equivalent to the behavior of POSIX pread().
> Reading a large file block-by-block thus becomes (pseudo-code):
> let content = [];
> while(response.truncated) {
> response = proxmox.agent_file_read(offset = content.length);
> content .= response.content;
> }
>
> To be backwards compatible, offset defaults to 0.
>
> Signed-off-by: Markus Ebner <[email protected]>
Reviewed-by: Fiona Ebner <[email protected]>