tftpfs: Always build TFTP client

Move TFTP client filesystem to separate library libtftpfs.a.
Conditionally use legacy network stack features, e.g. BOOTP support.

Update #3419.
This commit is contained in:
Sebastian Huber
2018-04-30 09:24:44 +02:00
parent dd8e4b760b
commit c3bab73b4b
5 changed files with 24 additions and 6 deletions

View File

@@ -190,6 +190,7 @@ include_rtems_HEADERS += include/rtems/termios_printk.h
include_rtems_HEADERS += include/rtems/termios_printk_cnf.h
include_rtems_HEADERS += include/rtems/termiostypes.h
include_rtems_HEADERS += include/rtems/test.h
include_rtems_HEADERS += include/rtems/tftp.h
include_rtems_HEADERS += include/rtems/thread.h
include_rtems_HEADERS += include/rtems/timecounter.h
include_rtems_HEADERS += include/rtems/timespec.h

View File

@@ -1,6 +1,14 @@
include $(top_srcdir)/automake/multilib.am
include $(top_srcdir)/automake/compile.am
project_lib_LIBRARIES =
TMPINSTALL_FILES =
project_lib_LIBRARIES += libtftpfs.a
libtftpfs_a_SOURCES = lib/tftpDriver.c
$(PROJECT_LIB)/libtftpfs.a: libtftpfs.a
$(INSTALL_DATA) $< $(PROJECT_LIB)/libtftpfs.a
TMPINSTALL_FILES += $(PROJECT_LIB)/libtftpfs.a
# poll is not supported
UNUSED_FILES = poll.h
@@ -127,7 +135,7 @@ noinst_LIBRARIES += lib.a
lib_a_CPPFLAGS = $(AM_CPPFLAGS) $(lib_CPPFLAGS) -D__BSD_VISIBLE
lib_a_SOURCES = lib/getprotoby.c lib/rtems_bsdnet_ntp.c lib/ftpfs.c \
lib/syslog.c lib/tftpDriver.c
lib/syslog.c
lib_a_SOURCES += rtems/rtems_syscall_api.c
endif

View File

@@ -115,7 +115,6 @@ include_rtems_HEADERS += rtems/rtems_mii_ioctl.h
include_rtems_HEADERS += rtems/rtems_netdb.h
include_rtems_HEADERS += rtems/rtems_netinet_in.h
include_rtems_HEADERS += rtems/rtems_syscall.h
include_rtems_HEADERS += rtems/tftp.h
include_rtems_bsdnetdir = $(includedir)/rtems/bsdnet
include_rtems_bsdnet_HEADERS =

View File

@@ -28,7 +28,6 @@
#include <rtems.h>
#include <rtems/libio_.h>
#include <rtems/seterr.h>
#include <rtems/rtems_bsdnet.h>
#include <rtems/tftp.h>
#include <rtems/thread.h>
#include <sys/types.h>
@@ -37,6 +36,10 @@
#include <arpa/inet.h>
#include <netdb.h>
#ifdef RTEMS_NETWORKING
#include <rtems/rtems_bsdnet.h>
#endif
#ifdef RTEMS_TFTP_DRIVER_DEBUG
int rtems_tftp_driver_debug = 1;
#endif
@@ -537,9 +540,11 @@ static int rtems_tftp_open_worker(
*/
hostname = full_path_name;
cp1 = strchr (full_path_name, ':');
if (!cp1)
if (!cp1) {
#ifdef RTEMS_NETWORKING
hostname = "BOOTP_HOST";
else {
#endif
} else {
*cp1 = '\0';
++cp1;
}
@@ -547,9 +552,12 @@ static int rtems_tftp_open_worker(
/*
* Convert hostname to Internet address
*/
#ifdef RTEMS_NETWORKING
if (strcmp (hostname, "BOOTP_HOST") == 0)
farAddress = rtems_bsdnet_bootp_server_address;
else if (inet_aton (hostname, &farAddress) == 0) {
else
#endif
if (inet_aton (hostname, &farAddress) == 0) {
struct hostent *he = gethostbyname(hostname);
if (he == NULL)
return ENOENT;
@@ -559,9 +567,11 @@ static int rtems_tftp_open_worker(
/*
* Extract file pathname component
*/
#ifdef RTEMS_NETWORKING
if (strcmp (cp1, "BOOTP_FILE") == 0) {
cp1 = rtems_bsdnet_bootp_boot_file_name;
}
#endif
if (*cp1 == '\0')
return ENOENT;
remoteFilename = cp1;