apps: unify FAR attribute usage across apps

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2022-04-04 12:36:53 +02:00 committed by Xiang Xiao
parent aaa950faee
commit 319203d5d8
5 changed files with 49 additions and 46 deletions

View File

@ -42,11 +42,11 @@
struct mqttc_cfg_s struct mqttc_cfg_s
{ {
struct mqtt_client client; struct mqtt_client client;
const FAR char *host; FAR const char *host;
const FAR char *port; FAR const char *port;
const FAR char *topic; FAR const char *topic;
const FAR char *msg; FAR const char *msg;
const FAR char *id; FAR const char *id;
uint8_t sendbuf[CONFIG_EXAMPLES_MQTTC_TXSIZE]; uint8_t sendbuf[CONFIG_EXAMPLES_MQTTC_TXSIZE];
uint8_t recvbuf[CONFIG_EXAMPLES_MQTTC_RXSIZE]; uint8_t recvbuf[CONFIG_EXAMPLES_MQTTC_RXSIZE];
uint32_t tmo; uint32_t tmo;
@ -59,9 +59,9 @@ struct mqttc_cfg_s
****************************************************************************/ ****************************************************************************/
static FAR void *client_refresher(FAR void *data); static FAR void *client_refresher(FAR void *data);
static void parsearg(int argc, char *argv[], struct mqttc_cfg_s *cfg, static void parsearg(int argc, FAR char *argv[], FAR struct mqttc_cfg_s *cfg,
int *n); FAR int *n);
static int initserver(const FAR struct mqttc_cfg_s *cfg); static int initserver(FAR const struct mqttc_cfg_s *cfg);
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@ -95,7 +95,8 @@ static FAR void *client_refresher(FAR void *data)
* *
****************************************************************************/ ****************************************************************************/
static void parsearg(int argc, char *argv[], struct mqttc_cfg_s *cfg, int *n) static void parsearg(int argc, FAR char *argv[],
FAR struct mqttc_cfg_s *cfg, FAR int *n)
{ {
int opt; int opt;
@ -138,11 +139,11 @@ static void parsearg(int argc, char *argv[], struct mqttc_cfg_s *cfg, int *n)
* *
****************************************************************************/ ****************************************************************************/
static int initserver(const FAR struct mqttc_cfg_s *cfg) static int initserver(FAR const struct mqttc_cfg_s *cfg)
{ {
struct addrinfo hints; struct addrinfo hints;
struct addrinfo *servinfo; FAR struct addrinfo *servinfo;
struct addrinfo *itr; FAR struct addrinfo *itr;
int fd; int fd;
int ret; int ret;
@ -208,7 +209,7 @@ static int initserver(const FAR struct mqttc_cfg_s *cfg)
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
int main(int argc, char *argv[]) int main(int argc, FAR char *argv[])
{ {
int sockfd; int sockfd;
enum MQTTErrors mqtterr; enum MQTTErrors mqtterr;

View File

@ -484,7 +484,7 @@ ftpd_account_search_user(FAR struct ftpd_session_s *session,
FAR const char *user) FAR const char *user)
{ {
FAR struct ftpd_account_s *newaccount = NULL; FAR struct ftpd_account_s *newaccount = NULL;
const FAR struct ftpd_account_s *account; FAR const struct ftpd_account_s *account;
uint8_t accountflags; uint8_t accountflags;
account = session->head; account = session->head;

View File

@ -89,8 +89,8 @@ union ftpd_sockaddr_u
struct ftpd_account_s struct ftpd_account_s
{ {
struct ftpd_account_s *blink; FAR struct ftpd_account_s *blink;
struct ftpd_account_s *flink; FAR struct ftpd_account_s *flink;
uint8_t flags; /* See FTPD_ACCOUNTFLAG_* definitions */ uint8_t flags; /* See FTPD_ACCOUNTFLAG_* definitions */
FAR char *user; /* User name */ FAR char *user; /* User name */
FAR char *password; /* Un-encrypted password */ FAR char *password; /* Un-encrypted password */
@ -103,8 +103,8 @@ struct ftpd_server_s
{ {
int sd; /* Listen socket descriptor */ int sd; /* Listen socket descriptor */
union ftpd_sockaddr_u addr; /* Listen address */ union ftpd_sockaddr_u addr; /* Listen address */
struct ftpd_account_s *head; /* Head of a list of accounts */ FAR struct ftpd_account_s *head; /* Head of a list of accounts */
struct ftpd_account_s *tail; /* Tail of a list of accounts */ FAR struct ftpd_account_s *tail; /* Tail of a list of accounts */
}; };
struct ftpd_stream_s struct ftpd_stream_s
@ -118,8 +118,8 @@ struct ftpd_stream_s
struct ftpd_session_s struct ftpd_session_s
{ {
const FAR struct ftpd_server_s *server; FAR const struct ftpd_server_s *server;
const FAR struct ftpd_account_s *head; FAR const struct ftpd_account_s *head;
bool loggedin; bool loggedin;
uint8_t flags; /* See TPD_SESSIONFLAG_* definitions */ uint8_t flags; /* See TPD_SESSIONFLAG_* definitions */
int rxtimeout; int rxtimeout;
@ -149,7 +149,7 @@ struct ftpd_session_s
FAR char *renamefrom; FAR char *renamefrom;
}; };
typedef int (*ftpd_cmdhandler_t)(struct ftpd_session_s *); typedef int (*ftpd_cmdhandler_t)(FAR struct ftpd_session_s *);
struct ftpd_cmd_s struct ftpd_cmd_s
{ {

View File

@ -86,8 +86,9 @@ static void ppp_reject_protocol(FAR struct ppp_context_s *ctx,
FAR uint8_t *sptr; FAR uint8_t *sptr;
FAR LCPPKT *pkt; FAR LCPPKT *pkt;
/* First copy rejected packet back, start from end and work forward, +++ Pay /* First copy rejected packet back, start from end and work forward, +++
* attention to buffer management when updated. Assumes fixed PPP blocks. * Pay attention to buffer management when updated. Assumes fixed PPP
* blocks.
*/ */
DEBUG1(("Rejecting Protocol\n")); DEBUG1(("Rejecting Protocol\n"));
@ -264,11 +265,11 @@ void ppp_poll(FAR struct ppp_context_s *ctx)
#else #else
if (ctx->lcp_state & LCP_RX_AUTH) if (ctx->lcp_state & LCP_RX_AUTH)
{ {
/* lcp is asking for authentication but we do not support this. This /* lcp is asking for authentication but we do not support this.
* should be communicated upstream but we do not have an interface * This should be communicated upstream but we do not have an
* for that right now, so just ignore it; nothing can be done. This * interface for that right now, so just ignore it; nothing can be
* also should not have been hit because upcall does not know about * done. This also should not have been hit because upcall does
* the pap message type. * not know about the pap message type.
*/ */
DEBUG1(("Asking for PAP, but we do not know PAP\n")); DEBUG1(("Asking for PAP, but we do not know PAP\n"));
@ -352,10 +353,10 @@ void ppp_upcall(FAR struct ppp_context_s *ctx, uint16_t protocol,
****************************************************************************/ ****************************************************************************/
uint16_t scan_packet(FAR struct ppp_context_s *ctx, uint16_t protocol, uint16_t scan_packet(FAR struct ppp_context_s *ctx, uint16_t protocol,
FAR const FAR uint8_t * list, FAR uint8_t * buffer, FAR const uint8_t * list, FAR uint8_t * buffer,
FAR uint8_t * options, uint16_t len) FAR uint8_t * options, uint16_t len)
{ {
FAR const FAR uint8_t *tlist; FAR const uint8_t *tlist;
FAR uint8_t *bptr; FAR uint8_t *bptr;
FAR uint8_t *tptr; FAR uint8_t *tptr;
uint8_t bad = 0; uint8_t bad = 0;
@ -369,8 +370,8 @@ uint16_t scan_packet(FAR struct ppp_context_s *ctx, uint16_t protocol,
while (bptr < options + len) while (bptr < options + len)
{ {
/* Get code and see if it matches somewhere in the list, if not we don't /* Get code and see if it matches somewhere in the list, if not we
* support it. * don't support it.
*/ */
i = *bptr++; i = *bptr++;

View File

@ -37,11 +37,11 @@
struct cfg_s struct cfg_s
{ {
const FAR char *delim; FAR const char *format;
const FAR char *format; FAR const char *delim;
uint8_t positions[CONFIG_BOARDCTL_UNIQUEID_SIZE]; uint8_t positions[CONFIG_BOARDCTL_UNIQUEID_SIZE];
size_t count; size_t count;
const FAR char *prefix; FAR const char *prefix;
}; };
/**************************************************************************** /****************************************************************************
@ -51,13 +51,13 @@ struct cfg_s
static int parse_positions(FAR char *arg, FAR uint8_t *positions, static int parse_positions(FAR char *arg, FAR uint8_t *positions,
FAR size_t *count) FAR size_t *count)
{ {
char *list_save; FAR char *list_save;
char *list_item; FAR char *list_item;
char *range_save; FAR char *range_save;
char *range_item; FAR char *range_item;
char *endptr; FAR char *endptr;
int pos; FAR int pos;
int pos2; FAR int pos2;
#define APPEND_POSITION(pos) \ #define APPEND_POSITION(pos) \
do \ do \
@ -227,11 +227,12 @@ static int parsearg(int argc, FAR char *argv[], FAR struct cfg_s *cfg)
int main(int argc, FAR char *argv[]) int main(int argc, FAR char *argv[])
{ {
uint8_t uniqueid[CONFIG_BOARDCTL_UNIQUEID_SIZE]; uint8_t uniqueid[CONFIG_BOARDCTL_UNIQUEID_SIZE];
char *formatter; FAR char *formatter;
int i; int i;
struct cfg_s cfg = { struct cfg_s cfg =
.format = "02x", {
"02x"
}; };
if (parsearg(argc, argv, &cfg) != 0) if (parsearg(argc, argv, &cfg) != 0)