summaryrefslogtreecommitdiffstats
path: root/cpukit/libnetworking
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-30 09:24:44 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-05-02 09:56:48 +0200
commitc3bab73b4bb1b02879671d72ff96e625a1b4807e (patch)
tree0e4967c81c4e9ae913b465fecef7d55436537d13 /cpukit/libnetworking
parentlibdebugger: Move to separate library (diff)
downloadrtems-c3bab73b4bb1b02879671d72ff96e625a1b4807e.tar.bz2
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.
Diffstat (limited to 'cpukit/libnetworking')
-rw-r--r--cpukit/libnetworking/Makefile.am10
-rw-r--r--cpukit/libnetworking/headers.am1
-rw-r--r--cpukit/libnetworking/lib/tftpDriver.c18
-rw-r--r--cpukit/libnetworking/rtems/tftp.h44
4 files changed, 23 insertions, 50 deletions
diff --git a/cpukit/libnetworking/Makefile.am b/cpukit/libnetworking/Makefile.am
index 3ab9a274e6..1f6be15312 100644
--- a/cpukit/libnetworking/Makefile.am
+++ b/cpukit/libnetworking/Makefile.am
@@ -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
diff --git a/cpukit/libnetworking/headers.am b/cpukit/libnetworking/headers.am
index b4532e4089..ce4c7c77e0 100644
--- a/cpukit/libnetworking/headers.am
+++ b/cpukit/libnetworking/headers.am
@@ -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 =
diff --git a/cpukit/libnetworking/lib/tftpDriver.c b/cpukit/libnetworking/lib/tftpDriver.c
index 97c9998aec..514f931b13 100644
--- a/cpukit/libnetworking/lib/tftpDriver.c
+++ b/cpukit/libnetworking/lib/tftpDriver.c
@@ -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;
diff --git a/cpukit/libnetworking/rtems/tftp.h b/cpukit/libnetworking/rtems/tftp.h
deleted file mode 100644
index ed3ebd7865..0000000000
--- a/cpukit/libnetworking/rtems/tftp.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Trivial File Transfer Protocol (TFTP)
- *
- * Transfer file to/from remote host
- *
- * W. Eric Norum
- * Saskatchewan Accelerator Laboratory
- * University of Saskatchewan
- * Saskatoon, Saskatchewan, CANADA
- * eric@skatter.usask.ca
- */
-
-/*
- * Usage:
- *
- * To open `/bootfiles/image' on `hostname' for reading:
- * fd = open ("/TFTP/hostname/bootfiles/image", O_RDONLY);
- *
- * The 'TFTP' is the mount path and the `hostname' must be four dot-separated
- * decimal values.
- */
-
-#ifndef _RTEMS_TFTP_H
-#define _RTEMS_TFTP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <rtems/fs.h>
-
-/*
- * Filesystem Mount table entry.
- */
-int rtems_tftpfs_initialize(
- rtems_filesystem_mount_table_entry_t *mt_entry,
- const void *data
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif