You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/08/11 18:33:57 UTC
[incubator-nuttx-apps] branch master updated (e6c5ff9 -> ebf3716)
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git.
from e6c5ff9 Remove the unnecessary touch and clean from Makefile
new bf4c36c netutils/ftpc: Embed wdog_s in ftpc_session_s directly
new ebf3716 Fix nxstyle warning
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
netutils/ftpc/ftpc_connect.c | 10 +++-------
netutils/ftpc/ftpc_getreply.c | 29 ++++++++++++++++-------------
netutils/ftpc/ftpc_internal.h | 17 ++++++++++-------
3 files changed, 29 insertions(+), 27 deletions(-)
[incubator-nuttx-apps] 01/02: netutils/ftpc: Embed wdog_s in
ftpc_session_s directly
Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit bf4c36c83f180b348bd9a4b171ad8e5e46d5d1e6
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Aug 10 02:31:34 2020 +0800
netutils/ftpc: Embed wdog_s in ftpc_session_s directly
follow up the kernel side change
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
netutils/ftpc/ftpc_connect.c | 10 +++-------
netutils/ftpc/ftpc_getreply.c | 9 +++++----
netutils/ftpc/ftpc_internal.h | 2 +-
3 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/netutils/ftpc/ftpc_connect.c b/netutils/ftpc/ftpc_connect.c
index c7c2017..f2ce0f8 100644
--- a/netutils/ftpc/ftpc_connect.c
+++ b/netutils/ftpc/ftpc_connect.c
@@ -103,10 +103,6 @@ SESSION ftpc_connect(FAR union ftpc_sockaddr_u *server)
session->homeldir = strdup(ftpc_lpwd());
- /* Create up a timer to prevent hangs */
-
- session->wdog = wd_create();
-
/* And (Re-)connect to the server */
ret = ftpc_reconnect(session);
@@ -152,8 +148,8 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
/* Set up a timer to prevent hangs */
- ret = wd_start(session->wdog,
- session->conntimeo, ftpc_timeout, 1, session);
+ ret = wd_start(&session->wdog, session->conntimeo,
+ ftpc_timeout, 1, (wdparm_t)session);
if (ret != OK)
{
nerr("ERROR: wd_start() failed\n");
@@ -214,7 +210,7 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
fptc_getreply(session);
}
- wd_cancel(session->wdog);
+ wd_cancel(&session->wdog);
if (!ftpc_sockconnected(&session->cmd))
{
diff --git a/netutils/ftpc/ftpc_getreply.c b/netutils/ftpc/ftpc_getreply.c
index b09ff22..e54b84a 100644
--- a/netutils/ftpc/ftpc_getreply.c
+++ b/netutils/ftpc/ftpc_getreply.c
@@ -215,7 +215,8 @@ int fptc_getreply(struct ftpc_session_s *session)
if (session->replytimeo)
{
- ret = wd_start(session->wdog, session->replytimeo, ftpc_timeout, 1, session);
+ ret = wd_start(&session->wdog, session->replytimeo,
+ ftpc_timeout, 1, (wdparm_t)session);
}
/* Get the next line from the server */
@@ -228,7 +229,7 @@ int fptc_getreply(struct ftpc_session_s *session)
{
/* No.. cancel the timer and return an error */
- wd_cancel(session->wdog);
+ wd_cancel(&session->wdog);
ninfo("Lost connection\n");
return ERROR;
}
@@ -239,7 +240,7 @@ int fptc_getreply(struct ftpc_session_s *session)
{
/* No.. cancel the timer and return an error */
- wd_cancel(session->wdog);
+ wd_cancel(&session->wdog);
ninfo("ftpc_gets failed\n");
return ERROR;
}
@@ -263,6 +264,6 @@ int fptc_getreply(struct ftpc_session_s *session)
while (strncmp(tmp, session->reply, 4) != 0);
}
- wd_cancel(session->wdog);
+ wd_cancel(&session->wdog);
return ret;
}
diff --git a/netutils/ftpc/ftpc_internal.h b/netutils/ftpc/ftpc_internal.h
index 0dfe733..68e90cc 100644
--- a/netutils/ftpc/ftpc_internal.h
+++ b/netutils/ftpc/ftpc_internal.h
@@ -165,7 +165,7 @@ struct ftpc_session_s
struct ftpc_socket_s cmd; /* FTP command channel */
struct ftpc_socket_s data; /* FTP data channel */
struct ftpc_socket_s dacceptor; /* FTP data listener (accepts data connection in active mode) */
- WDOG_ID wdog; /* Timer */
+ struct wdog_s wdog; /* Timer */
FAR char *uname; /* Login uname */
FAR char *pwd; /* Login pwd */
FAR char *initrdir; /* Initial remote directory */
[incubator-nuttx-apps] 02/02: Fix nxstyle warning
Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit ebf37162ed9c0691de6ce39a28b42c00f28bb200
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Aug 10 02:50:43 2020 +0800
Fix nxstyle warning
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
netutils/ftpc/ftpc_getreply.c | 20 +++++++++++---------
netutils/ftpc/ftpc_internal.h | 15 +++++++++------
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/netutils/ftpc/ftpc_getreply.c b/netutils/ftpc/ftpc_getreply.c
index e54b84a..04b79ac 100644
--- a/netutils/ftpc/ftpc_getreply.c
+++ b/netutils/ftpc/ftpc_getreply.c
@@ -88,7 +88,7 @@ static int ftpc_gets(struct ftpc_session_s *session)
/* Loop until the full line is obtained */
- for (;;)
+ for (; ; )
{
/* Get the next character from incoming command stream */
@@ -109,19 +109,21 @@ static int ftpc_gets(struct ftpc_session_s *session)
{
/* Handle TELNET commands */
- switch(ch = ftpc_sockgetc(&session->cmd))
+ switch (ch = ftpc_sockgetc(&session->cmd))
{
case TELNET_WILL:
case TELNET_WONT:
ch = ftpc_sockgetc(&session->cmd);
- ftpc_sockprintf(&session->cmd, "%c%c%c", TELNET_IAC, TELNET_DONT, ch);
+ ftpc_sockprintf(&session->cmd, "%c%c%c",
+ TELNET_IAC, TELNET_DONT, ch);
ftpc_sockflush(&session->cmd);
break;
case TELNET_DO:
case TELNET_DONT:
ch = ftpc_sockgetc(&session->cmd);
- ftpc_sockprintf(&session->cmd, "%c%c%c", TELNET_IAC, TELNET_WONT, ch);
+ ftpc_sockprintf(&session->cmd, "%c%c%c",
+ TELNET_IAC, TELNET_WONT, ch);
ftpc_sockflush(&session->cmd);
break;
@@ -134,7 +136,7 @@ static int ftpc_gets(struct ftpc_session_s *session)
/* Deal with carriage returns */
- else if (ch == ISO_cr)
+ else if (ch == ISO_CR)
{
/* What follows the carriage return? */
@@ -143,12 +145,12 @@ static int ftpc_gets(struct ftpc_session_s *session)
{
/* If it is followed by a NUL then keep it */
- ch = ISO_cr;
+ ch = ISO_CR;
}
/* If it is followed by a newline then break out of the loop. */
- else if (ch == ISO_nl)
+ else if (ch == ISO_NL)
{
/* Newline terminates the reply */
@@ -168,7 +170,7 @@ static int ftpc_gets(struct ftpc_session_s *session)
}
}
- else if (ch == ISO_nl)
+ else if (ch == ISO_NL)
{
/* The ISO newline character terminates the string. Just break
* out of the loop.
@@ -208,7 +210,7 @@ static int ftpc_gets(struct ftpc_session_s *session)
int fptc_getreply(struct ftpc_session_s *session)
{
- char tmp[5]="xxx ";
+ char tmp[5] = "xxx ";
int ret;
/* Set up a timeout */
diff --git a/netutils/ftpc/ftpc_internal.h b/netutils/ftpc/ftpc_internal.h
index 68e90cc..3934a89 100644
--- a/netutils/ftpc/ftpc_internal.h
+++ b/netutils/ftpc/ftpc_internal.h
@@ -59,10 +59,11 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
+
/* MISC definitions *********************************************************/
-#define ISO_nl 0x0a
-#define ISO_cr 0x0d
+#define ISO_NL 0x0a
+#define ISO_CR 0x0d
/* Telnet-related definitions */
@@ -181,8 +182,8 @@ struct ftpc_session_s
off_t offset; /* Transfer file offset */
off_t size; /* Number of bytes transferred */
- char reply[CONFIG_FTP_MAXREPLY+1]; /* Last reply string from server */
- char buffer[CONFIG_FTP_BUFSIZE]; /* Used to buffer file data during transfers */
+ char reply[CONFIG_FTP_MAXREPLY + 1]; /* Last reply string from server */
+ char buffer[CONFIG_FTP_BUFSIZE]; /* Used to buffer file data during transfers */
};
/* There is not yet any want to change the local working directly (an lcd
@@ -223,8 +224,9 @@ extern "C"
vfprintf((s)->outstream,f,ap)
/****************************************************************************
- * Public Functions
+ * Public Function Prototypes
****************************************************************************/
+
/* Low-level string management */
EXTERN void ftpc_stripcrlf(FAR char *str);
@@ -264,7 +266,8 @@ EXTERN void ftpc_sockcopy(FAR struct ftpc_socket_s *dest,
/* Socket I/O helpers */
-EXTERN int ftpc_sockprintf(FAR struct ftpc_socket_s *sock, const char *fmt, ...);
+EXTERN int ftpc_sockprintf(FAR struct ftpc_socket_s *sock,
+ const char *fmt, ...);
EXTERN void ftpc_timeout(int argc, wdparm_t arg1, ...);
/* Transfer helpers */