Implement ISOBUS File Server (FS) Interface as a Personal Project

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>
This commit is contained in:
Oleksij Rempel
2024-02-02 13:44:07 +01:00
committed by Oleksij Rempel
parent 6004c64f06
commit 42edaeaf52
30 changed files with 9750 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
#ifndef _ISOBUSFS_CMN_VA_H
#define _ISOBUSFS_CMN_VA_H
#include "isobusfs_cmn.h"
/**
* C.5.2.2 Initialize Volume Request
* struct isobusfs_va_init_vol_req - Initialize Volume Request structure
* @fs_function: Function and command (1 byte)
* Bits 7-4: 0b0100 (Command - Volume Access, see B.1)
* Bits 3-0: 0b0000 (Function - Initialize Volume, see B.2)
* @tan: Transaction number (1 byte) (see B.8)
* @space: Space (2 bytes) (see B.11)
* @volume_flags: Volume Flags (1 byte) (see B.29)
* @name_len: Pathname Length (2 bytes) (__le16, see B.12)
* @name: Volume, Path and Filename (variable length) (see B.35)
*
* Transmission repetition rate: On request
* Data length: Variable
* Parameter group number: Client to FS, destination-specific
*/
struct isobusfs_va_init_vol_req {
uint8_t fs_function;
uint8_t tan;
__le16 space;
uint8_t volume_flags;
__le16 name_len;
uint8_t name[];
};
/**
* C.5.2.3 Initialize Volume Response
* struct isobusfs_va_init_vol_res - Initialize Volume Response structure
* @fs_function: Function and command (1 byte)
* Bits 7-4: 0b0100 (Command - Volume Access, see B.1)
* Bits 3-0: 0b0000 (Function - Initialize Volume, see B.2)
* @tan: Transaction number (1 byte) (see B.8)
* @error_code: Error code (1 byte) (see B.9)
* 0: Success
* 1: Access denied
* 4: Volume, path or file not found
* 6: Invalid given source name
* 8: Volume out of free space
* 9: Failure during write operation
* 10: Media is not present
* 11 Failure during read operation
* 12: Function not supported
* 13: Volume is possibly not initialized
* 43: Out of memory
* 44: Any other error
* @reserved: Reserved, transmit as 0xFF (4 bytes)
*
* Transmission repetition rate: In response to Initialize Volume Request message
* Data length: 8 bytes
* Parameter group number: FS to client, destination-specific
*/
struct isobusfs_va_init_vol_res {
uint8_t fs_function;
uint8_t tan;
uint8_t error_code;
uint8_t reserved[4];
};
#endif /* _ISOBUSFS_CMN_VA_H */