From fea9a7a7e59f4a6f08805591200e6dd943412372 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 30 Apr 2018 09:48:13 +0200 Subject: ftpfs: Always build FTP client Move FTP client filesystem to separate library libftpfs.a. Update #3419. --- cpukit/headers.am | 1 + cpukit/include/rtems/ftpfs.h | 159 +++++++++++++++++++++++++++++++++++++ cpukit/libnetworking/Makefile.am | 8 +- cpukit/libnetworking/headers.am | 1 - cpukit/libnetworking/rtems/ftpfs.h | 159 ------------------------------------- testsuites/libtests/Makefile.am | 2 +- 6 files changed, 168 insertions(+), 162 deletions(-) create mode 100644 cpukit/include/rtems/ftpfs.h delete mode 100644 cpukit/libnetworking/rtems/ftpfs.h diff --git a/cpukit/headers.am b/cpukit/headers.am index 048cef6d83..66efcb5c58 100644 --- a/cpukit/headers.am +++ b/cpukit/headers.am @@ -124,6 +124,7 @@ include_rtems_HEADERS += include/rtems/framebuffer.h include_rtems_HEADERS += include/rtems/fs.h include_rtems_HEADERS += include/rtems/fsmount.h include_rtems_HEADERS += include/rtems/ftpd.h +include_rtems_HEADERS += include/rtems/ftpfs.h include_rtems_HEADERS += include/rtems/gxx_wrappers.h include_rtems_HEADERS += include/rtems/ide_part_table.h include_rtems_HEADERS += include/rtems/imfs.h diff --git a/cpukit/include/rtems/ftpfs.h b/cpukit/include/rtems/ftpfs.h new file mode 100644 index 0000000000..c1f615b85b --- /dev/null +++ b/cpukit/include/rtems/ftpfs.h @@ -0,0 +1,159 @@ +/** + * @file + * + * @brief File Transfer Protocol file system (FTP client). + */ + +/* + * Copyright (c) 2009 + * embedded brains GmbH + * Obere Lagerstr. 30 + * D-82178 Puchheim + * Germany + * + * + * (c) Copyright 2002 + * Thomas Doerfler + * IMD Ingenieurbuero fuer Microcomputertechnik + * Herbststr. 8 + * 82178 Puchheim, Germany + * + * + * Modified by Sebastian Huber . + * + * This code has been created after closly inspecting "tftpdriver.c" from Eric + * Norum. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifndef _RTEMS_FTPFS_H +#define _RTEMS_FTPFS_H + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup rtems_ftpfs File Transfer Protocol File System + * + * @brief The FTP file system (FTP client) can be used to transfer files from + * or to remote hosts. + * + * You can mount the FTP file system with a call to mount() or + * mount_and_make_target_path() with the @ref RTEMS_FILESYSTEM_TYPE_FTPFS file + * system type. + * + * You have to add @ref CONFIGURE_FILESYSTEM_FTPFS to your application + * configuration. + * + * You can open files either read-only or write-only. A seek is not allowed. + * A close terminates the control and data connections. + * + * To open a file @c file.txt in the directory @c dir (relative to home + * directory of the server) on a server named @c host using the user name + * @c user and the password @c pw you must specify the following path: + * /FTP/user:pw@@host/dir/file.txt. + * + * If the server is the default server specified in BOOTP, it can be ommitted: + * /FTP/user:pw/dir/file.txt. + * + * The user name will be used for the password if it is ommitted: + * /FTP/user@@host/dir/file.txt. + * + * For the data transfer passive (= default) and active (= fallback) mode are + * supported. + */ +/**@{**/ + +/** + * @brief Well-known port number for FTP control connection. + */ +#define RTEMS_FTPFS_CTRL_PORT 21 + +/** + * @brief Default mount point for FTP file system. + */ +#define RTEMS_FTPFS_MOUNT_POINT_DEFAULT "/FTP" + +/** + * @brief FTP file system IO control requests. + */ +typedef enum { + RTEMS_FTPFS_IOCTL_GET_VERBOSE = _IOR( 'd', 1, bool *), + RTEMS_FTPFS_IOCTL_SET_VERBOSE = _IOW( 'd', 1, bool *), + RTEMS_FTPFS_IOCTL_GET_TIMEOUT = _IOR( 'd', 2, struct timeval *), + RTEMS_FTPFS_IOCTL_SET_TIMEOUT = _IOW( 'd', 2, struct timeval *) +} rtems_ftpfs_ioctl_numbers; + +/** + * @brief Returns in @a verbose if the verbose mode is enabled or disabled for + * the file system at @a mount_point. + * + * If @a mount_point is @c NULL the default mount point + * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. + */ +rtems_status_code rtems_ftpfs_get_verbose( const char *mount_point, bool *verbose); + +/** + * @brief Enables or disables the verbose mode if @a verbose is @c true or + * @c false respectively for the file system at @a mount_point. + * + * In the enabled verbose mode the commands and replies of the FTP control + * connections will be printed to standard error. + * + * If @a mount_point is @c NULL the default mount point + * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. + */ +rtems_status_code rtems_ftpfs_set_verbose( const char *mount_point, bool verbose); + +/** + * @brief Returns the current timeout value in @a timeout for the file system + * at @a mount_point. + * + * If @a mount_point is @c NULL the default mount point + * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. + */ +rtems_status_code rtems_ftpfs_get_timeout( + const char *mount_point, + struct timeval *timeout +); + +/** + * @brief Sets the timeout value to @a timeout for the file system at + * @a mount_point. + * + * The timeout value will be used during connection establishment of active + * data connections. It will be also used for send and receive operations on + * data and control connections. + * + * If @a mount_point is @c NULL the default mount point + * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. + */ +rtems_status_code rtems_ftpfs_set_timeout( + const char *mount_point, + const struct timeval *timeout +); + +/** @} */ + +/** + * @brief Do not call directly, use mount(). + */ +int rtems_ftpfs_initialize( + rtems_filesystem_mount_table_entry_t *mt_entry, + const void *data +); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/cpukit/libnetworking/Makefile.am b/cpukit/libnetworking/Makefile.am index 1f6be15312..372f642610 100644 --- a/cpukit/libnetworking/Makefile.am +++ b/cpukit/libnetworking/Makefile.am @@ -4,6 +4,12 @@ include $(top_srcdir)/automake/compile.am project_lib_LIBRARIES = TMPINSTALL_FILES = +project_lib_LIBRARIES += libftpfs.a +libftpfs_a_SOURCES = lib/ftpfs.c +$(PROJECT_LIB)/libftpfs.a: libftpfs.a + $(INSTALL_DATA) $< $(PROJECT_LIB)/libftpfs.a +TMPINSTALL_FILES += $(PROJECT_LIB)/libftpfs.a + project_lib_LIBRARIES += libtftpfs.a libtftpfs_a_SOURCES = lib/tftpDriver.c $(PROJECT_LIB)/libtftpfs.a: libtftpfs.a @@ -134,7 +140,7 @@ lib_CPPFLAGS = -DNOPOLL -DNOSELECT 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_a_SOURCES = lib/getprotoby.c lib/rtems_bsdnet_ntp.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 ce4c7c77e0..93dce6ef8f 100644 --- a/cpukit/libnetworking/headers.am +++ b/cpukit/libnetworking/headers.am @@ -106,7 +106,6 @@ include_rtemsdir = $(includedir)/rtems include_rtems_HEADERS = include_rtems_HEADERS += rtems/bootp.h include_rtems_HEADERS += rtems/dhcp.h -include_rtems_HEADERS += rtems/ftpfs.h include_rtems_HEADERS += rtems/mkrootfs.h include_rtems_HEADERS += rtems/rtems_bsdnet.h include_rtems_HEADERS += rtems/rtems_bsdnet_internal.h diff --git a/cpukit/libnetworking/rtems/ftpfs.h b/cpukit/libnetworking/rtems/ftpfs.h deleted file mode 100644 index c1f615b85b..0000000000 --- a/cpukit/libnetworking/rtems/ftpfs.h +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @file - * - * @brief File Transfer Protocol file system (FTP client). - */ - -/* - * Copyright (c) 2009 - * embedded brains GmbH - * Obere Lagerstr. 30 - * D-82178 Puchheim - * Germany - * - * - * (c) Copyright 2002 - * Thomas Doerfler - * IMD Ingenieurbuero fuer Microcomputertechnik - * Herbststr. 8 - * 82178 Puchheim, Germany - * - * - * Modified by Sebastian Huber . - * - * This code has been created after closly inspecting "tftpdriver.c" from Eric - * Norum. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef _RTEMS_FTPFS_H -#define _RTEMS_FTPFS_H - -#include -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup rtems_ftpfs File Transfer Protocol File System - * - * @brief The FTP file system (FTP client) can be used to transfer files from - * or to remote hosts. - * - * You can mount the FTP file system with a call to mount() or - * mount_and_make_target_path() with the @ref RTEMS_FILESYSTEM_TYPE_FTPFS file - * system type. - * - * You have to add @ref CONFIGURE_FILESYSTEM_FTPFS to your application - * configuration. - * - * You can open files either read-only or write-only. A seek is not allowed. - * A close terminates the control and data connections. - * - * To open a file @c file.txt in the directory @c dir (relative to home - * directory of the server) on a server named @c host using the user name - * @c user and the password @c pw you must specify the following path: - * /FTP/user:pw@@host/dir/file.txt. - * - * If the server is the default server specified in BOOTP, it can be ommitted: - * /FTP/user:pw/dir/file.txt. - * - * The user name will be used for the password if it is ommitted: - * /FTP/user@@host/dir/file.txt. - * - * For the data transfer passive (= default) and active (= fallback) mode are - * supported. - */ -/**@{**/ - -/** - * @brief Well-known port number for FTP control connection. - */ -#define RTEMS_FTPFS_CTRL_PORT 21 - -/** - * @brief Default mount point for FTP file system. - */ -#define RTEMS_FTPFS_MOUNT_POINT_DEFAULT "/FTP" - -/** - * @brief FTP file system IO control requests. - */ -typedef enum { - RTEMS_FTPFS_IOCTL_GET_VERBOSE = _IOR( 'd', 1, bool *), - RTEMS_FTPFS_IOCTL_SET_VERBOSE = _IOW( 'd', 1, bool *), - RTEMS_FTPFS_IOCTL_GET_TIMEOUT = _IOR( 'd', 2, struct timeval *), - RTEMS_FTPFS_IOCTL_SET_TIMEOUT = _IOW( 'd', 2, struct timeval *) -} rtems_ftpfs_ioctl_numbers; - -/** - * @brief Returns in @a verbose if the verbose mode is enabled or disabled for - * the file system at @a mount_point. - * - * If @a mount_point is @c NULL the default mount point - * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. - */ -rtems_status_code rtems_ftpfs_get_verbose( const char *mount_point, bool *verbose); - -/** - * @brief Enables or disables the verbose mode if @a verbose is @c true or - * @c false respectively for the file system at @a mount_point. - * - * In the enabled verbose mode the commands and replies of the FTP control - * connections will be printed to standard error. - * - * If @a mount_point is @c NULL the default mount point - * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. - */ -rtems_status_code rtems_ftpfs_set_verbose( const char *mount_point, bool verbose); - -/** - * @brief Returns the current timeout value in @a timeout for the file system - * at @a mount_point. - * - * If @a mount_point is @c NULL the default mount point - * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. - */ -rtems_status_code rtems_ftpfs_get_timeout( - const char *mount_point, - struct timeval *timeout -); - -/** - * @brief Sets the timeout value to @a timeout for the file system at - * @a mount_point. - * - * The timeout value will be used during connection establishment of active - * data connections. It will be also used for send and receive operations on - * data and control connections. - * - * If @a mount_point is @c NULL the default mount point - * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. - */ -rtems_status_code rtems_ftpfs_set_timeout( - const char *mount_point, - const struct timeval *timeout -); - -/** @} */ - -/** - * @brief Do not call directly, use mount(). - */ -int rtems_ftpfs_initialize( - rtems_filesystem_mount_table_entry_t *mt_entry, - const void *data -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am index 68ff80a585..36f7a2f84c 100644 --- a/testsuites/libtests/Makefile.am +++ b/testsuites/libtests/Makefile.am @@ -582,7 +582,7 @@ lib_docs += ftp01/ftp01.doc ftp01_SOURCES = ftp01/init.c ftp01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_ftp01) \ $(support_includes) -I$(RTEMS_SOURCE_ROOT)/cpukit/libnetworking -ftp01_LDADD = -lftpd +ftp01_LDADD = -lftpd -lftpfs endif endif -- cgit v1.2.3