Add expected_size field to test patterns to properly validate cases
where the requested read size exceeds the actual file size. This allows
testing the server's behavior when clients request more data than is
available.
When a read request is larger than the file, the server correctly
returns data up to EOF. The test framework now distinguishes between
this expected scenario and genuine read failures.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
[socketcan: addressed review comments from PR #629:
- keep uint32_t instead of size_t for offset/read_size/expected_size:
ISO 11783-13 limits the file offset (Seek File) and the file size
(directory entry) to 32 bit, so uint32_t matches the protocol. The
sum offset + read_size can exceed 32 bit (see UINT32_MAX pattern)
and is therefore calculated in int64_t. size_t would not help here
as it is only 32 bit wide on 32 bit targets.
- remaining_size is a signed int64_t: the signed type is needed to
detect the 'remaining_size < 0' case (server returned more data than
requested) and int64_t holds the 33 bit sum on all platforms.
- fix printf format for the uint32_t read_offset (%zu -> %u)]
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Before more contributions will come, change the license and make this
project usable as a library.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Introduce the ISOBUS File Server (FS) interface, compatible with ISO
11783-13. The implementation utilizes the kernel's existing CAN J1939
socket support.
For testing following setup can be used:
ip link add type vcan
ip l s dev vcan0 up
j1939acd -r 64-95 -c /tmp/1122334455667788.jacd 1122334455667788 vcan0 &
j1939acd -r 96-127 -c /tmp/1122334455667789.jacd 1122334455667789 vcan0 &
sleep 1
isobusfs-srv -i vcan0 -n 1122334455667788 -v vol1:/path/to/export/
isobusfs-cli -i vcan0 -n 0x1122334455667789 -m 0x1122334455667788 -I
Interactive mode currently support following commands:
exit - exit interactive mode
quit - exit interactive mode
help - show this help
dmesg - show log buffer
selftest - run selftest
ls - list directory
ll - list directory with long listing format
cd - change directory
pwd - print name of current/working directory
get - get file
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>