[PATCH 0/7] TFTPFS: Add block and window size options

Frank Kuehndel frank.kuehndel at embedded-brains.de
Fri Jun 3 15:22:39 UTC 2022


From: Frank Kühndel <frank.kuehndel at embedded-brains.de>

The following patches extend the TFTP file system to support

  * RFC 2347 TFTP Option Extension
  * RFC 2348 TFTP Blocksize Option
  * RFC 7440 TFTP Windowsize Option

To benefit from improved download and upload speeds, a TFTP
server which supports at least the blocksize option must be used.
The code is still downward compatible to simple/old servers
which implement only RFC 1350.

The patches contain an extensive test suite.

The original code was in the single file tftpDriver.c where
the file system and the network aspects where entangled.
The patches split the code into files tftpfs.c for the file
system part and tftpDriver.c for the network related part.

Since both files are derived from the original tftpDriver.c,
it is possible to keep the git history working for both files
when committing the patches to the git repository.  For example,
as described here:

https://devblogs.microsoft.com/oldnewthing/20190919-00/?p=102904

Yet, this method requires a merge and the history gets lost
when the commits are "rebased".  I cannot say whether this
would be worth the trouble.

TFTP Files
----------

``cpukit/include/rtems/tftp.h``
  This file declares the public constants, structures, and functions
  of the Trivial File Transfer Protocol (TFTP) file system.

``cpukit/libfs/src/ftpfs/tftpDriver.c``
  This source file contains the implementation of a Trivial File
  Transfer Protocol (TFTP) client library --- the network related
  part of the code.

``cpukit/libfs/src/ftpfs/tftp_driver.h``
  This file declares private functions of the Trivial File Transfer
  Protocol (TFTP) client library.

``cpukit/libfs/src/ftpfs/tftpfs.c``
  This source file contains the implementation of the Trivial File
  Transfer Protocol (TFTP) filesystem.  The code in this file handles
  the file system operations (such as ``mount()``, ``open()``,
  ``read()``, ``write()``, ``close()`` etc.).

``spec/build/cpukit/libtftpfs.yml``
  This file specifies how the RTEMS WAF build system has to compile,
  link and install ``libtftpfs``.

``spec/build/testsuites/fstests/grp.yml``
  This file specifies how the RTEMS WAF build system has to compile,
  link and install all filesystem test suites.  The TFTP test suite
  must be mentioned in this file to be build.

``spec/build/testsuites/fstests/tftpfs.yml``
  This file specifies how the RTEMS WAF build system has to compile,
  link and install the TFTP test suite.

``testsuites/fstests/tftpfs/init.c``
  This source file contains the test suite with all tests for
  ``libtftpfs``. The test suite uses functions from files
  ``tftpfs_interactions.c`` and ``tftpfs_udp_network_fake.c`` as
  private helpers.

``testsuites/fstests/tftpfs/tftpfs_interactions.h``
  This header file provides definitions and declarations of data
  structures and functions used to implement network interactions
  of the UDP network fake for ``libtftpfs`` tests.

``testsuites/fstests/tftpfs/tftpfs_interactions.c``
  This source file contains the implementation of network interaction
  functions related to the UDP network fake for ``libtftpfs`` tests.

``testsuites/fstests/tftpfs/tftpfs_udp_network_fake.h``
  This header file provides definitions and declarations of data
  structures and functions used to implement the UDP network fake
  for ``libtftpfs`` tests.

``testsuites/fstests/tftpfs/tftpfs_udp_network_fake.c``
  This source file contains the implementation of UDP network fake
  functions related to ``libtftpfs`` testing.  This code provides
  fake implementations for functions like ``socket()``, ``bind()``,
  ``sendto()``, ``recvfrom()``, etc. which would normally be
  provided by libbsd.

Frank Kühndel (7):
  TFTPFS: Cleanup: Remove spaces at lines ends
  TFTPFS: Duplicate tftpDriver.c to tftpfs.c
  TFTPFS: Restore tftpDriver.c
  TFTPFS: Implement block and window size options
  TFTPFS: Add test suite framework
  TFTPFS: Add tests
  TFTPFS: Add more tests

 cpukit/include/rtems/tftp.h                   |  404 +-
 cpukit/libfs/src/ftpfs/tftpDriver.c           | 1780 ++--
 cpukit/libfs/src/ftpfs/tftp_driver.h          |   76 +
 cpukit/libfs/src/ftpfs/tftpfs.c               |  624 ++
 spec/build/cpukit/libtftpfs.yml               |    3 +-
 spec/build/testsuites/fstests/grp.yml         |    2 +
 spec/build/testsuites/fstests/tftpfs.yml      |   25 +
 testsuites/fstests/tftpfs/init.c              | 7318 +++++++++++++++++
 .../fstests/tftpfs/tftpfs_interactions.c      |  984 +++
 .../fstests/tftpfs/tftpfs_interactions.h      |  205 +
 .../fstests/tftpfs/tftpfs_udp_network_fake.c  |  983 +++
 .../fstests/tftpfs/tftpfs_udp_network_fake.h  |  283 +
 12 files changed, 12024 insertions(+), 663 deletions(-)
 create mode 100644 cpukit/libfs/src/ftpfs/tftp_driver.h
 create mode 100644 cpukit/libfs/src/ftpfs/tftpfs.c
 create mode 100644 spec/build/testsuites/fstests/tftpfs.yml
 create mode 100644 testsuites/fstests/tftpfs/init.c
 create mode 100644 testsuites/fstests/tftpfs/tftpfs_interactions.c
 create mode 100644 testsuites/fstests/tftpfs/tftpfs_interactions.h
 create mode 100644 testsuites/fstests/tftpfs/tftpfs_udp_network_fake.c
 create mode 100644 testsuites/fstests/tftpfs/tftpfs_udp_network_fake.h

-- 
2.35.3



More information about the devel mailing list